:root { --bg: #12161b; --card: #1b2128; --line: #2c343d; --txt: #eceee8; --mut: #a9b0a8; --gold: #ecd680; --g: #2fa152; --y: #f2c230; --r: #d63a3a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--txt); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-tap-highlight-color: transparent; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: #232a33; border-radius: 10px; padding: 8px 12px; }
button:hover { background: #2b343e; }
input { font: inherit; color: var(--txt); background: #10141a; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; }
input:focus { border-color: var(--gold); }
a { color: var(--gold); }
.muted { color: var(--mut); } .small { font-size: 12.5px; }
[hidden] { display: none !important; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; background: radial-gradient(ellipse at top, #24303c, #0d1014 70%); overflow-y: auto; }
#start { background: radial-gradient(ellipse at center, rgba(13,16,20,.35), rgba(13,16,20,.85)); }
.modal { background: rgba(5, 8, 12, .62); backdrop-filter: blur(3px); }
.card { position: relative; width: 100%; max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; margin: auto; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.card h1 { margin: 0 0 4px; font-size: 28px; line-height: 1.15; }
.card h2 { margin: 0 0 12px; font-size: 21px; }
.card .x { position: absolute; top: 10px; right: 10px; padding: 4px 10px; }
.lead { margin: 0 0 6px; color: #d6dbd2; }
.online { margin: 0 0 14px; color: var(--gold); font-weight: 600; font-size: 14px; }
.lbl { margin: 14px 0 6px; font-size: 13px; color: var(--mut); text-transform: uppercase; letter-spacing: .5px; }
.cta { display: block; width: 100%; margin-top: 16px; background: var(--gold); color: #161a1f; font-weight: 700; border: 0; padding: 13px; font-size: 16px; }
.cta:hover { background: #f5e39a; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side { padding: 12px; font-weight: 700; opacity: .55; }
.side.on { opacity: 1; }
.side.s0.on { background: #1e4d2c; border-color: var(--g); }
.side.s1.on { background: #5a1f1f; border-color: var(--r); }

.look .row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.look .row > span { width: 62px; font-size: 12.5px; color: var(--mut); }
.sw { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid transparent; position: relative; }
.sw.on { border-color: var(--gold); box-shadow: 0 0 0 2px #000 inset; }
.sw.lock::after { content: "⭐"; position: absolute; right: -6px; top: -8px; font-size: 12px; }
.opt { padding: 5px 9px; font-size: 13px; }
.opt.on { border-color: var(--gold); background: #3a3420; }
.opt.lock { opacity: .55; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#hud .top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: max(10px, env(safe-area-inset-top)) 12px 0; pointer-events: none; }
#hud .top > * { pointer-events: auto; }
.score { background: rgba(10,13,17,.72); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; font-weight: 800; font-size: 18px; display: flex; gap: 8px; align-items: baseline; }
.score .g { color: #6fdc8c; } .score .r { color: #ff7a7a; } .score .x { color: var(--mut); font-size: 14px; }
.score .tot { color: var(--mut); font-size: 12px; font-weight: 500; }
.btns { display: flex; gap: 6px; }
.btns button, .emotes button { background: rgba(20,25,31,.82); }
.gold { color: var(--gold); border-color: #6d6233 !important; font-weight: 700; }
.emotes { position: absolute; right: 12px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.emotes button { width: 52px; height: 52px; border-radius: 50%; font-size: 22px; padding: 0; }

#chat { position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: min(380px, calc(100vw - 90px)); }
#msgs { max-height: 34vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; margin-bottom: 6px; pointer-events: none; }
.msg { background: rgba(10,13,17,.62); padding: 4px 9px; border-radius: 8px; font-size: 13.5px; text-shadow: 0 1px 2px #000; word-wrap: break-word; animation: fadein .2s; }
.msg b.s0 { color: #6fdc8c; } .msg b.s1 { color: #ff7a7a; }
.msg.prem { background: rgba(80,66,15,.78); border: 1px solid #8a7a35; }
.msg.prem b { color: var(--gold) !important; }
.msg.sys { color: var(--gold); font-style: italic; }
#chatForm { display: flex; gap: 6px; }
#chatForm input { background: rgba(10,13,17,.78); padding: 9px 11px; }
#chatForm button { padding: 0 14px; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

#joy { position: absolute; left: 22px; bottom: 150px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.18); display: none; touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.35); }
.touch #joy { display: block; }
.touch #hint { display: none; }
.hint { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); background: rgba(10,13,17,.6); padding: 4px 12px; border-radius: 20px; font-size: 12.5px; color: var(--mut); white-space: nowrap; pointer-events: none !important; transition: opacity 1s; }
.net { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); background: #7a2a2a; padding: 6px 14px; border-radius: 20px; }

.perks { padding-left: 4px; list-style: none; margin: 0 0 10px; } .perks li { margin: 6px 0; }
.price { font-size: 17px; margin: 8px 0 10px; } .price b { color: var(--gold); font-size: 24px; }
#pQr { display: block; width: 220px; height: 220px; margin: 10px auto; background: #fff; border-radius: 10px; }
.copy { display: flex; gap: 6px; margin: 8px 0; } .copy input { flex: 1; min-width: 0; font-size: 13px; }
.wait { color: var(--gold); text-align: center; }
.err { color: #ff8a8a; min-height: 1em; margin: 8px 0 0; }
.big { font-size: 24px; font-weight: 800; text-align: center; margin: 6px 0; }
details { margin-top: 14px; color: var(--mut); } summary { cursor: pointer; }
.items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.items button.on, .signs button.on { border-color: var(--gold); background: #3a3420; }
.signs { display: flex; flex-wrap: wrap; gap: 6px; } .signs button { font-size: 12.5px; padding: 6px 9px; font-weight: 700; }
.tag { color: var(--gold); text-transform: none; }
.toast { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); z-index: 40; background: #3a3420; border: 1px solid var(--gold); color: var(--gold); padding: 12px 20px; border-radius: 12px; font-weight: 700; }
@media (max-width: 520px) { .score .tot { display: none; } .score { font-size: 15px; padding: 5px 9px; } .btns button { padding: 7px 9px; } #msgs { max-height: 24vh; } .hint { display: none; } }

.charPick { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 14px; font-weight: 700; }
.linkish { background: none; border: 0; color: var(--gold); padding: 8px 0 0; text-decoration: underline; }
.card.shop { max-width: 860px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button.on { border-color: var(--gold); background: #3a3420; color: var(--gold); }
.shopGrid { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.stage { display: flex; flex-direction: column; gap: 8px; }
#preview { width: 100%; aspect-ratio: 1 / 1.1; background: radial-gradient(ellipse at 50% 35%, #3a4756, #161b21 70%); border-radius: 12px; }
.selInfo b { font-size: 18px; } .selInfo p { margin: 4px 0; }
.selInfo .cta { margin-top: 8px; }
.selInfo .row { display: flex; align-items: center; gap: 8px; margin: 6px 0; } .selInfo .row > span { width: 64px; font-size: 12.5px; color: var(--mut); }
.swrow { display: flex; flex-wrap: wrap; gap: 5px; } .swrow .sw { width: 26px; height: 26px; }
.shopList { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-content: start; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.shopItem { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 10px; min-height: 64px; }
.shopItem.sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.shopItem .nm { font-weight: 700; font-size: 14px; }
.shopItem .pr { font-size: 12.5px; color: #6fdc8c; }
.shopItem .pr.buy { color: var(--gold); font-weight: 700; }
.shopItem.using .pr { color: var(--mut); }
.flagSw { width: 54px; height: 36px; border-radius: 4px; background-size: cover; border: 1px solid #0006; }
.buyWhat { font-weight: 700; color: var(--gold); margin: 4px 0; }
#buyBox { border-top: 1px solid var(--line); padding-top: 8px; }
@media (max-width: 700px) {
  .shopGrid { grid-template-columns: 1fr; }
  #preview { aspect-ratio: 1.6 / 1; }
  .shopList { max-height: none; grid-template-columns: repeat(2, 1fr); }
}
