:root {
  --ink: #263238;
  --muted: #5b6b72;
  --paper: #fffdf7;
  --line: #d9e6e8;
  --sky: #dff5ff;
  --mint: #c8f7dc;
  --coral: #ff7b6e;
  --yellow: #ffd766;
  --violet: #8b6cf6;
  --teal: #21a6a6;
  --blue: #3979ff;
  --rose: #ff8fb3;
  --shadow: 0 18px 40px rgba(38, 50, 56, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 215, 102, 0.34), transparent 22rem),
    radial-gradient(circle at 88% 18%, rgba(33, 166, 166, 0.24), transparent 18rem),
    linear-gradient(135deg, #f8fdff 0%, #eef8ec 46%, #fff4ee 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  min-height: 100dvh;
}

.screen {
  min-height: 100dvh;
  padding: 24px;
  display: grid;
  align-items: center;
}

.screen-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(340px, 1.08fr);
  gap: 34px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(33, 166, 166, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #167a7a;
  font-size: 14px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: 54px;
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.2;
}

.lead {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.72;
}

.safety-strip {
  display: grid;
  gap: 8px;
  margin: 18px 0 24px;
  color: #4a5b61;
  font-size: 16px;
  line-height: 1.55;
}

.safety-strip span {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(38, 50, 56, 0.12);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--coral);
  color: #ffffff;
}

.btn-secondary {
  background: var(--teal);
  color: #ffffff;
}

.btn-quiet {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
}

.btn-danger {
  background: #f05252;
  color: #ffffff;
}

.btn-icon {
  width: 48px;
  padding: 0;
}

.planet-stage {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.planet-stage::before {
  content: "";
  position: absolute;
  inset: 8% 4%;
  border: 2px dashed rgba(57, 121, 255, 0.2);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.planet {
  position: relative;
  width: 330px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #ffffff 0 9%, transparent 10%),
    radial-gradient(circle at 70% 65%, rgba(255, 255, 255, 0.4) 0 13%, transparent 14%),
    linear-gradient(145deg, #8b6cf6 0%, #3979ff 52%, #21a6a6 100%);
  box-shadow:
    inset -28px -24px 0 rgba(38, 50, 56, 0.13),
    0 28px 54px rgba(38, 50, 56, 0.2);
}

.planet-ring {
  position: absolute;
  width: 440px;
  height: 92px;
  border: 16px solid rgba(255, 215, 102, 0.82);
  border-left-color: rgba(255, 143, 179, 0.78);
  border-right-color: rgba(200, 247, 220, 0.78);
  border-radius: 50%;
  transform: rotate(-18deg);
  box-shadow: 0 8px 0 rgba(38, 50, 56, 0.08);
}

.ship {
  position: absolute;
  top: 54px;
  right: 70px;
  width: 98px;
  height: 58px;
  border-radius: 54px 54px 26px 26px;
  background: #fffdf7;
  border: 4px solid #263238;
  transform: rotate(12deg);
  box-shadow: 0 14px 24px rgba(38, 50, 56, 0.16);
}

.ship::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -22px;
  width: 38px;
  height: 32px;
  border-radius: 50% 50% 8px 8px;
  background: #bdefff;
  border: 4px solid #263238;
}

.ship::after {
  content: "";
  position: absolute;
  left: -26px;
  bottom: 8px;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--coral);
  box-shadow: -18px 1px 0 var(--yellow);
}

.decor {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  font-size: 36px;
  filter: drop-shadow(0 5px 4px rgba(38, 50, 56, 0.18));
}

.decor-rainbow {
  left: 22px;
  bottom: 116px;
}

.decor-star {
  right: 48px;
  top: 96px;
}

.decor-garden {
  left: 104px;
  bottom: 54px;
}

.decor-robot {
  right: 116px;
  bottom: 38px;
}

.decor-sticker {
  right: 44px;
  bottom: 120px;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.stat-pill {
  min-width: 138px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.78);
}

.stat-pill strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.stat-pill span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.topbar {
  width: min(1180px, 100%);
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h2 {
  margin-bottom: 3px;
}

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

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

.setting-block {
  border: 1px solid rgba(38, 50, 56, 0.11);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.setting-block label {
  display: block;
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

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

.segmented.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.segmented button.active {
  border-color: transparent;
  background: var(--blue);
  color: #ffffff;
}

.toggle {
  width: 74px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 4px;
  background: #b7c7cb;
}

.toggle span {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.18s ease;
}

.toggle.active {
  background: var(--teal);
}

.toggle.active span {
  transform: translateX(36px);
}

.countdown-screen {
  text-align: center;
}

.count-number {
  display: grid;
  place-items: center;
  width: 190px;
  aspect-ratio: 1;
  margin: 28px auto;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-size: 94px;
  font-weight: 1000;
  box-shadow: 0 22px 44px rgba(38, 50, 56, 0.17);
}

.game-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  padding: 16px 20px 20px;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr)) auto;
  gap: 10px;
  align-items: center;
}

.hud-item {
  min-height: 58px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.76);
}

.hud-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.hud-item strong {
  font-size: 22px;
  line-height: 1.12;
}

.stage-route {
  width: min(980px, 100%);
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.36fr) minmax(260px, 0.64fr);
  gap: 16px;
  align-items: center;
}

.stage-copy {
  min-height: 54px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.76);
}

.stage-copy strong,
.stage-copy span {
  display: block;
}

.stage-copy strong {
  font-size: 20px;
  line-height: 1.12;
}

.stage-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.route-track {
  position: relative;
  min-height: 54px;
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  background: rgba(255, 255, 255, 0.76);
  overflow: hidden;
}

.route-line {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 8px;
  border-radius: 999px;
  transform: translateY(-50%);
  background:
    linear-gradient(90deg, var(--yellow) 0 var(--route-progress), rgba(38, 50, 56, 0.12) var(--route-progress) 100%);
}

.stage-node {
  position: relative;
  z-index: 2;
  min-height: 34px;
  border: 2px solid rgba(38, 50, 56, 0.13);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 1000;
}

.stage-node.active {
  border-color: var(--coral);
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 0 0 5px rgba(255, 215, 102, 0.2);
}

.stage-node.complete {
  border-color: rgba(33, 166, 166, 0.32);
  background: var(--mint);
  color: #167a4b;
}

.lens-badge {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 5;
  min-width: 112px;
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  justify-content: center;
  background: var(--violet);
  color: #ffffff;
  font-size: 16px;
  font-weight: 1000;
}

.task-zone {
  display: grid;
  place-items: center;
  padding: 18px 0;
}

.target-wrap {
  position: relative;
  width: min(620px, 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(13, 31, 51, 0.9), rgba(28, 61, 87, 0.92)),
    #10243a;
  box-shadow: 0 16px 32px rgba(38, 50, 56, 0.12);
  overflow: hidden;
}

.target-prompt {
  position: absolute;
  left: 16px;
  top: 14px;
  z-index: 5;
  color: #ffffff;
  font-weight: 900;
  display: grid;
  gap: 3px;
  max-width: min(360px, calc(100% - 168px));
}

.target-prompt span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.target-prompt strong {
  font-size: 18px;
  line-height: 1.25;
}

.target-symbol {
  width: auto;
  height: auto;
  display: grid;
  place-items: center;
}

.symbol-svg {
  width: 100%;
  height: 100%;
}

.flight-scene {
  isolation: isolate;
}

.flight-stars {
  position: absolute;
  inset: 0;
  opacity: 0.38;
  background-image:
    radial-gradient(circle, #fff 0 1px, transparent 1.5px),
    radial-gradient(circle, #fff 0 1px, transparent 1.5px);
  background-position:
    0 0,
    28px 44px;
  background-size:
    76px 76px,
    118px 118px;
  animation: starDrift 8s linear infinite;
}

.clear-gate {
  position: relative;
  z-index: 2;
  width: min(270px, 68vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.gate-ring {
  position: absolute;
  inset: 16%;
  border: 3px solid rgba(255, 215, 102, 0.78);
  border-radius: 50%;
  box-shadow:
    0 0 0 12px rgba(33, 166, 166, 0.1),
    0 0 38px rgba(255, 215, 102, 0.38);
  animation: gatePulse 2.4s ease-in-out infinite;
}

.aim-reticle {
  position: relative;
  z-index: 4;
  width: 104px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: #fffef9;
  box-shadow:
    inset 0 0 0 1px rgba(38, 50, 56, 0.18),
    0 0 0 12px rgba(255, 255, 255, 0.08);
}

.aim-reticle::before,
.aim-reticle::after {
  content: "";
  position: absolute;
  display: none;
  background: transparent;
}

.aim-reticle::before {
  width: 1px;
  height: 72%;
}

.aim-reticle::after {
  width: 72%;
  height: 1px;
}

.optotype-target {
  position: relative;
  z-index: 2;
  width: var(--target-height);
  height: var(--target-height);
  color: #050505;
}

.optotype-target.wide {
  width: calc(var(--target-height) * 1.7);
}

.optotype-target.text-wide {
  width: calc(var(--target-height) * 2.4);
}

.optotype-target.text-line {
  width: calc(var(--target-height) * 5.8);
}

.optotype-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.standard-text {
  display: block;
  color: #050505;
  font-family: Arial, Helvetica, sans-serif;
  font-size: var(--target-height);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.word-target .standard-text,
.phrase-target .standard-text {
  font-family: Arial, Helvetica, sans-serif;
}

.poem-target .standard-text,
.sentence-target .standard-text {
  font-family: "KaiTi", "STKaiti", "Songti SC", "SimSun", serif;
  font-weight: 900;
}

.pilot-ship {
  position: absolute;
  z-index: 3;
  left: calc(50% - 42px);
  bottom: 28px;
  width: 84px;
  height: 48px;
  border-radius: 46px 46px 20px 20px;
  background: #fffdf7;
  border: 3px solid var(--ink);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.26);
  animation: pilotFloat 2.6s ease-in-out infinite;
}

.pilot-ship::before {
  content: "";
  position: absolute;
  left: 27px;
  top: -16px;
  width: 30px;
  height: 24px;
  border: 3px solid var(--ink);
  border-radius: 50% 50% 8px 8px;
  background: #bdefff;
}

.pilot-ship::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: -13px;
  width: 52px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--yellow));
  filter: blur(1px);
  opacity: 0.72;
}

.flight-beam {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 70px;
  width: 7px;
  height: 0;
  border-radius: 999px;
  transform: translateX(-50%);
  background: linear-gradient(0deg, rgba(255, 215, 102, 0), rgba(255, 215, 102, 0.92));
  opacity: 0;
}

.flight-scene.is-hit .flight-beam {
  animation: beamFire 0.72s ease-out;
}

.flight-scene.is-hit .gate-ring {
  border-color: rgba(200, 247, 220, 0.96);
  box-shadow:
    0 0 0 14px rgba(200, 247, 220, 0.18),
    0 0 44px rgba(200, 247, 220, 0.48);
}

.flight-scene.is-miss .clear-gate {
  animation: gentleShake 0.34s ease-in-out;
}

.target-text {
  font-size: var(--target-height);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 1;
}

.target-text.medium {
  font-size: var(--target-height);
}

.target-text.small {
  font-size: var(--target-height);
}

.target-hint {
  position: absolute;
  right: 16px;
  bottom: 14px;
  z-index: 5;
  min-height: 28px;
  color: #dfffea;
  font-weight: 900;
}

.answers {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.answer-btn {
  min-height: 76px;
  border: 2px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 22px;
  font-weight: 1000;
  box-shadow: 0 10px 18px rgba(38, 50, 56, 0.1);
}

.answer-btn:focus-visible,
.btn:focus-visible,
.segmented button:focus-visible {
  outline: 4px solid rgba(255, 143, 179, 0.55);
  outline-offset: 3px;
}

.feedback {
  position: absolute;
  left: 50%;
  bottom: 48px;
  z-index: 6;
  transform: translateX(-50%);
  min-width: min(420px, 86%);
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--mint);
  text-align: center;
  font-size: 20px;
  font-weight: 1000;
  box-shadow: var(--shadow);
}

.feedback.gentle {
  background: #ffe7d4;
}

.game-shell.is-flipping .answers {
  opacity: 0.58;
}

.answer-btn:disabled {
  transform: none;
  box-shadow: none;
}

.flip-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(8, 20, 34, 0.58);
  backdrop-filter: blur(2px);
}

.flip-card {
  width: min(390px, 100%);
  border: 2px solid rgba(255, 215, 102, 0.52);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 253, 247, 0.96);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.26);
  animation: flipCardIn 0.22s ease-out;
}

.flip-kicker {
  color: #167a7a;
  font-size: 13px;
  font-weight: 1000;
}

.flip-card h2 {
  margin: 4px 0 6px;
  font-size: 32px;
}

.flip-card p {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 900;
}

.inline-flip-visual {
  position: relative;
  width: 152px;
  height: 86px;
  margin: 8px auto 10px;
}

.inline-lens {
  position: absolute;
  top: 13px;
  width: 62px;
  height: 62px;
  border: 6px solid var(--ink);
  border-radius: 50%;
  background: rgba(223, 245, 255, 0.9);
}

.inline-lens:first-child {
  left: 8px;
}

.inline-lens:nth-child(3) {
  right: 8px;
}

.inline-bridge {
  position: absolute;
  left: 67px;
  top: 38px;
  width: 20px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink);
}

.inline-arrow {
  position: absolute;
  right: -10px;
  top: -5px;
  color: var(--coral);
  font-size: 38px;
  font-weight: 1000;
  animation: spinHint 1s ease-in-out infinite;
}

.flip-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.flip-visual {
  width: 210px;
  height: 126px;
  margin: 18px auto 20px;
  position: relative;
}

.flip-lens {
  position: absolute;
  top: 18px;
  width: 86px;
  height: 86px;
  border: 8px solid var(--ink);
  border-radius: 50%;
  background: rgba(223, 245, 255, 0.88);
}

.flip-lens:first-child {
  left: 10px;
}

.flip-lens:last-child {
  right: 10px;
}

.flip-bridge {
  position: absolute;
  left: 91px;
  top: 56px;
  width: 28px;
  height: 10px;
  border-radius: 999px;
  background: var(--ink);
}

.flip-arrow {
  position: absolute;
  right: -18px;
  top: -4px;
  font-size: 46px;
  color: var(--coral);
}

.pause-panel,
.rest-panel,
.summary-panel {
  width: min(820px, 100%);
  margin: 0 auto;
  text-align: center;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.summary-stat {
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.78);
}

.summary-stat strong {
  display: block;
  font-size: 30px;
}

.summary-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.star-rating {
  margin: 8px 0 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.star-rating span {
  color: rgba(38, 50, 56, 0.18);
  font-size: 38px;
  line-height: 1;
}

.star-rating span.active {
  color: var(--yellow);
  text-shadow: 0 3px 0 rgba(38, 50, 56, 0.12);
}

.planet-page {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(360px, 1.1fr);
  gap: 28px;
  align-items: start;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.decor-item {
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.decor-item .decor-icon {
  font-size: 34px;
}

.decor-item h3 {
  margin: 4px 0;
  font-size: 19px;
}

.decor-item p {
  margin-bottom: 12px;
  color: var(--muted);
}

.empty-note {
  color: var(--muted);
  line-height: 1.6;
}

.mini-log {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.sync-note {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 18px;
  border: 1px solid rgba(38, 50, 56, 0.12);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 900;
}

.sync-note.saved {
  border-color: rgba(33, 166, 91, 0.24);
  color: #167a4b;
}

.sync-note.failed {
  border-color: rgba(240, 82, 82, 0.26);
  color: #b83434;
}

.history-panel {
  margin-top: 20px;
}

.history-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.history-summary span {
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  border: 1px solid rgba(38, 50, 56, 0.1);
  border-radius: 8px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  background: rgba(255, 255, 255, 0.78);
}

.history-card strong {
  font-size: 16px;
}

.history-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

@media (max-width: 860px) {
  .screen {
    padding: 18px;
  }

  .home-layout,
  .planet-page,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 42px;
  }

  h2 {
    font-size: 30px;
  }

  .planet-stage {
    min-height: 390px;
  }

  .planet {
    width: 250px;
  }

  .planet-ring {
    width: 330px;
    height: 76px;
  }

  .ship {
    right: 34px;
    top: 34px;
  }

  .game-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  }

  .stage-route {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hud-item {
    min-height: 52px;
  }

  .target-wrap {
    min-height: 310px;
  }

  .clear-gate {
    width: min(230px, 68vw);
  }

  .aim-reticle {
    width: 92px;
  }

  .answers,
  .summary-grid,
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .screen,
  .flip-screen {
    padding: 14px;
  }

  h1 {
    font-size: 36px;
  }

  .lead {
    font-size: 17px;
  }

  .topbar {
    align-items: flex-start;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .game-shell {
    padding: 10px;
  }

  .game-hud {
    grid-template-columns: 1fr 1fr;
  }

  .game-hud .btn-icon {
    width: 100%;
  }

  .stage-copy {
    min-height: 48px;
  }

  .route-track {
    gap: 5px;
    padding: 8px;
  }

  .stage-node {
    min-height: 32px;
    font-size: 12px;
  }

  .target-prompt {
    left: 12px;
    top: 12px;
    max-width: calc(100% - 24px);
  }

  .target-prompt strong {
    font-size: 16px;
  }

  .lens-badge {
    top: auto;
    right: 12px;
    bottom: 12px;
    font-size: 13px;
  }

  .target-text {
    font-size: var(--target-height);
  }

  .target-text.medium {
    font-size: var(--target-height);
  }

  .target-text.small {
    font-size: var(--target-height);
  }

  .answer-btn {
    min-height: 66px;
    font-size: 19px;
  }

  .flip-card h2 {
    font-size: 28px;
  }
}

@keyframes starDrift {
  from {
    background-position:
      0 0,
      28px 44px;
  }
  to {
    background-position:
      -76px 76px,
      -90px 162px;
  }
}

@keyframes gatePulse {
  0%,
  100% {
    transform: scale(0.98);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes pilotFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-7px) rotate(2deg);
  }
}

@keyframes beamFire {
  0% {
    height: 0;
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  90% {
    height: 170px;
    opacity: 0.9;
  }
  100% {
    height: 170px;
    opacity: 0;
  }
}

@keyframes gentleShake {
  0%,
  100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(5px);
  }
}

@keyframes flipCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spinHint {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(22deg);
  }
}
