/* ==========================================================================
   MatrixHanzi — Gate Experience & Storytelling
   Harmonious Warm Oriental Palette:
   - Xuan Paper / Warm Parchment (宣纸米白)
   - Deep Chinese Calligraphy Ink (焦墨)
   - Cinnabar Seal Red (朱砂印泥) from Old Git
   - Antique Amber Gold (沉香金) from Old Git
   - Scholarly Pine & Jade Green (青松竹墨) from Current Git
   ========================================================================== */

:root {
  /* Warm oriental paper canvas */
  --canvas: #fbf8f2;
  --canvas-warm: #f6efe4;
  --surface: #ffffff;
  --surface-warm: #fffdf9;
  
  /* Ink & Tea typography */
  --text: #23201d;             /* Deep Calligraphic Charcoal Ink (焦墨) */
  --text-secondary: #4a4239;
  --muted: #786e63;            /* Warm Tea Tone */
  --muted-light: #9a8f82;
  
  /* Delicate warm borders */
  --line: #e6ddce;
  --line-strong: #d5c8b5;
  --line-subtle: #efe7db;
  
  /* Combined Palette: Old Git (Gold & Seal Red) + Current Git (Jade Green) */
  --seal-red: #a83220;         /* Cinnabar Seal Red (朱砂印泥) */
  --seal-red-dark: #7e1e12;
  --seal-red-subtle: rgba(168, 50, 32, 0.08);
  
  --gold: #ad7328;             /* Antique Amber Gold (沉香金) */
  --gold-dark: #875416;
  --gold-subtle: rgba(173, 115, 40, 0.09);
  
  --color-green: #1e4a38;      /* Deep Scholarly Jade / Pine Green (青松竹墨) */
  --color-green-dark: #15382a;
  --color-green-light: #285f49;
  --color-green-subtle: rgba(30, 74, 56, 0.08);
  
  --color-soft: #f4ede1;
  --focus: #ad7328;
  
  /* Typography */
  --font-serif: 'Noto Serif SC', serif;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-brush: 'Ma Shan Zheng', cursive;
  
  /* Aliases for story */
  --color-line: var(--line);
  --color-red: var(--seal-red);
  --color-muted: var(--muted);
  --color-card: var(--surface);
  --color-gold: var(--gold);
  --font-ui: var(--font-sans);
  --font-han: var(--font-serif);
  
  --container-max: 1200px;
  --container-padding: clamp(20px, 4vw, 48px);
}

/* ==========================================================================
   RESET & AMBIENT CANVAS (Warm Paper & Calligraphic Watermarks)
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.68;
  background-color: var(--canvas) !important;
  background-image: 
    radial-gradient(circle 800px at 50% -120px, rgba(218, 172, 92, 0.085) 0%, transparent 80%),
    radial-gradient(circle 600px at 95% 420px, rgba(168, 50, 32, 0.038) 0%, transparent 70%),
    radial-gradient(circle 700px at 5% 900px, rgba(30, 74, 56, 0.035) 0%, transparent 70%) !important;
  background-attachment: fixed !important;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Calligraphy background watermarks - Authentic East Asian literary feel */
body::before {
  display: block !important;
  content: "學" !important;
  position: fixed !important;
  top: 8% !important;
  right: -3% !important;
  font-family: var(--font-brush) !important;
  font-size: clamp(200px, 25vw, 400px) !important;
  color: rgba(173, 115, 40, 0.042) !important;
  line-height: 1 !important;
  pointer-events: none !important;
  z-index: 0 !important;
  user-select: none !important;
}

body::after {
  display: block !important;
  content: "習" !important;
  position: fixed !important;
  bottom: 8% !important;
  left: -2% !important;
  font-family: var(--font-brush) !important;
  font-size: clamp(180px, 22vw, 360px) !important;
  color: rgba(168, 50, 32, 0.036) !important;
  line-height: 1 !important;
  pointer-events: none !important;
  z-index: 0 !important;
  user-select: none !important;
}

button { font-family: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
[hidden] { display: none !important; }

/* Skip link */
.skip {
  position: fixed; left: 16px; top: -80px; z-index: 100;
  padding: 11px 16px; background: var(--text); color: #fff; border-radius: 10px;
  text-decoration: none;
}
.skip:focus { top: 16px; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  width: min(var(--container-max), calc(100% - 64px));
  margin: 0 auto;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.035em;
  color: var(--text);
  text-decoration: none;
}

/* Cinnabar stone seal stamp (Triện ấn) with red ink gradient & subtle bevel */
.brand-mark {
  width: 40px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #fffaf0;
  font-family: var(--font-brush);
  font-size: 23px;
  line-height: 1;
  background: linear-gradient(135deg, var(--seal-red) 0%, var(--seal-red-dark) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 5px 14px rgba(168, 50, 32, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  flex-shrink: 0;
}

.brand em {
  display: block;
  font-style: normal;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 1px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.header-badge svg {
  width: 13px;
  height: 13px;
  color: var(--gold);
}

/* ==========================================================================
   HERO / MAIN ENTRY SECTION
   ========================================================================== */
.main {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 42px var(--container-padding) 48px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.hero-wrapper {
  display: flex;
  flex-direction: column;
  gap: 36px;
  width: 100%;
  box-sizing: border-box;
}

.hero-content {
  width: 100%;
  max-width: 620px;
  box-sizing: border-box;
}

.hero-visual {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-sizing: border-box;
}

@media (min-width: 900px) {
  .hero-wrapper {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 56px;
  }
  .hero-content {
    flex: 1.15;
  }
  .hero-visual {
    flex: 0.85;
    justify-content: flex-end;
  }
}

/* Eyebrow badge */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(173, 115, 40, 0.28);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--seal-red);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(173, 115, 40, 0.06);
}

.eyebrow svg {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

/* Main Heading with High-End Serif & Balanced Dual Color Accents */
h1 {
  font-family: var(--font-serif) !important;
  font-size: clamp(32px, 3.8vw, 48px);
  line-height: 1.22;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  text-wrap: balance;
}

h1 .gold {
  color: var(--gold) !important;
  font-weight: 700;
}

h1 .red {
  color: var(--seal-red) !important;
  font-weight: 700;
}

.lede {
  color: var(--text-secondary);
  font-size: 14.5px;
  line-height: 1.82;
  max-width: 550px;
  margin-bottom: 8px;
}

.lede-zh {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  font-style: italic;
  max-width: 510px;
  margin-bottom: 24px;
}

/* ==========================================================================
   LANGUAGE SELECTION BOX
   ========================================================================== */
.lang-section {
  width: 100%;
  max-width: 530px;
  padding: 22px;
  background: var(--surface-warm);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 34px -8px rgba(80, 60, 40, 0.07), 0 1px 3px rgba(0, 0, 0, 0.02);
}

.lang-header {
  margin-bottom: 14px;
}

.lang-header h2 {
  font-family: var(--font-serif);
  font-size: 17.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.lang-header p {
  color: var(--muted);
  font-size: 12px;
}

.lang-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lang-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  min-height: 52px;
  border-radius: 13px;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1.5px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  box-sizing: border-box;
}

/* Primary Button (Tiếng Việt) — Harmonious Jade Green + Warm Gold glow */
.lang-btn.primary {
  background: linear-gradient(135deg, #1e4a38 0%, #15382a 100%) !important;
  border-color: #285f49 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(21, 56, 42, 0.22) !important;
}

.lang-btn.primary .lang-title {
  color: #ffffff !important;
}

.lang-btn.primary:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #245842 0%, #173d2e 100%) !important;
  box-shadow: 0 10px 26px rgba(21, 56, 42, 0.32), 0 0 0 1px rgba(173, 115, 40, 0.38) !important;
}

/* Secondary Button (English) — Warm Ivory with Antique Gold Accent */
.lang-btn:not(.primary) {
  background: #fffdf9;
  border-color: #dcd1be;
  color: var(--text);
}

.lang-btn:not(.primary) .lang-title {
  color: var(--text);
}

.lang-btn:not(.primary):hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(173, 115, 40, 0.14);
}

.lang-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.lang-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.lang-btn.primary .lang-icon {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.lang-btn.primary .lang-icon svg {
  width: 17px;
  height: 17px;
}

.lang-btn:not(.primary) .lang-icon {
  background: #f4ede1;
  border: 1px solid #e7ddcf;
  color: var(--color-green);
}

.lang-btn:not(.primary) .lang-icon svg {
  width: 17px;
  height: 17px;
}

.lang-arrow {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, border-color 0.2s ease;
}

.lang-arrow svg {
  width: 13px;
  height: 13px;
}

.lang-btn.primary .lang-arrow {
  background: rgba(212, 168, 88, 0.24);
  color: #ffe6aa;
  border: 1px solid rgba(212, 168, 88, 0.38);
}

.lang-btn.primary:hover .lang-arrow {
  background: rgba(212, 168, 88, 0.38);
  transform: translateX(4px);
}

.lang-btn:not(.primary) .lang-arrow {
  background: #f4ede1;
  color: var(--color-green);
  border: 1px solid #e7ddcf;
}

.lang-btn:not(.primary):hover .lang-arrow {
  background: #fdf5e7;
  color: var(--gold-dark);
  border-color: rgba(173, 115, 40, 0.35);
  transform: translateX(4px);
}

.trust {
  display: flex;
  align-items: center;
  gap: 7px 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 11px;
  color: var(--muted);
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trust-item svg {
  width: 12px;
  height: 12px;
  color: var(--gold);
}

/* ==========================================================================
   FLASHCARD DEMO COMPONENT
   ========================================================================== */
.demo-card-frame {
  width: 100%;
  max-width: 360px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 
    0 20px 48px -10px rgba(90, 65, 40, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.03),
    0 0 0 1px var(--line) !important;
  padding: 16px 18px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.demo-card-frame:hover {
  transform: translateY(-4px) !important;
  box-shadow: 
    0 26px 56px -12px rgba(90, 65, 40, 0.16),
    0 0 0 1.5px var(--gold) !important;
}

.demo-card-top-icons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.demo-card-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #faf7f2;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.demo-card-icon-btn:hover {
  background: #f4ede1;
  border-color: var(--gold);
  color: var(--color-green);
  transform: scale(1.05);
}

.demo-card-illustration {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: #faf7f2;
  border-radius: 14px;
  padding: 10px;
}

.demo-card-illustration img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
}

.demo-card-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent);
  margin-bottom: 12px;
}

.demo-card-hanzi {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 90px;
  margin-bottom: 6px;
}

.hanzi-char-box {
  width: 85px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 70px/85px var(--font-han);
}

.demo-definition {
  margin: 4px 0 14px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}

.demo-definition > span {
  color: var(--seal-red) !important;
  font-weight: 700;
}

.demo-definition small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.demo-card-pinyin-pill {
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #fdfbf7 0%, #f4ede1 100%) !important;
  border: 1.5px solid var(--line-strong) !important;
  color: var(--color-green) !important;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(80, 60, 40, 0.05);
}

.demo-card-pinyin-pill:hover {
  background: linear-gradient(135deg, #1e4a38 0%, #15382a 100%) !important;
  color: #ffffff !important;
  border-color: #1e4a38 !important;
  box-shadow: 0 6px 16px rgba(30, 74, 56, 0.24) !important;
  transform: translateY(-1px);
}

.demo-card-pinyin-pill svg {
  width: 14px;
  height: 14px;
  color: var(--seal-red);
  transition: color 0.2s ease;
}

.demo-card-pinyin-pill:hover svg {
  color: #ffffff;
}

/* ==========================================================================
   GATE NARRATIVE & STORYTELLING
   ========================================================================== */
.gate-narrative {
  width: min(var(--container-max), calc(100% - 64px));
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.matrix-intro {
  padding: 48px 0 0;
  border-top: 1px solid var(--line);
}

.story-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--seal-red);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.story-head h2,
.feature-copy h2,
.story-closing h2 {
  font-family: var(--font-serif) !important;
  font-size: clamp(24px, 2.7vw, 32px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.32;
  color: var(--text);
  margin-bottom: 12px;
}

.story-head p {
  max-width: 74ch;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.82;
}

.story-zh,
.story-head p.story-zh,
.feature-copy p.story-zh {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.7;
  margin-top: 8px;
}

.matrix-connections {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 22px 0 28px;
  list-style: none;
  gap: 10px;
}

.matrix-connections li {
  font-size: 12px;
  font-weight: 500;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--color-green);
  transition: all 0.2s ease;
}

.matrix-connections li:hover {
  background: #ffffff;
  border-color: var(--gold);
  color: var(--gold-dark);
  box-shadow: 0 4px 12px rgba(173, 115, 40, 0.08);
}

.story-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.story-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.story-nav a:hover {
  color: var(--color-green);
}

/* 01 · Đặt nền âm trước */
.story-feature {
  margin-top: 40px;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 32px -8px rgba(80, 60, 40, 0.06);
}

.story-feature > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 330px;
  object-fit: cover;
}

.feature-copy {
  padding: 34px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.feature-copy .feature-fact {
  border-left: 3px solid var(--gold);
  background: #faf6ee;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  margin-top: 18px;
  color: var(--color-green);
  font-size: 12px;
  line-height: 1.6;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin-top: 20px;
}

.resource-links a,
.ecosystem-links a {
  color: var(--color-green);
  font-size: 12.5px;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.resource-links a:hover,
.ecosystem-links a:hover {
  color: var(--gold-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.resource-links a[lang=en] {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}

/* 02 · Câu chuyện của một từ */
.story-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.story-beat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px -6px rgba(80, 60, 40, 0.05);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.story-beat:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 16px 36px -8px rgba(173, 115, 40, 0.14);
}

.story-art {
  position: relative;
  margin: 0;
  background: var(--color-soft);
}

.story-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Cinnabar Seal Stamp for 见, 懂, 记, 用 */
.story-seal {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--seal-red) 0%, var(--seal-red-dark) 100%) !important;
  color: #fffaf0 !important;
  font-family: var(--font-brush) !important;
  font-size: 24px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 6px 16px rgba(168, 50, 32, 0.32) !important;
}

.story-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 16px 0;
}

.story-copy strong {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.story-copy strong em {
  margin-left: 6px;
  color: var(--gold);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.story-copy small {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.7;
}

.story-copy small.story-zh {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  margin-top: 2px;
}

.story-tag {
  align-self: flex-start;
  margin: auto 16px 16px;
  padding: 4px 10px;
  border: 1px solid rgba(30, 74, 56, 0.16);
  border-radius: 999px;
  background: rgba(30, 74, 56, 0.05);
  color: var(--color-green);
  font-size: 10px;
  font-weight: 600;
}

/* 03 · Sáu cách luyện */
.gate-modes {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 28px;
}

.gate-modes li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 0.2s ease;
}

.mode-svg {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: var(--color-green);
  background: #f4efe5;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.mode-svg svg {
  width: 22px;
  height: 22px;
}

.gate-modes li:hover .mode-svg {
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-dark) 100%);
  color: #ffffff;
  border-color: var(--color-green);
  box-shadow: 0 6px 16px rgba(30, 74, 56, 0.22);
}

.gate-modes h3 {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 5px;
  color: var(--text);
}

.gate-modes p {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.75;
}

.gate-modes small {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

/* 04 · Recall loop */
.recall-feature {
  margin-top: 48px;
}

.recall-loop {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 18px 0;
  list-style: none;
  align-items: center;
}

.recall-loop li {
  color: var(--color-green);
  font-size: 12px;
  font-weight: 600;
  background: #fbf7ee;
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 7px;
}

.recall-loop li + li::before {
  content: '→';
  padding-right: 8px;
  color: var(--gold);
  font-weight: 700;
}

/* 05 · Ecosystem & Stats */
.story-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 26px 0;
  padding: 0;
  list-style: none;
}

.story-stats li {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-warm);
  box-shadow: 0 6px 16px -4px rgba(80, 60, 40, 0.04);
}

.story-stats b {
  display: block;
  color: var(--color-green);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.story-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.library-feature {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 32px -8px rgba(80, 60, 40, 0.06);
}

.library-feature > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 300px;
}

.library-feature h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  color: var(--text);
}

.ecosystem-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 28px;
}

.ecosystem-links article {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.resource-number {
  font-size: 9.5px;
  color: var(--seal-red);
  font-weight: 700;
  letter-spacing: 0.14em;
}

.ecosystem-links h3 {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 700;
  margin: 8px 0;
  color: var(--text);
}

.ecosystem-links p {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 0 0 14px;
  line-height: 1.75;
}

/* Closing Banner */
.story-closing {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 40px;
  margin: 36px 0 48px;
  padding: 36px 40px;
  border: 1.5px solid var(--line-strong);
  border-radius: 20px;
  background: linear-gradient(135deg, #f7f2e7 0%, #eff5ed 100%);
  box-shadow: 0 14px 38px -10px rgba(80, 60, 40, 0.08);
}

.story-closing h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

.story-closing p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.8;
  margin-top: 10px;
  max-width: 660px;
}

.closing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.closing-actions a {
  background: linear-gradient(135deg, #1e4a38 0%, #15382a 100%);
  color: #ffffff;
  padding: 12px 22px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(21, 56, 42, 0.2);
  transition: all 0.2s ease;
}

.closing-actions a:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(21, 56, 42, 0.32), 0 0 0 1px rgba(173, 115, 40, 0.3);
}

.closing-actions a[lang=en] {
  background: var(--surface-warm);
  border: 1.5px solid var(--color-green);
  color: var(--color-green);
  box-shadow: none;
}

.closing-actions a[lang=en]:hover {
  background: #ffffff;
  border-color: var(--gold);
  color: var(--gold-dark);
  box-shadow: 0 6px 18px rgba(173, 115, 40, 0.14);
}

/* Footer */
.footer {
  width: min(var(--container-max), calc(100% - 64px));
  margin: 0 auto;
  padding: 24px 0 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11.5px;
  gap: 18px;
  flex-wrap: wrap;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer a:hover {
  color: var(--gold);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1000px) {
  .hero-wrapper { gap: 32px; }
  .lang-btn { gap: 10px; padding: 12px 14px; }
  .lang-title { font-size: 14px; }
  .feature-copy { padding: 26px; }
  .gate-modes { gap: 0 20px; }
  .gate-modes li { gap: 10px; }
  .story-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 899px) {
  .header { width: calc(100% - 32px); padding: 18px 0; }
  .main { padding: 32px 16px 40px; }
  .hero-wrapper { flex-direction: column; gap: 32px; }
  .hero-content { max-width: 100%; text-align: left; }
  .lang-section { max-width: 100%; }
  .hero-visual { width: 100%; justify-content: center; }
  .demo-card-frame { max-width: 100%; }
  .lang-btn { padding: 12px 15px; gap: 10px; }
  .lang-title { font-size: 14.5px; }
  .gate-narrative { width: calc(100% - 32px); }
  .story-feature { grid-template-columns: 1fr; }
  .story-feature > img { min-height: 240px; max-height: 320px; }
  .feature-copy { padding: 26px; }
  .gate-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-feature { grid-template-columns: 1fr; }
  .library-feature > img { min-height: 240px; max-height: 320px; }
  .ecosystem-links { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .story-closing { grid-template-columns: 1fr; gap: 24px; padding: 28px 24px; }
  .footer { width: calc(100% - 32px); }
}

@media (max-width: 640px) {
  .header-badge { display: none; }
  .brand { font-size: 18px; }
  .brand-mark { width: 36px; height: 38px; font-size: 20px; }
  h1 { font-size: 30px; margin-bottom: 15px; }
  .eyebrow { font-size: 9.5px; margin-bottom: 14px; }
  .lede { font-size: 13.5px; line-height: 1.8; }
  .lede-zh { font-size: 11.5px; margin-bottom: 20px; }
  .lang-section { padding: 18px 16px; }
  .lang-buttons { grid-template-columns: 1fr; gap: 10px; }
  .lang-btn { padding: 12px 16px; min-height: 50px; }
  .lang-icon { width: 30px; height: 30px; }
  .lang-icon svg { width: 16px; height: 16px; }
  .lang-title { font-size: 14.5px; }
  .lang-arrow { width: 24px; height: 24px; }
  .lang-arrow svg { width: 12px; height: 12px; }
  .demo-card-frame { padding: 14px 16px 20px; max-width: 340px; margin: 0 auto; }
  .demo-card-illustration { height: 160px; }
  .matrix-intro { padding-top: 32px; }
  .story-track { grid-template-columns: 1fr; gap: 14px; }
  .story-seal { width: 36px; height: 36px; font-size: 20px; left: 10px; bottom: 10px; }
  .gate-modes { grid-template-columns: 1fr; }
  .story-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ecosystem-links { grid-template-columns: 1fr; }
  .footer { flex-direction: column; text-align: center; gap: 12px; }
  .footer-links { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* Gate language controls stay available at every viewport size. */
.header-tools { display: flex; align-items: center; gap: 20px; }
.gate-language-switch { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-warm); }
.gate-language-switch button { border: 0; border-radius: 999px; min-width: 48px; padding: 9px 10px; min-height: 44px; color: var(--text-secondary); background: transparent; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; }
.gate-language-switch button[aria-pressed="true"] { color: #fff; background: var(--color-green); }
.gate-language-switch button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
[lang="zh-Hans"] { font-family: var(--font-serif); letter-spacing: .025em; font-style: normal !important; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .header { gap: 10px; }
  /* Slogan đã có trong hero — ẩn ở header để dòng brand gọn, pill ngôn ngữ
     không bị đẩy xuống dòng thứ hai trên điện thoại. */
  .brand em { display: none; }
  .gate-language-switch { flex: none; }
  .gate-language-switch button { min-width: 42px; padding: 9px 8px; }
}
