/* Spillway: "Kontur" UI — paper, black outlines, hard shadows, monospace numbers. */
:root {
  --ink: #1A1A1A; --sub: #6F6F69; --paper: #F7F7F4; --line: #DADAD4; --soft: #EDEDE8;
  --r: 6px; --sh: 3px 3px 0 #1A1A1A; --sh-sm: 2px 2px 0 #1A1A1A;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
  --sans: -apple-system, "SF Pro Text", system-ui, sans-serif;
  --c0: #2B6BFF; --c1: #11A05B; --c2: #E8383D; --c3: #F0B000;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
.ic { display: block; flex: none; }
.hidden { display: none !important; }

.panel { background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); font-weight: 650; font-size: 15px; transition: transform .08s, box-shadow .08s, background .15s; white-space: nowrap; }
.btn:hover { background: #fff; }
.btn:active, .btn.press { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: #333; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.big { height: 56px; font-size: 17px; padding: 0 26px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sub); }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; }
canvas.layer { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- menu ---------- */
#menu .card { position: absolute; left: 56px; top: 50%; transform: translateY(-50%); width: 400px; padding: 30px 30px 26px; }
#menu h1 { font-family: var(--mono); font-weight: 800; font-size: 50px; letter-spacing: -.02em; line-height: 1; }
#menu h1 span { -webkit-text-stroke: 1.5px var(--ink); color: transparent; }
#menu .tag { margin: 10px 0 24px; color: var(--sub); font-size: 14px; line-height: 1.45; }
#menu .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.inp { height: 44px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: var(--r); background: #fff; outline: none; font-size: 16px; user-select: text; -webkit-user-select: text; }
.inp:focus { box-shadow: var(--sh-sm); }
#menu .row { display: flex; gap: 10px; margin-top: 10px; }
#menu .row .btn { flex: 1; }
#menu .join { display: flex; gap: 10px; margin-top: 10px; }
#menu .join .inp { width: 120px; text-align: center; text-transform: uppercase; letter-spacing: .3em; font-family: var(--mono); font-weight: 700; }
#menu .join .btn { flex: 1; }
#menu .or { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
#menu .or::before, #menu .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#menu .err { min-height: 20px; margin-top: 12px; font-size: 13px; font-weight: 600; }
#menu .err:not(:empty)::before { content: "! "; font-family: var(--mono); font-weight: 800; }
#menu .foot { position: absolute; right: 22px; bottom: 18px; font-family: var(--mono); font-size: 11px; color: var(--sub); }
#menu .keys { margin-top: 16px; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; color: var(--sub); }
.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 5px; border: 1.2px solid var(--ink); border-radius: 4px; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--ink); box-shadow: 1px 1px 0 var(--ink); background: #fff; }

/* ---------- level HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .tl { position: absolute; left: 14px; top: 14px; display: flex; gap: 10px; align-items: flex-start; }
.hud .tc { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hud .tr { position: absolute; right: 14px; top: 14px; display: flex; gap: 10px; align-items: flex-start; }
.pill { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); font-weight: 650; font-size: 14px; }
.money { font-family: var(--mono); font-size: 17px; font-weight: 800; }
.money .gain { font-size: 12px; color: var(--sub); font-weight: 700; }
.who { gap: 10px; }
.who .p { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 650; }
.who .p i { width: 10px; height: 10px; border-radius: 50%; border: 1.2px solid var(--ink); background: var(--c); }
.who .p.off { opacity: .35; }

.pump { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.plunger { position: relative; width: 74px; height: 78px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); cursor: pointer; overflow: hidden; touch-action: none; }
.plunger .handle { position: absolute; top: 6px; left: 50%; width: 48px; margin-left: -24px; transition: transform .1s cubic-bezier(.3, 1.5, .6, 1); }
.plunger .bar { display: block; height: 10px; border-radius: 3px; background: var(--ink); }
.plunger .rod { display: block; width: 6px; height: 32px; margin: 0 auto; background: var(--ink); }
.plunger .box { position: absolute; bottom: 7px; left: 8px; right: 8px; height: 30px; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--c); }
.plunger .box::after { content: ""; position: absolute; left: 50%; top: 6px; width: 16px; height: 4px; margin-left: -8px; border-radius: 2px; background: var(--ink); opacity: .55; }
.plunger.down .handle { transform: translateY(21px); }
.plunger.empty .box { background: repeating-linear-gradient(-45deg, var(--paper) 0 4px, var(--line) 4px 6px); }
.plunger.small { width: 48px; height: 54px; cursor: default; box-shadow: var(--sh-sm); }
.plunger.small .handle { width: 32px; margin-left: -16px; top: 4px; }
.plunger.small .bar { height: 7px; }
.plunger.small .rod { width: 4px; height: 21px; }
.plunger.small .box { height: 20px; left: 6px; right: 6px; bottom: 5px; }
.plunger.small .box::after { top: 4px; width: 10px; margin-left: -5px; height: 3px; }
.plunger.small.down .handle { transform: translateY(14px); }
.pump .water { width: 100%; height: 5px; border: 1.2px solid var(--ink); border-radius: 3px; overflow: hidden; background: var(--paper); }
.pump .water i { display: block; height: 100%; background: var(--c); transition: width .2s; }
.pump .nm { font-family: var(--mono); font-size: 10.5px; font-weight: 700; max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mini { position: relative; width: 340px; height: 52px; padding: 4px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh); cursor: pointer; }
.mini canvas { width: 100%; height: 100%; display: block; }
.lvname { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 3px 8px; background: var(--paper); border: 1.2px solid var(--ink); border-radius: 4px; }
.hud .hint { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); width: max-content; }
.hint { max-width: 460px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; font-size: 13.5px; line-height: 1.4; background: #fff; border: 1.5px solid var(--ink); border-radius: var(--r); box-shadow: var(--sh-sm); transition: opacity .3s; }
.hint button { flex: none; opacity: .6; }
.hint button:hover { opacity: 1; }

.bar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 10px; box-shadow: var(--sh); }
.slot { position: relative; width: 50px; height: 50px; border-radius: var(--r); display: grid; place-items: center; transition: background .12s; }
.slot:hover { background: var(--soft); }
.slot.sel { background: var(--ink); color: var(--paper); }
.slot .n { position: absolute; right: 4px; bottom: 2px; font-family: var(--mono); font-size: 10px; font-weight: 800; }
.slot .k { position: absolute; left: 4px; top: 2px; font-family: var(--mono); font-size: 9px; font-weight: 700; opacity: .45; }
.slot.off { opacity: .28; }
.slot .ink { position: absolute; left: 8px; right: 8px; bottom: 6px; height: 4px; border: 1px solid currentColor; border-radius: 2px; overflow: hidden; }
.slot .ink i { display: block; height: 100%; background: currentColor; }
.slot .tip { position: absolute; bottom: 62px; left: 50%; transform: translateX(-50%); padding: 5px 8px; background: var(--ink); color: var(--paper); border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.slot:hover .tip { opacity: 1; }
.sep { width: 1.5px; height: 30px; background: var(--ink); margin: 0 5px; opacity: .8; }
.bar .rot { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); font-size: 12px; white-space: nowrap; display: flex; gap: 6px; align-items: center; padding: 4px 8px; background: var(--paper); border: 1.2px solid var(--ink); border-radius: 4px; }
.hud .br { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 10px; }
.hud .bl { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 10px; align-items: center; }
.spect { padding: 10px 14px; font-weight: 650; font-size: 14px; }

/* ---------- overlays ---------- */
.veil { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(247, 247, 244, .55); z-index: 50; animation: fade .18s ease-out; }
.modal { width: min(520px, calc(100vw - 32px)); padding: 26px; animation: pop .22s cubic-bezier(.2, 1.4, .5, 1); }
.modal h2 { font-family: var(--mono); font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.modal p { color: var(--sub); font-size: 14.5px; line-height: 1.45; }
.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.97); opacity: 0; } }

.intro { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 40; text-align: center; padding: 22px 34px; animation: pop .3s cubic-bezier(.2, 1.4, .5, 1); pointer-events: none; }
.intro .num { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--sub); letter-spacing: .1em; }
.intro .t { font-family: var(--mono); font-size: 34px; font-weight: 800; margin-top: 4px; }
.intro .cd { font-family: var(--mono); font-size: 14px; margin-top: 8px; font-weight: 700; }
.intro.out { opacity: 0; transform: translate(-50%, -60%); transition: opacity .35s, transform .35s; }

.res-rows { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.res-row { display: grid; grid-template-columns: 14px 1fr 150px 58px; gap: 10px; align-items: center; font-size: 14px; }
.res-row i { width: 12px; height: 12px; border-radius: 50%; border: 1.2px solid var(--ink); background: var(--c); }
.res-row .meter { height: 10px; border: 1.2px solid var(--ink); border-radius: 3px; overflow: hidden; background: var(--paper); }
.res-row .meter b { display: block; height: 100%; background: var(--c); }
.res-row .pc { font-family: var(--mono); font-weight: 800; text-align: right; }
.res-row.rain i, .res-row.rain .meter b { background: linear-gradient(90deg, #E8383D, #F0B000, #11A05B, #2B6BFF, #9B5BFF); }
.res-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; padding-top: 14px; border-top: 1.5px dashed var(--ink); }
.res-total .money { font-size: 28px; }
.stars { font-size: 26px; letter-spacing: 4px; margin-top: 10px; }
.stars .off { -webkit-text-stroke: 1.2px var(--ink); color: transparent; }

.toast { position: fixed; left: 50%; bottom: 170px; transform: translateX(-50%); z-index: 60; padding: 9px 14px; background: var(--ink); color: var(--paper); border-radius: var(--r); font-size: 13.5px; font-weight: 600; animation: pop .2s ease-out; pointer-events: none; }

/* ---------- shop ---------- */
#shop { overflow: hidden; }
#shop .strip { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#shop .floor { position: absolute; left: 0; height: 2px; background: var(--ink); }
#shop .sec { position: absolute; top: 150px; }
#shop .sec > .lbl { position: absolute; top: -34px; left: 0; font-size: 14px; color: var(--ink); font-weight: 800; white-space: nowrap; }
.stall { position: absolute; width: 250px; height: 360px; padding: 18px; display: flex; flex-direction: column; }
.stall .art { height: 120px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 4px; background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(26, 26, 26, .06) 7px 8.5px); }
.stall h3 { font-family: var(--mono); font-size: 17px; font-weight: 800; margin-top: 14px; }
.stall p { font-size: 13px; line-height: 1.4; color: var(--sub); margin-top: 6px; flex: 1; }
.stall .own { font-family: var(--mono); font-size: 12px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; }
.stall .pips { display: flex; gap: 4px; }
.stall .pips i { width: 14px; height: 9px; border: 1.2px solid var(--ink); border-radius: 2px; }
.stall .pips i.on { background: var(--ink); }
.stall .btn { width: 100%; }
.room-card { position: absolute; width: 560px; padding: 26px; }
.code { display: flex; gap: 8px; margin: 12px 0 16px; }
.code b { width: 58px; height: 70px; display: grid; place-items: center; font-family: var(--mono); font-size: 40px; font-weight: 800; border: 1.5px solid var(--ink); border-radius: 6px; box-shadow: var(--sh-sm); background: #fff; }
.plist { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.plist .pl { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 6px; font-weight: 650; background: #fff; }
.plist .pl i { width: 14px; height: 14px; border-radius: 50%; border: 1.2px solid var(--ink); background: var(--c); }
.plist .pl .tagx { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--sub); }
.plist .pl.empty { border-style: dashed; color: var(--sub); background: transparent; font-weight: 500; }
.next-card { position: absolute; width: 520px; padding: 26px; }
.next-card canvas { width: 100%; height: 150px; display: block; border: 1.5px solid var(--ink); border-radius: 4px; margin: 14px 0; background: var(--paper); }
.go { position: absolute; width: 440px; padding: 30px; text-align: center; }
.go .btn { width: 100%; height: 120px; font-size: 30px; font-family: var(--mono); font-weight: 800; gap: 16px; }
.go p { margin-top: 18px; color: var(--sub); font-size: 14px; }
.shop-hud { position: absolute; inset: 0; pointer-events: none; }
.shop-hud > * { pointer-events: auto; }
.shop-hud .tr { position: absolute; right: 14px; top: 14px; display: flex; gap: 10px; }
.shop-hud .tl { position: absolute; left: 14px; top: 14px; display: flex; gap: 10px; }
.shop-hud .bc { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; }
.track { width: 300px; height: 8px; border: 1.5px solid var(--ink); border-radius: 4px; position: relative; background: var(--paper); cursor: pointer; }
.track i { position: absolute; top: 0; bottom: 0; background: var(--ink); border-radius: 2px; }
.cursor { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; transition: none; }
.cursor .nm { position: absolute; left: 14px; top: 18px; padding: 2px 7px; border: 1.2px solid var(--ink); border-radius: 4px; background: var(--c); color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 700; white-space: nowrap; box-shadow: 1.5px 1.5px 0 var(--ink); }
.flash { animation: flash .5s; }
@keyframes flash { 30% { transform: scale(1.06); } }
