:root {
  font: 17px/1.5 system-ui, sans-serif;
  color: #fff5e5;
  background: #160f25;
  --plum: #392454;
  --deep: #251637;
  --mint: #bdf2d3;
  --coral: #ff9a86;
  --lilac: #e8ddfb;
  --muted: #d0bfdc;
  --edge: #705586;
  --display: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --heading: "Avenir Next", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 9% 6%, #594077 0%, transparent 49%),
    radial-gradient(ellipse at 94% 35%, #57284f 0%, transparent 45%),
    #160f25;
}
body::before, body::after {
  content: '';
  position: fixed;
  pointer-events: none;
}
body::before {
  inset: 0;
  opacity: .55;
  background-image:
    radial-gradient(ellipse 2px 1px at 14px 23px, #a9e4ca 96%, transparent),
    radial-gradient(ellipse 1px 2px at 56px 71px, #ffab97 96%, transparent),
    radial-gradient(ellipse 2px 1px at 92px 18px, #d9a5f8 96%, transparent),
    radial-gradient(circle 1px at 70px 39px, #fcdb9e 96%, transparent);
  background-size: 106px 92px, 130px 102px, 150px 112px, 115px 124px;
}
body::after {
  inset: auto -20vw 0;
  height: 48vh;
  background:
    repeating-linear-gradient(90deg, #ce9ee35c 0 1px, transparent 1px 68px),
    repeating-linear-gradient(0deg, #ce9ee350 0 1px, transparent 1px 34px);
  transform-origin: bottom;
  transform: perspective(260px) rotateX(44deg);
  mask-image: linear-gradient(transparent, #000 82%);
  opacity: .45;
}
main {
  position: relative;
  z-index: 1;
  max-width: 690px;
  width: calc(100% - 32px);
  margin: 0 auto;
  padding-top: clamp(10px, 3vw, 24px);
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  border-bottom: 2px solid var(--edge);
  gap: 12px;
  padding-inline: clamp(4px, 2vw, 14px);
}
header strong {
  color: #fff1dc;
  font: 900 clamp(1.15rem, 4vw, 1.55rem)/1.1 var(--display);
  letter-spacing: -.055em;
  text-shadow: 0 0 10px #ff9a867a, 0 0 25px #ff9a864d;
}
#daily, .step { font: 700 .78rem/1.35 var(--display); letter-spacing: .09em; }
#daily { color: var(--muted); white-space: nowrap; }
.step { color: var(--coral); margin: 0 0 8px; }
main > section {
  margin-top: 12px;
  padding: clamp(22px, 5vw, 42px);
  background: linear-gradient(145deg,#302042f5,#241735fc 75%);
  border: 1px solid var(--edge);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 12px 36px #0e091a94;
}
h1 {
  margin: 0 0 12px;
  font: 800 clamp(2.1rem, 7.5vw, 3.9rem)/1.03 var(--heading);
  letter-spacing: -.052em;
  text-wrap: balance;
}
#example { color: var(--muted); margin: 0 0 22px; }
#clues { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); list-style: none; padding: 0; gap: 8px; margin: 0; }
#clues li {
  display: grid;
  place-items: center;
  padding: 12px 3px;
  min-height: 65px;
  color: var(--deep);
  background: var(--mint);
  border: 2px solid #82ccac;
  border-radius: 6px;
  box-shadow: inset 0 -4px #6bb39547;
  font: 850 clamp(.82rem, 4vw, 1.65rem)/1.2 var(--display);
  overflow-wrap: anywhere;
}
#chances, #feedback { margin: 9px 0; min-height: 1.5em; }
#chances { color: var(--muted); font-size: .875rem; }
#total { color: var(--mint); font: 800 clamp(1.12rem, 4.4vw, 1.55rem)/1.25 var(--heading); margin: 0 0 14px; }
#guess-form { display:flex; gap:8px; }
button,input,textarea { border:2px solid var(--deep); font:inherit; padding:9px 12px; }
button {
  color: var(--deep);
  background: var(--mint);
  border: 1px solid #89caae;
  border-radius: 5px;
  font: 750 .88rem/1.35 var(--display);
  cursor: pointer;
}
button:hover:enabled { filter: brightness(1.09); }
button.quiet, nav button { color: var(--lilac); background: #322247; border-color: var(--edge); }
button:focus-visible,input:focus-visible,textarea:focus-visible { outline:3px solid var(--coral); outline-offset:3px; }
input { flex:1; width:0; min-width:0; background:#fffdf3; }
nav { display:flex; gap:7px; margin-top:22px; }
nav button { width:43px; height:43px; padding:0; }
nav button[aria-current] { color:var(--deep); background:var(--mint); }
textarea { display:block; width:100%; min-height:116px; margin-bottom:10px; background:#f5edf9; color:var(--deep); font-family:var(--display); border-radius:5px; }
footer { background:#000; padding:16px clamp(22px, 5vw, 42px); color:#f0e6f0; font-size:.85rem; }

#clues[data-feedback="wrong"] li, #guess[data-feedback="wrong"] {
  color: #711e23;
  background: #fbe1df;
  border-color: #ae333a;
}
#clues[data-feedback="correct"] li, #guess[data-feedback="correct"] {
  color: #184c32;
  background: #bce8c7;
  border-color: #26754f;
}

#clues { perspective: 650px; }
#clues li { text-align:center; }
#clues.phrase-reveal li {
  font-size: clamp(.85rem, 3.5vw, 1.25rem);
  line-height: 1.2;
}
@media (prefers-reduced-motion: no-preference) {
  #clues.clue-entrance li {
    animation: clue-arrives .27s ease-out both;
    animation-delay: calc(var(--tile-order) * 55ms);
  }

}
@keyframes clue-arrives {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
.logo-star { display: inline-block; margin-left: .36em; color: var(--coral); text-shadow: 0 0 12px #ffab97a0; font-size: .88em; }
#arcade { margin: 22px 0 12px; border: 1px solid #85669b; border-radius: 9px; background: #382650; padding: clamp(12px, 3vw, 18px); }
#arcade h2 { margin: 0; font: 800 clamp(1.35rem,4vw,1.7rem)/1.15 var(--heading); letter-spacing: -.035em; }
#claw-hint { margin: 4px 0 12px; font-size: .9rem; color: var(--muted); }
.cabinet { border: 3px solid var(--deep); border-radius: 16px 16px 11px 11px; overflow: hidden; background: var(--plum); box-shadow: 0 4px #a890ba, inset 0 0 0 2px #624b7c; }
.marquee { display: flex; justify-content: space-between; align-items: center; padding: 7px 15px; font: 850 1rem var(--display); letter-spacing: .19em; color: var(--deep); background: repeating-linear-gradient(90deg,#ffc19f 0 27px,var(--coral) 27px 54px); border-bottom: 3px solid var(--deep); }
.marquee span { color: #fff0d3; text-shadow: 0 0 7px #9f285d, 0 0 12px #9f285d; }
.machine { position: relative; overflow: hidden; isolation: isolate; height: 190px; margin: 8px 9px 0; border: 3px solid #8f71aa; border-radius: 7px; background: radial-gradient(ellipse at 55% 12%, #694d8e, #322044 75%); box-shadow: inset 0 0 0 3px #231536; }
.machine::after { content: ''; z-index: 4; position: absolute; inset: 0; background: linear-gradient(115deg,transparent 24%,#fff1 24% 29%,transparent 29% 34%,#fff1 34% 36%,transparent 36%); pointer-events: none; }
.machine-rail { position: absolute; top: 12px; inset-inline: 8px; height: 7px; background: #c5b0dd; border: 2px solid #1d112e; border-radius: 3px; }
.machine-stars span { position: absolute; color: #e9df9f; opacity: .64; }
.machine-stars span:nth-child(1) { top: 38px; left: 13%; }
.machine-stars span:nth-child(2) { top: 60px; left: 33%; }
.machine-stars span:nth-child(3) { top: 30px; right: 18%; }
.machine-stars span:nth-child(4) { top: 67px; right: 11%; }
.machine-floor { position: absolute; bottom: 0; width: 100%; height: 16px; border-top: 2px solid var(--deep); background: repeating-linear-gradient(135deg,var(--coral) 0 8px,#c46082 8px 16px); }
#cabinet-jars { position: absolute; bottom: 16px; left: 7%; width: 63%; min-height: 50px; display: flex; justify-content: space-evenly; align-items: end; flex-wrap: wrap; gap: 0 2px; }
#cabinet-jars .jar:nth-child(2n) { rotate: -8deg; }
#cabinet-jars .jar:nth-child(3n) { rotate: 8deg; }
.machine.locked #cabinet-jars { opacity: .68; }
.claw { position: absolute; z-index: 3; top: 28px; left: calc(50% - 12px); width: 24px; height: 18px; border: 2px solid #261632; border-radius: 4px; background: linear-gradient(#f5e5f8,#a798c1); }
.claw::before { content: ''; position: absolute; height: 220px; width: 4px; background: #f0dcf7; bottom: 100%; left: calc(50% - 2px); box-shadow: 2px 0 #44335f; }
.claw-jaws { position: absolute; inset: 11px -8px auto; height: 20px; border: solid #e3c8ed; border-width: 0 4px 4px; transform: perspective(32px) rotateX(-22deg); border-radius: 2px 2px 10px 10px; }
#carrier { position: absolute; top: 24px; left: calc(50% - 17px); }
.chute { position: absolute; z-index: 2; width: 21%; height: 56px; left: 64.5%; bottom: 14px; display: grid; place-items: center; padding-bottom: 3px; border: 2px solid #bc92df; border-radius: 20% 20% 4px 4px; background: #241639; box-shadow: inset 0 -5px #141020; }
.chute .jar { box-shadow: 0 0 16px #f5dd7ab5; }
.console { color: #fff2e7; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px 12px; padding: 10px 12px; }
#moon-odds { margin: 0; font-size: .8rem; }
#grab { color: var(--deep); background: var(--mint); padding: 7px 12px; border-radius: 6px; }
#grab:disabled { opacity: .65; cursor: wait; }
.jar { display: inline-grid; place-items: center; width: 34px; height: 40px; border: 2px solid #473364; border-top: 7px solid #473364; border-radius: 4px 4px 8px 8px; background: #e9f9ec; box-shadow: inset 3px 0 #fff9, 1px 2px #21163590; color: #4c355b; font-size: 18px; line-height: 1; }
.jar[data-tier="1"] { background: #eadbff; border-color: #664482; }
.jar[data-tier="2"] { background: #fff0c4; border-color: #8a4d69; }
#prize-result { margin: 12px 0 5px; color: #ffead1; font: 780 1.12rem/1.35 var(--heading); }
#prize-result[data-revealed="true"] { text-shadow: 0 0 14px #ff9a866a; }
#prize-result:empty { display: none; }
.return-line { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.return-line time { font: 800 .9rem var(--display); white-space: nowrap; color: var(--mint); font-variant-numeric: tabular-nums; }
#shelf { margin-top: 16px; }
#shelf summary { cursor: pointer; font: 750 .92rem/1.4 var(--display); }
.shelf-key { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
#collection { display: grid; grid-template-columns: repeat(auto-fit,minmax(92px,1fr)); gap: 8px; padding: 0; list-style: none; margin: 10px 0 0; }
#collection li { min-height: 95px; padding: 7px 4px; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center; border: 1px solid #bca7d1; border-radius: 6px; background: #faf2ff; color: var(--deep); font-size: .78rem; line-height: 1.15; }
#collection li strong { color: #67497d; font-family: var(--display); }
#collection li.collected { border: 2px solid #4d725f; background: #e1f5e6; padding: 6px 3px; }
#collection li:last-child { border-color: #975c84; background: #fff0d2; }
@media (max-width: 380px) {
  #cabinet-jars .jar { width: 26px; height: 34px; font-size: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .logo-star, .machine-stars span { animation: arcade-glimmer 3.4s ease-in-out infinite alternate; }
  .machine-stars span:nth-child(even) { animation-delay: -1.4s; }
  #cabinet-jars .jar:nth-child(odd) { animation: jar-idle 3.2s ease-in-out infinite alternate; }
  #cabinet-jars .jar:nth-child(even) { animation: jar-idle 4.2s -1.2s ease-in-out infinite alternate; }
  .machine.grabbing .machine-stars span { animation-duration: .85s; }
}
@keyframes arcade-glimmer { from { opacity: .52; } to { opacity: 1; } }
@keyframes jar-idle { from { translate: 0 0; } to { translate: 0 -4px; } }

#round-intro p { color: var(--muted); margin: 0 0 12px; }
.puzzle-timer {
  width: fit-content;
  margin: 0 0 10px auto;
  padding: 4px 9px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  color: var(--mint);
  font: 800 .95rem/1.2 var(--display);
  font-variant-numeric: tabular-nums;
}
.puzzle-timer.urgent { color: #ffd3c9; border-color: var(--coral); }
