:root {
  --bg: #17152b;
  --panel: #24213d;
  --panel-light: #302c50;
  --text: #fffdf7;
  --muted: #aaa5c1;
  --yellow: #ffd447;
  --pink: #ff6b9d;
  --green: #60e6a8;
  --red: #ff6f70;
  --accent: var(--yellow);
  --accent-strong: var(--pink);
  --surface: rgba(36,33,61,.86);
  --surface-strong: rgba(47,44,78,.95);
  --border: rgba(255,255,255,.12);
  --shadow: 0 24px 70px rgba(0,0,0,.22);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -10%, rgba(255,212,71,.16), transparent 32%),
    radial-gradient(circle at 95% 25%, rgba(255,107,157,.14), transparent 30%),
    linear-gradient(180deg, #1d1839 0%, var(--bg) 100%);
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 16px;
  letter-spacing: .01em;
}
button { font: inherit; }
.app-shell,
.portal-shell { width: min(1120px, 100%); min-height: 100vh; margin: 0 auto; padding: 0 22px 36px; display: flex; flex-direction: column; gap: 16px; }
header {
  position: relative;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.logo { display: flex; align-items: center; gap: 8px; color: white; text-decoration: none; }
.logo span { font-size: 27px; }
.logo strong { font-size: 18px; letter-spacing: -.04em; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 800; }
.site-nav a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-nav-button { display: none; }
.sound-button,
.share-icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 50%;
  color: var(--yellow);
  background: rgba(36,33,61,.8);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}
.share-icon-button {
  color: var(--green);
  text-decoration: none;
}
.sound-button.muted { color: var(--muted); }
.best-score { padding: 9px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 99px; color: var(--muted); font-size: 14px; }
.best-score strong { color: var(--yellow); }
.game-stage { width: min(100%, 520px); flex: 1; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.screen { display: none; width: 100%; padding: 18px 0 32px; text-align: center; animation: enter .28s ease; }
.screen.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.hero-emoji { height: 112px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.hero-emoji span { display: inline-grid; place-items: center; width: 78px; height: 78px; border-radius: 23px; background: var(--panel); font-size: 40px; box-shadow: 0 18px 40px rgba(0,0,0,.25); transform: rotate(-7deg); }
.hero-emoji span:nth-child(2) { z-index: 2; width: 94px; height: 94px; background: var(--yellow); transform: translateY(-8px) rotate(3deg); }
.hero-emoji span:nth-child(3) { transform: rotate(8deg); }
.eyebrow { margin: 26px 0 10px; color: var(--yellow); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -.055em; line-height: 1.06; }
h1 { font-size: clamp(42px, 12vw, 64px); }
h2 { font-size: 38px; }
.intro { max-width: 430px; margin: 18px auto 26px; color: var(--muted); font-size: 16px; line-height: 1.7; }
.mode-card {
  margin: 0 auto 15px;
  padding: 17px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.mode-card span, .mode-card strong { display: block; }
.mode-card span { color: var(--muted); font-size: 13px; }
.mode-card strong { margin-top: 3px; font-size: 17px; }
.mode-icon { font-size: 30px !important; }
.primary-button, .secondary-button, .skip-button {
  width: 100%;
  min-height: 55px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .2s ease, background .2s ease;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
}
.primary-button { display: flex; justify-content: center; align-items: center; gap: 18px; color: #1a1728; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: 0 14px 34px rgba(255,107,157,.16); }
.primary-button:hover, .secondary-button:hover, .skip-button:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(0,0,0,.24); }
.primary-button:active { transform: scale(.98); }
.tiny-note { margin: 13px 0 0; color: #8f89aa; font-size: 13px; }
.kids-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; color: var(--green); text-decoration: none; font-size: 14px; font-weight: 700; }

.game-screen { align-self: stretch; }
.game-top { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.game-top strong { color: var(--yellow); }
.progress { height: 5px; margin: 12px 0 22px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.08); }
.progress i { display: block; width: 10%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--yellow)); transition: width .3s ease; }
.timer-wrap { position: relative; width: 72px; height: 72px; margin: 0 auto 18px; }
.timer { width: 72px; height: 72px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 8; }
.timer-bg { stroke: rgba(255,255,255,.08); }
.timer-ring { stroke: var(--yellow); stroke-linecap: round; stroke-dasharray: 276.46; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .2s; }
.timer-wrap strong { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.puzzle-card {
  min-height: 185px;
  padding: 28px 18px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.emoji-puzzle { font-size: clamp(52px, 15vw, 76px); letter-spacing: .08em; }
.puzzle-card p { margin: 20px 0 0; color: var(--muted); font-size: 14px; }
.answer-grid { margin-top: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer-button { min-height: 60px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); color: white; background: linear-gradient(135deg, var(--surface-strong), var(--surface)); cursor: pointer; font-size: 15px; font-weight: 700; box-shadow: 0 12px 24px rgba(0,0,0,.16); transition: transform .18s ease, border-color .2s ease; }
.answer-button:hover { border-color: var(--accent); transform: translateY(-1px); }
.answer-button:disabled { cursor: default; opacity: .65; }
.skip-button { min-height: auto; margin-top: 17px; padding: 8px; color: var(--muted); background: transparent; font-size: 14px; }

.feedback-icon { margin: 0 auto 8px; display: grid; place-items: center; width: 120px; height: 120px; border-radius: 38px; border: 1px solid var(--border); background: linear-gradient(145deg, var(--surface-strong), var(--surface)); font-size: 62px; transform: rotate(-4deg); box-shadow: var(--shadow); }
.feedback-screen h2 { color: white; }
.feedback-screen > p:not(.eyebrow) { margin: 16px 0 30px; color: var(--muted); font-size: 16px; }
.result-burst { display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 30px; }
.result-burst span:nth-child(2) { font-size: 70px; }
.score-circle { width: 190px; height: 190px; margin: 25px auto; display: grid; place-items: center; align-content: center; border: 9px solid var(--accent); border-radius: 50%; background: linear-gradient(145deg, var(--surface-strong), var(--surface)); box-shadow: 0 0 0 8px rgba(255,212,71,.08); }
.score-circle span { color: var(--muted); font-size: 13px; }
.score-circle strong { margin: 2px 0; font-size: 50px; line-height: 1; }
.score-circle small { color: var(--yellow); font-size: 13px; }
.result-stats { margin-bottom: 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-stats div { padding: 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: linear-gradient(145deg, var(--surface-strong), var(--surface)); box-shadow: 0 12px 24px rgba(0,0,0,.14); }
.result-stats span, .result-stats strong { display: block; }
.result-stats span { color: var(--muted); font-size: 13px; }
.result-stats strong { margin-top: 4px; font-size: 17px; }
.share-button { background: var(--green); }
.secondary-button { margin-top: 10px; color: white; border: 1px solid rgba(255,255,255,.11); background: transparent; font-size: 15px; }
.welcome-share-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
footer { padding: 18px 0; color: #8f89aa; text-align: center; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; padding: 11px 15px; color: var(--bg); background: white; border-radius: 10px; font-size: 13px; font-weight: 700; opacity: 0; transform: translate(-50%, 15px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.portal-hero {
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
  padding: 78px 0 72px;
}

.portal-hero .section-head {
  max-width: 860px;
  margin-bottom: 34px;
}

.portal-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(48px, 8vw, 86px);
  line-height: .98;
}

.portal-hero .section-head p:not(.eyebrow) {
  max-width: 720px;
  margin-top: 20px;
}

.game-categories {
  display: grid;
  gap: 34px;
}

.game-category {
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.game-category:first-child {
  padding-top: 0;
  border-top: 0;
}

.category-head {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
}

.category-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: var(--panel);
  font-size: 30px;
}

.category-head h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  letter-spacing: -.045em;
  line-height: 1.1;
}

.category-head p {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.portal-section {
  width: min(1120px, calc(100% - 44px));
  margin: 0 auto;
  padding: 70px 0;
  border-top: 1px solid rgba(255,255,255,.08);
}
.section-head { max-width: 760px; margin-bottom: 28px; }
.section-head.compact { max-width: 680px; }
.section-head .eyebrow { margin-top: 0; }
.section-head h2,
.legal-grid h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: -.055em;
  line-height: 1.08;
}
.section-head p:not(.eyebrow),
.legal-grid p:not(.eyebrow) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}
.game-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 16px;
}

.compact-grid {
  grid-template-columns: 1.25fr 1fr 1fr;
}

.compact-grid .game-card {
  min-height: 230px;
}
.game-card,
.blog-grid article,
.info-grid article,
.tip-list article,
.legal-grid article {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.game-card {
  min-height: 250px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
}
.featured-game { background: linear-gradient(145deg, rgba(255,212,71,.14), rgba(255,107,157,.12)); }
.muted-game { opacity: .74; }
.game-art {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--panel-light);
  font-size: 40px;
}
.tag {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.game-card h3,
.blog-grid h3 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: -.04em;
}
.game-card p,
.blog-grid p,
.info-grid p,
.tip-list p,
.faq-section p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}
.card-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--yellow);
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
}
.info-grid,
.tip-list,
.blog-grid,
.legal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.info-grid article,
.tip-list article,
.blog-grid article,
.legal-grid article {
  padding: 22px;
}
.info-grid strong,
.tip-list strong {
  display: block;
  margin-bottom: 8px;
  color: white;
  font-size: 18px;
}
.answer-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.answer-list div {
  min-height: 150px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(36,33,61,.74);
}
.answer-list span { font-size: 32px; }
.answer-list strong { display: block; margin-top: 14px; font-size: 17px; }
.answer-list small { color: var(--muted); font-size: 13px; line-height: 1.6; }
.mini-game-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.mini-game-row a {
  min-height: 72px;
  padding: 18px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  color: white;
  background: rgba(36,33,61,.74);
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
}
.blog-grid article span {
  display: block;
  margin-bottom: 16px;
  color: var(--pink);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.faq-section details {
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 16px;
  background: rgba(36,33,61,.74);
  margin-top: 10px;
  padding: 18px 20px;
}
.faq-section summary {
  cursor: pointer;
  color: white;
  font-size: 17px;
  font-weight: 800;
}
.faq-section details p { margin-top: 12px; }
.legal-grid { padding-bottom: 100px; }
.legal-grid article { min-height: 245px; }
.legal-grid h2 { font-size: clamp(24px, 4vw, 34px); }

body[data-game-theme="kids"] { --accent: #7fe0ff; --accent-strong: #8f7cff; }
body[data-game-theme="kids-english"] { --accent: #8f7cff; --accent-strong: #53d6b1; }
body[data-game-theme="sudoku"] { --accent: #7ad8ff; --accent-strong: #6ee7b7; }
body[data-game-theme="wordle"] { --accent: #ffd447; --accent-strong: #ff6b9d; }
body[data-game-theme="quiz-theo-chu-de"] { --accent: #60e6a8; --accent-strong: #85d7ff; }

@media (max-height: 720px) {
  header { height: 58px; }
  .screen { padding-top: 5px; }
  .hero-emoji { height: 85px; }
  .hero-emoji span { width: 62px; height: 62px; font-size: 31px; }
  .hero-emoji span:nth-child(2) { width: 75px; height: 75px; }
  .puzzle-card { min-height: 150px; }
  .timer-wrap { margin-bottom: 10px; }
}

@media (max-width: 900px) {
  .header-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .header-actions .hub-menu-button { order: 1; margin-right: auto; }
  .header-actions .ux-toolbar { order: 2; flex: 0 0 auto; }
  .header-actions .mobile-nav-button { order: 3; }
  .mobile-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255,255,255,.06);
    cursor: pointer;
    font-weight: 800;
  }
  .mobile-nav-button.active { color: #221b12; background: var(--accent); }
  .site-nav {
    position: absolute;
    z-index: 50;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    width: min(280px, calc(100vw - 24px));
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(29,24,57,.98);
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: grid; }
  .site-nav a { padding: 12px 14px; border-radius: 10px; }
  .site-nav a:hover { background: rgba(255,255,255,.07); }
  .game-grid,
  .answer-list {
    grid-template-columns: 1fr 1fr;
  }
  .compact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell,
  .portal-shell { padding: 0 12px 28px; }
  .portal-section {
    width: calc(100% - 32px);
    padding: 54px 0;
  }
  .game-grid,
  .compact-grid,
  .info-grid,
  .tip-list,
  .blog-grid,
  .answer-list,
  .legal-grid,
  .mini-game-row {
    grid-template-columns: 1fr;
  }
  .game-card { min-height: 220px; }
  .section-head h2 { font-size: 34px; }
  .category-head {
    grid-template-columns: 46px 1fr;
  }
  .category-icon {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    font-size: 24px;
  }
  header { height: auto; min-height: 68px; justify-content: flex-end; padding: 10px 0; }
  .guide-button { min-height: 42px; padding: 0 14px; }
  .game-stage { width: 100%; }
  .screen { padding: 16px 0 24px; }
  .hero-emoji { gap: 6px; }
  .primary-button { min-height: 52px; }
  .timer-wrap { width: 62px; height: 62px; margin-bottom: 16px; }
  .feedback-icon { width: 96px; height: 96px; font-size: 50px; }
  .score-circle { width: 160px; height: 160px; border-width: 7px; }
  .section-head h2 { font-size: 32px; }
}
