@font-face { font-family: "Jersey 25"; src: url("fonts/jersey-25-latin-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Jersey 20"; src: url("fonts/jersey-20-latin-400.woff2") format("woff2"); size-adjust: 118%; font-display: swap; }
:root {
  --ink: #f4efe4; --mut: #a9a6b4; --card: rgba(17, 19, 28, .9); --edge: rgba(255, 255, 255, .13); --field: rgba(255, 255, 255, .07);
  --leaf: #9bb86a; --bad: #e8745a; --gold: #f2c46d;
  --pix: "Jersey 25", "Jersey 20", ui-monospace, monospace;
  --sans: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #232842; color: var(--ink); font-family: var(--sans); font-size: 16px; overflow: hidden; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#sky { position: fixed; inset: 0; }
#flash { position: fixed; inset: 0; opacity: 0; pointer-events: none; }
#flash.red { background: #e8745a; opacity: .3; }
#flash.gold { background: radial-gradient(circle at 50% 42%, #fff1c9, #f2c46d 55%, transparent); opacity: .6; }
#flash.white { background: #fff; opacity: .35; }
#flash.fade { opacity: 0; transition: opacity .9s; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lbl { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); }
.bad { color: var(--bad); }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 10px 34px rgba(8, 8, 20, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
button { font: inherit; color: inherit; cursor: pointer; }

/* HUD */
#hud { position: fixed; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: max(12px, env(safe-area-inset-top)) 14px 0; pointer-events: none; z-index: 3; }
#hud > * { pointer-events: auto; }
#alt { background: var(--card); border: 1px solid var(--edge); border-radius: 10px; padding: 6px 12px 7px; justify-self: start; min-width: 92px; }
#meters { font-family: var(--pix); font-size: 30px; line-height: .95; letter-spacing: 1px; transition: color .3s; }
#meters.up { color: var(--gold); }
#zname { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mut); }
#hearts { display: flex; gap: 5px; padding: 8px 10px; background: var(--card); border: 1px solid var(--edge); border-radius: 10px; }
#hearts svg { width: 22px; height: 19px; fill: #e8745a; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
#hearts svg.lost { fill: #4a4458; }
#hearts svg.pop { animation: pop .5s; }
.hud-right { display: flex; gap: 6px; justify-self: end; }
.icon { width: 40px; height: 40px; background: var(--card); border: 1px solid var(--edge); border-radius: 10px; font-size: 18px; }
.icon.off { opacity: .45; }
.icon.langb { font-family: var(--pix); font-size: 20px; }

/* zone banner */
#zone { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); text-align: center; z-index: 3; animation: zin .6s cubic-bezier(.2, 1.4, .4, 1); width: 92vw; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
#zone b { display: block; font-family: var(--pix); font-size: clamp(40px, 9vw, 72px); letter-spacing: 3px; color: #fff8e6; line-height: .95; text-transform: uppercase; text-shadow: 3px 3px 0 #15111f, 0 0 24px rgba(242,196,109,.55); }
#zone span { font-size: 14px; font-weight: 800; color: #fff8e6; text-shadow: 1px 1px 0 #15111f, 0 0 8px rgba(21,17,31,.8); }
#zone.out { opacity: 0; transition: opacity .6s; }
@keyframes zin { from { opacity: 0; transform: translate(-50%, -14px) scale(.9); } }

/* play */
#play { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#play > * { pointer-events: auto; }
#qcard, #res { position: absolute; left: 50%; top: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); padding: 12px 16px 14px; }
#qcard { animation: qin .45s cubic-bezier(.2, 1.3, .4, 1); }
#qcard.leave { animation: qout .3s forwards; }
@keyframes qin { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@keyframes qout { to { opacity: 0; transform: translate(-50%, -10px) scale(.97); } }
.qtop { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--gold); }
#qtext { margin: 4px 0 0; font-size: 21px; line-height: 1.2; font-weight: 800; }
#qgot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-weight: 800; animation: qin .3s; }
#qgot b { font-family: var(--pix); font-size: 26px; line-height: 1; }
#qcard.hit { animation: hit .5s; }
@keyframes hit { 30% { box-shadow: 0 0 0 3px var(--c, var(--gold)), 0 10px 34px rgba(8,8,20,.35); } }
#qcard.miss { animation: shake .45s; border-color: var(--bad); }

#res { animation: rin .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes rin { from { opacity: 0; transform: translate(-50%, 18px) scale(.9); } }
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rtier { font-family: var(--pix); font-size: 34px; line-height: 1; letter-spacing: 1px; }
.rpts { font-family: var(--pix); font-size: 34px; line-height: 1; }
.tbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0 8px; align-items: end; }
.tbar i { height: 6px; border-radius: 3px; opacity: .35; position: relative; }
.tbar i.on { height: 10px; opacity: 1; }
.tbar i.on::after { content: ''; position: absolute; left: 50%; top: -9px; margin-left: -5px; border: 5px solid transparent; border-top-color: currentColor; color: inherit; }
.rrow { display: flex; justify-content: space-between; font-weight: 800; font-size: 15px; }
.rrow small { color: var(--mut); font-weight: 700; }
.peek { margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; display: grid; gap: 2px; }
.peek li { display: flex; justify-content: space-between; color: #d8d3e0; }
.peek li span:last-child { color: var(--mut); font-size: 12px; font-weight: 800; }
.peek li.trap { color: var(--bad); font-weight: 800; }
.peek li.me { color: var(--gold); font-weight: 800; }
.rfoot { display: flex; justify-content: flex-end; margin-top: 10px; }
.next { position: relative; overflow: hidden; background: var(--gold); color: #1c1a24; border: 0; border-radius: 8px; padding: 7px 16px; font-weight: 900; }
.next i { position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(0,0,0,.35); width: 0; }
.flunk { font-family: var(--pix); font-size: 46px; line-height: .9; color: var(--bad); letter-spacing: 2px; animation: stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: scale(1.8) rotate(-6deg); opacity: 0; } }

#msg { position: absolute; left: 50%; bottom: calc(var(--kb, 0px) + max(14px, env(safe-area-inset-bottom)) + 62px); transform: translateX(-50%); font-weight: 800; font-size: 14px; padding: 5px 12px; border-radius: 8px; background: var(--card); width: max-content; max-width: min(440px, calc(100vw - 24px)); text-align: center; }
#msg:empty { display: none; }
#msg.err { color: var(--bad); animation: shake .35s; }
.bar { position: absolute; left: 50%; bottom: calc(var(--kb, 0px) + max(14px, env(safe-area-inset-bottom))); transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); display: flex; gap: 8px; align-items: center; padding: 7px; background: var(--card); border: 1px solid var(--edge); border-radius: 14px; box-shadow: 0 10px 34px rgba(8,8,20,.35); }
.bar.off { opacity: .55; }
#ring { position: relative; width: 40px; height: 40px; flex: none; }
#ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
#ring circle { fill: none; stroke-width: 4; }
#ring .bg { stroke: rgba(255,255,255,.12); }
#arc { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 106.8; transition: stroke .3s; }
#ring.low #arc { stroke: var(--bad); }
#secs { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--pix); font-size: 20px; }
#ring.low #secs { color: var(--bad); animation: pulse .5s infinite alternate; }
#ans { flex: 1; min-width: 0; background: var(--field); border: 2px solid rgba(242,196,109,.55); border-radius: 9px; color: var(--ink); font: 700 17px var(--sans); padding: 9px 12px; outline: none; }
#ans:focus { border-color: var(--gold); }
.go { width: 44px; height: 42px; flex: none; background: var(--gold); color: #1c1a24; border: 0; border-radius: 9px; font-size: 20px; font-weight: 900; }

/* panel (start, end, archive) */
#panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 120px); overflow-y: auto; padding: 18px 20px 20px; z-index: 2; margin-top: 26px; }
#panel h1 { margin: 0 0 6px; font-size: 22px; font-weight: 900; }
#panel p { margin: 0 0 10px; line-height: 1.4; color: #d8d3e0; font-size: 15px; }
.logo { font-family: var(--pix); font-size: 54px; line-height: .8; letter-spacing: 3px; color: var(--gold); text-shadow: 3px 3px 0 #15111f; margin-bottom: 6px; }
.streak { color: var(--gold) !important; font-weight: 800; }
#name { width: 100%; margin: 4px 0 12px; background: var(--field); border: 2px solid var(--edge); border-radius: 9px; color: var(--ink); font: 700 16px var(--sans); padding: 9px 12px; outline: none; }
#name:focus { border-color: var(--gold); }
.big { display: block; width: 100%; margin: 0 0 8px; padding: 12px; background: var(--gold); color: #1c1a24; border: 0; border-radius: 10px; font-weight: 900; letter-spacing: .04em; }
.big.alt { background: var(--field); color: var(--ink); border: 1px solid var(--edge); }
.big:disabled { opacity: .5; cursor: default; }
.acct { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.link { background: none; border: 0; color: var(--mut); text-decoration: underline; font-size: 13px; padding: 0; }
.links { font-size: 13px; margin-top: 10px !important; }
.links a { color: var(--mut); }
#dheight { font-family: var(--pix); font-size: 64px; line-height: .9; color: var(--gold); }
#dzone { font-weight: 900; font-size: 15px; margin-bottom: 6px; }
#dmarks { margin: 8px 0; letter-spacing: 1px; line-height: 1.2; word-break: break-all; }
#dtoday p { font-size: 14px !important; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 12px; }
.tiles div { background: var(--field); border-radius: 8px; padding: 7px 4px; text-align: center; }
.tiles b { display: block; font-family: var(--pix); font-size: 26px; line-height: 1; }
.tiles span { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--mut); }
.tiles .hot b { color: var(--gold); }
#top div { display: flex; justify-content: space-between; font-size: 14px; padding: 2px 0; color: #d8d3e0; }
#arList { list-style: none; padding: 0; margin: 10px 0; }
#arList li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--edge); }
#arList small { display: block; color: var(--mut); font-size: 12px; }
#arList button { background: var(--gold); color: #1c1a24; border: 0; border-radius: 7px; padding: 5px 12px; font-weight: 900; }
.lock { color: var(--mut); font-size: 13px; }
.consent { display: flex; gap: 8px; font-size: 13px; color: #d8d3e0; margin-bottom: 10px; }
.consent a { color: var(--gold); }

@keyframes shake { 20%, 60% { transform: translateX(calc(-50% - 6px)); } 40%, 80% { transform: translateX(calc(-50% + 6px)); } }
@keyframes pop { 50% { transform: scale(1.5); } }
@keyframes pulse { to { opacity: .5; } }
@media (max-width: 480px) { #msg { font-size: 13px; } #hearts { padding: 7px 7px; gap: 3px; } #hearts svg { width: 17px; height: 15px; } #alt { min-width: 0; padding: 5px 9px 6px; } #meters { font-size: 24px; } #zname { font-size: 9px; max-width: 96px; } .icon { width: 36px; height: 36px; } #qtext { font-size: 19px; } }
@media (max-height: 640px) { #qtext { font-size: 18px; } #qcard, #res { top: 46%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.sugg-msg { color: var(--ink); }
.sugg { background: var(--gold); color: #1c1a24; border: 0; border-radius: 6px; padding: 2px 9px; font: inherit; font-weight: 800; cursor: pointer; }
.sugg-msg small { opacity: .7; font-size: .8em; }

/* my garden */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--field); padding: 4px; border-radius: 10px; margin: 6px 0 12px; }
.tabs button { background: none; border: 0; border-radius: 7px; padding: 8px 4px; font-weight: 800; font-size: 14px; color: var(--mut); }
.tabs button.on { background: var(--gold); color: #1c1a24; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.skin { background: linear-gradient(#a9cbe9, #ecc9a5); border: 2px solid transparent; border-radius: 10px; padding: 8px 6px 7px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.skin canvas { width: 66px; height: 96px; image-rendering: pixelated; }
.skin b { color: #1c1a24; font-size: 13px; } .skin small { color: #4a4458; font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center; }
.skin.sel { border-color: var(--gold); box-shadow: 0 0 0 2px #1c1a24 inset; }
.skin.locked { background: #2a2738; cursor: default; } .skin.locked b { color: var(--mut); } .skin.locked small { color: var(--mut); }
.herb { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.leafcard { background: #f3ead6; color: #3d3546; border-radius: 6px; padding: 9px 11px; box-shadow: 2px 2px 0 rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 2px; transform: rotate(-.6deg); }
.leafcard:nth-child(even) { transform: rotate(.7deg); }
.leafcard b { color: #8a5a2a; font-size: 15px; } .leafcard span { font-size: 12px; } .leafcard small { font-size: 11px; color: #8a8094; }
.empty { text-align: center; padding: 18px 6px; }
.achs { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 6px; }
.achs li { display: flex; gap: 10px; align-items: center; background: var(--field); border-radius: 9px; padding: 8px 10px; opacity: .55; }
.achs li.got { opacity: 1; box-shadow: inset 0 0 0 1px rgba(242,196,109,.5); }
.achs i { font-style: normal; font-size: 22px; width: 28px; text-align: center; } .achs div { flex: 1; display: flex; flex-direction: column; }
.achs b { font-size: 14px; } .achs span { font-size: 12px; color: var(--mut); } .achs small { font-size: 11px; color: var(--mut); }
#toast { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 120px); transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 9px 16px 10px 12px; z-index: 4; animation: zin .5s cubic-bezier(.2, 1.4, .4, 1); max-width: 90vw; border-color: rgba(242,196,109,.6); }
#toast i { font-style: normal; font-size: 26px; } #toast b { display: block; color: var(--gold); font-size: 14px; } #toast span { font-size: 12px; color: var(--mut); }
#toast.out { opacity: 0; transition: opacity .5s; }
p.tut { font-size: 14px; color: #d8d3e0; margin: 10px 0 0; line-height: 1.4; }

/* big word in the middle of the sky while the beanstalk climbs */
#big { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; white-space: nowrap; font-family: var(--pix); font-size: clamp(38px, 8.5vw, 70px); letter-spacing: 2px; line-height: 1;
  text-shadow: 3px 3px 0 #15111f, 0 0 26px currentColor; animation: bigin 1.7s cubic-bezier(.2, 1.4, .4, 1) forwards; }
#big.shine { animation: bigin 1.7s cubic-bezier(.2, 1.4, .4, 1) forwards, glow .35s ease-in-out 4 alternate; }
#big.bad { animation: bigin 1.7s cubic-bezier(.2, 1.4, .4, 1) forwards, wob .12s 6 alternate; }
@keyframes bigin { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(.92); } 24% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; transform: translate(-50%, -62%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(.96); } }
@keyframes glow { to { filter: brightness(1.5) drop-shadow(0 0 10px currentColor); } }
@keyframes wob { to { margin-left: 6px; } }
/* while climbing only the sky shows */
#play.climbing #qcard, #play.climbing .bar, #play.climbing #msg { visibility: hidden; }

/* phones: question and answer box at the top, so the keyboard never covers them; the result card sits at the bottom */
@media (max-width: 600px) {
  #play { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: calc(max(12px, env(safe-area-inset-top)) + 58px); }
  #qcard, .bar, #msg { position: static; transform: none; left: auto; bottom: auto; top: auto; width: calc(100vw - 20px); }
  #qcard { order: 1; animation: qinm .4s cubic-bezier(.2, 1.3, .4, 1); }
  .bar { order: 2; } #msg { order: 3; width: max-content; max-width: calc(100vw - 20px); }
  #qcard.miss, #msg.err { animation: shakem .4s; }
  #res { top: auto; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 10px); width: calc(100vw - 20px); }
  #zone { top: 24%; }
  #big { top: 36%; }
  #toast { top: calc(max(6px, env(safe-area-inset-top)) + 2px); z-index: 5; }
}
@keyframes qinm { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
@keyframes shakem { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
