:root {
  color-scheme: dark;
  --ink: #f5f2e9;
  --muted: #aaa9a2;
  --space: #07090d;
  --panel: #10141b;
  --line: #343b46;
  --blue: #49a5ff;
  --yellow: #ffd34d;
  --red: #ff5d61;
}

* { box-sizing: border-box; }

html { background: var(--space); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 15%, rgba(73, 165, 255, .08), transparent 36rem),
    var(--space);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  line-height: 1.5;
}

button, a { font: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.back-link {
  display: inline-block;
  margin: 1rem;
  min-height: 44px;
  padding: .65rem .85rem;
  color: var(--ink);
  border: 1px solid var(--line);
  text-underline-offset: .25rem;
}

main {
  width: min(70rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.intro { max-width: none; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(24rem, 42vw, 31rem);
  padding: clamp(2rem, 5vw, 4rem) 0;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  z-index: -2;
  width: min(36rem, 68vw);
  aspect-ratio: 1;
  right: -8rem;
  top: 50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(73, 165, 255, .16), rgba(73, 165, 255, .04) 38%, transparent 68%);
  transform: translateY(-50%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(49rem, 100%);
}

.hero h1 {
  display: grid;
  gap: .08em;
  margin: 0;
  font-size: clamp(4rem, 8.3vw, 7.35rem);
  line-height: .82;
  letter-spacing: -.07em;
  text-transform: uppercase;
}

.hero h1 span {
  display: block;
  opacity: 0;
  transform: translateY(1.15rem);
  animation: hero-rise .78s cubic-bezier(.2, .75, .25, 1) .12s forwards;
}

.hero h1 .hero-line-two {
  margin-left: clamp(1.2rem, 8vw, 6rem);
  animation-delay: .2s;
}

.hero h1 em {
  color: var(--blue);
  font-style: normal;
  text-shadow: 0 0 28px rgba(73, 165, 255, .22);
}

.hero-summary,
.hero .instructions {
  max-width: 43rem;
  opacity: 0;
  transform: translateY(.8rem);
  animation: hero-rise .7s cubic-bezier(.2, .75, .25, 1) .3s forwards;
}

.hero-summary { margin: 1.9rem 0 0; font-size: clamp(.95rem, 1.5vw, 1.08rem); }
.hero .instructions { margin-top: 1rem; color: var(--muted); animation-delay: .38s; }

.hero-orbit {
  position: absolute;
  z-index: -1;
  width: clamp(17rem, 34vw, 29rem);
  aspect-ratio: 1;
  right: clamp(-10rem, -5vw, -3rem);
  top: 50%;
  border: 1px solid rgba(73, 165, 255, .26);
  border-radius: 50%;
  box-shadow: inset 0 0 42px rgba(73, 165, 255, .035), 0 0 50px rgba(73, 165, 255, .04);
  animation: orbit-drift 22s linear infinite;
}

.hero-orbit::before,
.hero-orbit::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(245, 242, 233, .1);
  border-radius: 50%;
}

.hero-orbit::before { inset: 18%; }
.hero-orbit::after { inset: 39%; background: rgba(73, 165, 255, .06); }

.hero-mark {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: rgba(7, 9, 13, .84);
  font-size: .62rem;
  font-weight: 800;
  color: var(--ink);
  animation: mark-float 5.5s ease-in-out infinite alternate;
}

.hero-mark-one { right: 24%; top: 21%; color: #ffbd59; }
.hero-mark-two { right: 8%; bottom: 19%; color: #ff6f9f; animation-delay: -1.7s; }
.hero-mark-three { right: 31%; bottom: 9%; color: #e82127; animation-delay: -3.1s; }

@keyframes hero-rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes orbit-drift {
  from { transform: translateY(-50%) rotate(0deg); }
  to { transform: translateY(-50%) rotate(360deg); }
}

@keyframes mark-float {
  from { transform: translate3d(0, -.35rem, 0); }
  to { transform: translate3d(.35rem, .45rem, 0); }
}

.game {
  margin-top: 2rem;
  padding: clamp(.75rem, 2vw, 1.5rem);
  border: 1px solid var(--line);
  background: rgba(16, 20, 27, .9);
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}

.hud span {
  padding: .6rem;
  color: var(--muted);
  border-block: 1px solid var(--line);
  text-transform: uppercase;
  font-size: clamp(.68rem, 2vw, .86rem);
}

.hud output { display: block; color: var(--ink); font-size: 1.25rem; }
#game-status { min-height: 1.5em; color: var(--ink); }

.fact-console {
  margin: .75rem 0;
  padding: .8rem;
  border: 1px solid var(--line);
  background: rgba(5, 7, 10, .72);
}

.fact-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.fact-heading h3 {
  margin: 0;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

#facts-found { color: var(--yellow); font-weight: 800; }
.fact-tools { display: flex; align-items: center; gap: .35rem; }
.fact-tools button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.1rem;
}
.fact-tools button:disabled { opacity: .34; cursor: default; }
#fact-reveal { margin: .4rem 0 0; min-height: 1.5em; color: var(--ink); }

#fact-list {
  display: flex;
  gap: .65rem;
  min-height: 4.9rem;
  margin: .65rem 0 0;
  padding: 0 0 .25rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-color: var(--line) transparent;
}

.fact-item {
  flex: 0 0 min(22rem, 78vw);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .65rem;
  align-items: center;
  min-height: 4.25rem;
  padding: .65rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.fact-item p { margin: 0; font-size: .78rem; color: var(--ink); }

.fact-badge {
  display: grid;
  place-items: center;
  min-width: 4.6rem;
  min-height: 2.2rem;
  padding: .3rem .5rem;
  border: 1px solid currentColor;
  color: var(--blue);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fact-badge.girl-dad, .legend-mark.girl-dad { color: #ff6f9f; }
.fact-badge.birthday, .legend-mark.birthday { color: #ffbd59; }
.fact-badge.claude, .legend-mark.claude { color: #d97757; }
.fact-badge.openai, .legend-mark.openai { color: #8de5be; }
.fact-badge.creality, .legend-mark.creality { color: #38d6cc; }
.fact-badge.tesla, .legend-mark.tesla { color: #e82127; }

.field {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: #05070a;
}

canvas { display: block; width: 100%; height: 100%; }

.move-controls, .game-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: 1rem;
}

button {
  min-height: 44px;
  padding: .65rem 1rem;
  color: var(--ink);
  border: 1px solid #667080;
  background: #171d26;
  cursor: pointer;
}

button:not(:disabled):hover { border-color: var(--ink); background: #202936; }

.move-button {
  min-width: 44px;
  min-height: 44px;
  width: min(9rem, 36vw);
}

.lane-key { color: var(--muted); font-size: .8rem; }

.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: .75rem;
  margin: 1.25rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  color: var(--muted);
  font-size: .8rem;
}

.legend li { display: flex; align-items: center; gap: .55rem; }
.legend-mark {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--ink);
  font-size: .58rem;
  font-weight: 800;
}
.legend-mark.fractured { color: #d9dde2; clip-path: polygon(0 0, 100% 10%, 75% 45%, 100% 100%, 10% 85%, 28% 50%); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 34rem) {
  .hero { min-height: 25rem; padding: 1rem 0 2rem; }
  .hero h1 { font-size: clamp(3rem, 15vw, 4.2rem); }
  .hero h1 .hero-line-two { margin-left: 0; }
  .hero-orbit { width: 22rem; right: -13rem; opacity: .65; }
  .hero-mark-one { right: 5%; top: 18%; }
  .hero-mark-two { right: 1%; bottom: 18%; }
  .hero-mark-three { display: none; }
  .hud { grid-template-columns: repeat(2, 1fr); }
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legend li { min-width: 0; overflow-wrap: anywhere; }
  .game-actions { flex-wrap: wrap; }
}

@media (max-height: 30rem) and (orientation: landscape) {
  main { width: min(62rem, calc(100% - 1rem)); padding-top: 0; }
  .intro p, .legend, #fact-list { display: none; }
  .hero { min-height: 8rem; padding: .35rem 0 .8rem; }
  .hero h1 { font-size: 2.4rem; }
  .hero h1 .hero-line-two { margin-left: 1.5rem; }
  .hero-orbit, .hero-mark { display: none; }
  .game { margin-top: .5rem; }
  .field { max-height: 13rem; margin-inline: auto; }
  .fact-console { margin: .4rem 0; padding: .55rem .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .hero h1 span,
  .hero-summary,
  .hero .instructions {
    opacity: 1;
    transform: none;
  }
}
