@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:       #0d1117;
  --bg-2:     #161b27;
  --bg-3:     #1c2336;
  --bg-4:     #232d42;
  --bg-5:     #2a3550;
  --border:   #1e2d44;
  --border-2: #2e4060;
  --text:     #e2e8f0;
  --muted:    #7a90b8;
  --dim:      #3a5070;
  --accent:   #4facfe;
  --accent-d: #0073e6;
  --green:    #4ade80;
  --purple:   #c084fc;
  --orange:   #fb923c;
  --red:      #f87171;
  --fn-ui:    'Inter', system-ui, sans-serif;
  --fn-mono:  'JetBrains Mono', 'Fira Code', monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--fn-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }
::selection { background: rgba(79,172,254,.25); }

/* ── Navbar ── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  transition: background .2s, border-color .2s, backdrop-filter .2s;
  border-bottom: 1px solid transparent;
}
.navbar.scrolled {
  background: rgba(13,17,23,.92);
  border-color: var(--border);
  backdrop-filter: blur(12px);
}
.navbar-inner {
  max-width: 1152px; margin: 0 auto;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; background: none; border: none;
}
.nav-logo-text {
  font-weight: 700; font-size: 14px; letter-spacing: .04em;
  color: var(--text);
}
.nav-logo-text span { color: var(--accent); }
.nav-links {
  display: flex; align-items: center; gap: 24px;
}
.nav-link {
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); }
.btn-lang-toggle {
  padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: var(--r-sm);
  background: var(--bg-4); color: var(--muted); border: 1px solid var(--border-2);
  cursor: pointer; transition: color .15s, border-color .15s; letter-spacing: .04em;
}
.btn-lang-toggle:hover { color: var(--text); border-color: var(--accent); }
.btn-login-nav {
  padding: 6px 14px; font-size: 12px; font-weight: 600; border-radius: var(--r-sm);
  background: var(--accent); color: #000; border: none; cursor: pointer;
  transition: opacity .15s;
}
.btn-login-nav:hover { opacity: .88; }
.user-chip-nav {
  display: flex; align-items: center; gap: 8px;
}
.user-chip-name {
  font-size: 12px; padding: 4px 10px; border-radius: var(--r-sm);
  background: var(--bg-4); color: var(--muted);
}
.btn-logout-nav {
  font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer;
}
.btn-logout-nav:hover { color: var(--text); }
.nav-hamburger {
  display: none; background: none; border: none; cursor: pointer; color: var(--muted);
}
.mobile-menu {
  display: none; flex-direction: column; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.mobile-menu.open { display: flex; }
.mobile-menu .nav-link { font-size: 14px; text-align: left; }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: block; }
}

/* ── Sections ── */
.container { max-width: 1152px; margin: 0 auto; padding: 0 24px; }

section { padding: 96px 24px; }
section.alt { background: var(--bg-2); }

/* ── Hero ── */
#hero {
  position: relative; min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden; padding: 0 24px;
}
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .6; pointer-events: none;
}
.hero-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(79,172,254,.06) 0%, transparent 70%);
}
.hero-content {
  position: relative; z-index: 2;
  text-align: center; max-width: 760px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 14px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--accent);
  margin-bottom: 32px;
}
.hero-badge-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  display: inline-block;
}
.hero-h1 {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 900; line-height: 1.15; letter-spacing: -.02em;
  margin-bottom: 16px; min-height: 1.2em;
}
.gradient-text {
  background: linear-gradient(135deg, #4facfe 0%, #a78bfa 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.gradient-orange {
  background: linear-gradient(135deg, #fb923c 0%, #f59e0b 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: clamp(14px, 2vw, 18px); color: var(--muted);
  line-height: 1.75; margin-bottom: 40px; min-height: 3em;
}
.hero-cta {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 16px;
  animation: fadeIn .4s ease forwards;
}
.btn-cta-primary {
  padding: 12px 28px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  background: var(--accent); color: #000; border: none; cursor: pointer;
  transition: opacity .15s; display: inline-block;
}
.btn-cta-primary:hover { opacity: .88; }
.btn-cta-secondary {
  padding: 12px 28px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border-2); cursor: pointer;
  transition: border-color .15s; display: inline-block;
}
.btn-cta-secondary:hover { border-color: var(--accent); }
.hero-stats {
  display: flex; align-items: center; justify-content: center; gap: 32px;
  margin-top: 48px; animation: fadeIn .4s ease forwards;
}
.stat { text-align: center; }
.stat-val { font-size: 26px; font-weight: 900; color: var(--accent); }
.stat-key { font-size: 11px; color: var(--muted); margin-top: 2px; }
.scroll-hint {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  animation: bounce 2s ease-in-out infinite; color: var(--dim); background: none;
  border: none; cursor: pointer; z-index: 2;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Section Headers ── */
.section-tag {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.section-icon {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  background: var(--bg-3); border: 1px solid var(--border-2);
  color: var(--accent); font-family: var(--fn-mono);
}
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.section-h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900; line-height: 1.2; margin-bottom: 16px;
}
.section-desc {
  font-size: 15px; line-height: 1.75; color: var(--muted);
  max-width: 640px; margin-bottom: 48px;
}

/* ── Cards ── */
.cards-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 24px; margin-bottom: 48px; }
.cards-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; margin-bottom: 48px; }
@media (max-width: 900px) { .cards-3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .cards-2 { grid-template-columns: 1fr; } }

.card {
  padding: 24px; border-radius: var(--r-lg);
  background: var(--bg-2); border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card.dark { background: var(--bg-3); }
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79,172,254,.2), 0 8px 32px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.card-icon { font-size: 22px; margin-bottom: 12px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.card-desc { font-size: 12px; line-height: 1.7; color: var(--muted); }

/* ── Code cols ── */
.code-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 700px) { .code-cols { grid-template-columns: 1fr; } }
.code-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 12px;
}

/* ── Code Block ── */
.code-block {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px;
  font-family: var(--fn-mono); font-size: 12px; line-height: 1.65;
  color: #e2e8f0; overflow-x: auto;
}
.code-block .ln {
  color: var(--dim); user-select: none;
  display: inline-block; width: 2em; text-align: right; margin-right: 1.5em;
}
.kw  { color: #c084fc; }
.str { color: #4ade80; }
.cmt { color: #3a5070; }
.num { color: #fb923c; }

/* ── Buttons ── */
.btn-section {
  display: inline-flex; align-items: center;
  padding: 10px 22px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 600;
  background: var(--accent); color: #000; border: none; cursor: pointer;
  transition: opacity .15s; margin-top: 8px;
}
.btn-section:hover { opacity: .88; }

/* ── Playground Cards Section ── */
.playground-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.playground-cards-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 900px) { .playground-cards-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .playground-cards, .playground-cards-3 { grid-template-columns: 1fr; } }
.pg-card {
  display: block; padding: 24px; border-radius: var(--r-lg);
  background: var(--bg-2); border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s, transform .2s;
  text-decoration: none; color: inherit;
}
.pg-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79,172,254,.2), 0 8px 32px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.pg-card-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.pg-card-icon {
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-family: var(--fn-mono);
  background: var(--bg-4); border: 1px solid var(--border-2);
}
.pg-card-name { font-weight: 700; font-size: 14px; color: var(--text); }
.pg-card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pg-card-desc { font-size: 12px; line-height: 1.7; color: var(--muted); margin-bottom: 16px; }
.pg-card-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 2px 8px; font-size: 11px; border-radius: 4px;
  background: var(--bg-4); color: var(--dim); border: 1px solid var(--border);
}
.pg-card-cta { margin-top: 16px; font-size: 12px; font-weight: 600; }

/* ── About ── */
.about-section {
  text-align: center; padding: 80px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.about-h2 { font-size: 26px; font-weight: 900; margin: 24px 0 16px; }
.about-desc {
  font-size: 14px; line-height: 1.85; color: var(--muted);
  max-width: 560px; margin: 0 auto 24px;
}
.about-links { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; color: var(--dim); }
.about-links a { color: var(--muted); transition: color .15s; }
.about-links a:hover { color: var(--text); }

/* ── Footer ── */
footer {
  padding: 32px 24px; border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: 1152px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.footer-copy { font-size: 12px; color: var(--dim); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 12px; color: var(--muted); transition: color .15s; }
.footer-links a:hover { color: var(--text); }

/* ── Auth Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: min(360px, 94vw); border-radius: var(--r-lg);
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 24px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 14px; font-weight: 600; color: var(--text); }
.modal-close {
  font-size: 18px; line-height: 1; padding: 2px 6px;
  background: none; border: none; cursor: pointer; color: var(--muted);
  border-radius: 4px; transition: color .15s;
}
.modal-close:hover { color: var(--text); }
.modal-hint { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.modal-input {
  width: 100%; padding: 9px 12px; font-size: 13px; border-radius: var(--r-sm);
  background: var(--bg-4); border: 1px solid var(--border-2); color: var(--text);
  outline: none; margin-bottom: 12px; font-family: inherit;
  transition: border-color .15s;
}
.modal-input:focus { border-color: var(--accent); }
.modal-error { font-size: 12px; color: var(--red); margin-bottom: 12px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px;
}
.auth-switch-row { margin-top: 12px; font-size: 12px; color: var(--muted); }
.auth-switch-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.auth-switch-link:hover { text-decoration: underline; }
.btn-ghost { padding: 7px 14px; font-size: 12px; border-radius: var(--r-sm); background: var(--bg-4); color: var(--muted); border: none; cursor: pointer; transition: color .15s; }
.btn-ghost:hover { color: var(--text); }
.btn-accent { padding: 7px 14px; font-size: 12px; font-weight: 600; border-radius: var(--r-sm); background: var(--accent); color: #000; border: none; cursor: pointer; }
.btn-outline-sm { padding: 7px 14px; font-size: 12px; font-weight: 600; border-radius: var(--r-sm); background: var(--bg-5); color: var(--accent); border: none; cursor: pointer; }

.hidden { display: none !important; }
