/* ============================================================================
   NEXUS — design system
   Theme engine: 4 distinct visual languages, not just recolors.
     - nexus   (default): cyber glassmorphism
     - vista   : Windows Vista Glass (glossy aero glassmorphism)
     - xp      : Windows XP Retro (blocky, hard borders, pixel fonts)
     - dracula : Dracula Coder (IDE / code-editor aesthetic)
   Tailwind (Play CDN) handles utility layout; this file owns the signature look.
   ========================================================================== */

:root {
  /* ---- base surfaces ---- */
  --bg: #0f172a;
  --bg-2: #1e293b;
  --panel: rgba(30, 41, 59, 0.5);
  --panel-strong: rgba(15, 23, 42, 0.72);
  --input-bg: rgba(15, 23, 42, 0.6);
  --backdrop: rgba(2, 6, 23, 0.7);
  --shadow: 0 8px 32px rgba(2, 6, 23, 0.45);

  /* ---- text ---- */
  --text: #e2e8f0;
  --text-strong: #ffffff;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent-text: #04101a;

  /* ---- accents ---- */
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --fuchsia: #d946ef;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --violet-soft: #c4b5fd;
  --accent: linear-gradient(135deg, var(--cyan), var(--violet));
  --accent-soft: linear-gradient(135deg,
    color-mix(in srgb, var(--cyan) 14%, transparent),
    color-mix(in srgb, var(--violet) 14%, transparent));

  /* ---- borders / hovers ---- */
  --border: rgba(148, 163, 184, 0.14);
  --border-hover: rgba(148, 163, 184, 0.28);
  --hover: rgba(148, 163, 184, 0.08);
  --hover-2: rgba(148, 163, 184, 0.14);
  --grid-line: rgba(148, 163, 184, 0.04);

  /* ---- cover fallback ---- */
  --cover-a: #1e293b;
  --cover-b: #0f172a;

  /* ---- radius scale (drives each theme's silhouette) ---- */
  --radius: 16px;        /* cards, tiles, modals */
  --radius-sm: 11px;     /* buttons, inputs */
  --radius-xs: 6px;      /* small badges */
  --radius-pill: 999px;  /* pills, chips */

  /* ---- fonts (overridable per-theme AND per-user) ---- */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'Inter', ui-monospace, monospace;
}

/* ============================== THEMES ============================== */

/* ----- Dracula Coder — official Dracula palette, IDE vibe ----- */
html[data-theme="dracula"] {
  --bg: #282a36;
  --bg-2: #44475a;
  --panel: #44475a;
  --panel-strong: #21222c;
  --input-bg: #383a4c;
  --backdrop: rgba(15, 16, 24, 0.78);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);

  --text: #f8f8f2;
  --text-strong: #ffffff;
  --text-dim: #a7b1d4;
  --text-faint: #6272a4;
  --accent-text: #1d1e26;

  --cyan: #8be9fd;
  --violet: #bd93f9;
  --fuchsia: #ff79c6;
  --green: #50fa7b;
  --red: #ff5555;
  --amber: #ffb86c;
  --violet-soft: #d6acff;

  --border: #44475a;
  --border-hover: #6272a4;
  --hover: rgba(98, 114, 164, 0.18);
  --hover-2: rgba(98, 114, 164, 0.32);
  --grid-line: rgba(98, 114, 164, 0.10);

  --cover-a: #44475a;
  --cover-b: #282a36;

  --radius: 4px;
  --radius-sm: 3px;
  --radius-xs: 2px;
  --radius-pill: 3px;

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'JetBrains Mono', 'Fira Code', monospace;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ----- Windows Vista Glass — glossy aero glassmorphism ----- */
html[data-theme="vista"] {
  --bg: #dfeaf6;
  --bg-2: #c8d9ee;
  --panel: rgba(255, 255, 255, 0.45);
  --panel-strong: rgba(255, 255, 255, 0.7);
  --input-bg: rgba(255, 255, 255, 0.65);
  --backdrop: rgba(20, 45, 80, 0.32);
  --shadow: 0 8px 32px rgba(20, 45, 80, 0.16);

  --text: #12233c;
  --text-strong: #0b1a30;
  --text-dim: #3d5a80;
  --text-faint: #6b84a8;
  --accent-text: #ffffff;

  --cyan: #1b8fd6;
  --violet: #2f9b8f;
  --fuchsia: #1b8fd6;
  --green: #2e9e4f;
  --red: #cf3a2f;
  --amber: #c87b1e;
  --violet-soft: #1b8fd6;

  --border: rgba(30, 70, 130, 0.22);
  --border-hover: rgba(30, 70, 130, 0.5);
  --hover: rgba(30, 70, 130, 0.07);
  --hover-2: rgba(30, 70, 130, 0.13);
  --grid-line: rgba(30, 70, 130, 0.05);

  --cover-a: #b9d1ec;
  --cover-b: #dfeaf6;

  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 8px;
  --radius-pill: 999px;

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'Inter', system-ui, sans-serif;
}

/* ----- Windows XP Retro — blocky, hard borders, pixel headers ----- */
html[data-theme="xp"] {
  --bg: #1b4f9e;
  --bg-2: #2563bd;
  --panel: #2a6bc0;
  --panel-strong: #1b4f9e;
  --input-bg: #ffffff;
  --backdrop: rgba(6, 22, 48, 0.6);
  --shadow: 0 4px 0 rgba(6, 22, 48, 0.4);

  --text: #ffffff;
  --text-strong: #ffffff;
  --text-dim: #d7e6f8;
  --text-faint: #9dc1e8;
  --accent-text: #ffffff;

  --cyan: #3b82f6;
  --violet: #7ec850;
  --fuchsia: #3b82f6;
  --green: #7ec850;
  --red: #ff6b5e;
  --amber: #ffb347;
  --violet-soft: #a9d98a;

  --border: #9ec3ef;
  --border-hover: #ffffff;
  --hover: rgba(255, 255, 255, 0.12);
  --hover-2: rgba(255, 255, 255, 0.2);
  --grid-line: rgba(255, 255, 255, 0.05);

  --cover-a: #2563bd;
  --cover-b: #1b4f9e;

  --radius: 0px;
  --radius-sm: 0px;
  --radius-xs: 0px;
  --radius-pill: 0px;

  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Silkscreen', monospace;
  --font-mono: 'Silkscreen', monospace;
}

/* ============================== base ============================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background .3s ease, color .3s ease;
}

/* ---------- ambient background ---------- */
.bg-glow {
  position: fixed;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
  transition: background .3s ease;
}
.bg-glow--cyan    { top: -30vw; left: -15vw; background: var(--cyan); }
.bg-glow--violet  { bottom: -35vw; right: -15vw; background: var(--violet); }

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ---------- layout ---------- */
#app { position: relative; z-index: 1; display: flex; height: 100vh; }

#sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: var(--panel-strong);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border);
}

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.18em;
}
.logo-mark {
  font-size: 20px;
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-text { font-size: 18px; color: var(--text); font-family: var(--font-display); }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all .18s ease;
}
.nav-item:hover { color: var(--text); background: var(--hover); }
.nav-item.is-active {
  color: var(--text-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--cyan) 30%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cyan) 8%, transparent),
              0 4px 20px color-mix(in srgb, var(--cyan) 10%, transparent);
}
.nav-ico { width: 20px; height: 20px; fill: currentColor; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--hover-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.sidebar-foot { margin-top: auto; padding: 12px 8px 0; }
.sync-mini { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--hover); border: 1px solid var(--border); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.sync-dot.is-running { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: pulse 1.2s infinite; }
.sync-dot.is-error { background: var(--red); box-shadow: 0 0 10px var(--red); }
.sync-dot.is-done { background: var(--green); }
.sync-mini-label { font-size: 13px; font-weight: 600; font-family: var(--font-display); }
.sync-mini-sub { font-size: 11px; color: var(--text-faint); }

/* ---------- top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-strong);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 5;
}
#page-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.02em; }
.page-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--hover);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border-hover); background: var(--hover-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ico { width: 16px; height: 16px; fill: currentColor; }

.btn-primary {
  background: var(--accent);
  border: none;
  color: var(--accent-text);
  font-weight: 700;
  box-shadow: 0 4px 20px color-mix(in srgb, var(--cyan) 28%, transparent),
              0 0 0 1px rgba(255,255,255,0.06) inset;
}
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--hover-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.pill.is-running { color: var(--cyan); border-color: color-mix(in srgb, var(--cyan) 40%, transparent); }
.pill.is-error { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.pill.is-done { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }

/* ---------- banner ---------- */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 28px 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, transparent);
  background: var(--accent-soft);
  box-shadow: 0 0 30px color-mix(in srgb, var(--cyan) 12%, transparent);
}
.banner-ico { font-size: 22px; }
.banner-body { flex: 1; }
.banner-title { font-weight: 700; font-size: 15px; font-family: var(--font-display); }
.banner-text { font-size: 13px; color: var(--text-dim); }
.banner-close { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 15px; padding: 6px; }
.banner-close:hover { color: var(--text); }

/* ---------- glass cards ---------- */
.glass-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.glass-card:hover { border-color: var(--border-hover); }

/* ---------- metric cards ---------- */
.metric-card { display: flex; flex-direction: column; }
.metric-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.metric-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; }
.metric-sub { font-size: 12px; color: var(--text-faint); max-width: 60%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-foot { margin-top: 14px; text-align: center; font-size: 13px; color: var(--text-dim); }

.gauge-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto; }
.gauge { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.gauge-bg { stroke: var(--hover-2); }
.gauge-fg {
  stroke: var(--cyan);
  transition: stroke-dashoffset .8s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--cyan) 55%, transparent));
}
.gauge-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}
.gauge-value small { font-size: 15px; color: var(--text-dim); margin-left: 1px; }

.disk-list { display: flex; flex-direction: column; gap: 16px; justify-content: center; flex: 1; }
.disk-item .disk-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.disk-item .disk-row .dim { color: var(--text-dim); }
.disk-empty { color: var(--text-faint); text-align: center; }
.progress { height: 9px; border-radius: var(--radius-pill); background: var(--hover-2); overflow: hidden; }
.progress > i {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--cyan) 50%, transparent);
  transition: width .8s cubic-bezier(.22,1,.36,1);
}

/* ---------- stats strip ---------- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  backdrop-filter: blur(18px);
}
.stat-val { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-dim); }

/* ---------- section head ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 700; }

/* ---------- service tiles ---------- */
.tiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 12px;
  min-height: 108px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  backdrop-filter: blur(18px);
  transition: all .18s ease;
  position: relative;
}
.tile:hover { transform: translateY(-3px); border-color: var(--border-hover); box-shadow: var(--shadow); }
.tile-ico { font-size: 26px; line-height: 1; }
.tile-name { font-size: 13px; font-weight: 600; text-align: center; }
.tile--empty { justify-content: center; color: var(--text-faint); font-size: 13px; text-align: center; border-style: dashed; }

/* ---------- toolbar / search / chips ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { border-color: color-mix(in srgb, var(--cyan) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 12%, transparent); }
.search-box input::placeholder { color: var(--text-faint); }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: var(--text-faint); }

.select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}
.select option { background: var(--bg); color: var(--text); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--hover);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-hover); }
.chip.is-active {
  color: var(--accent-text);
  background: var(--accent);
  border-color: transparent;
  font-weight: 700;
}

.grid-meta { margin-bottom: 12px; font-size: 13px; color: var(--text-dim); }

/* ---------- games grid ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.game-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  cursor: pointer;
  transition: all .2s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cyan) 40%, transparent);
  box-shadow: 0 12px 40px var(--shadow), 0 0 24px color-mix(in srgb, var(--cyan) 14%, transparent);
}
.game-cover { position: relative; aspect-ratio: 460/215; background: linear-gradient(135deg, var(--cover-a), var(--cover-b)); }
.game-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-cover .fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; color: var(--text-faint); font-size: 13px; padding: 0 12px; text-align: center; }
.game-body { padding: 12px 14px 14px; }
.game-title { font-weight: 700; font-size: 14px; line-height: 1.3; font-family: var(--font-display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.game-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.game-meta .badge {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--cyan) 12%, transparent);
  color: var(--cyan);
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
}
.game-meta .badge--violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet-soft); }
.game-meta .badge--amber { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.game-meta .price { margin-left: auto; font-weight: 700; color: var(--green); }
.game-meta .price--free { color: var(--green); }
.game-tags { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.game-tag { font-size: 10.5px; color: var(--text-faint); padding: 2px 7px; border-radius: var(--radius-xs); background: var(--hover); font-family: var(--font-mono); }

.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }

/* ---------- empty states ---------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty-state .big { font-size: 40px; margin-bottom: 10px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-family: var(--font-display); }
.empty-state p { margin: 0 0 16px; font-size: 14px; }

/* ---------- settings ---------- */
.settings-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.settings-card { display: flex; flex-direction: column; gap: 14px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.settings-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.field input, .field textarea {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: color-mix(in srgb, var(--cyan) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 12%, transparent); }
.field .hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; }
.hint { font-size: 12px; color: var(--text-faint); line-height: 1.5; }

.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }

.field-actions { display: flex; align-items: center; gap: 12px; }
.test-result { font-size: 13px; line-height: 1.5; }
.test-result.ok { color: var(--green); }
.test-result.err { color: var(--red); }
.test-result.warn { color: var(--amber); }

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  margin-bottom: 8px;
}
.row-item input { flex: 1; background: transparent; border: none; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.row-item input::placeholder { color: var(--text-faint); }
.row-item .row-remove { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 16px; padding: 4px 6px; }
.row-item .row-remove:hover { color: var(--red); }
.row-color { width: 26px; height: 26px; border-radius: var(--radius-xs); border: 1px solid var(--border); cursor: pointer; padding: 0; }

.save-bar { display: flex; align-items: center; gap: 14px; position: sticky; bottom: 0; padding-top: 6px; }

/* ---------- theme picker ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text);
  transition: all .15s ease;
}
.theme-option:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.theme-option.is-active { border-color: var(--cyan); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cyan) 30%, transparent); }
.theme-swatch { display: flex; gap: 6px; align-items: center; }
.theme-swatch i { width: 22px; height: 22px; border-radius: var(--radius-xs); flex-shrink: 0; border: 1px solid rgba(0,0,0,0.12); }
.theme-swatch .swatch-grad { flex: 1; height: 22px; border-radius: var(--radius-xs); }
.theme-option .theme-name { font-size: 13px; font-weight: 700; font-family: var(--font-display); }
.theme-option .theme-desc { font-size: 11px; color: var(--text-faint); line-height: 1.4; }
.theme-check { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; opacity: 0; transition: opacity .15s; }
.theme-option.is-active .theme-check { opacity: 1; }

/* ---------- font picker ---------- */
.font-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.font-row .select { flex: 0 0 auto; }
.font-row .font-custom {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.font-row .font-custom:focus { border-color: color-mix(in srgb, var(--cyan) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 12%, transparent); }
.font-row .font-custom::placeholder { color: var(--text-faint); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--backdrop);
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
}
.modal { width: 90%; max-width: 440px; text-align: center; padding: 30px 28px; }
.modal-ico { font-size: 40px; margin-bottom: 10px; }
.modal-title { margin: 0 0 10px; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.modal-text { margin: 0 0 22px; color: var(--text-dim); line-height: 1.6; }
.modal-actions { display: flex; justify-content: center; gap: 12px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel-strong);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  animation: slideUp .25s ease;
  max-width: 360px;
}
.toast.ok { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.toast.err { border-color: color-mix(in srgb, var(--red) 40%, transparent); }

/* ---------- animations ---------- */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- scrollbar ---------- */
#content::-webkit-scrollbar { width: 10px; }
#content::-webkit-scrollbar-thumb { background: var(--hover-2); border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: padding-box; }
#content::-webkit-scrollbar-thumb:hover { background: var(--border-hover); background-clip: padding-box; }
#content::-webkit-scrollbar-track { background: transparent; }

/* ============================================================================
   THEME CHARACTER — structural identity for each theme (not just colors)
   ========================================================================== */

/* ============================== DRACULA CODER ============================== */
html[data-theme="dracula"] body { background: #282a36; }
html[data-theme="dracula"] .bg-grid {
  background-image: radial-gradient(rgba(98, 114, 164, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
}
html[data-theme="dracula"] .bg-glow { opacity: 0.14; }
html[data-theme="dracula"] .bg-glow--violet { background: var(--fuchsia); }

html[data-theme="dracula"] #sidebar,
html[data-theme="dracula"] #topbar {
  background: #21222c;
  backdrop-filter: none;
  border-color: #44475a;
}
html[data-theme="dracula"] .glass-card {
  backdrop-filter: none;
  background: #44475a;
  border: 1px solid #44475a;
  border-left: 3px solid #bd93f9;
  box-shadow: none;
}
html[data-theme="dracula"] .glass-card:hover { border-color: #6272a4; border-left-color: #ff79c6; }
html[data-theme="dracula"] .stat { backdrop-filter: none; }
html[data-theme="dracula"] .tile { backdrop-filter: none; }
html[data-theme="dracula"] .nav-item.is-active {
  background: rgba(189, 147, 249, 0.12);
  border: 1px solid #bd93f9;
  box-shadow: none;
  color: #bd93f9;
}
html[data-theme="dracula"] .logo-mark { color: #ff79c6; background: none; -webkit-background-clip: initial; background-clip: initial; }
html[data-theme="dracula"] .btn-primary {
  background: #bd93f9;
  box-shadow: none;
  color: #1d1e26;
}
html[data-theme="dracula"] .chip.is-active { background: #bd93f9; color: #1d1e26; }
html[data-theme="dracula"] .progress > i { background: #bd93f9; box-shadow: none; }

/* ============================== WINDOWS VISTA GLASS ============================== */
html[data-theme="vista"] body {
  background: linear-gradient(135deg, #dfeaf6 0%, #cfe0f2 30%, #e3f3e8 70%, #dfeaf6 100%);
}
html[data-theme="vista"] .bg-glow { opacity: 0.34; filter: blur(110px); }

html[data-theme="vista"] #sidebar,
html[data-theme="vista"] #topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0.28));
  backdrop-filter: blur(30px) saturate(170%);
  border-color: rgba(255, 255, 255, 0.55);
}

html[data-theme="vista"] .glass-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.28));
  border: 1px solid rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(28px) saturate(170%);
  box-shadow:
    0 8px 40px rgba(20, 45, 80, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.28) inset,
    0 1px 0 rgba(255, 255, 255, 0.85) inset;
}
html[data-theme="vista"] .glass-card:hover {
  box-shadow:
    0 12px 48px rgba(20, 45, 80, 0.24),
    0 0 18px rgba(120, 200, 255, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  border-color: rgba(255, 255, 255, 0.85);
}

html[data-theme="vista"] .stat,
html[data-theme="vista"] .tile {
  background: linear-gradient(180deg, rgba(255,255,255,0.5), rgba(255,255,255,0.26));
  backdrop-filter: blur(26px) saturate(170%);
  border-color: rgba(255, 255, 255, 0.6);
}

html[data-theme="vista"] .btn {
  background: linear-gradient(180deg, rgba(255,255,255,0.7), rgba(235,244,255,0.5));
  border: 1px solid rgba(120, 160, 210, 0.6);
  color: #1a3a66;
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 1px 2px rgba(20,45,80,0.12);
}
html[data-theme="vista"] .btn:hover { background: linear-gradient(180deg, #ffffff, #eef6ff); border-color: #6aa5e8; }
html[data-theme="vista"] .btn-primary {
  background: linear-gradient(180deg, #4aa7e8, #1b7fd6);
  color: #ffffff;
  border: 1px solid #1167b5;
  text-shadow: 0 1px 1px rgba(0,0,0,0.25);
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 3px 12px rgba(27,127,214,0.4);
}
html[data-theme="vista"] .btn-primary:hover { background: linear-gradient(180deg, #5cb5f2, #218be0); }

html[data-theme="vista"] .nav-item.is-active {
  background: linear-gradient(180deg, rgba(120,200,255,0.5), rgba(60,150,230,0.35));
  border: 1px solid rgba(120, 180, 240, 0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 0 12px rgba(120,200,255,0.4);
  color: #0b1a30;
}

html[data-theme="vista"] .input-with-btn input,
html[data-theme="vista"] .field input,
html[data-theme="vista"] .search-box input,
html[data-theme="vista"] .select {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(120, 160, 210, 0.55);
  box-shadow: 0 1px 0 rgba(255,255,255,0.85) inset;
}

html[data-theme="vista"] .chip { background: rgba(255,255,255,0.55); border-color: rgba(120,160,210,0.5); color: #2a4a78; }
html[data-theme="vista"] .chip.is-active { background: linear-gradient(180deg, #4aa7e8, #1b7fd6); color: #fff; border-color: #1167b5; }

/* ============================== WINDOWS XP RETRO ============================== */
html[data-theme="xp"] body {
  background: linear-gradient(180deg, #2a6bc0 0%, #1b4f9e 100%);
}
html[data-theme="xp"] .bg-glow { display: none; }
html[data-theme="xp"] .bg-grid { display: none; }

html[data-theme="xp"] #sidebar {
  background: linear-gradient(180deg, #1f63b5, #154a94);
  border-right: 2px solid #0d3a78;
  backdrop-filter: none;
}
html[data-theme="xp"] #topbar {
  background: linear-gradient(180deg, #4a90d9, #2a6bc0);
  border-bottom: 2px solid #0d3a78;
  backdrop-filter: none;
}
html[data-theme="xp"] #page-title { color: #ffffff; text-shadow: 1px 1px 0 rgba(0,0,0,0.25); }

/* solid beveled panels, no blur, hard borders */
html[data-theme="xp"] .glass-card,
html[data-theme="xp"] .stat,
html[data-theme="xp"] .tile,
html[data-theme="xp"] .banner,
html[data-theme="xp"] .modal,
html[data-theme="xp"] .toast,
html[data-theme="xp"] .theme-option {
  backdrop-filter: none;
  background: #2563bd;
  border: 2px solid #9ec3ef;
  box-shadow: inset 1px 1px 0 #7fb2e8, inset -1px -1px 0 #0d3a78;
}
html[data-theme="xp"] .game-card {
  backdrop-filter: none;
  background: #2563bd;
  border: 2px solid #9ec3ef;
  box-shadow: inset 1px 1px 0 #7fb2e8, inset -1px -1px 0 #0d3a78;
}
html[data-theme="xp"] .game-card:hover { transform: none; border-color: #ffffff; box-shadow: inset 1px 1px 0 #7fb2e8, inset -1px -1px 0 #0d3a78, 0 0 12px rgba(255,255,255,0.4); }

html[data-theme="xp"] .btn {
  background: linear-gradient(180deg, #f8fafc, #d6e4f5);
  border: 2px solid #0d3a78;
  color: #0d3a78;
  box-shadow: inset 1px 1px 0 #ffffff, inset -1px -1px 0 #9cb8dd;
  border-radius: 0;
}
html[data-theme="xp"] .btn:hover { background: linear-gradient(180deg, #ffffff, #e8f1fc); }
html[data-theme="xp"] .btn-primary {
  background: linear-gradient(180deg, #7ec850, #4f9e2f);
  border: 2px solid #2f6b15;
  color: #ffffff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
  box-shadow: inset 1px 1px 0 #b4e89b, inset -1px -1px 0 #2f6b15;
}
html[data-theme="xp"] .btn-primary:hover { background: linear-gradient(180deg, #8edc62, #5caf38); }

html[data-theme="xp"] .nav-item { border-radius: 0; }
html[data-theme="xp"] .nav-item:hover { background: rgba(255,255,255,0.12); }
html[data-theme="xp"] .nav-item.is-active {
  background: linear-gradient(180deg, #4a90d9, #1b4f9e);
  border: 2px solid #0d3a78;
  box-shadow: inset 1px 1px 0 #7fb2e8, inset -1px -1px 0 #0d3a78;
  color: #ffffff;
}

html[data-theme="xp"] .chip {
  background: #ffffff;
  color: #0d3a78;
  border: 2px solid #0d3a78;
  border-radius: 0;
  font-weight: 700;
}
html[data-theme="xp"] .chip.is-active {
  background: linear-gradient(180deg, #ffb347, #e8832b);
  color: #ffffff;
  border-color: #8a4a10;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.25);
}

html[data-theme="xp"] .pill { background: #ffffff; color: #0d3a78; border: 2px solid #0d3a78; border-radius: 0; }

html[data-theme="xp"] .field input,
html[data-theme="xp"] .search-box input,
html[data-theme="xp"] .select,
html[data-theme="xp"] .row-item {
  background: #ffffff;
  color: #0d3a78;
  border: 2px solid #0d3a78;
  border-radius: 0;
}
html[data-theme="xp"] .row-item input { color: #0d3a78; }
html[data-theme="xp"] .field input::placeholder,
html[data-theme="xp"] .search-box input::placeholder { color: #7a97bf; }
html[data-theme="xp"] .select option { background: #ffffff; color: #0d3a78; }

html[data-theme="xp"] .metric-title,
html[data-theme="xp"] .section-head h2,
html[data-theme="xp"] .settings-head h2,
html[data-theme="xp"] .banner-title,
html[data-theme="xp"] .stat-val,
html[data-theme="xp"] .logo-text,
html[data-theme="xp"] #page-title,
html[data-theme="xp"] .modal-title {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ============================== GAME ARCADE ============================== */

.arcade-banner code, .empty-state code {
  font-family: var(--font-mono);
  background: var(--hover-2);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.92em;
}

/* sub-tabs (Games | Tools) */
.arcade-tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.arcade-tab {
  padding: 9px 20px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: color .15s ease;
}
.arcade-tab:hover { color: var(--text); }
.arcade-tab.is-active { color: var(--cyan); border-color: var(--border); background: var(--panel-strong); }

/* tool cards */
.tool-cover { display: flex; align-items: center; justify-content: center; }
.tool-icon { font-size: 54px; }
.tool-open { margin-top: 10px; }

.arcade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.arcade-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-strong);
  cursor: pointer;
  transition: all .2s ease;
}
.arcade-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--cyan) 40%, transparent);
  box-shadow: 0 12px 40px var(--shadow), 0 0 24px color-mix(in srgb, var(--cyan) 14%, transparent);
}

.arcade-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, var(--cover-a), var(--cover-b));
}
.arcade-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arcade-cover .fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: var(--font-display);
  font-weight: 700;
  text-align: center;
  padding: 0 14px;
}

.arcade-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.arcade-title { font-weight: 700; font-size: 14px; font-family: var(--font-display); line-height: 1.3; }
.arcade-author { font-size: 11.5px; color: var(--text-dim); }
.arcade-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.arcade-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* detail page */
.arcade-back { margin-bottom: 12px; }
.arcade-detail { padding: 0; overflow: hidden; max-width: 980px; }
.arcade-banner {
  width: 100%;
  aspect-ratio: 1200 / 400;
  background: linear-gradient(135deg, var(--cover-a), var(--cover-b));
}
.arcade-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

.arcade-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 22px;
  flex-wrap: wrap;
}
.arcade-detail-info { flex: 1; min-width: 240px; }
.arcade-play-col { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.fs-opt {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.fs-opt input { accent-color: var(--cyan); width: 15px; height: 15px; cursor: pointer; }

.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--hover); margin-bottom: 6px;
}
.user-name { font-weight: 600; font-size: 14px; }
.user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.arcade-detail-title { margin: 0 0 4px; font-family: var(--font-display); font-size: 26px; }
.arcade-created { font-size: 12px; color: var(--text-faint); margin: 2px 0 10px; }

.arcade-section { padding: 0 22px 20px; }
.arcade-section h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 15px; }
.arcade-about { margin: 0; font-size: 14px; color: var(--text-dim); line-height: 1.6; }
.arcade-controls {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
  line-height: 1.6;
}
.arcade-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.arcade-shots img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }

.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn-play { animation: playGlow 2.2s ease-in-out infinite; }
@keyframes playGlow {
  0%, 100% { box-shadow: 0 0 12px color-mix(in srgb, var(--cyan) 40%, transparent); }
  50% { box-shadow: 0 0 30px color-mix(in srgb, var(--cyan) 75%, transparent); }
}

/* windowed game overlay — games run in a window, not fullscreen */
.game-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 1280px);
  height: min(86vh, 820px);
  z-index: 2000;
  background: #000;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.22);
}
.game-overlay[hidden] { display: none; }
/* when fullscreened the browser fills the viewport — drop the window chrome */
.game-overlay:fullscreen {
  top: 0; left: 0; transform: none;
  width: 100%; height: 100%;
  border-radius: 0;
}
#game-frame { flex: 1; width: 100%; border: none; background: #000; }

.game-overlay-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 16px;
  height: 44px;
  flex-shrink: 0;
  background: #0f172a;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
/* in fullscreen, the bar overlays the game and auto-hides */
.game-overlay:fullscreen .game-overlay-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.game-overlay:fullscreen .game-overlay-bar.is-visible { opacity: 1; pointer-events: auto; }
.game-overlay-title { color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-overlay-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* overlay buttons stay legible on black regardless of active theme */
.game-overlay .btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.game-overlay .btn:hover { background: rgba(255, 255, 255, 0.24); border-color: rgba(255, 255, 255, 0.55); }

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  #sidebar { width: 74px; padding: 18px 10px; }
  .logo-text, .nav-item span:not(.nav-badge), .sidebar-foot { display: none; }
  .nav-item { justify-content: center; min-height: 44px; }
  .nav-badge { display: none; }
  #content { padding: 18px 14px 40px; }

  #topbar { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
  #page-title { font-size: 18px; }
  .page-sub { display: none; }
  .topbar-actions { gap: 8px; }
  /* icon-only sync button on small screens */
  #sync-btn { font-size: 0; padding: 10px; }
  #sync-btn .btn-ico { width: 18px; height: 18px; }

  /* games run edge-to-edge on phones (no window chrome makes sense) */
  .game-overlay {
    top: 0; left: 0; transform: none;
    width: 100vw; height: 100dvh;
    border-radius: 0;
  }

  .arcade-detail { max-width: 100%; }
  .arcade-detail-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .arcade-play-col { flex-direction: row; align-items: center; justify-content: space-between; }
  .arcade-banner { height: 140px; }
  .arcade-shots { grid-template-columns: 1fr; }
  .modal { width: calc(100vw - 28px); }
}

@media (max-width: 480px) {
  .games-grid, .arcade-grid { grid-template-columns: 1fr; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .tiles-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; align-items: stretch; }
  .filter-group--right { margin-left: 0; }
  .btn { padding: 10px 14px; font-size: 13px; }
  .toolbar { flex-direction: column; gap: 10px; }
  .toolbar .search-box { width: 100%; }
  .toolbar .select { width: 100%; }
}

/* ============================== FILTERS / LIKES / DETAIL / CURATED ============================== */

.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-group--right { margin-left: auto; }
.filter-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.filter-sep { color: var(--text-faint); }
.filter-input {
  width: 64px;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}
.filter-input:focus { border-color: color-mix(in srgb, var(--cyan) 50%, transparent); }
.filter-chip.is-active { color: var(--accent-text); background: var(--accent); border-color: transparent; }

/* like / dislike on cards */
.like-btns { display: flex; gap: 4px; }
.like-btn {
  border: 1px solid var(--border);
  background: var(--hover);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.like-btn:hover { border-color: var(--border-hover); }
.like-btn.is-active.up { background: color-mix(in srgb, var(--green) 20%, transparent); border-color: var(--green); color: var(--green); }
.like-btn.is-active.down { background: color-mix(in srgb, var(--red) 20%, transparent); border-color: var(--red); color: var(--red); }

/* card overlay actions */
.game-card .card-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; z-index: 3; }
.game-card:hover .card-actions { opacity: 1; }
.game-card .card-actions .like-btn { width: 28px; height: 28px; backdrop-filter: blur(6px); }

.badge-ach {
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--amber) 16%, transparent);
  color: var(--amber);
  font-weight: 700;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ProtonDB tier badges */
.proton-ribbon, .proton-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .4px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--proton-c);
}
.proton-ribbon {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(8, 12, 20, .74);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--proton-c) 70%, transparent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.proton-badge {
  font-size: 11px;
  padding: 3px 10px;
  margin-top: 10px;
  width: fit-content;
  background: color-mix(in srgb, var(--proton-c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--proton-c) 45%, transparent);
}
.proton-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 7px var(--proton-c);
}
.proton-platinum { --proton-c: #58a6ff; }
.proton-gold { --proton-c: #e3b341; }
.proton-silver { --proton-c: #a8b3c0; }
.proton-bronze { --proton-c: #d28a4b; }
.proton-borked { --proton-c: #f85149; }
.proton-native { --proton-c: #3fb950; }

/* curated cards */
.curated-card { position: relative; }
.curated-score {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 3px 9px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 12px;
}
.curated-reasons { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.curated-reasons li { margin: 0; }
.curated-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  border: none;
  background: rgba(0,0,0,0.4);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.curated-card:hover .curated-dismiss { opacity: 1; }

/* game detail modal */
.game-detail-modal {
  width: min(92vw, 860px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  text-align: left;
}
.gd-banner { width: 100%; aspect-ratio: 1200/400; background: linear-gradient(135deg, var(--cover-a), var(--cover-b)); position: relative; }
.gd-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gd-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}
.gd-body { padding: 20px 22px; }
.gd-head { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.gd-title { margin: 0 0 4px; font-family: var(--font-display); font-size: 24px; }
.gd-meta { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.gd-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gd-stats { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.gd-stat { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--hover); border: 1px solid var(--border); }
.gd-stat .k { font-size: 11px; color: var(--text-faint); }
.gd-stat .v { font-size: 15px; font-weight: 700; font-family: var(--font-display); }

.gd-price { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.price-card { flex: 1; min-width: 200px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--input-bg); }
.price-card .k { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.price-card .v { font-size: 22px; font-weight: 700; font-family: var(--font-display); }
.price-card .sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.price-card.best { border-color: color-mix(in srgb, var(--green) 45%, transparent); }

.gd-bundles { margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.bundle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--hover); flex-wrap: wrap; }
.bundle-row .b-name { font-weight: 600; font-size: 13px; }
.bundle-row .b-sub { font-size: 12px; color: var(--text-dim); }

.gd-chart { margin: 16px 0; }
.gd-chart svg { width: 100%; height: auto; display: block; }
.gd-desc { font-size: 14px; color: var(--text-dim); line-height: 1.6; }
.gd-section-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; margin: 18px 0 8px; }

/* scroll sentinel + spinner */
.scroll-sentinel { height: 40px; display: flex; align-items: center; justify-content: center; margin-top: 8px; }
.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--hover-2);
  border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}
