/* ==========================================================================
   SIAM SIR ICT - ED-TECH PORTAL STYLESHEET
   Domain: www.siamsir.com | Hotline: 01676941117
   Branches: 11/3 Shiddheswari & 29, C8, Banasree

   Design language: "Board sheet"
   - Navy + cobalt + marker yellow, taken from the Siam Sir admission flyer
   - OMR answer-sheet bubble as the recurring signature (chapters, MCQ options)
   - Flat colour, hairline structure, no decorative gradients
   Fonts are loaded via <link> in each page <head> (faster than @import).
   ========================================================================== */

:root {
  /* Brand constants (same in both themes) */
  --ink: #0B1533;            /* flyer navy */
  --ink-deep: #070D22;
  --cobalt: #2448D8;         /* flyer cobalt - CTA fill */
  --cobalt-hover: #1A37B0;
  --marker: #FFD23F;         /* flyer ribbon yellow - highlights only */
  --paper: #F5F6F8;

  /* Legacy tokens kept for inline styles & JS-generated markup */
  --primary: #6E8DFF;
  --primary-hover: #8FA8FF;
  --primary-glow: rgba(110, 141, 255, 0.22);
  --secondary: #8FA8FF;
  --accent-cyan: #6E8DFF;
  --accent-gold: #FFD23F;
  --accent-gold-glow: rgba(255, 210, 63, 0.18);
  --success: #22C17A;
  --danger: #F0506E;
  --warning: #FFD23F;

  /* Theme: Dark (default) - deep flyer navy, not black */
  --bg-main: #0A1128;
  --bg-surface: #0E1733;
  --bg-card: #111B3B;
  --bg-card-hover: #15214A;
  --bg-elevated: #1B2852;
  --bg-input: #0C1430;
  --header-bg: rgba(10, 17, 40, 0.86);
  --code-bg: #070D22;
  --code-bar: #0A1229;

  --border-color: #1F2C55;
  --border-hover: #34437A;
  --border-focus: #6E8DFF;

  --text-main: #EEF1F8;
  --text-muted: #A3ADC8;
  --text-dim: #7A87A8;
  --text-invert: #0A1128;

  --success-tint: rgba(34, 193, 122, 0.12);
  --danger-tint: rgba(240, 80, 110, 0.12);
  --primary-tint: rgba(110, 141, 255, 0.10);

  --shadow-sm: none;
  --shadow-md: 0 1px 0 rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 48px -24px rgba(0, 0, 0, 0.6);
  --shadow-glow: none;

  /* Type */
  --font-display: 'Anek Bangla', 'Noto Sans Bengali', 'Instrument Sans', system-ui, sans-serif;
  --font-sans: 'Instrument Sans', 'Noto Sans Bengali', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, 'Noto Sans Bengali', monospace;

  /* Shape (MASTER.md) */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Motion (MASTER.md) */
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 180ms;
  --t-normal: 240ms;
  --t-slow: 320ms;
  --stagger: 60ms;
  --transition-fast: var(--t-fast) var(--ease-out);
  --transition-normal: var(--t-normal) var(--ease-out);

  /* Chapter colour code (MASTER.md) - dark values */
  --ch-1: #7C97FF;   /* Ch 1   cobalt */
  --ch-2: #38D6C4;   /* Ch 2   teal   */
  --ch-3: #AD92FF;   /* Ch 3.1 violet */
  --ch-4: #FFAE45;   /* Ch 3.2 amber  */
  --ch-5: #FF8468;   /* Ch 4   coral  */
  --ch-6: #5FDD93;   /* Ch 5   green  */
  --ch-7: #FF7EBB;   /* Ch 6   rose   */

  /* Elevation (MASTER.md) */
  --tile-shadow: none;
  --tile-shadow-hover: 0 24px 48px -24px rgba(0, 0, 0, 0.6);
  --bg-band: #0E1733;

  --container: 1480px;
  --gutter: clamp(20px, 4vw, 40px);
}

[data-theme="light"] {
  --primary: #2448D8;
  --primary-hover: #1A37B0;
  --primary-glow: rgba(36, 72, 216, 0.16);
  --secondary: #2448D8;
  --accent-cyan: #2448D8;
  --accent-gold: #9A6A00;
  --success: #12945A;
  --danger: #D02B4C;

  --bg-main: #F5F6F8;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F0F3F9;
  --bg-elevated: #EEF1F7;
  --bg-input: #FFFFFF;
  --header-bg: rgba(245, 246, 248, 0.9);
  --bg-band: #ECEFF5;

  --ch-1: #2448D8;
  --ch-2: #0B7A6E;
  --ch-3: #6A45DD;
  --ch-4: #A65A00;
  --ch-5: #C13F25;
  --ch-6: #147A3C;
  --ch-7: #BC2A69;

  --tile-shadow: 0 1px 2px rgba(11, 21, 51, 0.05);

  --border-color: #DDE2EC;
  --border-hover: #B9C2D4;
  --border-focus: #2448D8;

  --text-main: #0B1533;
  --text-muted: #4A5470;
  --text-dim: #6B7590;
  --text-invert: #FFFFFF;

  --success-tint: rgba(18, 148, 90, 0.08);
  --danger-tint: rgba(208, 43, 76, 0.07);
  --primary-tint: rgba(36, 72, 216, 0.06);

  --shadow-md: 0 1px 2px rgba(11, 21, 51, 0.06);
  --shadow-lg: 0 24px 48px -28px rgba(11, 21, 51, 0.28);
  --tile-shadow-hover: 0 18px 40px -24px rgba(11, 21, 51, 0.25);
}

/* Chapter hue mapping. Covers homepage tiles (.hue-*), the notes sidebar
   (rendered by notes.html with onclick="loadChapter('chX')") and the MCQ
   filters (data-chapter) - no JS changes needed. */
.hue-ch1,   .chapter-nav-btn[onclick*="'ch1'"],   .chapter-filter-btn[data-chapter="ch1"]   { --h: var(--ch-1); }
.hue-ch2,   .chapter-nav-btn[onclick*="'ch2'"],   .chapter-filter-btn[data-chapter="ch2"]   { --h: var(--ch-2); }
.hue-ch3_1, .chapter-nav-btn[onclick*="'ch3_1'"], .chapter-filter-btn[data-chapter="ch3_1"] { --h: var(--ch-3); }
.hue-ch3_2, .chapter-nav-btn[onclick*="'ch3_2'"], .chapter-filter-btn[data-chapter="ch3_2"] { --h: var(--ch-4); }
.hue-ch4,   .chapter-nav-btn[onclick*="'ch4'"],   .chapter-filter-btn[data-chapter="ch4"]   { --h: var(--ch-5); }
.hue-ch5,   .chapter-nav-btn[onclick*="'ch5'"],   .chapter-filter-btn[data-chapter="ch5"]   { --h: var(--ch-6); }
.hue-ch6,   .chapter-nav-btn[onclick*="'ch6'"],   .chapter-filter-btn[data-chapter="ch6"]   { --h: var(--ch-7); }

/* The notes reader takes the hue of whichever chapter is open */
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch1'"])   { --h: var(--ch-1); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch2'"])   { --h: var(--ch-2); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch3_1'"]) { --h: var(--ch-3); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch3_2'"]) { --h: var(--ch-4); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch4'"])   { --h: var(--ch-5); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch5'"])   { --h: var(--ch-6); }
.notes-layout:has(.chapter-nav-btn.active[onclick*="'ch6'"])   { --h: var(--ch-7); }

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: var(--marker);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Small mono label used across the site */
.eyebrow,
.section-tag,
.sidebar-title,
.panel-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* In Bangla mode, labels that carry Bengali text use the sans face without tracking */
[data-lang="bn"] .section-tag,
[data-lang="bn"] .sidebar-title,
[data-lang="bn"] .panel-label,
[data-lang="bn"] .hero-badge-tag,
[data-lang="bn"] .branch-pill strong,
[data-lang="bn"] .batch-facts li strong,
[data-lang="bn"] .branch-info-row strong,
[data-lang="bn"] .footer-col h4,
[data-lang="bn"] .convert-field label,
[data-lang="bn"] .stat-item .lbl,
[data-lang="bn"] .announcement-badge,
[data-lang="bn"] .qa-type-badge,
[data-lang="bn"] .mcq-chip,
[data-lang="bn"] .notes-chapter-meta {
  font-family: var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

[data-lang="bn"] .section-tag,
[data-lang="bn"] .hero-badge-tag {
  font-size: 0.86rem;
}

/* Students copy code character-for-character: never show ligatures (e.g. <!-- as an arrow) */
code, pre, kbd, samp, textarea,
.code-textarea, .terminal-body, .sql-table, .stdin-input, .convert-field input {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

/* ==========================================================================
   Announcement bar
   ========================================================================== */
.top-announcement-bar {
  background: var(--ink-deep);
  color: #C9D1E6;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 9px 0;
  font-size: 0.82rem;
}

.announcement-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.announcement-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.announcement-badge {
  background: var(--marker);
  color: var(--ink);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.announcement-contact {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #9AA5C4;
}

.announcement-contact a {
  color: #FFFFFF;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.announcement-contact a:hover {
  color: var(--marker);
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border-color);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 72px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-logo:hover {
  color: var(--text-main);
}

.brand-wordmark {
  font-family: var(--font-display);
  font-stretch: 80%;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: uppercase;
}

.brand-wordmark em {
  font-style: normal;
  color: var(--primary);
}

.brand-badge {
  display: inline-block;
  background: var(--ink);
  color: #FFFFFF;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

[data-theme="dark"] .brand-badge {
  background: var(--cobalt);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-link {
  position: relative;
  color: var(--text-muted);
  padding: 8px 10px;
  font-weight: 500;
  font-size: 0.88rem;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-main);
}

.nav-link.active {
  color: var(--text-main);
  font-weight: 600;
}

/* Active page = a small filled bubble, not an underline */
.nav-link.active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--primary);
  flex-shrink: 0;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Control pills */
.lang-toggle-btn, .theme-toggle-btn {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  color: var(--text-muted);
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.lang-toggle-btn:hover, .theme-toggle-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}

/* Primary button (class name kept for compatibility) */
.btn-primary-glow {
  background: var(--cobalt);
  color: #FFFFFF !important;
  font-weight: 600;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  border: 1px solid var(--cobalt);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-primary-glow:hover {
  background: var(--cobalt-hover);
  border-color: var(--cobalt-hover);
  color: #FFFFFF;
}

.btn-primary-glow:active {
  transform: translateY(1px);
}

.btn-primary-glow:disabled,
.btn-secondary-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-lg {
  height: 52px;
  padding: 0 26px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.mobile-toggle {
  display: none;
  background: var(--bg-elevated);
  border: 0;
  color: var(--text-main);
  width: 40px;
  height: 38px;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1.05rem;
}

.hide-mobile {
  display: inline;
}

/* ==========================================================================
   Buttons - secondary & utility
   ========================================================================== */
.btn-secondary-outline {
  background: transparent;
  border: 0;
  box-shadow: inset 0 0 0 1px var(--border-hover);
  color: var(--text-main);
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-secondary-outline:hover {
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 1px transparent;
}

.btn-secondary-outline:active {
  transform: translateY(1px);
}

.btn-secondary-outline.btn-lg {
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
}

.tool-btn {
  background: var(--bg-elevated);
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.tool-btn:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

.tool-btn:active {
  transform: translateY(1px);
}

/* Inline text link with arrow */
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-hover);
  padding-bottom: 2px;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.text-link:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.text-link .arrow {
  transition: transform var(--transition-fast);
}

.text-link:hover .arrow {
  transform: translateX(3px);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero-section {
  position: relative;
  padding: clamp(32px, 4.5vw, 64px) 0 clamp(28px, 3.5vw, 48px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.hero-badge-tag::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-tint);
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero-title-lead {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-muted);
  max-width: 30ch;
}

.hero-wordmark {
  font-family: var(--font-display);
  font-stretch: 75%;
  font-size: clamp(3.2rem, 8.4vw, 7.4rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--text-main);
}

/* "ICT" sits on a slanted yellow ribbon - the same shape as the flyer's
   "BOOK YOUR SEATS EARLY!" banner. Flat colour, ink text, both themes. */
.hero-wordmark mark {
  display: inline-block;
  background: var(--marker);
  color: var(--ink);
  padding: 0.07em 0.14em 0;
  margin: 0 0.02em;
  line-height: 0.88;
  clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
}

.hero-subtitle {
  font-size: clamp(1rem, 1.3vw, 1.12rem);
  color: var(--text-muted);
  max-width: 56ch;
  line-height: 1.75;
}

.hero-cta-group {
  display: flex;
  gap: 12px 14px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-whatsapp {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  margin-left: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--border-color);
  line-height: 1.3;
  color: var(--text-main);
}

.hero-whatsapp small {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.hero-whatsapp strong {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
}

.hero-whatsapp:hover strong {
  color: #22C17A;
}

/* Flyer */
.hero-media-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  max-width: 440px;
  width: 100%;
  justify-self: end;
}

.flyer-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--tile-shadow-hover);
}

.flyer-card img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* CTA arrow (sits beside the i18n span, so app.js never overwrites it) */
.btn-arrow {
  display: inline-block;
  transition: transform var(--t-fast) var(--ease-out);
}

.btn-primary-glow:hover .btn-arrow,
.btn-secondary-outline:hover .btn-arrow {
  transform: translateX(4px);
}

/* ==========================================================================
   Highlights strip - facts + branch addresses, full width under the hero
   ========================================================================== */
.stat-strip {
  padding: 0 0 clamp(24px, 3vw, 36px);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 0.8fr)) repeat(2, minmax(0, 1.3fr));
  gap: 12px;
}

.stat-item,
.branch-pill {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--tile-shadow);
  min-width: 0;
}

.icon-chip.sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.icon-chip.sm svg {
  width: 22px;
  height: 22px;
}

.stat-item .num {
  font-family: var(--font-display);
  font-stretch: 80%;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.stat-item .lbl {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.branch-pill {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.branch-pill strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 2px;
}

/* ==========================================================================
   Notice strip
   ========================================================================== */
.notice-strip {
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  padding: 14px 0;
}

.notice-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notice-ic {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--primary);
}

.notice-label {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--marker);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.notice-text {
  font-weight: 500;
  color: var(--text-main);
  font-size: 0.94rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ==========================================================================
   Sections & headers
   ========================================================================== */
.section {
  padding: clamp(48px, 6vw, 88px) 0;
}

.section-bg-alt {
  background-color: var(--bg-band);
}

/* Default: centered (used by inner pages) */
.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 48px;
}

/* Split header: title left, description right (homepage) */
.section-header.split {
  text-align: left;
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px 48px;
  align-items: end;
  margin: 0 0 clamp(24px, 3.2vw, 40px);
}

.section-header.split .section-desc {
  justify-self: end;
  max-width: 44ch;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--primary);
}

.section-header.split .section-tag::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
  color: var(--text-main);
}

.section-header.split .section-title {
  margin-bottom: 0;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

/* Page intro on inner pages (Q&A, Lab) */
/* Left-aligned and full width - no centred intro blocks */
.page-intro {
  text-align: left;
  max-width: none;
  margin: 0 0 28px;
}

.page-intro .section-title {
  max-width: 24ch;
}

.page-intro-desc {
  color: var(--text-muted);
  font-size: 1.04rem;
  line-height: 1.7;
  max-width: 72ch;
}

/* Generic grids */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
}

.card {
  background-color: var(--bg-card);
  border: 0;
  border-radius: var(--radius-lg);
  padding: 28px;
  position: relative;
  box-shadow: var(--tile-shadow);
}

/* ==========================================================================
   Tile system (MASTER.md: Tile, Icon chip, Tags, Arrow link)
   Neutral surface; the hue (--h) only touches the eyebrow, icon and arrow.
   ========================================================================== */
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  list-style: none;
}

/* Default hue at zero specificity so .hue-* classes always win */
:where(.tile) {
  --h: var(--primary);
}

.tile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--tile-shadow);
  transition: transform var(--t-normal) var(--ease-out), box-shadow var(--t-normal) var(--ease-out);
}

.tile.is-wide {
  grid-column: span 2;
}

/* Cursor-following glow (position fed by ui.js; centred without JS) */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--h) 12%, transparent), transparent 70%);
  transition: opacity var(--t-slow) var(--ease-out);
  pointer-events: none;
}

.tile:hover::before {
  opacity: 1;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--tile-shadow-hover);
}

.tile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 4px;
}

.icon-chip {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: var(--bg-elevated);
  color: var(--h);
}

.icon-chip svg {
  width: 28px;
  height: 28px;
  overflow: visible;
}

/* Dot-separated tags - plain text, no boxes */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-dim);
}

/* A hue dot before every tag - wraps cleanly, no orphan separators */
.tags > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tags > span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--h);
  flex-shrink: 0;
}

.tile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: auto;
  padding-top: 14px;
}

/* Arrow link: label + hue circle that nudges on hover */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-main);
  border-radius: var(--radius-full);
  transition: color var(--t-fast) var(--ease-out);
}

.arrow-link:hover {
  color: var(--text-main);
}

.arrow-link .arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--h);
  color: var(--bg-card);
  font-size: 0.9rem;
  line-height: 1;
  transition: transform var(--t-fast) var(--ease-out);
}

.tile:hover .arrow-link .arrow,
.arrow-link:hover .arrow,
.arrow-link:focus-visible .arrow {
  transform: translateX(4px);
}

.arrow-link.is-sub {
  font-weight: 500;
  color: var(--text-muted);
}

.arrow-link.is-sub:hover {
  color: var(--h);
}

/* ==========================================================================
   Animated icons - play once on reveal, replay on hover (ui.js adds .is-playing).
   Never loop at rest. All transform/opacity/stroke-dashoffset only.
   ========================================================================== */
.ic .draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.is-playing .ic .draw { animation: icDraw 1.2s var(--ease-out) 1 both; }
@keyframes icDraw { from { stroke-dashoffset: 1; } }

.is-playing .ic .mer { animation: icSpinY 1.2s var(--ease-out) 1; transform-origin: 12px 12px; transform-box: view-box; }
@keyframes icSpinY { 50% { transform: scaleX(-1); } }

.is-playing .ic .a1 { animation: icWave 1.2s var(--ease-out) 1 both; }
.is-playing .ic .a2 { animation: icWave 1.2s var(--ease-out) 0.12s 1 both; }
.is-playing .ic .a3 { animation: icWave 1.2s var(--ease-out) 0.24s 1 both; }
@keyframes icWave { 30% { opacity: 0.15; } }

.is-playing .ic .bit { animation: icFlip 1.2s steps(1) 1 both; }
.is-playing .ic .bit:nth-of-type(2) { animation-delay: 0.15s; }
.is-playing .ic .bit:nth-of-type(3) { animation-delay: 0.3s; }
.is-playing .ic .bit:nth-of-type(4) { animation-delay: 0.45s; }
@keyframes icFlip { 33% { fill-opacity: 0; } 66% { fill-opacity: 1; } }

.is-playing .ic .lamp { animation: icLamp 1.2s var(--ease-out) 1 both; }
@keyframes icLamp { 0%, 45% { fill-opacity: 0; } 70%, 100% { fill-opacity: 1; } }

.is-playing .ic .bl { animation: icBrL 1.2s var(--ease-out) 1; }
.is-playing .ic .br { animation: icBrR 1.2s var(--ease-out) 1; }
@keyframes icBrL { 40% { transform: translateX(-2px); } }
@keyframes icBrR { 40% { transform: translateX(2px); } }

.is-playing .ic .cur { animation: icBlink 1.2s steps(1) 1 both; }
@keyframes icBlink { 0%, 33%, 66% { opacity: 1; } 16%, 50%, 83% { opacity: 0; } }

.is-playing .ic .disc { animation: icDrop 1.2s var(--ease-out) 1 both; }
.is-playing .ic .disc:nth-of-type(2) { animation-delay: 0.12s; }
.is-playing .ic .disc:nth-of-type(3) { animation-delay: 0.24s; }
@keyframes icDrop { 0% { transform: translateY(-4px); opacity: 0; } 40%, 100% { transform: none; opacity: 1; } }

/* ==========================================================================
   Scroll reveal - only when ui.js has confirmed it runs (html.ui-ready),
   so content is never hidden for no-JS visitors or crawlers.
   ========================================================================== */
.ui-ready .rv {
  opacity: 0;
  transform: translateY(14px);
}

.ui-ready .rv.rv-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * var(--stagger));
}

/* ==========================================================================
   Homepage - "Why choose us"
   ========================================================================== */
.feature-tile h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.feature-tile p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}



/* ==========================================================================
   Homepage - Chapter bento
   Layout: [1 wide][2] / [3.1][3.2][4] / [5][6 wide]
   ========================================================================== */
.chapter-name {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.chapter-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 56ch;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

/* ==========================================================================
   Homepage - Batch timetable (three tiles)
   ========================================================================== */
.batch-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.batch-col {
  display: flex;
  flex-direction: column;
  padding: 32px 28px 28px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--tile-shadow);
}

.batch-col.is-featured {
  background: var(--ink);
  color: #EEF1F8;
  --text-main: #EEF1F8;
  --text-muted: #A3ADC8;
  --text-dim: #7A87A8;
  --border-color: #23305C;
  --bg-elevated: #1B2852;
}

.batch-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.batch-tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  border: 1.5px solid currentColor;
}

.batch-col.is-featured .batch-tag {
  color: var(--marker);
}

.batch-col.is-featured .batch-tag::before {
  background: currentColor;
}

.batch-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 14px 0 8px;
  color: var(--text-main);
}

.batch-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.batch-facts {
  list-style: none;
  margin: auto 0 24px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  padding: 4px 16px;
}

.batch-facts li {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  font-size: 0.9rem;
  color: var(--text-main);
}

.batch-facts li + li {
  border-top: 1px solid var(--border-color);
}

.batch-facts li strong {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 3px;
}

.batch-facts .mono {
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.batch-col .btn-primary-glow,
.batch-col .btn-secondary-outline {
  width: 100%;
  height: 46px;
}

.batch-col.is-featured .btn-primary-glow {
  background: var(--marker);
  border-color: var(--marker);
  color: var(--ink) !important;
}

.batch-col.is-featured .btn-primary-glow:hover {
  background: #FFFFFF;
  border-color: #FFFFFF;
}

/* ==========================================================================
   Homepage - Branches
   ========================================================================== */
.branch-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--tile-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px;
  transition: box-shadow var(--t-normal) var(--ease-out);
}

.branch-card:hover {
  box-shadow: var(--tile-shadow-hover);
}

.branch-map-embed {
  width: 100%;
  height: 260px;
  border: none;
  display: block;
  border-radius: 14px;
  filter: grayscale(0.85) contrast(1.05);
  transition: filter var(--t-slow) var(--ease-out);
}

.branch-card:hover .branch-map-embed {
  filter: none;
}

[data-theme="dark"] .branch-map-embed {
  filter: grayscale(0.9) brightness(0.82) contrast(1.05);
}

.branch-details {
  padding: 22px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-grow: 1;
}

.branch-details > .tag-badge {
  align-self: flex-start;
  margin-bottom: 14px;
}

.branch-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 18px;
}

.branch-info-row {
  display: block;
  font-size: 0.94rem;
  color: var(--text-muted);
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  line-height: 1.6;
}

.branch-info-row strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.branch-info-row a {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

.branch-actions {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.branch-actions .tool-btn {
  margin-left: auto;
}

/* ==========================================================================
   Revision 2 components (MASTER.md)
   ========================================================================== */

/* Extra one-shot icon motions */
.is-playing .ic .pin { animation: icPin 1.2s var(--ease-out) 1 both; }
.is-playing .ic .pin-late { animation-delay: 0.15s; }
@keyframes icPin { 0% { transform: translateY(-5px); opacity: 0; } 45%, 100% { transform: none; opacity: 1; } }

.is-playing .ic .hand { animation: icHand 1.2s var(--ease-out) 1; transform-origin: 12px 12px; transform-box: view-box; }
@keyframes icHand { to { transform: rotate(360deg); } }

/* ---- Features: title column + three live demos ---- */
.features-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 3fr);
  gap: 16px 40px;
  align-items: start;
}

.features-layout .section-header.split.features-head {
  display: block;
  margin: 0;
  position: sticky;
  top: 100px;
}

.section-header.split.features-head .section-title {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  margin-bottom: 14px;
}

.features-head .section-desc {
  max-width: 36ch;
}

.demo {
  position: relative;
  height: 156px;
  border-radius: 14px;
  background: var(--bg-elevated);
  margin-bottom: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Demo 1 - AND gate you can actually toggle */
.demo-gate {
  gap: 12px;
}

.gate-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gate-in {
  width: 60px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--tile-shadow);
  transition: background-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.gate-in:hover {
  color: var(--text-main);
}

.gate-in:active {
  transform: translateY(1px);
}

.gate-in[aria-pressed="true"] {
  background: var(--primary);
  color: var(--bg-card);
}

.gate-svg {
  width: 84px;
  color: var(--text-dim);
}

.gate-svg .out {
  transition: color var(--t-fast) var(--ease-out);
}

.demo-gate.is-on .gate-svg .out {
  stroke: var(--accent-gold);
}

.gate-lamp {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-hover);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-dim);
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-normal) var(--ease-out);
}

.demo-gate.is-on .gate-lamp {
  background: var(--marker);
  border-color: var(--marker);
  color: var(--ink);
  box-shadow: 0 0 0 6px rgba(255, 210, 63, 0.18);
}

/* Demo 2 - <h1> types out, then renders */
.demo-code {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 18px;
  background: var(--code-bg);
}

[data-theme="light"] .demo-code {
  background: var(--ink);
}

.demo-src {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: #E3E8F5;
  white-space: nowrap;
  font-variant-ligatures: none;
}

.demo-src .tk {
  color: #8FA8FF;
}

.demo-src .typed {
  display: inline-block;
  vertical-align: bottom;
}

.is-playing .demo-src .typed {
  animation: demoType 1.2s steps(11) 1 both;
}

@keyframes demoType {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.demo-src .caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--marker);
  opacity: 0;
}

.is-playing .demo-src .caret {
  animation: icBlink 1.2s steps(1) 1 both;
}

.demo-out {
  background: #FFFFFF;
  color: #0B1533;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: Arial, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.is-playing .demo-out {
  animation: demoOut 1.2s var(--ease-out) 1 both;
}

@keyframes demoOut {
  0%, 75% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: none; }
}

/* Demo 3 - lecture sheets fan out on hover */
.demo-notes .sheet {
  position: absolute;
  width: 92px;
  height: 116px;
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.45);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--t-normal) var(--ease-out);
}

.demo-notes .sheet i {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--border-hover);
}

.demo-notes .sheet i:first-child {
  width: 62%;
  background: var(--h);
}

.demo-notes .sheet i:nth-child(3) { width: 80%; }
.demo-notes .sheet i:nth-child(5) { width: 55%; }

.demo-notes .sheet:nth-child(1) { transform: rotate(-5deg); }
.demo-notes .sheet:nth-child(3) { transform: rotate(5deg); }

.tile:hover .demo-notes .sheet:nth-child(1) { transform: translateX(-66px) rotate(-9deg); }
.tile:hover .demo-notes .sheet:nth-child(2) { transform: translateY(-6px); }
.tile:hover .demo-notes .sheet:nth-child(3) { transform: translateX(66px) rotate(9deg); }

/* ---- Batch rows: icon + label + value ---- */
.batch-facts li {
  grid-template-columns: 18px 64px minmax(0, 1fr);
  align-items: start;
}

.fact-ic {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--primary);
}

.batch-col.is-featured .fact-ic {
  color: var(--marker);
}

/* ---- Branches: list on the left, one map that switches ---- */
.branch-switch {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 16px;
  align-items: stretch;
}

.branch-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.branch-list .branch-card {
  padding: 4px;
  transition: box-shadow var(--t-normal) var(--ease-out);
}

.branch-list .branch-card.is-active {
  box-shadow: inset 0 0 0 2px var(--primary), var(--tile-shadow-hover);
}

.branch-map-stage {
  position: relative;
  min-height: 420px;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--tile-shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.branch-map-stage .branch-map-embed {
  flex: 1;
  height: auto;
  min-height: 260px;
}

.branch-map-stage:hover .branch-map-embed {
  filter: none;
}

/* With ui.js: maps stack and crossfade (240ms) */
.branch-map-stage.is-switching .branch-map-embed {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-normal) var(--ease-out), filter var(--t-slow) var(--ease-out);
}

.branch-map-stage.is-switching .branch-map-embed.is-active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1199px) and (min-width: 993px) {
  .features-layout {
    grid-template-columns: 1fr;
  }
  .features-layout .section-header.split.features-head {
    position: static;
    display: grid;
  }
  .stat-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .stat-grid .stat-item {
    grid-column: span 2;
  }
  .stat-grid .branch-pill {
    grid-column: span 3;
  }
}

@media (max-width: 992px) {
  .features-layout {
    grid-template-columns: 1fr;
  }
  .features-layout .section-header.split.features-head {
    position: static;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .branch-switch {
    grid-template-columns: 1fr;
  }
  .branch-map-stage {
    min-height: 320px;
  }
  .qa-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-grid .stat-item,
  .stat-grid .branch-pill {
    padding: 12px 14px;
    gap: 12px;
  }
  .stat-grid .stat-item:nth-child(3),
  .stat-grid .branch-pill {
    grid-column: 1 / -1;
  }
}

/* ==========================================================================
   Notes page & reader
   ========================================================================== */
.page-main {
  flex: 1;
  padding-top: 32px;
  padding-bottom: 72px;
}

.notes-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.notes-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar-title {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.chapter-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-nav-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.chapter-nav-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.chapter-nav-btn.active {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}

.chapter-nav-btn .chap-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  min-width: 34px;
  height: 34px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-hover);
  color: var(--text-dim);
  background: transparent;
}

.sidebar-cta {
  margin-top: 28px;
  padding: 20px;
  background: var(--ink);
  color: #EEF1F8;
  border-radius: var(--radius-lg);
}

.sidebar-cta-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.sidebar-cta p {
  font-size: 0.84rem;
  color: #A3ADC8;
  line-height: 1.55;
  margin-bottom: 14px;
}

.sidebar-cta .btn-primary-glow {
  width: 100%;
  background: var(--marker);
  border-color: var(--marker);
  color: var(--ink) !important;
}

.sidebar-cta .btn-primary-glow:hover {
  background: #FFFFFF;
  border-color: #FFFFFF;
}

.notes-content-area {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 56px);
  min-width: 0;
}

.notes-header-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--text-main);
  padding-bottom: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
  gap: 16px;
}

.notes-header-toolbar .tag-badge {
  margin-bottom: 12px;
  color: var(--primary);
  border-color: currentColor;
}

.notes-chapter-heading {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.notes-chapter-meta {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  margin-top: 8px;
}

.notes-toolbar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Typography inside notes */
.note-body {
  line-height: 1.8;
}

.note-body > * {
  max-width: 78ch;
}

.note-body > table,
.note-body > .code-container,
.note-body > .output-preview-box,
.note-body > div {
  max-width: none;
}

.note-body h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  color: var(--text-main);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  border-left: none;
  padding-left: 0;
}

.note-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.note-body h3 {
  font-size: 1.18rem;
  color: var(--text-main);
  margin-top: 28px;
  margin-bottom: 10px;
}

.note-body p {
  margin-bottom: 14px;
  color: var(--text-main);
}

.note-body ul, .note-body ol {
  padding-left: 22px;
  margin-bottom: 18px;
}

.note-body li {
  margin-bottom: 8px;
  color: var(--text-main);
}

.note-body strong {
  font-weight: 700;
}

.note-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
  overflow-x: auto;
}

.note-body th, .note-body td {
  border: 1px solid var(--border-color);
  padding: 11px 14px;
  text-align: left;
  font-size: 0.94rem;
  vertical-align: top;
}

.note-body th {
  background-color: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.86rem;
}

.note-body tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.015);
}

[data-theme="light"] .note-body tr:nth-child(even) td {
  background-color: #FAFBFC;
}

.note-body code {
  background-color: var(--primary-tint);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-weight: 500;
}

.code-container {
  position: relative;
  margin: 20px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.code-header {
  background: var(--code-bar);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: #9AA5C4;
  border-bottom: 1px solid #1A2448;
  font-family: var(--font-mono);
}

.copy-btn {
  background: transparent;
  border: 1px solid #2A3766;
  color: #A3ADC8;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.copy-btn:hover {
  color: #FFFFFF;
  border-color: #6E8DFF;
}

.note-body pre {
  background-color: var(--code-bg);
  color: #E3E8F5;
  padding: 18px;
  margin: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
}

.note-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.output-preview-box {
  border: 1px dashed var(--border-hover);
  padding: 20px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-md);
  margin: 14px 0 26px;
}

.callout-box {
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  padding: 16px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 22px 0;
}

.callout-box.tip {
  border-left-color: var(--marker);
  background: rgba(255, 210, 63, 0.08);
}

.callout-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.note-footer-credits {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.note-footer-credits .credits-small {
  font-size: 0.84rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Chapter hue on inner pages (hue comes from the hue mapping at the top) */
.chapter-nav-btn .chap-badge {
  color: var(--h, var(--text-dim));
  border-color: color-mix(in srgb, var(--h, var(--border-hover)) 45%, transparent);
}

.chapter-nav-btn.active .chap-badge {
  background: var(--h, var(--text-main));
  border-color: var(--h, var(--text-main));
  color: var(--bg-card);
}

.chapter-nav-btn.active {
  box-shadow: inset 3px 0 0 var(--h, var(--primary));
}

.chapter-filter-btn {
  justify-content: flex-start;
}

.chapter-filter-btn[data-chapter]:not([data-chapter="all"])::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--h);
  flex-shrink: 0;
}

/* Locked chapters: shared by the notes and MCQ pages */
.chapter-nav-btn.is-locked:not(.active) { color: var(--text-dim); }
.chapter-nav-btn.is-locked .chap-badge svg { display: block; }
.chapter-filter-btn.is-locked > span:first-child { flex: 1; min-width: 0; }

.note-locked {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: inset 3px 0 0 var(--h, var(--primary));
  scroll-margin: 96px 0 24px;
}
.note-locked-topic {
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--h, var(--primary));
}
.note-locked-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--h, var(--primary));
  color: var(--bg-card);
}
.note-locked-icon svg { width: 18px; height: 18px; }
.note-locked-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
}
.note-locked p {
  margin: 6px 0 16px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.note-locked p a { color: inherit; font-weight: 600; text-decoration: underline; }
.note-locked-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}
.note-locked-link {
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
}
.note-locked-link:hover { color: var(--h, var(--primary)); }

.notes-header-toolbar .tag-badge {
  color: var(--h, var(--primary));
}

.note-body li::marker {
  color: var(--h, var(--primary));
}

.notes-header-toolbar {
  border-bottom: 2px solid var(--h, var(--text-main));
}

/* ==========================================================================
   MCQ practice & exam
   ========================================================================== */
.mcq-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.mcq-filter-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}

.panel-label {
  margin-bottom: 12px;
}

.panel-label + .mode-selector {
  margin-bottom: 28px;
}

.chapter-filter-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.panel-tip {
  margin-top: 28px;
  padding: 18px;
  background: rgba(255, 210, 63, 0.08);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--marker);
}

.panel-tip-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.panel-tip p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.mcq-main-arena {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.mcq-questions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mode-selector {
  display: flex;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.mode-btn {
  flex: 1;
  padding: 9px 8px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.86rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--text-main);
  color: var(--bg-main);
}

/* Question card */
.mcq-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 30px);
}

.mcq-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mcq-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.mcq-question-text {
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 20px;
  color: var(--text-main);
}

.mcq-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.mcq-option-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.96rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.mcq-option-btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.mcq-option-btn:disabled {
  cursor: default;
}

/* Option letter = OMR bubble */
.mcq-option-btn .opt-badge {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-hover);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.mcq-option-btn:hover:not(:disabled) .opt-badge {
  border-color: var(--text-main);
  color: var(--text-main);
}

/* Exam mode: selected answer is a filled bubble */
.mcq-option-btn.active {
  border-color: var(--text-main);
}

.mcq-option-btn.active .opt-badge {
  background: var(--text-main);
  border-color: var(--text-main);
  color: var(--bg-main);
}

.mcq-option-btn.correct {
  background: var(--success-tint) !important;
  border-color: var(--success) !important;
  color: var(--text-main) !important;
}

.mcq-option-btn.correct .opt-badge {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.mcq-option-btn.incorrect {
  background: var(--danger-tint) !important;
  border-color: var(--danger) !important;
  color: var(--text-main) !important;
}

.mcq-option-btn.incorrect .opt-badge {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}

.mcq-explanation-box {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--primary-tint);
  border-left: 3px solid var(--primary);
  font-size: 0.92rem;
  line-height: 1.65;
  display: none;
}

.mcq-explanation-box.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Exam timer bar */
.exam-top-bar {
  background: var(--ink);
  color: #EEF1F8;
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 84px;
  z-index: 5;
}

.exam-top-bar .tag-badge {
  background: var(--marker) !important;
  border-color: var(--marker);
  color: var(--ink) !important;
}

.exam-top-bar-label {
  font-weight: 600;
  margin-left: 10px;
  font-size: 0.94rem;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--marker);
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.exam-submit-bar {
  margin-top: 12px;
  text-align: center;
}

/* Scorecard */
.scorecard-modal {
  text-align: center;
  padding: 36px;
}

.scorecard-circle {
  width: 140px;
  height: 140px;
  border-radius: var(--radius-full);
  margin: 0 auto 22px;
  border: 2px solid var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 8px var(--bg-card), inset 0 0 0 9px var(--border-color);
}

.scorecard-circle .marks {
  font-family: var(--font-display);
  font-stretch: 80%;
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
}

.scorecard-circle .total {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* ==========================================================================
   CQ Type a & b vault
   ========================================================================== */
.qa-controls {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.qa-controls input,
.qa-controls select,
.field-control {
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.94rem;
  font-weight: 500;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.qa-controls input {
  flex: 1 1 360px;
  max-width: 460px;
}

.qa-controls input:focus,
.qa-controls select:focus,
.field-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.qa-controls .tool-btn {
  height: 46px;
  padding: 0 16px;
}

.qa-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.qa-list > .qa-card {
  margin-bottom: 0;
}

.qa-list > .card:only-child {
  grid-column: 1 / -1;
}

.qa-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  margin-bottom: 14px;
  transition: border-color var(--transition-normal);
}

.qa-card:hover {
  box-shadow: var(--tile-shadow-hover);
}

.qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qa-type-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.badge-type-a {
  background: var(--primary-tint);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.badge-type-b {
  background: rgba(255, 210, 63, 0.1);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
}

.qa-question-title {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.5;
}

.qa-answer-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 18px 20px;
  margin-top: 14px;
  line-height: 1.75;
}

.qa-answer-tier {
  margin-bottom: 12px;
}

.qa-tier-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 4px;
}

.qa-tier-label.comp {
  color: var(--accent-gold);
}

.reveal-answer-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.86rem;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.reveal-answer-btn:hover {
  background: var(--bg-surface);
  border-color: var(--text-main);
}

/* ==========================================================================
   Interactive ICT Lab tools
   ========================================================================== */
.lab-header-card {
  margin-bottom: 20px;
}

.lab-container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.editor-box {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-toolbar {
  background: var(--code-bar);
  padding: 10px 14px;
  border-bottom: 1px solid #1A2448;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: #CDD5EA;
}

.editor-toolbar .tool-btn,
.terminal-header .tool-btn {
  background: transparent;
  border-color: #2A3766;
  color: #A3ADC8;
}

.editor-toolbar .tool-btn:hover,
.terminal-header .tool-btn:hover {
  color: #FFFFFF;
  border-color: #6E8DFF;
}

.btn-run-primary {
  background: var(--success);
  color: #FFFFFF;
  border: 1px solid var(--success);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: filter var(--transition-fast);
}

[data-theme="light"] .btn-run-primary,
.editor-toolbar .btn-run-primary {
  background: #16A366;
  border-color: #16A366;
}

.btn-run-primary:hover {
  filter: brightness(1.08);
}

.btn-run-primary:active {
  transform: translateY(1px);
}

.code-textarea {
  flex-grow: 1;
  min-height: 400px;
  background: transparent;
  color: #E3E8F5;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 18px;
  border: none;
  resize: vertical;
  outline: none;
  line-height: 1.65;
  tab-size: 4;
}

.code-textarea:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.code-textarea::placeholder {
  color: #4C5980;
}

.preview-box {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-toolbar {
  background: #F2F4F8;
  padding: 12px 16px;
  border-bottom: 1px solid #DDE2EC;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #0B1533;
  font-weight: 600;
  font-size: 0.86rem;
}

.preview-iframe {
  flex-grow: 1;
  width: 100%;
  min-height: 400px;
  border: none;
  background: #FFFFFF;
}

/* Number system converter */
.converter-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3vw, 34px);
  margin-bottom: 24px;
}

.converter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.convert-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.convert-field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.convert-field input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.convert-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Logic gate simulator & expression styles */
.logic-bar {
  text-decoration: overline;
  text-decoration-thickness: 1.8px;
  display: inline-block;
  padding: 0 2px;
  letter-spacing: 0.5px;
  text-decoration-color: currentColor;
}

.logic-bar-double {
  border-top: 1.8px solid currentColor;
  padding-top: 2px;
  display: inline-block;
  text-decoration: overline;
  text-decoration-thickness: 1.8px;
  padding-left: 2px;
  padding-right: 2px;
  letter-spacing: 0.5px;
}

.gate-sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.gate-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.gate-switches {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}

.switch-btn {
  background: transparent;
  border: 1.5px solid var(--border-hover);
  color: var(--text-main);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.switch-btn:hover {
  border-color: var(--text-main);
}

.switch-btn.on {
  border-color: var(--text-main);
  background: var(--text-main);
  color: var(--bg-main);
}

.gate-output-lamp {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-full);
  margin: 15px auto;
  border: 1.5px solid var(--border-hover);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dim);
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.gate-output-lamp.active {
  background: var(--marker);
  border-color: var(--marker);
  color: var(--ink);
  box-shadow: 0 0 0 6px rgba(255, 210, 63, 0.18);
}

/* Gate card - circuit diagram + truth table */
.gate-sim-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
}

.gate-sim-grid .gate-card {
  text-align: left;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.gate-card .tag-badge {
  background: none;
  padding: 0;
  font-weight: 700;
  letter-spacing: 0.06em;
  gap: 8px;
  align-self: flex-start;
}

.gate-card .tag-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.gate-circuit {
  --wire-off: var(--border-hover);
  --wire-on: var(--accent-gold);
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  margin: 16px 0 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.gate-circuit .gate-switches {
  display: grid;
  grid-auto-rows: 1fr;
  height: 100px;
  margin: 0;
  gap: 0;
  align-items: center;
}

.gate-input {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.gate-in-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  white-space: nowrap;
}

.gate-circuit .switch-btn {
  width: 40px;
  height: 40px;
  font-size: 1rem;
  background: var(--bg-card);
  position: relative;
  z-index: 1;
}

.gate-circuit .switch-btn.on {
  background: var(--text-main);
}

.gate-wire-cell {
  height: 100px;
  overflow: hidden;
}

.gate-diagram {
  display: block;
  width: 100%;
  height: 100px;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gate-diagram .wire {
  stroke: var(--wire-off);
  stroke-width: 3;
  transition: stroke var(--t-fast, 180ms) var(--ease-out, ease-out);
}

.gate-diagram .gate-body,
.gate-diagram .gate-body-line {
  stroke: var(--text-muted);
  stroke-width: 2.5;
}

.gate-diagram .gate-body {
  fill: var(--bg-card);
}

.gate-card[data-a="1"] .w-a,
.gate-card[data-b="1"] .w-b,
.gate-card[data-y="1"] .w-y {
  stroke: var(--wire-on);
}

.gate-circuit .gate-output-lamp {
  width: 54px;
  height: 54px;
  margin: 0;
  font-size: 1.05rem;
  background: var(--bg-card);
}

.gate-circuit .gate-output-lamp.active {
  background: var(--marker);
}

.gate-out-line {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.gate-out-line span {
  font-family: var(--font-mono);
  color: var(--text-main);
}

.gate-card[data-y="1"] .gate-out-line span {
  color: var(--accent-gold);
}

.gate-truth {
  width: 100%;
  margin-top: auto;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
}

.gate-truth th {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 6px 4px;
  border-bottom: 1.5px solid var(--border-hover);
}

.gate-truth td {
  padding: 6px 4px;
  color: var(--text-muted);
  transition: background-color var(--t-fast, 180ms) var(--ease-out, ease-out), color var(--t-fast, 180ms) var(--ease-out, ease-out);
}

.gate-truth .mid {
  color: var(--text-dim);
}

.gate-truth .y {
  border-left: 1.5px solid var(--border-hover);
  font-weight: 700;
}

.gate-truth td.y.on {
  color: var(--accent-gold);
}

.gate-truth tbody tr {
  cursor: pointer;
}

.gate-truth tbody tr:hover td {
  background: var(--bg-elevated);
}

.gate-truth tbody tr:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.gate-truth tbody tr.is-current td {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.gate-truth tbody tr.is-current td:first-child {
  box-shadow: inset 3px 0 0 var(--accent-gold);
}

.gate-truth tbody tr.is-current td.y.on {
  color: var(--accent-gold);
}

@media (max-width: 380px) {
  .gate-in-label {
    display: none;
  }
}

/* Lab tab navigation - segmented control */
.lab-tabs-nav {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  margin: 24px 0 4px;
  flex-wrap: wrap;
}

.tool-tab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.tool-tab-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}

.tool-tab-btn.active-tab {
  background: var(--text-main);
  border-color: var(--text-main);
  color: var(--bg-main);
}

/* SQL lab */
.schema-preview-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.schema-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.schema-table-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.88rem;
}

.schema-table-name {
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.schema-col-pill {
  display: inline-block;
  background: transparent;
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  margin: 2px;
  border: 1px solid var(--border-color);
}

.sql-quick-bar {
  padding: 10px 14px;
  background: var(--code-bar);
  border-top: 1px solid #1A2448;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sql-result-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 380px;
}

.sql-result-header {
  background: var(--bg-surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.sql-status-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sql-status-badge.success {
  background: var(--success-tint);
  color: var(--success);
  border: 1px solid var(--success);
}

.sql-status-badge.error {
  background: var(--danger-tint);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.sql-table-container {
  overflow-x: auto;
  max-height: 480px;
  width: 100%;
}

.sql-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

.sql-table th {
  background: var(--bg-elevated);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-hover);
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.sql-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
}

.sql-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

[data-theme="light"] .sql-table tbody tr:nth-child(even) {
  background: #FAFBFC;
}

.sql-table tbody tr:hover {
  background: var(--primary-tint);
}

/* Virtual terminal console (C & Python) - always dark */
.terminal-window {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 400px;
}

[data-theme="light"] .terminal-window,
[data-theme="light"] .editor-box {
  background: #0B1533;
  border-color: #0B1533;
}

[data-theme="light"] .editor-toolbar,
[data-theme="light"] .editor-status-bar,
[data-theme="light"] .sql-quick-bar,
[data-theme="light"] .terminal-header {
  background: #0E1A3F;
}

.terminal-header {
  background: var(--code-bar);
  padding: 10px 14px;
  border-bottom: 1px solid #1A2448;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2A3766;
}

.terminal-dot.red { background: #2A3766; }
.terminal-dot.yellow { background: #2A3766; }
.terminal-dot.green { background: #2A3766; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: #9AA5C4;
  letter-spacing: 0.02em;
}

.terminal-body {
  flex-grow: 1;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: #E3E8F5;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-prompt {
  color: #8FA8FF;
  font-weight: 700;
}

.terminal-success-text {
  color: #4ADE9B;
}

.terminal-error-text {
  color: #FF8DA3;
  background: rgba(240, 80, 110, 0.1);
  padding: 8px 12px;
  border-left: 3px solid #F0506E;
  border-radius: var(--radius-sm);
  margin: 10px 0;
}

.terminal-meta-text {
  color: #6F7A9A;
  font-size: 0.78rem;
  margin-top: 15px;
  border-top: 1px dashed #1F2C55;
  padding-top: 8px;
}

/* Stdin input card */
.stdin-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 12px;
}

.stdin-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.stdin-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stdin-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.stdin-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.94rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.stdin-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.editor-status-bar {
  background: var(--code-bar);
  padding: 8px 14px;
  border-top: 1px solid #1A2448;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #6F7A9A;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.editor-label,
.editor-hint {
  font-family: var(--font-mono);
  color: #8FA8FF;
}

.editor-label {
  font-weight: 700;
  font-size: 0.82rem;
}

.quick-tag-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.quick-tag-btn:hover {
  background: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
}

.sql-quick-bar .quick-tag-btn,
.editor-box .quick-tag-btn {
  border-color: #2A3766;
  color: #A3ADC8;
}

.sql-quick-bar .quick-tag-btn:hover,
.editor-box .quick-tag-btn:hover {
  background: #8FA8FF;
  border-color: #8FA8FF;
  color: #0A1128;
}

/* Native selects on tool pages */
.tool-section select,
.lab-select {
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-md) !important;
  background: var(--bg-input) !important;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.86rem;
}

/* ==========================================================================
   Modals & forms
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 0;
  box-shadow: var(--tile-shadow);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  padding: clamp(24px, 4vw, 40px);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-head {
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-right: 40px;
}

.modal-head h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin: 12px 0 6px;
}

.modal-head p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.modal-head .brand-badge {
  background: var(--marker);
  color: var(--ink);
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-main);
  border-color: var(--text-main);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group textarea {
  height: auto;
  padding: 12px 14px;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-submit {
  width: 100%;
  height: 52px;
  font-size: 1rem;
  margin-top: 8px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--ink-deep);
  color: #C9D1E6;
  margin-top: auto;
  --text-main: #EEF1F8;
  --text-muted: #A3ADC8;
  --text-dim: #6F7A9A;
  --border-color: #1A2650;
  --primary: #8FA8FF;
}

/* Giant hotline - echoes the flyer's phone number */
.footer-hotline {
  border-bottom: 1px solid var(--border-color);
  padding: clamp(48px, 7vw, 88px) 0 clamp(36px, 5vw, 56px);
}

.footer-hotline-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-hotline-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--marker);
  margin-bottom: 10px;
}

.footer-hotline-number {
  display: block;
  font-family: var(--font-display);
  font-stretch: 75%;
  font-size: clamp(3rem, 11vw, 9.5rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  transition: color var(--transition-fast);
}

.footer-hotline-number:hover {
  color: var(--marker);
}

.footer-hotline .btn-primary-glow {
  background: var(--marker);
  border-color: var(--marker);
  color: var(--ink) !important;
}

.footer-hotline .btn-primary-glow:hover {
  background: #FFFFFF;
  border-color: #FFFFFF;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 40px;
  padding-top: 56px;
  padding-bottom: 48px;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.footer-col .brand-logo {
  margin-bottom: 16px;
  color: #FFFFFF;
}

.footer-about {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  max-width: 38ch;
}

.footer-note {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links strong {
  color: var(--text-main);
  font-weight: 600;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: #FFFFFF;
}

.site-footer .tool-btn {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.site-footer .tool-btn:hover {
  border-color: var(--text-main);
}

.footer-bottom {
  position: relative;
  padding-top: 22px;
  padding-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.footer-bottom::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--border-color);
}

.site-footer .brand-badge {
  background: var(--cobalt);
}

.footer-bottom a {
  color: var(--text-muted);
}

/* ==========================================================================
   Animation
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ribbonIn {
  from { clip-path: polygon(5% 0, 5% 0, 0 100%, 0 100%); }
  to { clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%); }
}

/* One orchestrated moment: hero settles in, then the yellow ribbon pulls across "ICT" */
.hero-content > * {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero-content > *:nth-child(1) { animation-delay: 0.05s; }
.hero-content > *:nth-child(2) { animation-delay: 0.12s; }
.hero-content > *:nth-child(3) { animation-delay: 0.22s; }
.hero-content > *:nth-child(4) { animation-delay: 0.3s; }
.hero-content > *:nth-child(5) { animation-delay: 0.38s; }

.hero-media-wrapper {
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.2s both;
}

.hero-wordmark mark {
  animation: ribbonIn 0.6s cubic-bezier(0.6, 0, 0.2, 1) 0.7s both;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1240px) {
  .nav-links {
    display: none;
  }
  .mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  /* app.js toggles inline display:flex on .nav-links for the drawer */
  .nav-links[style*="flex"] {
    z-index: 99;
    gap: 2px;
    box-shadow: var(--shadow-lg);
  }
  .nav-links[style*="flex"] .nav-link {
    padding: 12px 8px;
    font-size: 1rem;
  }
}

@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .hero-media-wrapper {
    justify-self: start;
    max-width: 420px;
  }
  .section-header.split {
    grid-template-columns: 1fr;
  }
  .section-header.split .section-desc {
    justify-self: start;
  }
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .batch-table {
    grid-template-columns: 1fr;
  }
  .notes-layout, .mcq-layout, .lab-container {
    grid-template-columns: 1fr;
  }
  .notes-sidebar, .mcq-filter-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .announcement-contact span {
    display: none;
  }
  .notice-text {
    white-space: normal;
  }
  .lang-toggle-btn {
    padding: 0 10px;
  }
  .hide-mobile {
    display: none;
  }
  .nav-actions > .btn-primary-glow {
    display: none;
  }
  .hero-whatsapp {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    width: 100%;
  }
  .bento {
    grid-template-columns: 1fr;
  }
  .tile.is-wide {
    grid-column: auto;
  }
  .tile {
    padding: 24px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .notes-header-toolbar {
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .brand-badge {
    display: none;
  }
  .theme-toggle-btn {
    padding: 0 10px;
  }
  .stat-item {
    padding: 12px 10px 14px;
  }
  .stat-item .num {
    font-size: 1.2rem;
  }
}

/* ==========================================================================
   Print (notes)
   ========================================================================== */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .site-header, .site-footer, .notes-sidebar, .notes-toolbar-tools, .mobile-toggle, .top-announcement-bar {
    display: none !important;
  }
  .notes-layout {
    display: block;
  }
  .notes-content-area {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  pre, code {
    background: #f1f5f9 !important;
    color: black !important;
    border: 1px solid #ccc !important;
  }
}
