/* Giggity Games - dark app-shell design. Surfaces step up by colour, not shadow. */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

:root {
  --bg: #000000;        /* canvas */
  --s1: #121212;        /* panels, cards */
  --s2: #1f1f1f;        /* hover, inputs */
  --s3: #292929;        /* active */
  --line: #333333;
  --text: #ffffff;
  --text-2: #b3b3b3;
  --muted: #73777c;
  --accent: #ff4d5e;    /* Giggity coral: play buttons, active states, logo */
  --accent-hi: #ff6876;
  --font: "Archivo", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --r-card: 6px;
  --r-panel: 8px;
  --pill: 9999px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--font); font-stretch: 100%; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--text); color: #000; padding: 8px 16px; border-radius: var(--pill); font-weight: 700; }
.skip:focus { left: 8px; }
svg.i { width: 24px; height: 24px; fill: currentColor; flex: none; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 8px; padding: 8px; height: 100vh; height: 100dvh; }
.side { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel { background: var(--s1); border-radius: var(--r-panel); }
.nav { padding: 16px 12px 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 12px 16px; }
.brand img { width: 32px; height: 32px; }
.brand span { font-size: 19px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 16px; padding: 8px 12px; border-radius: var(--r-card); color: var(--text-2); text-decoration: none; font-size: 16px; font-weight: 700; transition: color .15s; }
.nav-item:hover, .nav-item.on { color: var(--text); }
.library { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 8px 0; }
.lib-head { display: flex; align-items: center; gap: 12px; padding: 8px 12px; color: var(--text-2); font-size: 16px; font-weight: 700; }
.chips { display: flex; gap: 8px; padding: 8px 8px 12px; flex-wrap: wrap; }
.chip { border: 0; background: var(--s2); color: var(--text); padding: 6px 12px; border-radius: var(--pill); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { background: var(--s3); }
.chip.on { background: var(--text); color: #000; }
.lib-list { list-style: none; margin: 0; padding: 0 0 8px; overflow-y: auto; flex: 1; }
.lib-list a { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: var(--r-card); text-decoration: none; }
.lib-list a:hover { background: var(--s2); }
.lib-list a.on { background: var(--s3); }
.lib-list img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; }
.lib-list b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-list small { color: var(--text-2); font-size: 13px; }
.lib-list > div { min-width: 0; }
.lib-empty { margin: 8px; padding: 16px; background: var(--s2); border-radius: var(--r-panel); }
.lib-empty b { display: block; font-size: 15px; margin-bottom: 4px; }
.lib-empty p { margin: 0; color: var(--text-2); font-size: 13px; }

.main { overflow-y: auto; min-width: 0; position: relative; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(18,18,18,.92); backdrop-filter: blur(8px); border-radius: var(--r-panel) var(--r-panel) 0 0; }
.round { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); display: grid; place-items: center; cursor: pointer; color: var(--text); text-decoration: none; flex: none; }
.round svg.i { width: 18px; height: 18px; }
.search { flex: 1; max-width: 420px; position: relative; }
.search input { width: 100%; height: 44px; border-radius: var(--pill); border: 1px solid transparent; background: var(--s2); color: var(--text); font: 400 15px var(--font); padding: 0 16px 0 46px; outline: none; transition: border-color .15s, background .15s; }
.search input::placeholder { color: var(--text-2); }
.search input:hover { background: var(--s3); }
.search input:focus { border-color: var(--text); background: var(--s3); }
.search svg.i { position: absolute; left: 14px; top: 11px; width: 22px; height: 22px; color: var(--text-2); pointer-events: none; }
.content { padding: 8px 24px 32px; flex: 1; }
.foot { padding: 24px; border-top: 1px solid var(--line); margin: 0 24px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.foot a { color: var(--text-2); }

.tabbar { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 32px; border-radius: var(--pill); border: 0; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; transition: transform .1s, background .15s; white-space: nowrap; }
.btn:hover { transform: scale(1.04); }
.btn:active { transform: scale(1); }
.btn-white { background: var(--text); color: #000; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--muted); height: 40px; padding: 0 20px; font-size: 14px; }
.btn-ghost:hover { border-color: var(--text); }
.btn-ghost.on { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.fab { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--accent); color: #000; display: grid; place-items: center; cursor: pointer; transition: transform .1s, background .15s; text-decoration: none; }
.fab:hover { background: var(--accent-hi); transform: scale(1.06); }
.fab svg.i { width: 24px; height: 24px; }
.fab-big { width: 60px; height: 60px; }
.fab-big svg.i { width: 28px; height: 28px; }
.fab:disabled { opacity: .4; cursor: default; transform: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: var(--pill); background: var(--s3); color: var(--text-2); font-size: 12px; font-weight: 600; }
.tag.beta { background: var(--accent); color: #000; }

/* ---------- Home ---------- */
.promo { position: relative; display: flex; align-items: center; gap: 24px; padding: 24px; margin: 8px 0 32px; border-radius: var(--r-panel); overflow: hidden;
  background: linear-gradient(115deg, #ff4d5e 0%, #c0309a 45%, #5b2fd6 75%, #2a49e8 100%); }
.promo img { width: 180px; height: 180px; border-radius: var(--r-card); object-fit: cover; flex: none; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.promo > div { min-width: 0; }
.promo .kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.promo h2 { font-size: clamp(28px, 4.2vw, 48px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 8px; }
.promo p { margin: 0 0 20px; font-size: 15px; max-width: 46ch; color: rgba(255,255,255,.88); }
.promo .acts { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.promo .btn-ghost { border-color: rgba(255,255,255,.7); }

.sec { margin-bottom: 24px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 12px; margin-bottom: 4px; }
.sec-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.sec-head h2 a { text-decoration: none; }
.sec-head h2 a:hover, .sec-head .all:hover { text-decoration: underline; }
.sec-head .all { color: var(--text-2); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.sec-note { color: var(--text-2); font-size: 13px; margin: 0 12px 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 0 4px; }
.empty-msg { color: var(--text-2); padding: 24px 12px; font-size: 15px; }

.card { position: relative; display: block; padding: 12px; border-radius: var(--r-panel); text-decoration: none; transition: background .2s; min-width: 0; }
.card:hover, .card:focus-visible { background: var(--s2); }
.card .art { position: relative; aspect-ratio: 1; border-radius: var(--r-card); overflow: hidden; background: var(--s3); }
.card .art img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: 15px; font-weight: 600; margin: 10px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .fab { position: absolute; right: 8px; bottom: 8px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s, background .15s; box-shadow: 0 8px 8px rgba(0,0,0,.3); }
.card:hover .fab, .card:focus-visible .fab { opacity: 1; transform: none; }
.card .fab:hover { transform: scale(1.06); }
.card .corner { position: absolute; left: 8px; top: 8px; }
.card.soon .art img { filter: saturate(.5) brightness(.6); }
.card.soon .corner { background: rgba(0,0,0,.7); color: var(--text); }

/* ---------- Game page ---------- */
.game .top { background: color-mix(in srgb, var(--tint, #333) 92%, #000); backdrop-filter: none; }
.hero { display: flex; align-items: flex-end; gap: 24px; padding: 32px 24px 24px;
  background: linear-gradient(180deg, var(--tint, #333) 0%, color-mix(in srgb, var(--tint, #333) 35%, var(--s1)) 100%); }
.hero img { width: 232px; height: 232px; border-radius: var(--r-card); object-fit: cover; flex: none; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.hero .kicker { font-size: 13px; font-weight: 600; }
.hero h1 { font-size: clamp(32px, 5.5vw, 72px); line-height: 1; font-weight: 800; letter-spacing: -.04em; margin: 8px 0 12px; overflow-wrap: anywhere; }
.hero .meta { font-size: 14px; color: rgba(255,255,255,.85); }
.hero .meta b { color: var(--text); }
.bar { display: flex; align-items: center; gap: 16px; padding: 24px; flex-wrap: wrap;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint, #333) 35%, var(--s1)) 0%, var(--s1) 100%); }
.bar .icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.bar .icon-btn:hover { color: var(--text); transform: scale(1.05); }
.bar .icon-btn:disabled { opacity: .35; cursor: default; transform: none; }
.blurb { color: var(--text-2); font-size: 16px; max-width: 64ch; margin: 0 0 20px; }
.notice { background: var(--s2); border-radius: var(--r-panel); padding: 14px 16px; margin: 0 0 16px; font-size: 14px; color: var(--text-2); }
.notice b { color: var(--text); }
.notice.warn { box-shadow: inset 3px 0 0 var(--accent); }

.stage { position: relative; background: #000; border-radius: var(--r-panel); overflow: hidden; aspect-ratio: 16 / 9; width: 100%; max-width: max(480px, calc((100vh - 120px) * 16 / 9)); }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; max-width: none; }
.stage.idle.running, .stage.idle.running iframe { cursor: none; }
.stage-ctl { position: absolute; top: 12px; right: 12px; z-index: 3; display: none; align-items: center; gap: 2px; padding: 2px 4px; border-radius: 999px; background: rgba(0,0,0,.6); opacity: 1; transition: opacity .4s; }
.stage.running .stage-ctl { display: flex; }
.stage.idle .stage-ctl { opacity: 0; pointer-events: none; }
.stage-fs { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: #fff; display: grid; place-items: center; cursor: pointer; transition: transform .15s, background .15s; }
.stage-fs:hover { background: rgba(255,255,255,.12); transform: scale(1.06); }
.stage-fs:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stage-ctl input[type=range] { width: 84px; }
.vol { display: flex; align-items: center; gap: 2px; }
.vol input[type=range] { width: 96px; }
.vol input[type=range], .stage-ctl input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; margin: 0 6px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) 0, var(--accent) var(--fill, 60%), rgba(255,255,255,.3) var(--fill, 60%)); }
.vol input[type=range]::-webkit-slider-thumb, .stage-ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
.vol input[type=range]::-moz-range-thumb, .stage-ctl input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; }
.vol input[type=range]:focus-visible, .stage-ctl input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.stage-tip { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 120px); padding: 8px 16px; border-radius: 999px; background: rgba(0,0,0,.75); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; text-align: center; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.poster { position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; }
.poster .bgart { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); max-width: none; object-fit: cover; filter: blur(28px) brightness(.45) saturate(1.2); }
.poster .inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 16px; }
.poster .fab { width: 72px; height: 72px; }
.poster .fab svg.i { width: 34px; height: 34px; }
.poster b { font-size: 18px; font-weight: 700; }
.poster small { color: var(--text-2); font-size: 13px; }
.status { min-height: 1.5em; font-size: 13px; color: var(--text-2); margin: 10px 0 0; }
.status.err { color: var(--accent-hi); font-weight: 600; }
.hints { min-height: 1.4em; font-size: 13px; color: var(--muted); margin: 2px 0 0; }

.h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 32px 0 12px; }
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 32px; }
.keys { width: 100%; border-collapse: collapse; font-size: 14px; }
.keys th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0 12px 8px; border-bottom: 1px solid var(--line); }
.keys td { padding: 8px 12px; color: var(--text-2); }
.keys td:first-child { color: var(--text); }
.keys tr:hover td { background: var(--s2); }
.keys tr:hover td:first-child { border-radius: 4px 0 0 4px; }
.keys tr:hover td:last-child { border-radius: 0 4px 4px 0; }
.small { color: var(--text-2); font-size: 13px; margin: 12px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.tile { background: var(--s2); border-radius: var(--r-panel); padding: 16px; }
.tile h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tile p { margin: 0; font-size: 15px; line-height: 1.45; }

@media (max-width: 1100px) and (min-width: 801px) {
  .app { grid-template-columns: 240px minmax(0, 1fr); }
  .promo { flex-direction: column; align-items: flex-start; }
  .promo img { width: 140px; height: 140px; }
  .hero img { width: 180px; height: 180px; }
}
/* ---------- Phones ---------- */
@media (max-width: 800px) {
  .vol input[type=range] { width: 72px; }
  .app { display: block; padding: 0; height: auto; }
  .side { display: none; }
  .main { border-radius: 0; overflow: visible; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .top { border-radius: 0; padding: 10px 16px; top: env(safe-area-inset-top, 0px); }
  .search { max-width: none; }
  .content { padding: 8px 16px 24px; }
  .foot { margin: 0 16px; padding: 20px 0; }
  .promo { flex-direction: column; align-items: flex-start; padding: 20px; }
  .promo img { width: 120px; height: 120px; }
  .sec-head { padding: 0 4px; }
  .sec-note { margin: 0 4px 8px; }
  .sec .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .card { padding: 6px; }
  .card .fab { opacity: 1; transform: none; width: 40px; height: 40px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px 16px 16px; }
  .hero img { width: 160px; height: 160px; }
  .bar { padding: 16px; }
  .stage { aspect-ratio: 4 / 3; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(180deg, rgba(0,0,0,.6), #000 40%); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-2); text-decoration: none; font-size: 11px; font-weight: 600; padding: 4px 12px; }
  .tabbar a.on { color: var(--text); }
}
@media (max-width: 340px) { .sec .grid { grid-template-columns: 1fr; } }
