/* NearAyo Words: "hot & cold arcade". A night-sky game world where every guess glows from ice blue to fire.
   Layout: one centered column (max 640px), a game HUD bar on top, big tactile 3D buttons, and a winding level map. */
:root {
  --ink: #0d0a24;
  --night: #17113b;
  --panel: #211a52;
  --panel-2: #2c236d;
  --edge: #3a3089;
  --fg: #f6f3ff;
  --muted: #b3aae4;
  --gold: #ffc93c;
  --gold-deep: #c58800;
  --gold-ink: #2a1a00;
  --pink: #ff4d8d;
  --pink-deep: #b3245c;
  --cold: #4f86ff;
  --warm: #ffaa1f;
  --hot: #ff4d5e;
  --exact: #1fd69b;
  --exact-deep: #0c9465;
  --locked: #4a4280;
  --shade: rgba(5, 3, 20, .55);
  --display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--fg);
  font: 600 16px/1.5 var(--body);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 77, 141, .22), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(79, 134, 255, .22), transparent 60%),
    linear-gradient(180deg, var(--night), var(--ink) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 400; line-height: 1.05; letter-spacing: .01em; text-wrap: balance; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* Floating letter tiles in the background */
.bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg span {
  position: absolute; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; font: 400 26px var(--display); color: rgba(246, 243, 255, .16);
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06);
  animation: drift 26s linear infinite;
}
@keyframes drift { from { transform: translateY(0) rotate(var(--r0, -8deg)); } 50% { transform: translateY(-40px) rotate(calc(var(--r0, -8deg) * -1)); } to { transform: translateY(0) rotate(var(--r0, -8deg)); } }

/* HUD bar */
.hud { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(13, 10, 36, .78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--edge); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--ink); }
.hud-in { max-width: 640px; margin: 0 auto; padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--fg); min-width: 0; }
.logo-tile { width: 36px; height: 36px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; font: 400 22px var(--display); box-shadow: 0 4px 0 var(--gold-deep); transform: rotate(-6deg); flex: none; }
.logo-word { font: 400 25px var(--display); letter-spacing: .01em; }
.logo-word b { font-weight: 400; color: var(--gold); }
.logo-tag { font: 500 11px var(--mono); letter-spacing: .14em; color: var(--pink); border: 1px solid var(--pink); border-radius: 6px; padding: 1px 5px; }
.hud-right { display: flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--edge); border-radius: 999px; padding: 4px 10px 4px 8px; font: 800 14px var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip .icon { width: 17px; height: 17px; }
.chip.star .icon { color: var(--gold); }
.chip.flame .icon { color: var(--hot); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); display: grid; place-items: center; }
.icon-btn .icon { width: 18px; height: 18px; }

/* Main column */
.app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding-block: 20px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr); }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.loading { text-align: center; color: var(--muted); padding-block: 60px; font-weight: 800; }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* 3D game buttons */
.btn { --b: var(--gold); --d: var(--gold-deep); --t: var(--gold-ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 14px 22px 12px; background: var(--b); color: var(--t);
  font: 400 20px var(--display); letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 6px 0 var(--d), 0 10px 24px rgba(0, 0, 0, .35); transition: transform .08s ease, box-shadow .08s ease, filter .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--d), 0 4px 10px rgba(0, 0, 0, .3); }
.btn.pink { --b: var(--pink); --d: var(--pink-deep); --t: #fff; }
.btn.green { --b: var(--exact); --d: var(--exact-deep); --t: #032a1c; }
.btn.dark { --b: var(--panel-2); --d: #16104a; --t: var(--fg); }
.btn.small { font-size: 16px; padding: 10px 16px 8px; border-radius: 14px; box-shadow: 0 4px 0 var(--d); }
.btn.small:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--d); }
.btn[disabled] { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; }
.btn .icon { width: 20px; height: 20px; }

/* Daily hero */
.daily { position: relative; overflow: hidden; border-radius: 26px; padding: 22px; display: grid; gap: 14px;
  background: linear-gradient(135deg, #3b2aa8 0%, #6a2b9e 55%, #b02a77 100%); border: 2px solid rgba(255, 255, 255, .14);
  box-shadow: 0 18px 40px rgba(20, 8, 60, .55), inset 0 1px 0 rgba(255, 255, 255, .2); }
.daily::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 201, 60, .45), transparent 70%); pointer-events: none; }
.daily .eyebrow { color: rgba(255, 255, 255, .8); }
.daily h1 { font-size: clamp(30px, 7vw, 42px); text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.daily p { margin: 0; color: rgba(255, 255, 255, .86); max-width: 46ch; }
.mystery { display: flex; gap: 6px; }
.mystery span { width: 42px; height: 48px; border-radius: 10px; display: grid; place-items: center; font: 400 26px var(--display); color: var(--gold-ink); background: var(--gold); box-shadow: 0 4px 0 var(--gold-deep); animation: bob 2.4s ease-in-out infinite; }
.mystery span:nth-child(2) { animation-delay: .15s; } .mystery span:nth-child(3) { animation-delay: .3s; } .mystery span:nth-child(4) { animation-delay: .45s; } .mystery span:nth-child(5) { animation-delay: .6s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.daily-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.countdown { font: 500 14px var(--mono); color: rgba(255, 255, 255, .85); font-variant-numeric: tabular-nums; }
.streaks { display: flex; flex-wrap: wrap; gap: 8px; }
.streaks .chip { background: rgba(13, 10, 36, .35); border-color: rgba(255, 255, 255, .18); }

/* Two side-by-side cards */
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); padding: 18px; display: grid; gap: 10px; align-content: start; }
.card h2 { font-size: 24px; }
.card p { margin: 0; color: var(--muted); }
.card.challenge { background: linear-gradient(160deg, #3a1d5e, #5a1f55); border-color: #7a2c72; }
.card .btn { justify-self: start; }

/* How to play */
details.how { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); }
details.how > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 400 22px var(--display); }
details.how > summary::-webkit-details-marker { display: none; }
details.how > summary::after { content: "+"; font: 400 26px var(--display); color: var(--gold); }
details.how[open] > summary::after { content: "–"; }
.how-body { padding: 0 18px 18px; display: grid; gap: 12px; }
.how-body p { margin: 0; color: var(--muted); }
.how-body strong { color: var(--fg); }

/* Guess rows */
.rows { display: grid; gap: 8px; }
.row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px; background: var(--night); border: 1px solid var(--edge); overflow: hidden; }
.row .fill { position: absolute; inset: 0 auto 0 0; border-radius: 13px; }
.row .fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .22), transparent 55%); }
.row .w, .row .n { position: relative; }
.row .w { font: 800 18px var(--body); min-width: 0; overflow-wrap: anywhere; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.row .n { font: 500 15px var(--mono); font-variant-numeric: tabular-nums; background: rgba(13, 10, 36, .55); border-radius: 999px; padding: 2px 10px; }
.row.cold .fill { background: linear-gradient(90deg, #3561d6, var(--cold)); }
.row.warm .fill { background: linear-gradient(90deg, #e07a00, var(--warm)); }
.row.hot .fill { background: linear-gradient(90deg, #d8283f, var(--hot)); }
.row.exact .fill { background: linear-gradient(90deg, var(--exact-deep), var(--exact)); }
.row.latest { border: 2px solid var(--gold); box-shadow: 0 0 0 4px rgba(255, 201, 60, .18); animation: slidein .35s cubic-bezier(.2, .9, .3, 1.3); }
.row.hinted .w::after { content: "hint"; margin-left: 8px; font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; background: rgba(13, 10, 36, .5); border-radius: 6px; padding: 1px 6px; }
@keyframes slidein { from { transform: translateY(-10px) scale(.96); opacity: .3; } to { transform: none; opacity: 1; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* Levels */
.levels-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.levels-head h2 { font-size: 32px; }
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; background: var(--night); border: 1px solid var(--edge); border-radius: 16px; padding: 5px; }
.tab { border: 0; border-radius: 12px; background: transparent; padding: 8px 4px; display: grid; gap: 1px; color: var(--muted); }
.tab b { font: 400 17px var(--display); letter-spacing: .02em; color: inherit; }
.tab small { font: 500 11px var(--mono); }
.tab[aria-selected="true"] { background: var(--panel-2); color: var(--fg); box-shadow: inset 0 0 0 2px var(--gold); }
.stage-note { margin: 0; color: var(--muted); text-align: center; }
.map { position: relative; width: 100%; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map path { fill: none; stroke: var(--edge); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map path.done { stroke: var(--gold-deep); }
.node { position: absolute; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; align-content: center; gap: 0;
  background: var(--panel-2); box-shadow: 0 6px 0 #16104a, inset 0 2px 0 rgba(255, 255, 255, .15); transition: transform .12s ease; }
.node b { font: 400 26px var(--display); line-height: 1; }
.node .st { display: flex; gap: 1px; margin-top: 2px; color: var(--gold-ink); }
.node .st .icon { width: 11px; height: 11px; }
.node.done { background: var(--gold); color: var(--gold-ink); box-shadow: 0 6px 0 var(--gold-deep), inset 0 2px 0 rgba(255, 255, 255, .5); }
.node.next { background: var(--pink); color: #fff; box-shadow: 0 6px 0 var(--pink-deep), 0 0 0 6px rgba(255, 77, 141, .25); animation: pulse 1.6s ease-in-out infinite; }
.node.next::after { content: "PLAY"; position: absolute; top: -26px; font: 400 13px var(--display); letter-spacing: .08em; background: var(--fg); color: var(--ink); border-radius: 8px; padding: 2px 8px; }
.node[disabled] { background: var(--night); color: var(--muted); box-shadow: 0 4px 0 #0a0820, inset 0 0 0 2px var(--edge); cursor: not-allowed; }
.node[disabled] b { font-size: 21px; opacity: .55; }
.node[disabled] .icon { width: 13px; height: 13px; margin-top: 2px; opacity: .7; }
.node:not([disabled]):hover { transform: translateY(-3px) scale(1.05); }
.node:not([disabled]):active { transform: translateY(3px); }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 0 var(--pink-deep), 0 0 0 4px rgba(255, 77, 141, .35); } 50% { box-shadow: 0 6px 0 var(--pink-deep), 0 0 0 14px rgba(255, 77, 141, 0); } }
.stage-trophy { text-align: center; color: var(--muted); font-weight: 800; }

/* Play screen */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .ttl { min-width: 0; display: grid; gap: 4px; flex: 1; }
.topbar h1 { font-size: 30px; }
.pill { justify-self: start; font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); display: grid; place-items: center; flex: none; }
.round-btn .icon { width: 22px; height: 22px; }

.meter { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); padding: 14px 16px 16px; display: grid; gap: 10px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.meter-top b { font: 400 22px var(--display); }
.meter-top span { color: var(--muted); font-weight: 700; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.track { position: relative; height: 18px; border-radius: 999px; background: linear-gradient(90deg, var(--cold), var(--warm) 55%, var(--hot) 85%, var(--exact)); }
.track::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--night); opacity: .72; clip-path: inset(0 0 0 var(--p, 0%)); transition: clip-path .5s cubic-bezier(.2, .9, .3, 1.2); }
.track i { position: absolute; top: 50%; left: var(--p, 0%); width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: var(--fg); border: 4px solid var(--ink); box-shadow: 0 0 16px rgba(255, 255, 255, .55); transition: left .5s cubic-bezier(.2, .9, .3, 1.2); }

form.guess { display: flex; gap: 10px; }
form.guess input { flex: 1; min-width: 0; font: 800 20px var(--body); padding: 14px 16px; border-radius: 16px; border: 2px solid var(--edge); background: var(--night); color: var(--fg); }
form.guess input::placeholder { color: var(--locked); }
form.guess input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 4px rgba(255, 201, 60, .2); }
.toast { min-height: 1.5em; margin: 0; font-weight: 800; color: var(--muted); }
.toast.err { color: var(--hot); }
.toast.t-hot { color: var(--hot); } .toast.t-warm { color: var(--warm); } .toast.t-cold { color: var(--cold); }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.tools .btns { display: flex; gap: 8px; }
.count { font: 500 14px var(--mono); color: var(--muted); }
.badge { background: var(--ink); color: var(--gold); border-radius: 999px; padding: 0 7px; font: 500 13px var(--mono); }
.confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; font-weight: 800; }

/* Results */
.result { background: var(--panel); border: 2px solid var(--exact); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; text-align: center; }
.result.gaveup { border-color: var(--edge); }
.result h2 { font-size: 28px; }
.result p { margin: 0; color: var(--muted); }
.result .btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.share-box { width: 100%; font: 500 14px var(--mono); padding: 10px 12px; border-radius: 12px; border: 1px solid var(--edge); background: var(--night); color: var(--fg); resize: none; }
.word-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.word-tiles span { width: 44px; height: 50px; border-radius: 10px; display: grid; place-items: center; font: 400 28px var(--display); text-transform: uppercase; background: var(--exact); color: #032a1c; box-shadow: 0 4px 0 var(--exact-deep); animation: flip .5s both; }
.gaveup .word-tiles span { background: var(--panel-2); color: var(--fg); box-shadow: 0 4px 0 #16104a; }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: none; } }

/* Win celebration */
.celebrate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); background: var(--shade); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.celebrate canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cele-card { position: relative; width: min(420px, 100%); background: linear-gradient(160deg, #3b2aa8, #6a2b9e); border: 2px solid rgba(255, 255, 255, .2); border-radius: 28px; padding: 26px 20px 22px; display: grid; gap: 14px; text-align: center; box-shadow: 0 30px 60px rgba(0, 0, 0, .5); animation: popin .45s cubic-bezier(.2, .9, .3, 1.4); }
.cele-card .ayo { font: 400 clamp(64px, 18vw, 92px) var(--display); line-height: .9; color: var(--gold); text-shadow: 0 6px 0 var(--gold-deep), 0 12px 30px rgba(0, 0, 0, .4); letter-spacing: .02em; }
.cele-card p { margin: 0; color: rgba(255, 255, 255, .9); font-weight: 700; }
.cele-stars { display: flex; justify-content: center; gap: 10px; }
.cele-stars .icon { width: 46px; height: 46px; color: rgba(13, 10, 36, .45); }
.cele-stars .on { color: var(--gold); filter: drop-shadow(0 3px 0 var(--gold-deep)); animation: starpop .45s cubic-bezier(.2, .9, .3, 1.6) both; }
.cele-stars .on:nth-child(2) { animation-delay: .25s; } .cele-stars .on:nth-child(3) { animation-delay: .5s; }
.cele-card .btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 4px; }
.cele-card .close { position: absolute; top: 10px; right: 10px; }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes starpop { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }

/* Challenge picker */
.search { width: 100%; font: 800 18px var(--body); padding: 13px 16px; border-radius: 16px; border: 2px solid var(--edge); background: var(--night); color: var(--fg); }
.search:focus { border-color: var(--pink); outline: none; box-shadow: 0 0 0 4px rgba(255, 77, 141, .2); }
.pick-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.pick { border: 0; border-radius: 12px; padding: 9px 14px 7px; font: 400 18px var(--display); letter-spacing: .03em; background: var(--panel-2); color: var(--fg); box-shadow: 0 4px 0 #16104a; }
.pick:hover { background: var(--pink); box-shadow: 0 4px 0 var(--pink-deep); }
.pick:active { transform: translateY(3px); box-shadow: 0 1px 0 #16104a; }
.notice { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; justify-items: start; }
.notice p { margin: 0; }

/* Static info pages and footer */
.seo { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding-block: 0 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.seo > div, .prose { background: rgba(33, 26, 82, .6); border: 1px solid var(--edge); border-radius: var(--r); padding: 20px; display: grid; gap: 12px; }
.seo h2, .prose h1, .prose h2 { font-size: 24px; }
.prose h1 { font-size: 34px; }
.seo p, .prose p { margin: 0; color: var(--muted); max-width: 65ch; font-weight: 600; }
.foot { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 14px; padding-block: 18px 30px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.foot a { color: var(--muted); }

@media (max-width: 420px) {
  .logo-word { font-size: 21px; } .logo-tag { display: none; }
  .chip { padding: 3px 8px 3px 6px; font-size: 13px; }
  .btn { font-size: 18px; padding: 13px 18px 11px; }
  .mystery span { width: 36px; height: 42px; font-size: 22px; }
  .topbar h1 { font-size: 25px; }
  .node { width: 60px; height: 60px; margin: -30px 0 0 -30px; }
  .node b { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
