/* Sk8er Park: page shell look (ARCHITECTURE §5). Night city palette, text ≥ 16 px phone / 18 px desktop,
   touch targets ≥ 44 px. */
:root {
  --bg: #0b0d1a;
  --panel: #151a2e;
  --panel-2: #1c2240;
  --line: #2a3260;
  --text: #e8ecff;
  --muted: #aeb6dc;
  --cyan: #3ce3ff;
  --magenta: #ff4fd8;
  --lime: #a6ff4f;
  --warn: #ffb347;
  --red: #ff4f5e;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs: 16px;
  --tap: 44px;
  --radius: 12px;
  --topbar: 60px;
  color-scheme: dark;
}
@media (min-width: 700px) { :root { --fs: 18px; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 400 var(--fs)/1.4 var(--font); }
body { overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.15; }
h1 { font-size: 1.5em; }
h2 { font-size: 1.15em; }
h3 { font-size: 1.05em; }
p { margin: 0.4em 0; }
a { color: var(--cyan); }
[hidden] { display: none !important; }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }

/* ---------- buttons ---------- */
.btn {
  min-height: var(--tap); min-width: var(--tap); padding: 0.45em 1.05em; border-radius: 999px;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--text);
  font: 700 var(--fs)/1.1 var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4em; text-decoration: none; white-space: nowrap; transition: transform 0.08s, border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--cyan); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:focus-visible, .iconbtn:focus-visible, .tab:focus-visible, .item:focus-visible, .pin:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }
/* a controller (padnav.js) moves the focus from script, which browsers don't always ring: ring it always */
body[data-input="pad"] :focus { outline: 3px solid var(--lime); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #2fd6f2, #1ba8c9); border-color: #7ff0ff; color: #06121c; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--red); color: #ffd6da; }
.btn.small { padding: 0.3em 0.8em; }
.btn.big { font-size: 1.25em; padding: 0.6em 1.8em; min-height: 56px; }
.btn.locked { opacity: 0.75; border-style: dashed; }
.btn.signin { border-color: var(--magenta); color: #ffd6f6; background: rgba(255, 79, 216, 0.12); white-space: normal; text-align: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.iconbtn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid transparent; background: rgba(21, 26, 46, 0.85);
  color: var(--text); display: inline-grid; place-items: center; cursor: pointer; padding: 0; font: 700 26px/1 var(--font);
}
.iconbtn svg { width: 26px; height: 26px; }
.iconbtn:hover { border-color: var(--cyan); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.hint { color: var(--muted); }
.tag {
  display: inline-block; padding: 0.1em 0.55em; border-radius: 999px; font-size: 0.85em; font-weight: 800;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.tag.guest { color: #0b0d1a; background: var(--warn); border-color: var(--warn); }
.tag.on { color: #0b0d1a; background: var(--lime); border-color: var(--lime); }
.tag.warn { color: #0b0d1a; background: var(--warn); border-color: var(--warn); }
.tag.price { color: var(--cyan); border-color: var(--cyan); }
.guest-line { color: #ffe1b8; }
html[data-gs-tier="member"] .guest-only, html[data-gs-tier="member"] .guest-line { display: none; }

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar); z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(11, 13, 26, 0.95), rgba(11, 13, 26, 0.75)); border-bottom: 1px solid rgba(60, 227, 255, 0.18);
}
#tb-logo { height: 44px; width: auto; cursor: pointer; filter: drop-shadow(0 0 6px rgba(255, 79, 216, 0.35)); }
#tb-me { display: flex; align-items: center; gap: 6px; min-width: 0; }
#tb-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30vw; }
#tb-rep { display: flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: 999px; background: rgba(166, 255, 79, 0.12); border: 1px solid rgba(166, 255, 79, 0.45); font-weight: 800; }
#tb-rep .rep-label { color: var(--lime); font-size: 0.85em; }
.spacer { flex: 1; }
body[data-screen="title"] #topbar { background: transparent; border-color: transparent; }
body[data-screen="title"] #tb-logo, body[data-screen="title"] #tb-me, body[data-screen="title"] #tb-rep { visibility: hidden; }
/* in a zone the bar shrinks to its buttons so the park has the screen */
body.in-zone #topbar { background: transparent; border-color: transparent; pointer-events: none; }
body.in-zone #topbar > * { pointer-events: auto; }
body.in-zone #tb-logo, body.in-zone #tb-me { display: none; }
@media (max-width: 520px) {
  #tb-logo { height: 36px; }
  #tb-name { max-width: 28vw; }
  #tb-offline { display: none; }
  #topbar { gap: 6px; padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 380px) { #tb-logo { display: none; } }

#banner {
  position: fixed; top: var(--topbar); left: 50%; transform: translateX(-50%); z-index: 40; margin-top: 8px;
  background: var(--warn); color: #1a1006; font-weight: 800; padding: 8px 10px 8px 16px; border-radius: 999px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); max-width: calc(100vw - 24px);
}
#version { position: fixed; left: 8px; bottom: 6px; z-index: 30; font-size: 13px; color: rgba(232, 236, 255, 0.55); pointer-events: none; }
body.in-zone #version { opacity: 0.6; }

/* ---------- screens ---------- */
#screens { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; pointer-events: none; }
.screen.on { display: block; }
.screen.on > * { pointer-events: auto; }
#scr-zone.on { pointer-events: none; }

/* title */
#scr-title.on { display: grid; place-items: center; padding: var(--topbar) 16px 32px; overflow-y: auto; pointer-events: auto; }
.title-box { text-align: center; max-width: 760px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.title-logo { width: min(640px, 92vw); height: auto; filter: drop-shadow(0 0 24px rgba(255, 79, 216, 0.35)); animation: bob 3.5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-0.6deg); } }
.title-tag { font-size: 1.1em; font-weight: 700; color: var(--text); text-shadow: 0 2px 8px #000; }
#title-name-row label { font-weight: 700; }
input[type="text"], select {
  min-height: var(--tap); padding: 0.4em 0.8em; border-radius: 10px; border: 2px solid var(--line); background: var(--bg);
  color: var(--text); font: 600 var(--fs) var(--font);
}
input[type="text"]:focus, select:focus { border-color: var(--cyan); outline: none; }
@media (prefers-reduced-motion: reduce) { .title-logo { animation: none; } }

/* hub pins */
.hub-pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute; transform: translate(-50%, -30px); pointer-events: auto; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 4px 10px 8px; width: max-content; min-width: 120px; max-width: 230px; border: 0; background: none; color: var(--text); cursor: pointer;
  font-family: var(--font); font-size: var(--fs);
}
.pin-ico { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(11, 13, 26, 0.85);
  border: 3px solid var(--cyan); box-shadow: 0 0 18px rgba(60, 227, 255, 0.55); transition: transform 0.15s; overflow: hidden; }
.pin-ico img { width: 52px; height: 52px; }
.pin-ico svg { width: 44px; height: 44px; }
.pin-shop .pin-ico { border-color: var(--magenta); box-shadow: 0 0 18px rgba(255, 79, 216, 0.6); }
.pin-myparks .pin-ico { border-color: var(--lime); box-shadow: 0 0 18px rgba(166, 255, 79, 0.5); }
.pin-pier .pin-ico { border-color: var(--warn); box-shadow: 0 0 18px rgba(255, 179, 71, 0.55); }
.pin:hover .pin-ico, .pin:focus-visible .pin-ico { transform: scale(1.08); }
.pin-label { font-weight: 900; font-size: 1.05em; padding: 2px 10px; border-radius: 999px; background: rgba(11, 13, 26, 0.85); white-space: nowrap; }
.pin-sub { font-size: var(--fs); color: var(--muted); background: rgba(11, 13, 26, 0.7); padding: 0 8px; border-radius: 8px; text-align: center; line-height: 1.25; }
.pin.live .pin-sub { color: var(--lime); font-weight: 800; }
/* Beaz Sk8 N More: the graffiti sign is the pin's label (owner 11-15); the name stays for screen readers */
.pin.has-logo { padding-top: 0; max-width: 260px; }
.pin-logo { display: block; width: 200px; height: auto; filter: drop-shadow(0 0 10px rgba(255, 79, 216, 0.55)); transition: transform 0.15s; }
.pin.has-logo:hover .pin-logo, .pin.has-logo:focus-visible .pin-logo { transform: scale(1.05); }
.pin.has-logo .pin-label { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) { .pin-logo { width: 150px; } }
.hub-foot { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 16px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(0deg, rgba(11, 13, 26, 0.9), rgba(11, 13, 26, 0)); pointer-events: none; }
.hub-foot > * { pointer-events: auto; }
.hub-foot .guest-line { margin: 0; max-width: 640px; text-shadow: 0 1px 4px #000; }
html[data-gs-tier="member"] .hub-foot { display: none; }

/* panels: browser + shop */
.panel-screen.on { padding: calc(var(--topbar) + 10px) 12px 28px; overflow-y: auto; pointer-events: auto; }
.panel { max-width: 1180px; margin: 0 auto; background: rgba(21, 26, 46, 0.94); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tab { min-height: var(--tap); padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg); color: var(--muted);
  font: 800 var(--fs) var(--font); cursor: pointer; }
.tab.on { color: #06121c; background: var(--cyan); border-color: var(--cyan); }
.note { margin: 4px 0 10px; }
.note .btn { margin: 4px 8px 4px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { display: grid; grid-template-columns: 112px 1fr; grid-template-rows: 1fr auto; gap: 6px 12px; padding: 12px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--line); }
.card .thumb { grid-row: 1 / 3; border-radius: 8px; }
.card-body { min-width: 0; }
.card-body h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .by, .card .stats { color: var(--muted); margin: 2px 0; }
.card .live { color: var(--lime); font-weight: 800; margin: 2px 0; }
.card-act { display: flex; gap: 8px; flex-wrap: wrap; }
.card.slot .thumb.empty { opacity: 0.45; }
@media (max-width: 520px) {
  .panel { padding: 12px; border-radius: 14px; }
  .cards { grid-template-columns: 1fr; }
  .tabs { margin-left: 0; width: 100%; }
  .tab { flex: 1; padding: 0 8px; }
}

/* shop */
.rep-chip { font-weight: 900; color: var(--lime); padding: 4px 12px; border: 1px solid rgba(166, 255, 79, 0.5); border-radius: 999px; }
.shop-body { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; align-items: start; }
.shop-left { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
.shop-preview { width: 100%; height: 300px; border-radius: 14px; background: radial-gradient(ellipse at 50% 85%, #1d2a52, #0f1328 70%); border: 1px solid var(--line); }
.shop-decks { width: 100%; height: 260px; border-radius: 14px; background: #0f1328; border: 1px solid var(--line); }
.shop-preview.drop, .shop-decks.drop { outline: 3px dashed var(--magenta); }
.shop-items { min-width: 0; }
.shop-sec { margin-bottom: 18px; }
.shop-sec h2 { margin-bottom: 8px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.item { min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; font: 700 var(--fs) var(--font); text-align: center; }
.item:hover { border-color: var(--cyan); }
.item.on { border-color: var(--lime); box-shadow: 0 0 0 2px rgba(166, 255, 79, 0.25) inset; }
.item-name { line-height: 1.15; }
.sw.dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); display: grid; place-items: center; }
.sw.dot.txt { background: var(--panel-2); font-weight: 900; }
.sw.deck { display: block; }
.mydecks .row { margin-bottom: 8px; }
.items.decks { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.deckcard { cursor: default; }
.deckcard .row { justify-content: center; margin: 0; }
@media (max-width: 760px) {
  .shop-body { grid-template-columns: 1fr; }
  .shop-left { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .shop-left .hint { grid-column: 1 / 3; }
  .shop-preview, .shop-decks { height: 220px; }
  .items { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
}

/* loading + zone */
#scr-loading.on { display: grid; place-items: center; pointer-events: auto; }
.loading-box { text-align: center; }
.loading-box img { width: min(358px, 80vw); height: auto; image-rendering: pixelated; }
.loading-box p { font-weight: 800; font-size: 1.2em; }
.zone-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px; pointer-events: auto; }

/* ---------- modals ---------- */
#modal-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-wrap { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 12, 0.6); pointer-events: auto; overflow-y: auto; }
.modal { position: relative; width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6); }
.modal h2 { margin: 0 44px 10px 0; font-size: 1.3em; }
.modal .row.end { margin-top: 14px; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.settings { display: flex; flex-direction: column; gap: 10px; }
label.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: var(--tap); padding-top: 8px; }
label.check input { width: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--lime); }
label.range { display: flex; align-items: center; gap: 12px; min-height: var(--tap); }
label.range input[type="range"] { flex: 1; accent-color: var(--cyan); height: 32px; }
.player-card .pcard { display: flex; flex-direction: column; align-items: center; }
.card-skater { border-radius: 14px; background: radial-gradient(ellipse at 40% 85%, #1d2a52, #0f1328 70%); }

/* deck editor */
.modal.de { width: min(1100px, 100%); }
.de-body { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 420px); gap: 16px; }
.de-main { position: relative; height: min(72vh, 680px); border-radius: 14px; border: 1px solid var(--line);
  background: repeating-conic-gradient(#1a1f38 0 25%, #12162b 0 50%) 0 0 / 24px 24px; }
.de-main.drop { outline: 3px dashed var(--magenta); outline-offset: -6px; }
.de-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; border-radius: 14px; }
.de-canvas:active { cursor: grabbing; }
.de-empty { position: absolute; inset: auto 12px 16px 12px; text-align: center; background: rgba(11, 13, 26, 0.85); border-radius: 12px; padding: 10px; }
.de-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.de-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.de-label { font-weight: 700; }
.de-bgs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bgsw { width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); cursor: pointer; }
.bgsw.wood { background: repeating-linear-gradient(90deg, #d9b47a 0 6px, #c99e62 6px 9px); }
.de-bgs input[type="color"] { width: 56px; height: var(--tap); border: 2px solid var(--line); border-radius: 10px; background: var(--bg); padding: 2px; }
.de-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.de-prev { width: 100%; height: 150px; border-radius: 12px; background: radial-gradient(ellipse at 50% 80%, #1d2a52, #0f1328 70%); border: 1px solid var(--line); }
.rights span { font-size: 0.95em; }
.de-error { color: #ffc2c8; font-weight: 700; min-height: 1.2em; }
@media (max-width: 760px) {
  .modal-wrap.de-wrap { padding: 0; place-items: stretch; }
  .modal.de { border-radius: 0; min-height: 100%; padding: 14px; }
  .de-body { grid-template-columns: 1fr; }
  .de-main { height: 46vh; }
  .de-prev { height: 120px; }
}

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(var(--topbar) + 8px); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column;
  gap: 8px; width: min(560px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: rgba(21, 26, 46, 0.96); border: 1px solid var(--cyan); border-radius: 12px; padding: 10px 14px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); transition: opacity 0.35s, transform 0.35s; }
.toast.error { border-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- touch controls (input.js) ---------- */
#touch { position: fixed; inset: auto 0 0 0; height: 0; z-index: 15; display: none; }
#touch.show { display: block; }
.tpad { position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(20px, env(safe-area-inset-bottom)); width: 150px; height: 150px;
  touch-action: none; }
.tpad-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(60, 227, 255, 0.55); background: rgba(11, 13, 26, 0.35); }
.tpad-knob { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%;
  background: rgba(60, 227, 255, 0.55); border: 2px solid #bff6ff; }
.tbtns { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 176px; height: 176px; }
.tbtn { position: absolute; width: 64px; height: 64px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.6); color: #fff;
  font: 800 16px var(--font); touch-action: none; user-select: none; -webkit-user-select: none; background: rgba(11, 13, 26, 0.55); padding: 0; }
.tbtn.on { filter: brightness(1.5); transform: scale(0.94); }
.t-ollie { right: 0; bottom: 0; width: 84px; height: 84px; border-color: var(--lime); background: rgba(166, 255, 79, 0.28); }
.t-flip { right: 96px; bottom: 6px; border-color: var(--cyan); background: rgba(60, 227, 255, 0.25); }
.t-grab { right: 10px; bottom: 96px; border-color: var(--magenta); background: rgba(255, 79, 216, 0.25); }
.t-grind { right: 96px; bottom: 96px; border-color: var(--warn); background: rgba(255, 179, 71, 0.25); }
