* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0818; color: #f2eefc;
  font-family: "Courier New", ui-monospace, monospace; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; outline: none; }
.hidden { display: none !important; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 6, 22, 0.55); z-index: 10; padding: 16px; }
.panel { background: #17122e; border: 3px solid #f2eefc; box-shadow: 6px 6px 0 #000, inset 0 0 0 3px #3a2f6a; padding: 20px 24px; }
.title-panel { width: min(760px, 100%); max-height: 100%; overflow: auto; }

.logo { margin: 0; font-size: clamp(40px, 8vw, 68px); letter-spacing: 2px; line-height: 1; color: #f2eefc; text-shadow: 4px 4px 0 #ff4fa3, 8px 8px 0 #000; }
.logo span { color: #ffd23f; }
.tag { margin: 10px 0 18px; color: #b9b0de; }

.title-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .title-grid { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 8px; }

.preview-box { display: flex; flex-direction: column; align-items: center; background: linear-gradient(#4d8fe8, #bfe3ff); border: 3px solid #000; padding: 10px 6px 8px; }
#preview { image-rendering: pixelated; width: 72px; height: 88px; }
.preview-name { min-height: 1.3em; font-weight: bold; color: #120e1a; text-align: center; }
.hint { font-size: 12px; color: #26305a; }

label { font-size: 13px; color: #b9b0de; margin-top: 6px; }
input { font: inherit; font-size: 18px; padding: 8px 10px; background: #0a0818; color: #fff; border: 3px solid #f2eefc; outline: none; }
input:focus { border-color: #ffd23f; }
button { font: inherit; cursor: pointer; }
#play { font-size: 20px; font-weight: bold; padding: 10px; background: #ffd23f; color: #120e1a; border: 3px solid #000; box-shadow: 4px 4px 0 #000; }
#play:hover { background: #ffe680; }
#play:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }

.controls .warn { color: #ff8aa0; }
.controls { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; color: #cfc8ee; line-height: 1.9; }
kbd { display: inline-block; padding: 0 5px; margin: 0 1px; border: 2px solid #6a5fa8; border-bottom-width: 3px; background: #241d48; font: inherit; font-size: 12px; line-height: 1.4; }

.week-box { background: #0a0818; border: 2px solid #3a2f6a; padding: 8px 10px; line-height: 1.7; font-size: 14px; }
.week-box b { color: #ffd23f; }

.board-tabs { display: flex; gap: 6px; }
.board-tabs button { flex: 1; padding: 5px; background: #241d48; color: #cfc8ee; border: 2px solid #3a2f6a; }
.board-tabs button.active { background: #ff4fa3; color: #120e1a; border-color: #000; font-weight: bold; }

.board-list { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.board-list li { display: flex; gap: 10px; padding: 4px 6px; border-bottom: 1px dashed #3a2f6a; }
.board-list li:nth-child(1) .rk { color: #ffd23f; }
.board-list li:nth-child(2) .rk { color: #d8dde8; }
.board-list li:nth-child(3) .rk { color: #e0904a; }
.board-list li.me { background: #3a2f6a; }
.board-list .rk { width: 2.2em; font-weight: bold; }
.board-list .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list .ht { font-weight: bold; color: #8ef6ff; }
.board-list .empty { color: #8a82b0; justify-content: center; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-left, .hud-right { position: absolute; top: 12px; padding: 8px 12px; background: rgba(10, 8, 24, 0.6); border: 2px solid rgba(242, 238, 252, 0.6); text-shadow: 2px 2px 0 #000; font-size: 14px; line-height: 1.5; }
.hud-left { left: 50%; transform: translateX(-50%); text-align: center; min-width: 200px; }
.hud-right { right: 12px; text-align: right; }
.hud-left .big { font-size: 34px; font-weight: bold; color: #ffd23f; line-height: 1.1; }
.hud-left b, .hud-right b { color: #8ef6ff; }
.roundtok { color: #ffd23f; font-size: 12px; }
.roundtok:empty { display: none; }
.zone { color: #ffb0e0; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.dim { color: #8a82b0; font-size: 12px; }
.board { position: absolute; right: 12px; top: 80px; width: 280px; pointer-events: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 10%; transform: translate(-50%, 20px); opacity: 0; transition: opacity .25s, transform .25s; z-index: 20;
  background: #17122e; border: 3px solid #ffd23f; box-shadow: 4px 4px 0 #000; padding: 10px 16px; font-weight: bold; pointer-events: none; text-align: center; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.center { bottom: auto; top: 50%; transform: translate(-50%, calc(-50% + 20px)) scale(0.9); font-size: clamp(18px, 2.6vw, 26px); padding: 16px 24px; border-width: 4px; box-shadow: 6px 6px 0 #000, inset 0 0 0 3px #ff4fa3; color: #ffd23f; text-shadow: 2px 2px 0 #000; }
#toast.center.show { transform: translate(-50%, -50%) scale(1); }

.board-list .wins { color: #ffd23f; font-size: 13px; }
#banner { position: fixed; left: 50%; top: 9%; transform: translate(-50%, -20px) scale(0.9); opacity: 0; transition: opacity .3s, transform .3s; z-index: 25;
  background: #17122e; border: 4px solid #ffd23f; box-shadow: 6px 6px 0 #000, inset 0 0 0 3px #ff4fa3; padding: 18px 26px; text-align: center; pointer-events: none; max-width: 92vw; }
#banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#banner .b1 { font-size: clamp(20px, 3.4vw, 34px); font-weight: bold; color: #ffd23f; text-shadow: 3px 3px 0 #000; }
#banner .b2 { margin-top: 6px; color: #cfc8ee; }

/* ---------- accounts ---------- */
.err { color: #ff8aa0; font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.secondary { font: inherit; font-size: 15px; padding: 7px 10px; background: #241d48; color: #f2eefc; border: 3px solid #000; box-shadow: 3px 3px 0 #000; cursor: pointer; }
.secondary:hover { background: #3a2f6a; }
.account-box { background: #0a0818; border: 2px solid #3a2f6a; padding: 6px 8px; font-size: 13px; color: #cfc8ee; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.account-box b { color: #8ef6ff; }
.account-box button { font: inherit; font-size: 12px; padding: 2px 7px; background: #241d48; color: #f2eefc; border: 2px solid #6a5fa8; cursor: pointer; }
.account-box button.hot { background: #ff4fa3; color: #120e1a; border-color: #000; font-weight: bold; }
.account-box .why { flex-basis: 100%; color: #8a82b0; font-size: 12px; }
#shop-btn { font-weight: bold; }
#shop-btn .tok { color: #ffd23f; }

#shop, #auth { z-index: 30; background: rgba(8, 6, 22, 0.7); }
.auth-panel { width: min(360px, 100%); display: flex; flex-direction: column; gap: 6px; }
.auth-panel h2, .shop-head h2 { margin: 0; color: #ffd23f; text-shadow: 3px 3px 0 #000; }
.auth-panel p { margin: 0 0 4px; font-size: 13px; }
.auth-row { display: flex; gap: 8px; margin-top: 6px; }
.auth-row button[type=submit] { flex: 1; font: inherit; font-weight: bold; padding: 8px; background: #ffd23f; color: #120e1a; border: 3px solid #000; box-shadow: 3px 3px 0 #000; cursor: pointer; }
#auth-switch { color: #8ef6ff; font-size: 13px; margin-top: 4px; }

/* ---------- shop ---------- */
.shop-panel { width: min(720px, 100%); max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.shop-head { display: flex; align-items: center; gap: 14px; }
.shop-head .wallet { margin-left: auto; font-size: 18px; }
.shop-head .wallet b { color: #ffd23f; }
.shop-head .x { font: inherit; font-size: 18px; background: none; color: #f2eefc; border: 2px solid #6a5fa8; padding: 0 8px; cursor: pointer; }
.shop-body { display: grid; grid-template-columns: 1fr 200px; gap: 12px; }
@media (max-width: 640px) { .shop-body { grid-template-columns: 1fr; } }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; align-content: start; }
.card { background: #0a0818; border: 2px solid #3a2f6a; padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-align: center; }
.card:hover { border-color: #6a5fa8; }
.card.sel { border-color: #ffd23f; }
.card.worn { background: #1d2a1a; border-color: #5ad66a; }
.card canvas { width: 54px; height: 54px; image-rendering: pixelated; }
.card .cname { font-size: 12px; font-weight: bold; min-height: 2.4em; display: flex; align-items: center; }
.card button { font: inherit; font-size: 12px; padding: 3px 6px; width: 100%; cursor: pointer; border: 2px solid #000; background: #8ef6ff; color: #120e1a; font-weight: bold; }
.card.buy button { background: #ffd23f; }
.card.poor button { background: #4a4266; color: #b9b0de; }
.card.worn button { background: #241d48; color: #cfc8ee; }
.card .cstate { font-size: 12px; color: #5ad66a; font-weight: bold; padding: 3px; }
.shop-side { display: flex; flex-direction: column; gap: 8px; align-items: center; }
#shop-preview { width: 184px; height: 184px; image-rendering: pixelated; border: 3px solid #000; }
#shop-detail { font-size: 13px; text-align: center; }
#shop-msg { font-size: 13px; color: #b9b0de; min-height: 1.4em; }
#shop-msg.err { color: #ff8aa0; font-weight: bold; }
#shop-msg.ok { color: #5ad66a; font-weight: bold; }
#shop-msg b { color: #ffd23f; }

/* ---------- phones: coming soon (mobile.js) ---------- */
#mobile { position: fixed; inset: 0; z-index: 100; background: #0a0818; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; text-align: center; overflow: auto; }
#mobile .logo { font-size: clamp(40px, 13vw, 64px); }
#mobile canvas { width: min(72vw, 288px); aspect-ratio: 96 / 150; height: auto; image-rendering: pixelated; border: 3px solid #f2eefc; box-shadow: 6px 6px 0 #000, inset 0 0 0 3px #3a2f6a; }
#mobile p { margin: 0; color: #cfc8ee; font-size: 15px; line-height: 1.5; max-width: 320px; }
#mobile .who { color: #ffd23f; font-weight: bold; font-size: 13px; min-height: 1.5em; }
#mobile a { color: #8ef6ff; font-size: 13px; }

/* ---------- version / beta ---------- */
.logo-row { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.beta-badge { margin-top: 6px; padding: 4px 9px; background: #ff4fa3; color: #120e1a; font-weight: bold; font-size: 14px; letter-spacing: 1px;
  border: 3px solid #000; box-shadow: 3px 3px 0 #000; transform: rotate(-6deg); white-space: nowrap; cursor: help; }
.build { position: fixed; left: 8px; bottom: 6px; z-index: 6; font-size: 11px; color: rgba(242, 238, 252, 0.7); text-shadow: 1px 1px 0 #000; pointer-events: none; }
