/* GateShala styles: a light "glass" theme. Colours are tokens on :root; the dark toggle redefines them. */
:root {
  --bg: #f6f8fc;
  --bg-alt: rgba(255, 255, 255, .45);
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-border: rgba(255, 255, 255, .9);
  --border: #e3e8f0;
  --text: #0f1b33;
  --text-soft: #5b6578;
  --primary: #0d9fb0;
  --primary-strong: #0b7f8d;
  --primary-soft: #dff6f7;
  --grad-a: #14b8a6;
  --grad-b: #0ea5e9;
  --accent: #2563eb;
  --on-primary: #ffffff;
  --shadow: 0 1px 2px rgba(15, 27, 51, .04), 0 10px 30px rgba(15, 27, 51, .07);
  --shadow-lg: 0 2px 6px rgba(15, 27, 51, .04), 0 24px 60px rgba(15, 27, 51, .10);
  --blob-1: #ffd9b8;
  --blob-2: #cfe6ff;
  --blob-3: #ffe9c7;
  --blob-4: #e3dcff;
  --code-bg: rgba(248, 250, 253, .9);
  --code-head: rgba(241, 245, 250, .9);
  --code-text: #1e293b;
  --out-bg: #f3f6fa;
  --out-text: #1e293b;
  --out-muted: #64748b;
  --out-warn: #b45309;
  --out-error: #dc2626;
  --tok-comment: #6b7a90;
  --tok-keyword: #2563eb;
  --tok-string: #0f8a4a;
  --tok-number: #c2410c;
  --tok-function: #1d4ed8;
  --tok-builtin: #7c3aed;
  --tok-constant: #c2410c;
  --tok-class: #0e7490;
  --tok-meta: #be185d;
  --tok-operator: #475569;
  --note-bg: #eef4ff;
  --note-border: #4f6bed;
  --tip-bg: #e8f7f1;
  --tip-border: #10a37f;
  --warn-bg: #fff6e5;
  --warn-border: #e8a317;
  --radius: 16px;
  --page: min(1480px, 100%);
  --gutter: clamp(16px, 3vw, 40px);
  --header-h: 84px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --hand: "Caveat", "Segoe Print", cursive;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1020;
  --bg-alt: rgba(20, 27, 45, .5);
  --surface: #131a2b;
  --surface-2: #1a2236;
  --glass: rgba(22, 30, 50, .58);
  --glass-strong: rgba(24, 33, 54, .85);
  --glass-border: rgba(255, 255, 255, .08);
  --border: #26304a;
  --text: #e8edf7;
  --text-soft: #9aa6bd;
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --primary-soft: rgba(45, 212, 191, .14);
  --accent: #7aa2ff;
  --on-primary: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .3);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 60px rgba(0, 0, 0, .4);
  --blob-1: #5b3416;
  --blob-2: #123a66;
  --blob-3: #3d2c0c;
  --blob-4: #2c2266;
  --code-bg: rgba(12, 17, 30, .75);
  --code-head: rgba(20, 27, 45, .9);
  --code-text: #dbe3f0;
  --out-bg: rgba(8, 12, 22, .7);
  --out-text: #dbe3f0;
  --out-muted: #8b98ad;
  --out-warn: #fbbf24;
  --out-error: #f87171;
  --tok-comment: #7d8799;
  --tok-keyword: #7cb7ff;
  --tok-string: #7ee2a8;
  --tok-number: #ffb86b;
  --tok-function: #93c5fd;
  --tok-builtin: #c4a7ff;
  --tok-constant: #ffb86b;
  --tok-class: #67e8f9;
  --tok-meta: #ff7ab2;
  --tok-operator: #a2aaba;
  --note-bg: #1a2140;
  --note-border: #818cf8;
  --tip-bg: #0f2a24;
  --tip-border: #2dd4bf;
  --warn-bg: #2d2410;
  --warn-border: #f0b429;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; font-size: 15px; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.65 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1; position: relative; z-index: 1; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-strong); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }
code, pre, textarea { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
img, svg { max-width: 100%; }
.icon { flex: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.container { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Soft colour blobs painted behind every page. */
.bg-blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .75; }
.bg-blobs span:nth-child(1) { width: 520px; height: 520px; left: -160px; top: 80px; background: var(--blob-1); }
.bg-blobs span:nth-child(2) { width: 620px; height: 520px; right: -180px; top: -140px; background: var(--blob-2); }
.bg-blobs span:nth-child(3) { width: 460px; height: 420px; right: 8%; bottom: -120px; background: var(--blob-3); }
.bg-blobs span:nth-child(4) { width: 420px; height: 380px; left: 30%; top: 45%; background: var(--blob-4); opacity: .45; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; padding: 12px 0 0; }
.header-inner {
  height: 60px; display: flex; align-items: center; gap: 28px; width: calc(min(1480px, 100%) - 2 * var(--gutter) + 24px); margin: 0 auto; padding: 0 12px 0 22px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 18px; box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }
.logo-mark { flex: none; border-radius: 9px; box-shadow: 0 4px 12px rgba(37, 99, 235, .3); }
.main-nav { display: flex; gap: 2px; flex: 1; }
.main-nav a { color: var(--text-soft); text-decoration: none; padding: 7px 13px; border-radius: 10px; font-weight: 550; font-size: .94rem; }
.main-nav a:hover { color: var(--text); background: var(--primary-soft); }
.main-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.main-nav .nav-playground { display: none; }
.header-tools { display: flex; gap: 10px; margin-left: auto; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--border); background: var(--surface); color: #f59e0b;
  border-radius: 12px; cursor: pointer; box-shadow: var(--shadow);
}
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { color: var(--text); }
.icon-sun, .icon-moon { display: grid; place-items: center; line-height: 0; transition: transform .4s ease; }
.icon-btn:hover .icon-sun { transform: rotate(45deg); }
.icon-btn:hover .icon-moon { transform: rotate(-20deg); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: grid; }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .header-tools .header-cta { display: none; }
  .header-inner { gap: 12px; padding: 0 10px 0 14px; }
  .site-header { padding: 10px 12px 0; }
  .hero-actions .btn { flex: 1 1 100%; }
  .main-nav {
    position: absolute; top: 80px; left: 16px; right: 16px;
    flex-direction: column; gap: 2px; padding: 10px;
    background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: 16px; box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 10px 12px; }
  .main-nav .nav-playground { display: block; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px; border-radius: 12px; font-weight: 650; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; font-size: .97rem; line-height: 1.2;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-sm { padding: 9px 16px; font-size: .9rem; }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; border-radius: 14px; }
.btn-primary { background: linear-gradient(100deg, var(--grad-a), var(--grad-b)); color: var(--on-primary); box-shadow: 0 8px 22px rgba(14, 165, 233, .32); }
.btn-primary:hover { color: var(--on-primary); transform: translateY(-1px); box-shadow: 0 12px 28px rgba(14, 165, 233, .4); }
.btn-primary:disabled { opacity: .7; cursor: progress; transform: none; }
.btn-ghost { background: var(--glass-strong); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.btn-ghost:hover { background: var(--surface); color: var(--text); transform: translateY(-1px); }

/* ---------- Home ---------- */
.hero { padding: 28px 0 8px; }
.hero-inner { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.eyebrow { margin-bottom: 12px !important;
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 14px; border-radius: 99px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); color: #0f9d6b; font-weight: 600; font-size: .82rem; box-shadow: var(--shadow);
}
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.hero h1 { font-size: clamp(2.2rem, 3.6vw, 3.1rem); margin: 0 0 14px; letter-spacing: -0.035em; font-weight: 800; line-height: 1.1; }
.grad { background: linear-gradient(90deg, var(--grad-a), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.squiggle { position: relative; display: inline-block; }
.squiggle::after {
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -10px; height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12'%3E%3Cpath d='M3 9C50 2 120 1 197 6' fill='none' stroke='%230d9fb0' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.hero-lead { font-size: 1.02rem; color: var(--text-soft); margin: 0 0 22px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 14px 30px; font-size: .88rem; color: var(--text-soft); font-weight: 500; }
.hero-points li { display: flex; align-items: center; gap: 8px; }
.pt { display: inline-grid; place-items: center; }
.pt-blue { color: #2563eb; }
.pt-amber { color: #f59e0b; }
.pt-violet { color: #7c3aed; }
.pt-teal { color: #0d9488; }

.hero-visual { position: relative; }
.hero-code { border-radius: 20px; overflow: hidden; padding: 10px; box-shadow: var(--shadow-lg); }
.hero-code-bar { display: flex; align-items: center; gap: 14px; padding: 6px 6px 12px 8px; }
.window-dots { display: flex; gap: 7px; }
.window-dots span { width: 12px; height: 12px; border-radius: 50%; background: #f87171; }
.window-dots span:nth-child(2) { background: #fbbf24; }
.window-dots span:nth-child(3) { background: #34d399; }
.file-tab { display: inline-flex; align-items: center; gap: 7px; font: 500 .85rem var(--mono); color: var(--text); }
.hero-code-tools { margin-left: auto; display: flex; gap: 8px; }
.mini-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px; font-size: .84rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none;
}
.mini-btn:hover { color: var(--text); background: var(--surface-2); }
.mini-run { background: linear-gradient(100deg, var(--grad-a), #10b981); border-color: transparent; color: #fff; padding: 6px 16px; }
.mini-run:hover { color: #fff; filter: brightness(1.05); }
.hero-code .code-body { background: var(--code-bg); border-radius: 12px 12px 0 0; border: 1px solid var(--border); border-bottom: 0; padding: 12px 16px; }
.numbered .ln { display: inline-block; width: 1.6em; margin-right: 14px; color: var(--out-muted); text-align: right; user-select: none; }
.hero-code-out { background: var(--code-bg); border: 1px solid var(--border); border-radius: 0 0 12px 12px; }
.out-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--code-head); font-size: .86rem; font-weight: 600; }
.out-head span { display: inline-flex; align-items: center; gap: 8px; }
.out-head em { font-style: normal; color: var(--accent); font-weight: 600; }
.hero-code-out pre { margin: 0; padding: 10px 16px 14px; font-size: .88rem; color: var(--out-text); }
.hero-float {
  position: absolute; right: -76px; top: 54px; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--accent); box-shadow: var(--shadow-lg); transform: rotate(-6deg);
}
.hand-note { font-family: var(--hand); font-size: 1.35rem; line-height: 1.15; color: var(--text-soft); margin: 0; transform: rotate(-8deg); }
.hero-visual .hand-note { position: absolute; right: -96px; top: 130px; }
.section-gap { position: relative; margin-top: 32px; }
.hand-note-right { position: absolute; right: -40px; top: -18px; transform: rotate(-12deg); }
@media (max-width: 1599px) { .hero-float, .hero-visual .hand-note, .hand-note-right { display: none; } }

.section { padding: 20px 0 48px; }
.section-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.section-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; color: var(--accent);
  background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow);
}
.section-title { font-size: 1.6rem; margin: 0 0 2px; font-weight: 750; }
.section-lead { color: var(--text-soft); margin: 0; font-size: .95rem; }
.card-arrow {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: var(--surface); border: 1px solid var(--border); color: var(--accent); box-shadow: var(--shadow);
}
.lang-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.lang-card { padding: 16px 18px !important;
  display: flex; flex-direction: column; gap: 6px; padding: 20px 22px; border-radius: 18px; color: var(--text); text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.lang-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: var(--text); }
.lang-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.lang-card h3 { margin: 8px 0 0; font-size: 1.25rem; font-weight: 750; }
.lang-card p { margin: 0; color: var(--text-soft); font-size: .93rem; flex: 1; }
.lang-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .88rem; font-weight: 650; color: var(--badge, var(--primary)); margin-top: 12px; }
.lang-card .lang-card-top .card-arrow { width: 26px; height: 26px; }
.lang-card .lang-card-meta .card-arrow { width: 26px; height: 26px; color: var(--badge); }
.logo-tile {
  display: inline-grid; place-items: center; flex: none; border-radius: 16px; color: var(--badge);
  background: color-mix(in srgb, var(--badge) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--badge) 22%, transparent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--badge) 20%, transparent);
}
.logo-tile b { font: 800 1rem/1 var(--mono); }
.logo-tile.lg { width: 50px; height: 50px; border-radius: 14px; }
.logo-tile.lg svg:not(.icon) { width: 30px; height: 30px; }
.logo-tile.md { width: 50px; height: 50px; border-radius: 14px; }
.logo-tile.md svg:not(.icon) { width: 30px; height: 30px; }
.logo-tile.sm { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.logo-tile.sm svg:not(.icon) { width: 20px; height: 20px; }
.logo-tile.xs { width: 20px; height: 20px; border: 0; background: none; box-shadow: none; }
.lang-badge { display: none; }

.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.topic-card { padding: 18px !important;
  display: flex; gap: 18px; align-items: center; padding: 22px; border-radius: 18px; text-decoration: none; color: var(--text);
  background: linear-gradient(120deg, color-mix(in srgb, var(--badge) 12%, var(--glass)), var(--glass));
  transition: transform .18s ease, box-shadow .18s ease;
}
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--text); }
.topic-card-body { flex: 1; }
.topic-card h3 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 750; }
.topic-card p { margin: 0 0 8px; color: var(--text-soft); font-size: .9rem; }
.topic-card .lang-card-meta { margin: 0; color: var(--accent); }
.topic-card .card-arrow { align-self: flex-end; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 18px; }
.feature h3 { margin: 2px 0 4px; font-size: 1rem; }
.feature p { margin: 0; color: var(--text-soft); font-size: .88rem; }
.step {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none; font-weight: 750; font-size: .9rem;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--glass-border);
}
.feature-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; flex: none; background: color-mix(in srgb, currentColor 12%, var(--surface)); }

@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; }
  .lang-grid { grid-template-columns: repeat(2, 1fr); }
  .topic-grid, .features { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .hero { padding: 28px 0 12px; }
  .lang-grid { grid-template-columns: 1fr; }
  .hero-code-tools .mini-btn:not(.mini-run) { display: none; }
  .section { padding: 24px 0 44px; }
}

/* ---------- Tutorial layout ---------- */
.tutorial-layout {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); width: 100%; max-width: calc(min(1480px, 100%) - 2 * var(--gutter) + 24px); margin: 0 auto;
}
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 24px 16px 40px; border-right: 1px solid var(--border); background: var(--bg-alt);
}
.sidebar-head { display: flex; align-items: center; gap: 10px; font-weight: 750; margin: 0 8px 18px; }
.sidebar-head a { color: var(--text); text-decoration: none; }
.sidebar-chapter { margin-bottom: 18px; }
.sidebar-chapter-title { display: flex; align-items: center; gap: 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-soft); margin: 0 8px 6px; }
.chapter-num { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-size: .72rem; color: var(--text-soft); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { display: block; padding: 7px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .94rem; border-left: 3px solid transparent; }
.sidebar li a:hover { background: var(--surface); }
.sidebar li a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 650; border-left-color: var(--primary); }

.lesson { padding: 24px clamp(24px, 4vw, 64px) 64px; max-width: 1000px; width: 100%; }
.lesson h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 4px 0 10px; letter-spacing: -0.02em; }
.lesson-lead { font-size: 1.12rem; color: var(--text-soft); margin: 0 0 24px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: var(--text-soft); }
.breadcrumb a { color: var(--text-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.sidebar-toggle { display: none; }

.prose h2 { font-size: 1.45rem; margin: 40px 0 12px; padding-top: 8px; }
.prose h3 { font-size: 1.15rem; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose :not(pre) > code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.table-wrap { margin: 20px 0 24px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: .94rem; background: var(--surface); }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.prose th { background: var(--code-head); font-weight: 700; white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose tbody tr:nth-child(even) td { background: var(--surface-2); }
.callout { margin: 20px 0; padding: 14px 18px; border-radius: 10px; border-left: 4px solid var(--note-border); background: var(--note-bg); }
.callout-tip { border-color: var(--tip-border); background: var(--tip-bg); }
.callout-warning { border-color: var(--warn-border); background: var(--warn-bg); }

.lang-hero { display: flex; gap: 18px; align-items: flex-start; margin-top: 12px; }
.lang-hero h1 { margin-top: 0; }
.chapter-card { margin-top: 36px; }
.chapter-card h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin: 0 0 12px; }
.chapter-lessons { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.chapter-lessons a { display: flex; flex-direction: column; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.chapter-lessons a:hover { border-color: var(--primary); box-shadow: var(--shadow); color: var(--text); }
.chapter-lessons span { color: var(--text-soft); font-size: .92rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); font-weight: 650; background: var(--surface); }
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager span { font-size: .8rem; font-weight: 500; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; }
.pager-next { text-align: right; grid-column: 2; }

@media (max-width: 900px) {
  .tutorial-layout { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; z-index: 60; top: var(--header-h); left: 0; bottom: 0; width: min(300px, 85vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  body.sidebar-open::after { content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0, 0, 0, .35); z-index: 55; }
  .sidebar-toggle {
    display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; padding: 7px 14px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; font-size: .9rem;
  }
  .sidebar-toggle::before { content: "\2630"; }
  .lesson { padding: 20px 16px 48px; }
}
@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
  .lang-hero { flex-direction: column; }
}

/* ---------- Code blocks ---------- */
.code-block { margin: 20px 0 24px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 14px; background: var(--code-head); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.code-lang { font: 700 .75rem/1 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); }
.code-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.code-btn { display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .8rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.5;
}
.code-btn:hover { background: var(--surface-2); color: var(--text); }
.code-btn-run { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.code-btn-run:hover { background: var(--primary-strong); color: var(--on-primary); }
.code-btn:disabled { opacity: .7; cursor: progress; }
.code-body { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: .9rem; line-height: 1.6; color: var(--code-text); tab-size: 4; }
.hero-code .code-body { padding: 18px 20px; }
.code-output { border-top: 1px solid var(--border); background: var(--out-bg); }
.code-output-head { padding: 8px 18px 0; font: 700 .72rem/1 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--out-muted); }
.code-output-body { margin: 0; padding: 8px 18px 14px; color: var(--out-text); font-size: .88rem; overflow-x: auto; white-space: pre-wrap; }
.out-warn { color: var(--out-warn); }
.out-error { color: var(--out-error); }
.out-info { color: var(--out-muted); }

.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.tok-string { color: var(--tok-string); }
.tok-number { color: var(--tok-number); }
.tok-function { color: var(--tok-function); }
.tok-builtin { color: var(--tok-builtin); }
.tok-constant { color: var(--tok-constant); font-weight: 600; }
.tok-class { color: var(--tok-class); }
.tok-meta { color: var(--tok-meta); }
.tok-operator { color: var(--tok-operator); }

/* ---------- Diagrams (flowcharts, trees, pipelines) ---------- */
.diagram { margin: 24px 0 28px; padding: 18px 12px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.diagram-scroll { overflow-x: auto; text-align: center; }
.diagram-svg { max-width: 100%; height: auto; color: var(--text-soft); font-family: var(--font); }
.diagram figcaption { margin-top: 10px; text-align: center; font-size: .88rem; color: var(--text-soft); }
.diagram-narrow-only { display: none; }
@media (max-width: 700px) {
  .diagram-wide-only { display: none; }
  .diagram-narrow-only { display: block; }
}
.dg-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.dg-node { fill: var(--surface-2); stroke: var(--border); stroke-width: 1.5; }
.dg-terminal { fill: var(--primary-soft); stroke: var(--primary); }
.dg-decision { fill: var(--warn-bg); stroke: var(--warn-border); }
.dg-io { fill: var(--note-bg); stroke: var(--note-border); }
.dg-parent { fill: var(--primary-soft); stroke: var(--primary); }
.dg-tool { fill: var(--note-bg); stroke: var(--note-border); }
.dg-text { fill: var(--text); font-size: 13px; font-weight: 600; }
.dg-note { fill: var(--text-soft); font-size: 11px; }
.dg-label { fill: var(--primary); font-size: 12px; font-weight: 700; }
.dg-vertex { fill: var(--primary-soft); stroke: var(--primary); }
.dg-weight-bg { fill: var(--surface); }

/* ---------- Code tabs (same example in several languages) ---------- */
.code-tabs { margin: 20px 0 24px; }
.code-tabs-bar { display: flex; gap: 4px; }
.code-tab {
  padding: 7px 16px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: var(--surface-2); color: var(--text-soft); font-weight: 650; font-size: .88rem; cursor: pointer;
}
.code-tab[aria-selected="true"] { background: var(--code-head); color: var(--primary); position: relative; top: 1px; }
.code-tabs .code-block { margin: 0; border-top-left-radius: 0; }

/* ---------- GATE-style practice questions ---------- */
.quiz { margin: 22px 0; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.quiz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.quiz-badge { padding: 2px 10px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .74rem; font-weight: 750; letter-spacing: .03em; }
.quiz-type { font-size: .8rem; font-weight: 650; color: var(--text-soft); }
.quiz-q p { margin: 6px 0; font-weight: 560; }
.quiz-code { margin: 10px 0 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--code-bg); }
.quiz-options { margin: 10px 0 4px; padding-left: 0; list-style: none; counter-reset: opt; display: grid; gap: 8px; }
.quiz-options li { counter-increment: opt; }
.quiz-options label { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; background: var(--surface-2); }
.quiz-options label::before { content: "(" counter(opt, upper-alpha) ")"; font-weight: 700; color: var(--text-soft); min-width: 26px; }
.quiz-options input { margin-top: 4px; accent-color: var(--primary); }
.quiz-options label:hover { border-color: var(--primary); }
.quiz-options .is-right label { border-color: var(--tip-border); background: var(--tip-bg); }
.quiz-options .is-wrong label { border-color: #e5484d; background: color-mix(in srgb, #e5484d 12%, var(--surface)); }
.quiz-nat { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; font-size: .92rem; }
.quiz-nat input { font: 500 1rem var(--mono); padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); width: 160px; }
.quiz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.quiz-feedback { font-weight: 650; font-size: .92rem; }
.quiz-feedback.ok { color: var(--tip-border); }
.quiz-feedback.bad { color: #e5484d; }
.quiz-answer { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.quiz-answer summary { cursor: pointer; color: var(--primary); font-weight: 650; font-size: .9rem; }
.quiz-answer > strong { display: block; margin-top: 10px; }
.quiz-answer p { margin: 6px 0; color: var(--text); }

/* ---------- GATE hub ---------- */
.gate-list { list-style: none; padding: 0; margin: 24px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.gate-subject { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.gate-subject a, .gate-subject div { display: flex; flex-direction: column; text-decoration: none; color: var(--text); flex: 1; }
.gate-subject span:not(.chapter-num) { font-size: .88rem; color: var(--text-soft); }
.gate-subject:hover:not(.is-soon) { border-color: var(--primary); box-shadow: var(--shadow); }
.gate-subject.is-soon { opacity: .6; background: var(--surface-2); }
@media (max-width: 640px) { .gate-list { grid-template-columns: 1fr; } }

/* ---------- Playground ---------- */
.playground { max-width: var(--page); width: 100%; margin: 0 auto; padding: 28px var(--gutter) 32px; display: flex; flex-direction: column; gap: 22px; }
.pg-hero { display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; width: 100%; }
.pg-hero .eyebrow { margin-bottom: 12px; color: #0f9d6b; }
.pg-title { font-size: clamp(2.2rem, 3.6vw, 3rem); font-weight: 800; letter-spacing: -0.04em; margin: 0 0 10px; line-height: 1.05; }
.pg-hero .hero-lead { margin: 0; }
.pg-points { list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; flex-wrap: wrap; }
.pg-points li { display: flex; gap: 12px; align-items: center; font-size: .82rem; color: var(--text-soft); }
.pg-points strong { display: block; color: var(--text); font-size: .98rem; }
.pg-points .pt { width: 52px; height: 52px; border-radius: 50%; background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.pg-shell { border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.pg-toolbar { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pg-field { display: flex; align-items: center; gap: 12px; font-size: .95rem; font-weight: 650; color: var(--text); }
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap .select-icon { position: absolute; left: 14px; color: var(--accent); pointer-events: none; }
.select-wrap .select-caret { position: absolute; right: 14px; color: var(--text-soft); pointer-events: none; }
.pg-field select {
  appearance: none; -webkit-appearance: none; font: 600 .95rem var(--font); padding: 11px 42px 11px 44px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 200px; max-width: 72vw; cursor: pointer; box-shadow: var(--shadow);
}
#pg-example { min-width: 280px; }
.pg-buttons { display: flex; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.btn-run { padding: 12px 26px; min-width: 220px; justify-content: flex-start; font-size: 1.08rem; }
.btn-run kbd { margin-left: auto; padding-left: 20px; font: 500 .8rem var(--font); opacity: .85; }
.pg-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-height: 480px; }
.pg-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pg-pane { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--glass-strong); min-width: 0; }
.pg-pane:first-child { flex: 1; }
.pg-pane-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--text-soft); }
.pg-file { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font-weight: 650; }
.pg-file strong { color: var(--text); }
#pg-filename { font: 650 .92rem var(--mono); color: var(--accent); }
.muted { color: var(--text-soft); }
.pg-hint { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; }
.pg-clear { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--accent); cursor: pointer; font: 650 .88rem var(--font); }
#pg-editor {
  flex: 1; width: 100%; resize: none; border: 0; outline: none; padding: 16px 20px; background: var(--code-bg); color: var(--code-text);
  font-size: .92rem; line-height: 1.7; tab-size: 4; white-space: pre; min-height: 300px;
}
.pg-stdin textarea {
  display: block; width: calc(100% - 28px); margin: 12px 14px 14px; resize: vertical; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; background: var(--surface); color: var(--code-text); font-size: .88rem; outline: none;
}
.pg-stdin textarea:focus { border-color: var(--primary); }
.pg-notice { margin: 12px 12px 0; padding: 10px 14px; border-radius: 10px; background: var(--note-bg); border-left: 4px solid var(--note-border); font-size: .9rem; }
.pg-output { flex: 1; margin: 12px; padding: 16px 18px; border-radius: 12px; background: var(--out-bg); border: 1px solid var(--border); color: var(--out-text); font-size: .92rem; overflow: auto; white-space: pre-wrap; min-height: 240px; }
.pg-tracks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.pg-track { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; text-decoration: none; color: var(--text); position: relative; transition: transform .18s ease, box-shadow .18s ease; }
.pg-track:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--text); }
.pg-track > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; padding-right: 28px; }
.pg-track strong { font-size: .98rem; }
.pg-track small { color: var(--text-soft); font-size: .78rem; line-height: 1.4; }
.pg-track .card-arrow { position: absolute; right: 12px; top: 12px; width: 26px; height: 26px; }
@media (max-width: 1200px) { .pg-tracks { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 860px) {
  .playground { padding: 20px 16px 28px; }
  .pg-panes { grid-template-columns: 1fr; }
  .pg-buttons { margin-left: 0; }
  .pg-hint { display: none; }
  .pg-tracks { grid-template-columns: repeat(2, 1fr); }
  .btn-run { min-width: 0; }
  .btn-run kbd { display: none; }
}
@media (max-width: 520px) {
  .pg-field { flex-direction: column; align-items: flex-start; gap: 6px; width: 100%; }
  .pg-field select, #pg-example { min-width: 0; width: 100%; }
  .select-wrap { width: 100%; }
  .pg-tracks { grid-template-columns: 1fr; }
  .pg-points { gap: 16px; }
}

/* ---------- Footer & misc ---------- */
.site-footer { position: relative; z-index: 1; border-top: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.footer-inner { max-width: var(--page); margin: 0 auto; padding: 22px var(--gutter); display: flex; flex-wrap: wrap; gap: 12px 28px; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: .92rem; }
.footer-inner p { margin: 0; flex: 1; padding-left: 24px; border-left: 1px solid var(--border); }
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--text); }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-inner nav a { color: var(--text-soft); text-decoration: none; }
.footer-inner nav a:hover { color: var(--primary); }
@media (max-width: 760px) { .footer-inner p { border-left: 0; padding-left: 0; flex-basis: 100%; } }
.not-found { text-align: center; padding: 96px 16px; }
.not-found h1 { font-size: 2rem; margin: 16px 0 8px; }
.not-found p { color: var(--text-soft); margin: 0 0 24px; }
.select-icon [data-logo] { display: none; }
#pg-lang-wrap[data-lang="python"] [data-logo="python"],
#pg-lang-wrap[data-lang="c"] [data-logo="c"],
#pg-lang-wrap[data-lang="java"] [data-logo="java"],
#pg-lang-wrap[data-lang="javascript"] [data-logo="javascript"] { display: inline-grid; }
.select-wrap .select-icon { display: inline-grid; top: 50%; transform: translateY(-50%); }
.select-icon .logo-tile.xs svg { width: 22px; height: 22px; }

/* ---------- Motion ---------- */
@keyframes blob-drift-a { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(60px, 40px) scale(1.08); } }
@keyframes blob-drift-b { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-70px, 50px) scale(1.12); } }
@keyframes float-bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
@keyframes grad-flow { to { background-position: 200% center; } }
@keyframes draw-line { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes line-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes pulse-dot { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); } 100% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } }
@keyframes run-glow { 0%, 100% { box-shadow: 0 8px 22px rgba(14, 165, 233, .32); } 50% { box-shadow: 0 10px 34px rgba(20, 184, 166, .55); } }

.bg-blobs span:nth-child(odd) { animation: blob-drift-a 18s ease-in-out infinite; }
.bg-blobs span:nth-child(even) { animation: blob-drift-b 22s ease-in-out infinite; }
.grad { background-size: 200% auto; background-image: linear-gradient(90deg, var(--grad-a), var(--accent), var(--grad-b), var(--grad-a)); animation: grad-flow 6s linear infinite; }
.squiggle::after { animation: draw-line 1s .5s cubic-bezier(.65, 0, .35, 1) both; }
.eyebrow-dot { animation: pulse-dot 1.8s ease-out infinite; }
.hero-float { animation: float-bob 5s ease-in-out infinite; }
.hand-note { animation: rise-in .8s 1.2s ease both; }
.hero-text > * { animation: rise-in .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-text > :nth-child(2) { animation-delay: .08s; }
.hero-text > :nth-child(3) { animation-delay: .16s; }
.hero-text > :nth-child(4) { animation-delay: .24s; }
.hero-text > :nth-child(5) { animation-delay: .32s; }
.hero-code { animation: rise-in .8s .2s cubic-bezier(.2, .7, .2, 1) both; }
.hero-code .numbered .ln-row { display: inline-block; opacity: 0; animation: line-in .4s ease forwards; }
.hero-code-out pre { opacity: 0; animation: rise-in .5s 1.6s ease forwards; }
.hero-code-out pre::after { content: "▍"; color: var(--primary); margin-left: 2px; animation: caret 1s steps(1) infinite; }
.mini-run, .btn-run { animation: run-glow 2.6s ease-in-out infinite; }
.btn-primary .icon:last-child { transition: transform .2s ease; }
.btn-primary:hover .icon:last-child { transform: translateX(3px); }
.card-arrow { transition: transform .2s ease, background .2s ease, color .2s ease; }
.lang-card:hover .card-arrow, .topic-card:hover .card-arrow, .pg-track:hover .card-arrow { transform: translateX(3px); background: var(--accent); color: #fff; border-color: transparent; }
.logo-tile { transition: transform .3s cubic-bezier(.2, .7, .2, 1.4); }
.lang-card:hover .logo-tile, .topic-card:hover .logo-tile, .pg-track:hover .logo-tile { transform: scale(1.08) rotate(-4deg); }
.pg-hero > *, .pg-shell, .pg-tracks { animation: rise-in .7s cubic-bezier(.2, .7, .2, 1) both; }
.pg-points { animation-delay: .1s !important; }
.pg-shell { animation-delay: .18s; }
.pg-tracks { animation-delay: .3s; }
.pg-output .out-line { animation: line-in .25s ease both; }

/* Elements below the fold slide in as they scroll into view (classes added by app.js). */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .hero-code .numbered .ln-row, .hero-code-out pre { opacity: 1; transform: none; }
}

/* ---------- Phone layout ---------- */
@media (max-width: 600px) {
  .site-header { padding-top: 8px; }
  .header-inner { height: 54px; border-radius: 16px; }
  .brand { font-size: 1.05rem; }
  .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
  :root { --header-h: 70px; }

  /* Playground: feature points as one compact row, controls packed into tidy rows */
  .playground { gap: 16px; padding-top: 16px; }
  .pg-hero { gap: 16px; }
  .pg-hero .hero-lead br { display: none; }
  .pg-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
  .pg-points li { flex-direction: column; text-align: center; gap: 6px; padding: 10px 6px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); font-size: .72rem; line-height: 1.3; }
  .pg-points strong { font-size: .82rem; }
  .pg-points .pt { width: 38px; height: 38px; }
  .pg-points .pt svg { width: 18px; height: 18px; }
  .pg-shell { padding: 12px; border-radius: 18px; gap: 12px; }
  .pg-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pg-field { width: auto; font-size: .78rem; color: var(--text-soft); }
  .pg-field select { padding: 10px 32px 10px 40px; font-size: .88rem; }
  .select-wrap .select-caret { right: 10px; }
  .select-wrap .select-icon { left: 11px; }
  .pg-buttons { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin: 0; }
  .pg-buttons .btn { padding: 10px 8px; font-size: .9rem; }
  .btn-run { min-width: 0; justify-content: center; }
  .pg-pane-head { padding: 9px 12px; }
  .pg-stdin .pg-hint { display: none; }
  #pg-editor { min-height: 220px; padding: 12px 14px; font-size: .86rem; }
  .pg-output { min-height: 140px; margin: 10px; }
  .pg-tracks { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pg-track { padding: 12px; gap: 10px; flex-direction: column; }
  .pg-track > span:nth-child(2) { padding-right: 0; }
  .pg-track .logo-tile.md { width: 40px; height: 40px; }
  .pg-track .logo-tile.md svg:not(.icon) { width: 24px; height: 24px; }

  /* Home */
  .hero h1 { font-size: 2.1rem; }
  .hero-actions .btn { flex: 1 1 100%; }
  .hero-points { gap: 10px 18px; margin-top: 16px; }
  .hero-code-bar { gap: 10px; }
  .hero-code .code-body { font-size: .78rem; padding: 10px 12px; overflow-x: auto; }
  .lang-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .lang-card { padding: 14px !important; }
  .lang-card p { font-size: .82rem; }
  .lang-card-top .card-arrow { display: none; }
  .lang-card .lang-card-meta { font-size: .78rem; }
  .topic-card { flex-direction: row; align-items: flex-start; padding: 14px !important; gap: 12px; }
  .topic-card .card-arrow { display: none; }
  .section-head { gap: 12px; }
  .section-icon { width: 36px; height: 36px; }
  .section-title { font-size: 1.3rem; }
  .feature { padding: 14px; }

  /* Footer */
  .footer-inner { padding: 18px var(--gutter); gap: 10px; }
  .footer-inner nav { gap: 6px 14px; font-size: .88rem; }
}

/* Drawers on small screens are solid, so the page behind never shows through. */
@media (max-width: 900px) {
  .sidebar { background: var(--surface); top: 0; bottom: auto; height: 100vh; height: 100dvh; z-index: 70; border-radius: 0 18px 18px 0; box-shadow: var(--shadow-lg); padding-top: 22px; }
  /* The drawer lives inside <main>, so it dims the page with its own shadow instead of an overlay on top of it. */
  body.sidebar-open::after { display: none; }
  body.sidebar-open main { z-index: 60; }
  .sidebar.is-open { box-shadow: 0 0 0 100vmax rgba(15, 27, 51, .45); }
}
@media (max-width: 860px) {
  .main-nav { background: var(--surface); }
}
