:root {
  --ink: #172033;
  --muted: #667085;
  --paper: #fffdf8;
  --line: rgba(23, 32, 51, 0.12);
  --sun: #ffd166;
  --coral: #ff6b6b;
  --aqua: #35d0ba;
  --sky: #4dabf7;
  --leaf: #68c76f;
  --violet: #8e7dff;
  --shadow: 0 20px 60px rgba(22, 32, 56, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 209, 102, 0.35), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(77, 171, 247, 0.32), transparent 30%),
    linear-gradient(135deg, #fff7dc 0%, #dcf7f2 45%, #eef1ff 100%);
  overflow-x: hidden;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 2px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1px);
  background-size: 86px 86px, 47px 47px;
  animation: drift 16s linear infinite;
}

.app {
  position: relative;
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.topbar, .game-head, .hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  min-height: 64px;
}

.brand, .stats, .hud {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(42, 56, 92, .08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 8px 8px;
  border-radius: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, var(--coral), var(--violet));
}

.brand strong, .brand small { display: block; text-align: left; }
.brand small { color: var(--muted); font-size: 12px; }

.stats {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border-radius: 20px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.screen { display: none; }
.screen.active { display: block; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 28px;
  align-items: center;
  min-height: clamp(430px, 58vh, 620px);
  padding: 24px 6px 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #1d7f72;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(42px, 8vw, 92px);
  line-height: .96;
  letter-spacing: 0;
}

.intro {
  max-width: 680px;
  color: #3b475d;
  font-size: 20px;
  line-height: 1.7;
}

.word-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 430px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow);
}

.word-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.word-panel h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
}

#wordCount {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #35d0ba, #4dabf7);
  box-shadow: 0 12px 22px rgba(77,171,247,.22);
}

#wordInput {
  flex: 1;
  min-height: 230px;
  width: 100%;
  resize: vertical;
  border: 2px solid rgba(23,32,51,.12);
  border-radius: 8px;
  padding: 14px;
  outline: 0;
  color: var(--ink);
  background: rgba(255,255,255,.92);
  font: 700 18px/1.6 "Trebuchet MS", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif;
  box-shadow: inset 0 2px 12px rgba(20,30,50,.04);
}

#wordInput:focus {
  border-color: #35d0ba;
  box-shadow: 0 0 0 4px rgba(53,208,186,.16);
}

.word-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.word-note {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.player-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .75fr);
  gap: 16px;
  margin: 0 0 16px;
}

.player-panel, .leaderboard {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 16px 42px rgba(42, 56, 92, .10);
}

.player-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.player-panel h2, .leaderboard h2 {
  margin: 0;
  font-size: 30px;
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.player-input {
  min-height: 44px;
  min-width: 180px;
  border: 2px solid rgba(23,32,51,.12);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font: 800 16px/1 "Trebuchet MS", "Arial", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.bomb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b6b, #243b55);
  box-shadow: 0 12px 24px rgba(255,107,107,.18);
}

.leaderboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.leaderboard small {
  color: var(--muted);
  font-weight: 800;
}

.leaderboard ol {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style-position: inside;
}

.leaderboard li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.8);
  font-weight: 900;
}

.leaderboard b { color: #1d7f72; }

.mascot-stage {
  position: relative;
  min-height: 430px;
}

.planet {
  position: absolute;
  inset: 42px 28px 48px;
  border-radius: 48% 52% 50% 50%;
  background:
    radial-gradient(circle at 32% 25%, #fff 0 5%, transparent 6%),
    linear-gradient(150deg, #ffd166, #ff8a65 48%, #8e7dff);
  box-shadow: inset -28px -30px 0 rgba(70, 38, 120, .16), var(--shadow);
  animation: float 4s ease-in-out infinite;
}

.ship {
  position: absolute;
  left: 45%;
  top: 18px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: white;
  border-radius: 20px 20px 28px 28px;
  background: linear-gradient(180deg, #4dabf7, #2f6fed);
  transform: rotate(180deg);
  box-shadow: var(--shadow);
  animation: bob 2.3s ease-in-out infinite;
}

.orbit-word {
  position: absolute;
  padding: 10px 16px;
  border-radius: 18px;
  color: #112;
  font-weight: 900;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 30px rgba(20,30,50,.14);
}

.word-a { left: 7%; top: 26%; animation: bob 2.7s ease-in-out infinite; }
.word-b { right: 2%; top: 44%; animation: bob 2.1s ease-in-out infinite reverse; }
.word-c { left: 24%; bottom: 12%; animation: bob 3s ease-in-out infinite; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  min-height: 194px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 16px 42px rgba(42, 56, 92, .10);
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.game-card.locked {
  opacity: .48;
  filter: grayscale(.35);
  cursor: not-allowed;
}

.game-card.locked:hover {
  transform: none;
  box-shadow: 0 16px 42px rgba(42, 56, 92, .10);
}

.game-card.locked::before {
  content: "先保存 10 个单词";
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  padding: 6px 9px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  background: rgba(20,30,48,.78);
}

.game-card .badge {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  color: white;
  font-size: 26px;
  background: var(--accent);
}

.game-card h3 {
  margin: 16px 0 8px;
  font-size: 24px;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.game-card::after {
  content: "";
  position: absolute;
  right: -32px;
  bottom: -38px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent), transparent 78%);
}

.game-head {
  padding: 12px 0;
}

.game-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 52px);
}

.game-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bomb-status {
  padding: 10px 12px;
  border-radius: 999px;
  color: white;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, #243b55, #ff6b6b);
  box-shadow: 0 10px 24px rgba(20,30,50,.12);
}

.back-btn, .primary {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 16px;
  font-weight: 900;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 28px rgba(42,56,92,.10);
}

.primary {
  color: white;
  background: linear-gradient(135deg, #ff6b6b, #4dabf7);
  box-shadow: 0 14px 28px rgba(77, 171, 247, .28);
}

.primary.small { min-height: 42px; }

.hud {
  justify-content: center;
  margin: 8px 0 16px;
  padding: 10px;
  border-radius: 18px;
}

.hud span {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
}

.hud b { color: var(--ink); font-size: 20px; }

.play-area {
  position: relative;
  min-height: 600px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.74);
  box-shadow: var(--shadow);
}

.bomb-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: white;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,209,102,.72), transparent 15%),
    radial-gradient(circle, rgba(255,107,107,.92), rgba(20,30,48,.94));
  text-align: center;
}

.bomb-overlay strong {
  font-size: clamp(60px, 14vw, 150px);
  line-height: 1;
}

.bomb-overlay span {
  font-size: 24px;
  font-weight: 900;
}

.end-screen {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(20,30,48,.72);
  backdrop-filter: blur(10px);
}

.end-card {
  width: min(780px, 96%);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.end-card h2 {
  margin: 0 0 10px;
  font-size: clamp(34px, 6vw, 72px);
}

.end-reason {
  color: #b42318;
  font-size: 20px;
  font-weight: 900;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.end-stats span {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
  background: #f6f8fb;
}

.end-stats b {
  color: var(--ink);
  font-size: 28px;
}

.miss-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
  margin: 10px 0 18px;
  padding: 0;
}

.miss-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ec;
  font-weight: 900;
}

.miss-list em {
  color: var(--muted);
  font-style: normal;
}

.miss-list b {
  color: #b42318;
}

.miss-list .perfect {
  grid-template-columns: 1fr auto;
  background: #effaf3;
}

.miss-list .perfect b {
  color: #1d7f72;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prompt-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 86px;
  padding: 14px;
  color: white;
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #243b55, #141e30);
}

.word-token {
  display: inline-block;
  max-width: min(92vw, 920px);
  overflow-wrap: anywhere;
}

.word-img {
  width: 66px;
  height: 66px;
  object-fit: contain;
  border-radius: 18px;
  background: white;
  padding: 6px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.choice {
  min-height: 78px;
  border-radius: 8px;
  color: #13213a;
  font-size: 24px;
  font-weight: 900;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(23,32,51,.08), 0 12px 26px rgba(20,30,50,.08);
}

.choice:hover { transform: translateY(-2px); }

.arena {
  position: absolute;
  inset: 86px 0 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.32), rgba(255,255,255,.32)),
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(23,32,51,.05) 55px 56px),
    repeating-linear-gradient(0deg, transparent 0 54px, rgba(23,32,51,.05) 55px 56px);
}

.cannon {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 78px;
  height: 64px;
  transform: translateX(-50%);
  border-radius: 28px 28px 18px 18px;
  background: linear-gradient(180deg, #4dabf7, #1d68d8);
  box-shadow: inset 0 -9px 0 rgba(0,0,0,.13), 0 14px 22px rgba(20,30,50,.22);
}

.cannon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -28px;
  width: 24px;
  height: 46px;
  border-radius: 14px;
  background: #243b55;
  transform: translateX(-50%);
}

.laser, .pop, .monster, .runner, .duel-shot {
  position: absolute;
  pointer-events: none;
}

.target-word {
  position: absolute;
  display: grid;
  place-items: center;
  width: min(38%, 320px);
  min-height: 92px;
  padding: 8px 16px;
  border-radius: 20px;
  color: white;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.12;
  text-align: center;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, #ff6b6b, #ffb86b);
  box-shadow: 0 14px 24px rgba(255,107,107,.28);
  pointer-events: auto;
  z-index: 3;
  touch-action: manipulation;
  animation: targetFloat 2.8s ease-in-out infinite alternate;
}

.laser {
  width: 8px;
  height: 120px;
  border-radius: 6px;
  background: linear-gradient(0deg, transparent, #fff, #35d0ba);
  filter: drop-shadow(0 0 10px #35d0ba);
}

.pop {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sun);
  animation: pop .55s ease-out forwards;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 14px;
  padding: 18px;
  min-height: 430px;
}

.memory-card {
  height: 128px;
  min-height: 128px;
  border-radius: 8px;
  perspective: 800px;
  background: transparent;
  padding: 0;
  overflow: visible;
}

.memory-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 128px;
  display: block;
  transition: transform .42s ease;
  transform-style: preserve-3d;
}

.memory-card.open .memory-inner, .memory-card.done .memory-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 8px;
  backface-visibility: hidden;
  box-shadow: 0 12px 26px rgba(20,30,50,.12);
  overflow-wrap: anywhere;
}

.front {
  color: white;
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, #4dabf7, #8e7dff);
}

.back {
  transform: rotateY(180deg);
  background: white;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.maze-wrap {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 18px;
  padding: 18px;
}

.maze {
  --cell: 44px;
  display: grid;
  grid-template-columns: repeat(12, var(--cell));
  grid-template-rows: repeat(10, var(--cell));
  width: calc(12 * var(--cell));
  height: calc(10 * var(--cell));
  margin: 0 auto;
  border: 8px solid #243b55;
  border-radius: 8px;
  background: #fff;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23,32,51,.06);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.wall { background: #243b55; }
.safe-path {
  background:
    radial-gradient(circle, rgba(255,255,255,.78) 0 18%, transparent 19%),
    linear-gradient(135deg, rgba(104,199,111,.28), rgba(53,208,186,.2));
}
.room {
  overflow: visible;
  color: white;
  background: linear-gradient(135deg, #35d0ba, #4dabf7);
  z-index: 2;
}

.room-label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  min-width: 52px;
  max-width: 150px;
  padding: 4px 6px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #169c8e, #2f7ee8);
  box-shadow: 0 8px 18px rgba(20,30,50,.2);
  font-size: 11px;
  line-height: 1.12;
  overflow-wrap: anywhere;
  transform: translate(-50%, -50%);
}
.maze-star {
  position: absolute;
  right: 3px;
  top: 1px;
  color: #f59f00;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(245,159,0,.45);
}
.avatar, .monster {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.avatar {
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, #ffd166 19% 100%);
  box-shadow: 0 0 0 4px rgba(255,209,102,.25);
}

.monster {
  background: radial-gradient(circle at 35% 35%, #fff 0 7%, transparent 8%), linear-gradient(135deg, #ff6b6b, #8e2c2c);
  animation: pulse .8s ease-in-out infinite alternate;
}

.side-panel {
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}

.side-panel h3 { font-size: 28px; }
.side-panel p { color: var(--muted); line-height: 1.5; }

.d-pad {
  display: grid;
  grid-template-columns: repeat(3, 58px);
  grid-template-rows: repeat(3, 50px);
  justify-content: center;
  gap: 8px;
  margin: 14px 0;
}

.d-pad button {
  border-radius: 8px;
  color: white;
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, #243b55, #4dabf7);
  box-shadow: 0 10px 20px rgba(20,30,50,.14);
  touch-action: manipulation;
}

.d-pad [data-move="up"] { grid-column: 2; grid-row: 1; }
.d-pad [data-move="left"] { grid-column: 1; grid-row: 2; }
.d-pad [data-move="down"] { grid-column: 2; grid-row: 2; }
.d-pad [data-move="right"] { grid-column: 3; grid-row: 2; }

.duel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  min-height: 430px;
}

.duel-setup {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 28px;
  background:
    radial-gradient(circle at 25% 35%, rgba(77,171,247,.28), transparent 30%),
    radial-gradient(circle at 75% 35%, rgba(255,107,107,.24), transparent 30%);
}

.duel-player-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 8px;
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow);
}

.duel-player-card .player-input {
  width: 100%;
}

.duel-versus {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  color: white;
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(135deg, #243b55, #ff6b6b);
  box-shadow: var(--shadow);
}

.duel-start {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: 220px;
}

.fighter {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  overflow: hidden;
}

.fighter.left { background: linear-gradient(135deg, rgba(77,171,247,.28), rgba(255,255,255,.72)); }
.fighter.right { background: linear-gradient(135deg, rgba(255,107,107,.26), rgba(255,255,255,.72)); }

.hp {
  height: 16px;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(23,32,51,.12);
}

.hp > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #68c76f, #ffd166);
}

.fighter-body {
  display: grid;
  place-items: center;
  min-height: 82px;
  font-size: 56px;
}

.duel .choices {
  gap: 10px;
  padding: 10px 0 0;
}

.duel .choice {
  min-height: 56px;
  padding: 6px;
  font-size: clamp(16px, 2.2vw, 22px);
  overflow-wrap: anywhere;
}

.duel-shot {
  top: 48%;
  width: 28px;
  height: 12px;
  border-radius: 999px;
  background: #ffd166;
  box-shadow: 0 0 22px #ffd166;
}

.typing-track {
  position: relative;
  min-height: 530px;
  padding: 20px;
  background:
    linear-gradient(rgba(255,255,255,.64), rgba(255,255,255,.64)),
    linear-gradient(90deg, rgba(104,199,111,.35) 0 10%, transparent 10% 90%, rgba(255,107,107,.32) 90%);
}

.race-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(860px, 92%);
  margin: 28px auto 8px;
  color: #243b55;
  font-weight: 900;
}

.race-labels strong {
  min-width: 76px;
  padding: 7px 12px;
  border-radius: 999px;
  color: white;
  text-align: center;
  background: linear-gradient(135deg, #35d0ba, #68c76f);
  box-shadow: 0 10px 22px rgba(53,208,186,.22);
}

.race-road {
  position: relative;
  width: min(860px, 92%);
  height: 118px;
  margin: 0 auto;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.45) 0 22px, transparent 22px 44px),
    linear-gradient(180deg, #243b55, #141e30);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.45), 0 18px 36px rgba(20,30,50,.18);
}

.race-fill {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 0;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #35d0ba, #ffd166);
  box-shadow: 0 0 22px rgba(53,208,186,.62);
  transform: translateY(-50%);
  transition: width .28s ease;
}

.race-steps {
  position: absolute;
  inset: 0 32px;
}

.race-steps i {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 4px solid white;
  border-radius: 50%;
  background: #4c5c75;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 16px rgba(0,0,0,.22);
}

.race-steps i.done {
  background: #ffd166;
}

.runner {
  left: 4%;
  top: 50%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 16px 24px rgba(20,30,50,.18);
  transform: translate(-50%, -50%);
  transition: left .28s ease;
  z-index: 2;
}

.typing-box, .builder-box {
  width: min(720px, 94%);
  margin: 22px auto;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255,255,255,.86);
  text-align: center;
  box-shadow: 0 16px 36px rgba(20,30,50,.12);
}

.big-word {
  margin: 6px 0 14px;
  font-size: clamp(38px, 7vw, 82px);
  font-weight: 900;
}

.text-input {
  width: 100%;
  min-height: 56px;
  border: 2px solid rgba(23,32,51,.18);
  border-radius: 8px;
  padding: 0 16px;
  font-size: 28px;
  text-align: center;
  outline: 0;
}

.typing-submit {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.builder {
  min-height: 530px;
  padding: 18px;
}

.letter-row, .slot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}

.letter, .slot {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  font-size: 28px;
  font-weight: 900;
}

.letter {
  color: white;
  background: linear-gradient(135deg, #8e7dff, #4dabf7);
  box-shadow: 0 10px 20px rgba(77,171,247,.22);
}

.slot {
  background: white;
  border: 2px dashed rgba(23,32,51,.22);
}

.slot.filled {
  border-style: solid;
  color: white;
  background: linear-gradient(135deg, #35d0ba, #68c76f);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  min-width: 220px;
  padding: 12px 18px;
  border-radius: 18px;
  color: white;
  font-weight: 900;
  text-align: center;
  background: rgba(20,30,48,.9);
  box-shadow: var(--shadow);
  transform: translate(-50%, 120px);
  transition: transform .25s ease;
}

.toast.show { transform: translate(-50%, 0); }

@keyframes drift { to { background-position: 86px 86px, -47px 47px; } }
@keyframes float { 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes bob { 50% { transform: translateY(-12px) rotate(180deg); } }
@keyframes pop {
  to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; }
}
@keyframes pulse { to { transform: scale(1.15); } }
@keyframes targetFloat {
  to { transform: translate(var(--float-x), var(--float-y)); }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .player-zone { grid-template-columns: 1fr; }
  .player-panel { align-items: stretch; flex-direction: column; }
  .player-controls { justify-content: stretch; }
  .player-input { flex: 1 1 180px; }
  .mascot-stage { min-height: 300px; }
  .game-grid { grid-template-columns: 1fr; }
  .game-head, .game-actions { align-items: flex-start; flex-wrap: wrap; }
  .hud { flex-wrap: wrap; }
  .play-area { min-height: 620px; }
  .choices, .maze-wrap { grid-template-columns: 1fr; }
  .maze { --cell: min(7.3vw, 38px); }
  .memory-board { grid-template-columns: repeat(3, minmax(84px, 1fr)); }
  .duel {
    grid-template-columns: 1fr 1fr;
    min-height: 430px;
  }
  .duel-setup {
    grid-template-columns: 1fr;
    min-height: 620px;
  }
  .duel-versus {
    justify-self: center;
    width: 68px;
    height: 68px;
  }
  .fighter { padding: 10px; }
  .fighter-body {
    min-height: 64px;
    font-size: 42px;
  }
  .duel .choices { grid-template-columns: 1fr; }
  .duel .choice {
    min-height: 42px;
    font-size: 15px;
  }
  .target-word {
    width: 40%;
    min-height: 52px;
    font-size: 17px;
    padding: 7px 10px;
  }
  .race-road {
    width: 96%;
    height: 98px;
  }
  .race-labels { width: 96%; }
  .typing-submit { grid-template-columns: 1fr; }
  .d-pad {
    grid-template-columns: repeat(3, 54px);
    grid-template-rows: repeat(3, 46px);
  }
}
