:root {
  --lime: #CCFF00; --pale: #EDFFB0; --ink: #080A04; --panel: #0E1206; --panel2: #23271a; --muted: #A6AA9C; --white: #F4F6F4; --red: #FF2A3C;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--white); overflow: hidden; overscroll-behavior: none; }
body { font: 500 16px/1.35 'Chakra Petch', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
[hidden] { display: none !important; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button, input, a.btn { font: inherit; color: inherit; }
h1, h2, h3 { font-family: 'Unbounded', sans-serif; font-weight: 900; margin: 0; text-transform: uppercase; letter-spacing: -0.01em; }
b { font-family: 'JetBrains Mono', monospace; font-weight: 700; }

.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: var(--lime); box-shadow: inset 0 0 0 0.14em #8fb300; vertical-align: -0.14em; margin-right: 0.3em; position: relative; }
.coin::after { content: '$'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 0.68em 'JetBrains Mono', monospace; color: var(--ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.2em; border: 2px solid var(--lime); background: var(--lime); color: var(--ink); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.62em 1.1em; border-radius: 12px; cursor: pointer; text-decoration: none; transition: transform 0.08s; }
.btn:active { transform: scale(0.96); }
.btn.big { font: 900 1.25rem 'Unbounded', sans-serif; padding: 0.8em 1.4em; width: 100%; box-shadow: 0 6px 0 #7a9900; }
.btn.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #7a9900; }
.btn.ghost { background: rgba(8, 10, 4, 0.72); color: var(--lime); border-color: rgba(204, 255, 0, 0.45); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn .coin { background: var(--ink); box-shadow: none; }
.btn .coin::after { color: var(--lime); }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.row > * { flex: 1 1 auto; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); z-index: 10; }
.screen.dim { background: rgba(8, 10, 4, 0.72); backdrop-filter: blur(3px); }
.panel { width: min(100%, 460px); max-height: 100%; overflow-y: auto; background: var(--panel); border: 2px solid var(--lime); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 0 0 6px rgba(204, 255, 0, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6); touch-action: pan-y; }
.panel.small { width: min(100%, 340px); text-align: center; }
.panel header { display: flex; align-items: center; gap: 12px; }
.panel header h2 { flex: 1; }
.panel h2 { font-size: 1.5rem; color: var(--lime); }
.panel h3 { font-size: 0.9rem; color: var(--pale); margin-top: 6px; }
.panel p { margin: 0; color: var(--muted); }
.x { width: 38px; height: 38px; border-radius: 10px; border: 2px solid rgba(204, 255, 0, 0.4); background: none; color: var(--lime); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.bank { color: var(--lime); }
.note { font-size: 0.86rem; color: var(--muted); min-height: 1.2em; }
.eyebrow { font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--lime); font-size: 0.8rem; }

#title { justify-content: space-between; pointer-events: none; background: linear-gradient(180deg, rgba(8, 10, 4, 0.82) 0%, rgba(8, 10, 4, 0) 34%, rgba(8, 10, 4, 0) 52%, rgba(8, 10, 4, 0.9) 82%); }
#title > * { pointer-events: auto; width: min(100%, 460px); }
#title .top { text-align: center; padding-top: 2vh; }
#title h1 { font-size: clamp(3.4rem, 17vw, 6rem); line-height: 0.86; color: var(--lime); text-shadow: 0 5px 0 #5c7300, 0 0 40px rgba(204, 255, 0, 0.35); letter-spacing: -0.03em; margin: 6px 0 10px; }
#title .tag { margin: 0; font-weight: 700; color: var(--white); letter-spacing: 0.06em; text-transform: uppercase; }
#title .bottom { display: flex; flex-direction: column; gap: 12px; }
.wallet { display: flex; justify-content: space-between; gap: 8px; background: rgba(14, 18, 6, 0.85); border: 1px solid rgba(204, 255, 0, 0.3); border-radius: 12px; padding: 8px 14px; font-size: 0.85rem; color: var(--muted); letter-spacing: 0.06em; }
.wallet b { color: var(--lime); font-size: 1rem; }
.keys { margin: 0; text-align: center; font-size: 0.78rem; color: var(--muted); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; padding: calc(10px + var(--sat)) 12px calc(12px + var(--sab)); }
#hud .chip { pointer-events: auto; position: absolute; border: 2px solid rgba(204, 255, 0, 0.5); background: rgba(8, 10, 4, 0.7); color: var(--lime); border-radius: 12px; font-weight: 700; cursor: pointer; }
#btnPause { top: calc(10px + var(--sat)); left: 12px; width: 44px; height: 44px; letter-spacing: 0.1em; }
#btnBoard { bottom: calc(14px + var(--sab)); right: 12px; height: 52px; padding: 0 14px; display: flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; }
#btnBoard.on { background: var(--lime); color: var(--ink); }
.deck { display: inline-block; width: 30px; height: 10px; border-radius: 6px; background: currentColor; transform: skewX(-18deg); }
.hud-right { position: absolute; top: calc(8px + var(--sat)); right: 12px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
#hudScore { font: 700 2rem/1 'JetBrains Mono', monospace; color: var(--white); text-shadow: 0 2px 0 var(--ink), 0 0 12px rgba(0, 0, 0, 0.8); }
#hudCoins { font: 700 1.15rem/1 'JetBrains Mono', monospace; color: var(--lime); text-shadow: 0 2px 0 var(--ink); }
#hudMult { font: 900 0.85rem/1 'Unbounded', sans-serif; background: var(--lime); color: var(--ink); padding: 5px 8px; border-radius: 8px; }
#hudMult.hot { background: var(--white); box-shadow: 0 0 16px var(--lime); }
#hudDaily { position: absolute; top: calc(14px + var(--sat)); left: 50%; transform: translateX(-50%); display: flex; gap: 3px; }
#hudDaily i, .word i { font: 900 0.72rem/1 'Unbounded', sans-serif; font-style: normal; width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 5px; border: 1.5px solid rgba(204, 255, 0, 0.45); color: rgba(204, 255, 0, 0.5); background: rgba(8, 10, 4, 0.6); }
#hudDaily i.got, .word i.got { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.word { display: flex; gap: 5px; flex-wrap: wrap; }
.word i { font-size: 1rem; }
#hudPowers { position: absolute; left: 12px; top: calc(66px + var(--sat)); display: flex; flex-direction: column; gap: 6px; width: 132px; }
.power { background: rgba(8, 10, 4, 0.72); border: 1.5px solid rgba(204, 255, 0, 0.5); border-radius: 8px; padding: 4px 7px 6px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: var(--lime); text-transform: uppercase; }
.power u { display: block; height: 4px; margin-top: 3px; border-radius: 2px; background: var(--lime); transform-origin: left; text-decoration: none; }
#toast { position: absolute; left: 50%; top: 26%; transform: translate(-50%, 0); font: 900 clamp(1.1rem, 5.5vw, 1.9rem)/1.1 'Unbounded', sans-serif; text-transform: uppercase; text-align: center; color: var(--lime); text-shadow: 0 3px 0 var(--ink), 0 0 20px rgba(0, 0, 0, 0.9); opacity: 0; white-space: nowrap; }
#toast.red { color: var(--red); }
#toast.show { animation: pop 1.5s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, 14px) scale(0.8); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1.06); } 20% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -12px); } }
#hint { position: absolute; left: 50%; bottom: 10.5%; transform: translateX(-50%); background: rgba(8, 10, 4, 0.8); border: 1.5px solid var(--lime); border-radius: 12px; padding: 10px 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pale); text-align: center; white-space: nowrap; font-size: clamp(0.72rem, 3.4vw, 1rem); }

.timer { height: 8px; border-radius: 4px; background: var(--panel2); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--lime); transform-origin: left; }
.score { font: 900 clamp(2.4rem, 13vw, 3.6rem)/1 'Unbounded', sans-serif; color: var(--lime); text-align: center; }
#over .eyebrow { text-align: center; }
.stats { display: flex; justify-content: space-around; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.06em; }
.stats b { color: var(--white); font-size: 1rem; }
.missions { display: flex; flex-direction: column; gap: 6px; }
.mission { background: var(--panel2); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; position: relative; overflow: hidden; display: flex; justify-content: space-between; gap: 8px; }
.mission::before { content: ''; position: absolute; inset: 0; width: var(--p, 0%); background: rgba(204, 255, 0, 0.16); }
.mission > * { position: relative; }
.mission.done { color: var(--lime); }
.mission b { font-size: 0.85rem; }
input { flex: 2 1 140px; min-width: 0; background: var(--ink); border: 2px solid rgba(204, 255, 0, 0.45); border-radius: 12px; padding: 0.6em 0.8em; color: var(--white); user-select: text; -webkit-user-select: text; outline: none; }
input:focus { border-color: var(--lime); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; background: var(--panel2); border-radius: 12px; padding: 10px; }
.item .sw { width: 42px; height: 42px; border-radius: 10px; flex: none; border: 2px solid var(--ink); display: grid; place-items: center; font: 900 0.8rem 'Unbounded', sans-serif; color: var(--ink); }
.item .txt { flex: 1; min-width: 0; }
.item .txt strong { display: block; text-transform: uppercase; letter-spacing: 0.04em; }
.item .txt span { font-size: 0.82rem; color: var(--muted); }
.item .btn { padding: 0.45em 0.8em; font-size: 0.85rem; min-width: 96px; }
.tabs { display: flex; gap: 6px; }
.tabs button { flex: 1; padding: 8px; border-radius: 10px; border: 2px solid rgba(204, 255, 0, 0.35); background: none; color: var(--lime); font-weight: 700; text-transform: uppercase; cursor: pointer; }
.tabs button.on { background: var(--lime); color: var(--ink); }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; min-height: 180px; }
.board li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--panel2); font-size: 0.92rem; }
.board li:nth-child(1) { background: var(--lime); color: var(--ink); }
.board li span:first-child { font-family: 'JetBrains Mono', monospace; opacity: 0.7; }
.board li em { font-style: normal; color: var(--muted); grid-column: 1 / -1; text-align: center; }
#cardSlot canvas { width: 100%; height: auto; border-radius: 12px; display: block; }

@media (min-aspect-ratio: 1/1) {
  #title { align-items: flex-end; padding-right: 6vw; background: linear-gradient(270deg, rgba(8, 10, 4, 0.92) 0%, rgba(8, 10, 4, 0.6) 34%, rgba(8, 10, 4, 0) 60%); justify-content: center; gap: 4vh; }
  #title .top { text-align: left; padding-top: 0; }
  #hudScore { font-size: 2.4rem; }
}
@media (max-height: 560px) {
  #title h1 { font-size: 3rem; }
  .panel { padding: 14px; gap: 8px; }
}

#intro { z-index: 20; background: radial-gradient(120% 80% at 50% 30%, rgba(35, 39, 26, 0.94), rgba(8, 10, 4, 0.97)); justify-content: space-between; gap: 12px; cursor: pointer; }
#intro .skip { position: absolute; top: calc(12px + var(--sat)); right: 14px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 2px solid rgba(204, 255, 0, 0.5); background: rgba(8, 10, 4, 0.8); color: var(--lime); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; z-index: 1; }
#intro .slide { flex: 1; width: min(100%, 560px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding-top: 48px; animation: introIn 0.28s ease-out; }
#intro h2 { font-size: clamp(1.7rem, 8vw, 3rem); line-height: 0.95; color: var(--lime); text-shadow: 0 4px 0 #5c7300; }
#intro p { margin: 0; max-width: 30ch; font-size: clamp(1rem, 4.2vw, 1.2rem); color: var(--white); }
#intro .foot { width: min(100%, 460px); display: flex; flex-direction: column; gap: 14px; align-items: center; }
#intro .dots { display: flex; gap: 8px; }
#intro .dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(204, 255, 0, 0.25); }
#intro .dots i.on { width: 26px; border-radius: 5px; background: var(--lime); }
@keyframes introIn { from { opacity: 0; transform: translateY(10px); } }
.art { width: min(100%, 380px); height: clamp(150px, 30vh, 240px); display: grid; place-items: center; }

.fig { position: absolute; bottom: 14%; width: 46px; }
.fig i { display: block; height: 40px; border-radius: 9px; background: var(--white); position: relative; }
.fig b { display: block; height: 34px; margin: 2px 7px 0; border-radius: 6px 6px 3px 3px; background: var(--lime); }
.fig.bull { left: calc(50% - 23px); animation: bob 0.5s ease-in-out infinite alternate; }
.fig.bull i::before, .fig.bull i::after { content: ''; position: absolute; top: -9px; width: 12px; height: 16px; border: 5px solid var(--white); border-bottom: 0; }
.fig.bull i::before { left: -8px; border-right: 0; border-radius: 12px 0 0 0; }
.fig.bull i::after { right: -8px; border-left: 0; border-radius: 0 12px 0 0; }
.fig.bear { left: 16%; bottom: 4%; transform: scale(1.25); animation: bob 0.5s ease-in-out -0.25s infinite alternate; }
.fig.bear i { background: #3b302c; }
.fig.bear i::before, .fig.bear i::after { content: ''; position: absolute; top: -7px; width: 15px; height: 15px; border-radius: 50%; background: #3b302c; }
.fig.bear i::before { left: -3px; } .fig.bear i::after { right: -3px; }
.fig.bear b { background: var(--red); }
@keyframes bob { to { translate: 0 -7px; } }
.road { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 18px; background: linear-gradient(180deg, #0E1206, #171c0b); border: 2px solid rgba(204, 255, 0, 0.35); }
.road u { position: absolute; left: 50%; top: -20%; bottom: -20%; width: 3px; background: repeating-linear-gradient(180deg, var(--lime) 0 18px, transparent 18px 38px); transform-origin: 50% 0; opacity: 0.7; }
.road u:nth-of-type(1) { transform: rotate(16deg); } .road u:nth-of-type(2) { transform: rotate(-16deg); } .road u:nth-of-type(3) { transform: rotate(48deg); box-shadow: 0 0 0 0 transparent; }
.road u:nth-of-type(3) { display: none; }

.pad { display: grid; grid-template-columns: repeat(3, 84px); grid-template-rows: repeat(2, auto); gap: 10px; justify-content: center; }
.pad .ctl:first-child { grid-column: 2; }
.pad .ctl:nth-child(2) { grid-column: 1; }
.pad.touch { grid-template-rows: repeat(3, auto); align-items: center; }
.pad.touch .ctl:last-child { grid-column: 2; }
.pad em { width: 44px; height: 44px; margin: auto; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 10px rgba(204, 255, 0, 0.18); animation: bob 0.6s ease-in-out infinite alternate; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; color: var(--pale); }
.ctl kbd { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 12px; border: 2px solid var(--lime); background: var(--panel); box-shadow: 0 5px 0 #5c7300; font: 700 1.6rem 'JetBrains Mono', monospace; color: var(--lime); }
.pad.touch .ctl kbd { border: 0; background: none; box-shadow: none; height: 34px; font-size: 2rem; }

.gates { display: flex; gap: 12px; width: 100%; }
.gates > div { flex: 1; display: flex; flex-direction: column; gap: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; color: var(--pale); }
.gates s { display: block; height: 110px; border-radius: 12px; background: var(--panel); border: 2px solid rgba(204, 255, 0, 0.35); position: relative; text-decoration: none; }
.gates s::after { content: ''; position: absolute; left: 14%; right: 14%; border-radius: 4px; }
.gates .low::after { bottom: 12px; height: 26px; background: repeating-linear-gradient(90deg, var(--lime) 0 10px, var(--ink) 10px 20px); }
.gates .high::after { top: 18px; height: 34px; background: repeating-linear-gradient(115deg, var(--red) 0 10px, var(--ink) 10px 20px); box-shadow: -4px 44px 0 -15px var(--muted); }
.gates .roof::after { bottom: 12px; height: 56px; left: 22%; right: 22%; background: #2a2f22; border-top: 5px solid var(--red); }

.loot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.loot span, .ladder span { background: var(--panel); border: 2px solid rgba(204, 255, 0, 0.4); border-radius: 12px; padding: 12px 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--lime); }
.loot .hot { background: var(--lime); color: var(--ink); }
.ladder { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ladder span { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; }
.ladder b { font: 500 0.82rem 'Chakra Petch', sans-serif; color: var(--muted); text-transform: none; letter-spacing: 0; text-align: right; }

@media (min-aspect-ratio: 1/1) { #intro .slide { padding-top: 0; } }
@media (max-height: 560px) { .art { height: 120px; } .gates s { height: 80px; } #intro .slide { gap: 8px; padding-top: 0; } }
@media (prefers-reduced-motion: reduce) { #intro .slide, .fig, .pad em { animation: none !important; } }
