/* Cartridge — styles */
:root {
  --bg: #110f1a;
  --bg-2: #171425;
  --surface: #1d1a2c;
  --surface-2: #262238;
  --surface-3: #312c47;
  --line: #342f4d;
  --text: #eeebf8;
  --muted: #a49dbf;
  --faint: #6f6990;
  --accent: #8b7bff;
  --accent-strong: #6d5cf0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(139, 123, 255, 0.16);
  --ok: #5ee0a0;
  --warn: #ffc65c;
  --danger: #ff7a85;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Focus is only drawn when navigating by keyboard or controller */
:focus { outline: none; }
:root[data-input="keyboard"] :focus-visible,
:root[data-input="gamepad"] :focus {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
:root[data-input="gamepad"] .game-card:focus,
:root[data-input="keyboard"] .game-card:focus-visible { outline-offset: 4px; transform: translateY(-2px); }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; text-align: left;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent-strong); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); }
.btn-danger { background: rgba(255, 122, 133, 0.12); border-color: rgba(255, 122, 133, 0.35); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: flex-start; }
.btn-text { display: flex; flex-direction: column; min-width: 0; }
.btn-text small { font-weight: 400; color: var(--muted); font-size: 13px; line-height: 1.3; margin-top: 2px; }
.btn-primary .btn-text small { color: rgba(255,255,255,.78); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------- library --- */
.library { min-height: 100%; padding: calc(var(--safe-t) + 8px) max(16px, var(--safe-r)) calc(var(--safe-b) + 40px) max(16px, var(--safe-l)); max-width: 1200px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 0 18px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark { width: 34px; height: 34px; }
.brand h1 { font-size: 20px; letter-spacing: -0.01em; margin: 0; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.topbar .btn { min-height: 40px; padding: 8px 14px; }
@media (max-width: 520px) { .topbar .btn .label { display: none; } .topbar .btn { padding: 8px 10px; } }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 2px 12px; font-weight: 700; }

.continue {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0;
  border-radius: 20px; overflow: hidden; background: var(--surface); border: 1px solid var(--line);
  text-align: left; padding: 0; width: 100%; color: inherit;
}
.continue:hover { border-color: var(--surface-3); }
.continue-shot { position: relative; aspect-ratio: 3 / 2; background: #000; }
.continue-shot img, .continue-shot .cover-gen { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; display: block; }
.continue-info { padding: 20px; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; }
.continue-info .eyebrow { color: var(--accent); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.continue-info h2 { margin: 0; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.continue-info .meta { color: var(--muted); font-size: 14px; }
.continue-info .play { margin-top: 8px; align-self: flex-start; pointer-events: none; }
@media (max-width: 640px) { .continue { grid-template-columns: 1fr; } .continue-info { padding: 16px; } .continue-info h2 { font-size: 19px; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
@media (max-width: 420px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
.game-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; overflow: hidden; color: inherit; transition: transform .15s, border-color .15s;
}
.game-card:hover { border-color: var(--surface-3); transform: translateY(-2px); }
.cover { position: relative; aspect-ratio: 1 / 1; background: var(--bg-2); display: grid; place-items: center; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.cover-gen {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px; font-weight: 800; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.35); overflow-wrap: anywhere;
}
.cover-gen::before {
  content: ""; position: absolute; inset: 0; opacity: .22;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 1.5px); background-size: 10px 10px;
}
.cover-gen span { position: relative; }
.badge {
  position: absolute; top: 8px; left: 8px; font: 700 10px/1 var(--mono); letter-spacing: .06em;
  padding: 5px 7px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px);
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-title { font-weight: 650; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; }
.card-more { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; border-radius: 10px; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); color: #fff; }
.card-more:hover { background: rgba(0,0,0,.7); }

.empty {
  border: 2px dashed var(--line); border-radius: 22px; padding: 44px 22px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty h2 { color: var(--text); margin: 6px 0 0; font-size: 20px; }
.empty p { margin: 0; max-width: 420px; }
.drop-hint {
  position: fixed; inset: 12px; border: 3px dashed var(--accent); border-radius: 24px; background: rgba(17,15,26,.85);
  display: grid; place-items: center; font-size: 22px; font-weight: 700; z-index: 50; pointer-events: none;
}
.uploads { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.upload-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.upload-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { width: 90px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.pad-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--accent-soft); color: var(--text); margin-bottom: 4px; font-size: 14px;
}
.pad-banner .icon { color: var(--accent); }
.foot { margin-top: 36px; color: var(--faint); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- login --- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login .brand-mark { width: 64px; height: 64px; margin: 0 auto; }
.login h1 { margin: 0; }
.login p { margin: 0; color: var(--muted); }
.field { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.field:focus { border-color: var(--accent); outline: none; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

/* --------------------------------------------------------------- sheets --- */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(6, 5, 12, 0.6);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
}
.scrim.in { opacity: 1; }
.sheet {
  width: min(560px, 100%); max-height: calc(100% - 24px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow);
  transform: translateY(24px); transition: transform .22s cubic-bezier(.2,.8,.2,1);
  padding-bottom: var(--safe-b);
}
.scrim.in .sheet { transform: none; }
@media (min-width: 700px) and (min-height: 500px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--line); max-height: min(86vh, 820px); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); max-height: calc(100% - 16px); width: min(640px, calc(100% - 24px)); }
}
.sheet-narrow { width: min(440px, 100%); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px 20px; }
.sheet-head h2 { margin: 0 auto 0 0; font-size: 18px; line-height: 1.3; }
.sheet-body { padding: 8px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.choice { display: flex; flex-direction: column; gap: 14px; }
.choice-msg { margin: 0; color: var(--muted); }
.choice-actions { display: flex; flex-direction: column; gap: 10px; }
.choice-thumb { width: 100%; aspect-ratio: 3/2; border-radius: 12px; image-rendering: pixelated; background: #000; object-fit: cover; display: block; }

.menu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 380px) { .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.menu-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 6px; min-height: 84px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 13px; font-weight: 600; text-align: center;
}
.menu-tile .icon { width: 24px; height: 24px; }
.menu-tile:hover { background: var(--surface-3); }
.menu-tile[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.menu-tile.primary { background: var(--accent-strong); border-color: transparent; color: #fff; }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.menu-list .btn { justify-content: flex-start; }
.menu-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.menu-row label { flex: none; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.menu-row input[type="range"] { flex: 1; }
.menu-sub { color: var(--muted); font-size: 13px; margin: 14px 2px 4px; }

input[type="range"] { accent-color: var(--accent); height: 28px; }
select.field { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

/* save-state slots */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.slot {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.slot:hover { border-color: var(--accent); }
.slot-img { aspect-ratio: 3 / 2; background: #000 center/cover no-repeat; image-rendering: pixelated; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.slot-info { padding: 7px 9px 9px; font-size: 12px; line-height: 1.3; }
.slot-info b { display: block; font-size: 13px; }
.slot-info span { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.auto .slot-info b { color: var(--accent); }

/* settings */
.set-section { margin-top: 18px; }
.set-section:first-child { margin-top: 4px; }
.set-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row > span { min-width: 0; }
.set-row small { display: block; color: var(--muted); font-size: 12px; }
.set-row .field { width: auto; min-height: 40px; padding: 8px 12px; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 34px; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.bind-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.bind-list .lbl { font-size: 14px; }
.bind-btn { min-width: 110px; min-height: 38px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); font: 600 13px var(--mono); }
.bind-btn.listening { border-color: var(--accent); color: var(--accent); animation: pulse 1s infinite; }
.bind-btn.live { border-color: var(--ok); color: var(--ok); }
@keyframes pulse { 50% { opacity: .55; } }
.pad-list { display: flex; flex-direction: column; gap: 8px; }
.pad-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; }
.pad-item small { color: var(--muted); display: block; font-size: 12px; overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.note.warn { color: var(--warn); }
.backup-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.backup-row span { flex: 1; min-width: 0; }
.backup-row small { display: block; color: var(--muted); }
.backup-row .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ---------------------------------------------------------------- toasts --- */
.toasts { position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 12px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 999px;
  background: rgba(38, 34, 56, 0.96); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 14px; font-weight: 550;
  opacity: 0; transform: translateY(-8px); transition: opacity .2s, transform .2s;
}
.toast.in { opacity: 1; transform: none; }
.toast .icon { width: 18px; height: 18px; color: var(--accent); }
.toast-ok .icon { color: var(--ok); }
.toast-warn .icon { color: var(--warn); }
.toast-error .icon { color: var(--danger); }

/* ---------------------------------------------------------------- player --- */
.player {
  position: fixed; inset: 0; z-index: 10; background: #07060b;
  display: grid; grid-template-rows: auto auto 1fr;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.player-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; min-height: 52px; }
.player-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.player-title strong { font-size: 14px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-pill {
  display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; padding: 0;
  color: var(--muted); font-size: 12px; font-weight: 550;
}
.sync-pill .icon { width: 15px; height: 15px; }
.sync-pill[data-status="synced"] .icon { color: var(--ok); }
.sync-pill[data-status="uploading"] .icon, .sync-pill[data-status="pending"] .icon { color: var(--accent); }
.sync-pill[data-status="offline"] .icon, .sync-pill[data-status="error"] .icon { color: var(--warn); }
.sync-pill[data-status="conflict"] { color: var(--danger); }
.sync-pill[data-status="conflict"] .icon { color: var(--danger); }

.stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.screen { position: relative; width: 100%; aspect-ratio: 3 / 2; max-height: 56vh; background: #000; }
#screen {
  outline: none !important;
  display: block; width: 100% !important; height: 100% !important;
  object-fit: contain; image-rendering: pixelated; image-rendering: crisp-edges; background: #000;
}
.player[data-smooth="true"] #screen { image-rendering: auto; }
.screen-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px;
  background: rgba(7, 6, 11, 0.86); color: var(--text); font-size: 15px;
}
.screen-overlay .spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen-overlay .progress { width: 180px; margin: 12px auto 0; }
.sound-hint, .ff-badge {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 10px;
  border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 650;
  background: rgba(0,0,0,.72); color: #fff; backdrop-filter: blur(6px);
}
.ff-badge { top: 10px; bottom: auto; left: auto; right: 10px; transform: none; padding: 4px 10px; font: 700 12px var(--mono); pointer-events: none; }

/* Desktop / controller play: big screen, no on-screen pad */
.player[data-touch="off"] { grid-template-rows: auto 1fr; }
.player[data-touch="off"] .touch { display: none; }
.player[data-touch="off"] .stage { padding: 0 12px 12px; }
.player[data-touch="off"] .screen { width: auto; height: 100%; max-height: none; max-width: 100%; aspect-ratio: 3 / 2; }
@supports not (aspect-ratio: 3 / 2) { .player[data-touch="off"] .screen { width: 100%; } }

/* --------------------------------------------------------- touch controls --- */
.touch {
  position: relative; min-height: 0; touch-action: none;
  --u: min(calc((100vw - var(--safe-l) - var(--safe-r)) / 100), 5.2px);
  opacity: var(--touch-opacity, .75);
}
.touch [data-control] {
  position: absolute; display: grid; place-items: center;
  color: rgba(255,255,255,.85); font-weight: 800; letter-spacing: .04em;
  transition: transform .05s, background .05s;
}
.t-shoulder {
  top: 10px; width: calc(var(--u) * 30); height: 40px; border-radius: 12px 12px 18px 18px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); font-size: 15px;
}
.t-l { left: 14px; }
.t-r { right: 14px; }
.t-dpad { left: calc(var(--u) * 4); top: 50%; width: calc(var(--u) * 40); height: calc(var(--u) * 40); transform: translateY(-46%); }
.t-dpad svg { width: 100%; height: 100%; overflow: visible; }
.dpad-shape { fill: rgba(255,255,255,.1); stroke: rgba(255,255,255,.16); stroke-width: 1.5; }
.dpad-arrow { fill: rgba(255,255,255,.45); }
.dpad-hub { fill: rgba(0,0,0,.25); }
.t-dpad[data-dirs~="Up"] .a-up, .t-dpad[data-dirs~="Down"] .a-down, .t-dpad[data-dirs~="Left"] .a-left, .t-dpad[data-dirs~="Right"] .a-right { fill: var(--accent); }
.t-dpad.on .dpad-shape { fill: rgba(255,255,255,.16); }
.t-face { position: absolute; right: calc(var(--u) * 4); top: 50%; width: calc(var(--u) * 42); height: calc(var(--u) * 42); transform: translateY(-46%); }
.t-btn {
  width: 46%; height: 46%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9b8cff, #5a49d6 70%); box-shadow: 0 4px 0 #3a2d9a, 0 8px 18px rgba(0,0,0,.35);
  font-size: calc(var(--u) * 5.4);
}
.t-btn span { pointer-events: none; color: rgba(255,255,255,.92); }
.t-a { right: 0; top: 4%; }
.t-b { left: 0; bottom: 4%; }
.t-btn.on { transform: translateY(3px); box-shadow: 0 1px 0 #3a2d9a, 0 4px 10px rgba(0,0,0,.35); filter: brightness(1.15); }
.t-meta { position: absolute; left: 50%; bottom: max(14px, calc(var(--u) * 5)); transform: translateX(-50%); display: flex; gap: 18px; }
.t-meta [data-control] { position: static; }
.t-pill {
  width: calc(var(--u) * 17); height: 30px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14);
  font-size: 10px; letter-spacing: .12em;
}
.touch .on:not(.t-btn):not(.t-dpad) { background: rgba(139,123,255,.45); }

/* Landscape phones: screen in the middle, controls on either side */
@media (orientation: landscape) and (max-height: 560px) {
  .player:not([data-touch="off"]) { grid-template-rows: 1fr; grid-template-columns: 1fr; --u: min(calc(100vh / 100), 7px); }
  .player:not([data-touch="off"]) .player-bar {
    position: absolute; z-index: 3; top: calc(var(--safe-t) + 2px); left: 50%; transform: translateX(-50%);
    min-height: 0; padding: 0; gap: 0; background: rgba(0,0,0,.4); border-radius: 0 0 14px 14px; opacity: .8;
  }
  .player:not([data-touch="off"]) .player-title { display: none; }
  .player:not([data-touch="off"]) .player-bar .icon-btn { width: 40px; height: 34px; }
  .player:not([data-touch="off"]) .stage { grid-area: 1 / 1; height: 100%; }
  .player:not([data-touch="off"]) .screen { height: auto; width: 100%; max-height: 100%; max-width: calc(100% - 2 * (var(--u) * 46)); }
  .player:not([data-touch="off"]) .touch { grid-area: 1 / 1; --u: inherit; pointer-events: none; }
  .player:not([data-touch="off"]) .touch [data-control] { pointer-events: auto; }
  .player:not([data-touch="off"]) .t-dpad { left: calc(var(--safe-l) + var(--u) * 5); top: 58%; width: calc(var(--u) * 36); height: calc(var(--u) * 36); transform: translateY(-50%); }
  .player:not([data-touch="off"]) .t-face { right: calc(var(--safe-r) + var(--u) * 4); top: 58%; width: calc(var(--u) * 38); height: calc(var(--u) * 38); transform: translateY(-50%); }
  .player:not([data-touch="off"]) .t-shoulder { top: calc(var(--safe-t) + 8px); width: calc(var(--u) * 34); }
  .player:not([data-touch="off"]) .t-l { left: calc(var(--safe-l) + 10px); }
  .player:not([data-touch="off"]) .t-r { right: calc(var(--safe-r) + 10px); }
  .player:not([data-touch="off"]) .t-meta { left: 0; right: 0; bottom: calc(var(--safe-b) + 8px); transform: none; justify-content: space-between; padding: 0 calc(var(--u) * 9); pointer-events: none; }
  .player:not([data-touch="off"]) .t-pill { width: calc(var(--u) * 18); height: 28px; }
}

/* Very short portrait screens (small phones) */
@media (orientation: portrait) and (max-height: 640px) {
  .screen { max-height: 44vh; }
  .t-shoulder { height: 34px; top: 6px; }
}

.card-wrap { position: relative; display: flex; }
.card-wrap .game-card { width: 100%; }

.warn-banner {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 10px;
  background: rgba(255, 198, 92, 0.12); border: 1px solid rgba(255, 198, 92, 0.35); color: var(--text); font-size: 14px;
}
.warn-banner .icon { color: var(--warn); margin-top: 1px; }
