:root {
  --ink: #203044;
  --muted: #637083;
  --paper: #fffaf0;
  --card: #ffffff;
  --line: #e9dfcf;
  --mint: #33c7a1;
  --sky: #4da3ff;
  --sun: #ffbf3f;
  --rose: #ff6f8f;
  --grape: #8d6bff;
  --green: #25a56a;
  --red: #db4761;
  --shadow: 0 18px 45px rgba(40, 58, 82, .14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(77,163,255,.18), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(255,191,63,.25), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, var(--paper) 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.topbar {
  height: 72px;
  padding: 0 clamp(18px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid rgba(233,223,207,.75);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 900; font-size: 20px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--sun); border: 3px solid var(--ink); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
}

.nav { display: flex; gap: 18px; align-items: center; font-weight: 700; }
.nav form { margin: 0; }
.nav-cta, .link-button {
  border: 0; background: #eef8ff; padding: 10px 14px; border-radius: 999px; font-weight: 800; cursor: pointer;
}

.section, .play-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0; }
.section-head.center { text-align: center; }
.hero { display: grid; grid-template-columns: 1fr 430px; gap: 34px; align-items: center; min-height: calc(100vh - 90px); }
.hero h1, .section-head h1, .welcome h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1.05; margin: 10px 0 18px; letter-spacing: 0; }
.lede { color: var(--muted); font-size: 20px; line-height: 1.75; max-width: 620px; }
.eyebrow { color: var(--grape); font-weight: 900; letter-spacing: 0; margin: 0 0 8px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

.play-card, .game-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 rgba(32,48,68,.95), var(--shadow);
  padding: 24px;
}

.hero-board { transform: rotate(1deg); }
.board-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.star-badge, .score-pill {
  display: inline-flex; align-items: center; min-height: 34px; padding: 7px 12px;
  border-radius: 999px; font-weight: 900; background: #fff1b8; border: 2px solid var(--ink);
}
.score-pill { background: #e8fff6; font-size: 14px; }
.score-pill.warm { background: #fff0dd; color: #c94e1b; }
.energy { height: 22px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #f2f2f2; }
.energy span { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--sky)); }
.mini-rank, .list, .rank-list { display: grid; gap: 12px; margin-top: 18px; }
.mini-rank b, .list-row, .rank-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 14px 16px; background: #f7fbff; border: 2px solid #dbe8f8; border-radius: 16px;
}
.list-row small, .rank-row small { display: block; color: var(--muted); margin-top: 4px; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.game-card { min-height: 150px; display: grid; align-content: start; gap: 12px; color: var(--ink); }
.game-card b { font-size: 22px; }
.game-card span { color: var(--muted); line-height: 1.55; }
.action-card:hover { transform: translateY(-3px); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.split-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; }
.welcome { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.muted { color: var(--muted); line-height: 1.65; }

.kid-button {
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 13px 18px;
  min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  background: #fff;
}
.kid-button.primary { background: var(--mint); color: #06251d; }
.kid-button.sun { background: var(--sun); }
.kid-button.ghost { background: #f3f8ff; }
.kid-button.danger { background: var(--rose); }
.kid-button.full { width: 100%; }

.auth-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(440px, 100%); display: grid; gap: 16px; }
.input, .textarea, .code-input {
  width: 100%; margin-top: 8px; padding: 14px 16px;
  border: 3px solid var(--ink); border-radius: 16px; background: #fffdf8; outline: none;
}
.code-input { text-align: center; font-size: 42px; font-weight: 900; letter-spacing: 8px; }
.textarea { resize: vertical; min-height: 190px; }
.notice { padding: 12px 14px; border-radius: 14px; border: 2px solid var(--ink); font-weight: 800; }
.notice.danger { background: #ffe4e9; color: #8d1830; }
.check-list { list-style: none; padding: 0; margin: 18px 0 24px; display: grid; gap: 12px; color: var(--muted); }
.check-list li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; }
.check-list li::before { content: '✓'; font-weight: 900; }
.check-list.green li::before { color: var(--green); }
.check-list.orange li::before { color: #e95a20; }

.demo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
.demo-card {
  min-height: 204px;
  padding: 22px;
  background: rgba(255,255,255,.86);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(40,58,82,.09);
  display: grid;
  align-content: start;
  gap: 10px;
}
.demo-card h3 { margin: 4px 0 0; font-size: 20px; }
.demo-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.demo-card a { color: #e94f1a; font-weight: 900; align-self: end; }
.demo-icon { font-size: 34px; line-height: 1; }
.demo-icon.big { font-size: 74px; text-align: center; }
.demo-note { margin-top: 48px; }
.demo-play {
  width: min(980px, calc(100% - 24px));
  margin: 24px auto 42px;
}
.demo-play-head {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  font-weight: 900;
}
.demo-game-board {
  min-height: 620px;
  display: grid;
  align-content: center;
  gap: 18px;
}
.demo-game-board > .eyebrow,
.demo-game-board > h1,
.demo-game-board > .muted { text-align: center; }
.demo-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.option-button.wrong { background: #ffe3e8; }

.room-form { width: min(680px, calc(100% - 32px)); margin: 42px auto; display: grid; gap: 18px; }
.host-stage { width: min(1280px, calc(100% - 24px)); margin: 24px auto; display: grid; grid-template-columns: 320px 1fr; gap: 24px; }
.host-side { align-self: start; position: sticky; top: 96px; }
.room-code { font-size: 64px; font-weight: 900; letter-spacing: 8px; text-align: center; padding: 12px; background: #fff1b8; border: 3px dashed var(--ink); border-radius: 18px; }
.host-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.host-main h1, .student-stage h1 { font-size: clamp(28px, 5vw, 54px); line-height: 1.18; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
.option-tile, .option-button {
  min-height: 86px; padding: 18px; border-radius: 20px; border: 3px solid var(--ink);
  background: #f7fbff; display: flex; gap: 14px; align-items: center; text-align: left;
}
.option-button { cursor: pointer; box-shadow: 4px 4px 0 var(--ink); }
.option-button:disabled { opacity: .72; cursor: default; box-shadow: none; }
.option-tile b, .option-button b { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--sun); border: 2px solid var(--ink); flex: none; }
.correct { background: #dffbea; }
.student-stage { width: min(760px, calc(100% - 24px)); margin: 36px auto; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.metric { text-align: center; }
.metric b { display: block; font-size: 44px; }

@media (max-width: 860px) {
  .topbar { height: auto; min-height: 68px; align-items: flex-start; flex-direction: column; padding: 14px 18px; gap: 12px; }
  .nav { flex-wrap: wrap; gap: 10px; }
  .hero, .two-col, .host-stage { grid-template-columns: 1fr; }
  .feature-grid, .metric-grid { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
  .split-panels { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .welcome { flex-direction: column; align-items: stretch; }
  .host-side { position: static; }
}
