/* ==========================================================================
   Game List — styles
   Tokens first (light, then dark under both the OS setting and the toggle).
   Status colours are a validated categorical palette (CVD-safe in both modes).
   ========================================================================== */

:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f2f2f6;
  --glow-1: rgba(91, 75, 219, 0.14);
  --glow-2: rgba(42, 120, 214, 0.09);
  --surface: #ffffff;
  --surface-2: #f6f6f9;
  --surface-3: #ececf1;
  --border: rgba(17, 18, 23, 0.08);
  --border-strong: rgba(17, 18, 23, 0.16);
  --text: #121318;
  --text-2: #464955;
  --muted: #6c6f7c;
  --accent: #5b4bdb;
  --accent-hover: #4a3bc6;
  --accent-text: #4a3bc6;
  --accent-soft: rgba(91, 75, 219, 0.1);
  --on-accent: #ffffff;
  --danger: #c43131;
  --danger-soft: rgba(196, 49, 49, 0.1);
  --good: #006300;
  --good-mark: #0ca30c;
  --warn-text: #8a5a00;
  --warn-mark: #fab219;
  --gold: #c28a00;
  --grid: #e7e7ed;
  --axis: #c6c7d0;
  --de-emph: #a4a6b2;

  --shadow: 0 1px 2px rgba(17, 18, 23, 0.04), 0 10px 28px -14px rgba(17, 18, 23, 0.14);
  --shadow-lg: 0 30px 80px -20px rgba(17, 18, 23, 0.35);

  /* Status — light steps */
  --s-complete: #1baf7a;
  --s-retired: #eb6834;
  --s-playing: #2a78d6;
  --s-upnext: #eda100;
  --s-backlog: #4a3aa7;
  --series-1: #2a78d6;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0b0f;
    --glow-1: rgba(111, 95, 232, 0.2);
    --glow-2: rgba(57, 135, 229, 0.1);
    --surface: #15171d;
    --surface-2: #1b1e26;
    --surface-3: #252934;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f1f2f6;
    --text-2: #b9bcc8;
    --muted: #8a8e9c;
    --accent: #6f5fe8;
    --accent-hover: #8173f0;
    --accent-text: #a99ffb;
    --accent-soft: rgba(139, 124, 246, 0.16);
    --danger: #f07070;
    --danger-soft: rgba(240, 112, 112, 0.13);
    --good: #3ccf3c;
    --warn-text: #fab219;
    --gold: #f2c14e;
    --grid: #242733;
    --axis: #363a48;
    --de-emph: #626676;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
    --s-complete: #199e70;
    --s-retired: #d95926;
    --s-playing: #3987e5;
    --s-upnext: #c98500;
    --s-backlog: #9085e9;
    --series-1: #3987e5;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0b0f;
  --glow-1: rgba(111, 95, 232, 0.2);
  --glow-2: rgba(57, 135, 229, 0.1);
  --surface: #15171d;
  --surface-2: #1b1e26;
  --surface-3: #252934;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f1f2f6;
  --text-2: #b9bcc8;
  --muted: #8a8e9c;
  --accent: #6f5fe8;
  --accent-hover: #8173f0;
  --accent-text: #a99ffb;
  --accent-soft: rgba(139, 124, 246, 0.16);
  --danger: #f07070;
  --danger-soft: rgba(240, 112, 112, 0.13);
  --good: #3ccf3c;
  --warn-text: #fab219;
  --gold: #f2c14e;
  --grid: #242733;
  --axis: #363a48;
  --de-emph: #626676;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --s-complete: #199e70;
  --s-retired: #d95926;
  --s-playing: #3987e5;
  --s-upnext: #c98500;
  --s-backlog: #9085e9;
  --series-1: #3987e5;
}

/* ==========================================================================
   Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -12%, var(--glow-1), transparent 62%),
    radial-gradient(760px 480px at 100% -6%, var(--glow-2), transparent 60%);
}

html.loading .main {
  opacity: 0;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

a {
  color: var(--accent-text);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

.spacer {
  flex: 1;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 40px;
  text-align: center;
}

/* ==========================================================================
   Top bar + navigation
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #8b7cf6, #4a3aa7);
  box-shadow: 0 6px 16px -6px rgba(91, 75, 219, 0.7);
}

.nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.12);
}

.nav-link[aria-current="page"] .icon {
  color: var(--accent-text);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.sync-badge:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.sync-badge.is-synced .icon {
  color: var(--good-mark);
}

.sync-badge.is-error .icon,
.sync-badge.is-offline .icon {
  color: var(--warn-mark);
}

.sync-badge.is-syncing .icon {
  animation: spin 1s linear infinite;
}

.tabbar,
.fab {
  display: none;
}

/* ==========================================================================
   Buttons, chips, inputs
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-3);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
}

.btn-danger-solid {
  background: var(--danger);
  border-color: transparent;
  color: #fff;
}

.btn-danger-solid:hover {
  filter: brightness(1.08);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: transparent;
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent-text);
  font-weight: 600;
  font-size: 13.5px;
  text-align: left;
}

.link-btn:hover {
  text-decoration: underline;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 30%, transparent);
}

.chip[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  flex: none;
}

.chip[aria-pressed="true"] .chip-dot {
  box-shadow: 0 0 0 2px var(--text);
}

.chip-count {
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chip[aria-pressed="true"] .chip-count {
  color: inherit;
  opacity: 0.7;
}

.chip .icon-trophy {
  color: var(--gold);
}

.input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.input {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

select.input {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.input-sm {
  height: 34px;
  font-size: 13.5px;
  border-radius: 9px;
}

.input-num {
  width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field > label,
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.field-error {
  margin: -6px 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}

/* Segmented radio pills */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg {
  position: relative;
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.seg > span:hover {
  color: var(--text);
}

.seg input:checked + span {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.seg input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.segmented-compact {
  gap: 0;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
}

.segmented-compact .seg > span {
  height: 30px;
  border: 0;
  background: transparent;
}

.segmented-compact .seg input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 6px -2px rgba(0, 0, 0, 0.15);
}

/* Toggle switch */
.switch-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 4px 0;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.18s, border-color 0.18s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s;
}

.switch-field input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch-field input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch-field input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-text {
  display: grid;
  gap: 1px;
}

.switch-label {
  font-weight: 600;
  font-size: 14px;
}

.switch-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
}

/* ==========================================================================
   Layout
   ========================================================================== */

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 80px;
  transition: opacity 0.2s;
}

.main:focus {
  outline: none;
}

.view {
  display: grid;
  gap: 16px;
  animation: view-in 0.25s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.page-head h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14.5px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

section.card,
.card.chart-card {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
}

.card-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.chart-card > .card-sub {
  margin-bottom: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* KPI tiles */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpis-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi {
  padding: 16px 18px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.kpi-label .icon {
  color: var(--muted);
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.kpi-note {
  font-size: 12.5px;
  color: var(--muted);
}

/* ==========================================================================
   Library
   ========================================================================== */

.toolbar {
  padding: 14px;
  display: grid;
  gap: 14px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search > .icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.search .kbd {
  position: absolute;
  right: 12px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 48px;
  padding: 0 44px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 15.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input::-webkit-search-cancel-button {
  margin-right: 30px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 24px;
}

.filter-group {
  display: grid;
  gap: 6px;
}

.filter-group-end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.sort select {
  width: auto;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.list-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.game-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.game-row:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.row-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.row-title {
  justify-self: start;
  max-width: 100%;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.row-title:hover {
  color: var(--accent-text);
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.plat {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.tag-current {
  color: var(--text-2);
}

.tag-current .icon {
  color: var(--gold);
  fill: var(--gold);
}

/* Status pill (select) */
.status-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
  transition: background 0.15s;
}

.status-pill:hover {
  background: color-mix(in srgb, var(--c) 20%, var(--surface));
}

.status-pill::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c);
  pointer-events: none;
}

.status-pill::after {
  content: "";
  position: absolute;
  right: 11px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.status-pill select {
  appearance: none;
  height: 100%;
  width: 136px;
  padding: 0 30px 0 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.status-pill select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.status-pill option {
  background: var(--surface);
  color: var(--text);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.status-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

.trophy-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: color-mix(in srgb, var(--muted) 60%, transparent);
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.trophy-btn:hover {
  background: var(--surface-3);
  color: var(--text-2);
}

.trophy-btn[aria-pressed="true"] {
  color: var(--gold);
}

.trophy-btn[aria-pressed="true"] .icon {
  fill: color-mix(in srgb, var(--gold) 30%, transparent);
}

.trophy-btn:active {
  transform: scale(0.9);
}

/* Generated covers */
.cover {
  --size: 44px;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border-radius: calc(var(--size) * 0.24);
  overflow: hidden;
  background: linear-gradient(140deg, hsl(var(--h1) 74% 60%), hsl(var(--h2) 62% 34%));
  color: #fff;
  font-weight: 800;
  font-size: calc(var(--size) * 0.36);
  letter-spacing: -0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  user-select: none;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.42), transparent 46%),
    radial-gradient(circle at 90% 110%, rgba(0, 0, 0, 0.28), transparent 55%);
}

.cover > span {
  position: relative;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.empty h3 {
  font-size: 18px;
}

.empty p {
  color: var(--muted);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--surface-3);
  color: var(--muted);
  margin-bottom: 4px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

/* ==========================================================================
   Pick
   ========================================================================== */

.pick-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.pick-stage {
  --h1: 250;
  position: relative;
  overflow: hidden;
  overflow: clip; /* can't be scrolled by focus changes */
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 22px;
  min-height: 520px;
  padding: 40px 24px !important;
  text-align: center;
}

.pick-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(farthest-side at 50% 34%, hsl(var(--h1) 80% 60% / 0.28), transparent 80%);
  transition: background 0.3s;
}

.pick-stage > *:not(.pick-glow) {
  position: relative;
  z-index: 1;
}

.pick-result {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.pick-art {
  display: grid;
  place-items: center;
  min-height: 176px;
}

.pick-placeholder {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border-radius: 40px;
  border: 2px dashed var(--border-strong);
  color: var(--muted);
}

.cover-xl {
  border-radius: 36px;
  box-shadow:
    0 30px 60px -24px hsl(var(--h1) 70% 40% / 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.cover-xl.spinning {
  transform: rotate(-3deg) scale(0.96);
  filter: saturate(0.9);
}

.cover-xl.reveal {
  animation: reveal 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes reveal {
  from {
    transform: scale(0.7) rotate(-8deg);
    opacity: 0;
  }
}

.pick-title {
  max-width: 560px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.is-rolling .pick-title {
  opacity: 0.7;
}

.pick-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  color: var(--muted);
}

.btn-roll {
  height: 56px;
  padding: 0 28px;
  border: 0;
  border-radius: 16px;
  font-size: 16.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #8b7cf6, #5b4bdb 55%, #4a3aa7);
  box-shadow: 0 16px 34px -14px rgba(91, 75, 219, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-roll:hover {
  background: linear-gradient(135deg, #9a8df8, #6555e6 55%, #5343b5);
}

.btn-roll:disabled {
  opacity: 0.85;
  cursor: progress;
}

.is-rolling .btn-roll .icon {
  animation: spin 0.5s linear infinite;
}

.pick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pick-controls {
  padding: 20px;
  display: grid;
  gap: 12px;
}

.pick-controls .card-title:not(:first-child) {
  margin-top: 8px;
}

.pool-count {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 14px;
}

.pick-nudge {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
}

.pick-nudge .icon {
  flex: none;
  margin-top: 2px;
  color: var(--warn-mark);
}

/* ==========================================================================
   Target
   ========================================================================== */

.target-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 28px !important;
}

.target-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 300px at 0% 0%, var(--accent-soft), transparent 70%);
}

.target-hero > * {
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
}

.hero-figure {
  margin-top: 12px;
  font-size: 76px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hero-caption {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-2);
}

.hero-pace {
  margin-top: 14px;
  color: var(--text-2);
}

.hero-pace strong {
  color: var(--text);
}

.pace-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-weight: 600;
  font-size: 14px;
}

.pace-status.is-good {
  color: var(--good);
}

.pace-status.is-good .icon {
  color: var(--good-mark);
}

.pace-status.is-behind {
  color: var(--warn-text);
}

.pace-status.is-behind .icon {
  color: var(--warn-mark);
}

.hero-meter {
  display: grid;
  gap: 10px;
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-2);
}

.meter-labels strong {
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.meter {
  position: relative;
  height: 16px;
  margin-top: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--series-1) 16%, var(--surface));
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--series-1);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.meter-target {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--text);
}

.meter-scale {
  font-size: 13px;
  color: var(--muted);
}

.grid-target {
  align-items: start;
}

.settings-card {
  display: grid;
  gap: 4px;
}

.settings-card .card-title {
  margin-bottom: 12px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range {
  flex: 1;
  accent-color: var(--accent);
  height: 24px;
}

.num-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-2);
}

.since-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 600;
}

.chart-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* ==========================================================================
   Summary
   ========================================================================== */

.now-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.now-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.now-plat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.now-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--text);
  text-decoration: none;
}

.now-current:hover .now-title {
  color: var(--accent-text);
}

.now-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.now-kicker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.now-kicker .icon {
  color: var(--gold);
  fill: var(--gold);
}

.now-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
}

.now-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 13px;
  border: 2px dashed var(--border-strong);
  color: var(--muted);
}

.now-others {
  list-style: none;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 5px;
}

.now-others .link-btn {
  color: var(--text-2);
  font-weight: 500;
}

.now-others .link-btn:hover {
  color: var(--accent-text);
}

/* ==========================================================================
   Charts
   ========================================================================== */

.legend {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  color: var(--text-2);
}

.card-head .legend {
  margin: 0;
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-key {
  flex: none;
  background: var(--c);
}

.legend-rect {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

/* Stacked bars */
.sbar-chart {
  display: grid;
  gap: 12px;
}

.sbar-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.sbar-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}

.sbar-track {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sbar-bar {
  display: flex;
  gap: 2px;
  height: 24px;
  width: calc((100% - 46px) * var(--frac));
  min-width: 4px;
}

.sbar-share .sbar-bar {
  width: calc(100% * var(--frac));
}

.sbar-seg {
  flex-basis: 0;
  min-width: 3px;
  background: var(--c);
  transition: filter 0.12s, transform 0.12s;
}

.sbar-seg:last-child {
  border-radius: 0 4px 4px 0;
}

.sbar-seg:hover,
.sbar-seg:focus-visible {
  filter: brightness(1.12) saturate(1.1);
  outline: none;
  transform: scaleY(1.12);
}

.sbar-value {
  font-size: 13.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sbar-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sbar-axis-row {
  margin-top: -4px;
}

/* Percentage bars */
.pbar-chart {
  display: grid;
  gap: 10px;
}

.pbar-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 10px;
}

.pbar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.pbar-track {
  height: 14px;
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--c) 13%, var(--surface));
}

.pbar-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pbar-fill {
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--c);
  transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pbar-track:hover .pbar-fill {
  filter: brightness(1.1);
}

.pbar-value {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pbar-strong {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.pbar-strong .pbar-label {
  color: var(--text);
}

/* Burn-up (SVG) */
.burnup {
  width: 100%;
  min-height: 220px;
}

.burnup-svg {
  display: block;
  overflow: visible;
}

.burnup-svg .grid line {
  stroke: var(--grid);
  stroke-width: 1;
}

.burnup-svg .axis {
  stroke: var(--axis);
  stroke-width: 1;
}

.burnup-svg .tick {
  fill: var(--muted);
  font-size: 11.5px;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.burnup-svg .today-line {
  stroke: var(--axis);
  stroke-width: 1;
}

.burnup-svg .today-label,
.burnup-svg .end-label {
  fill: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font);
}

.burnup-svg .pace-line {
  stroke: var(--de-emph);
  stroke-width: 2;
  stroke-linecap: round;
}

.burnup-svg .progress-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.burnup-svg .progress-area {
  fill: var(--series-1);
  opacity: 0.1;
}

.burnup-svg .progress-dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}

.burnup-svg .goal-dot {
  fill: var(--de-emph);
  stroke: var(--surface);
  stroke-width: 2;
}

.burnup-svg .crosshair {
  stroke: var(--text-2);
  stroke-width: 1;
  pointer-events: none;
}

.burnup-svg .hit {
  cursor: crosshair;
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  max-width: 260px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}

.tip {
  display: grid;
  gap: 2px;
}

.tip-label {
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
}

.tip-value {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tip-detail {
  color: var(--muted);
  font-size: 12px;
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.tip-row strong {
  font-size: 14px;
}

.tip-row span:last-child {
  color: var(--text-2);
}

.tip-key {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--c);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table thead th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--border-strong);
}

.data-table tbody th {
  font-weight: 600;
  color: var(--text-2);
}

.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .strong,
.data-table .col-total {
  font-weight: 700;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table .row-total th,
.data-table .row-total td,
.data-table .row-strong th,
.data-table .row-strong td {
  font-weight: 700;
  color: var(--text);
}

.data-table .row-total td,
.data-table .row-total th {
  border-top: 1px solid var(--border-strong);
}

.data-table tr:last-child th,
.data-table tr:last-child td {
  border-bottom: 0;
}

.th-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--c);
  vertical-align: 1px;
}

/* ==========================================================================
   Modals
   ========================================================================== */

dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 48px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog.modal[open] {
  display: flex;
  animation: modal-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

dialog.modal-sm {
  width: min(420px, calc(100vw - 32px));
}

dialog.modal-lg {
  width: min(680px, calc(100vw - 32px));
}

dialog.modal::backdrop {
  background: rgba(6, 7, 10, 0.55);
  backdrop-filter: blur(3px);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.modal-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 12px 20px;
}

.modal-head h2 {
  flex: 1;
  font-size: 19px;
  font-weight: 800;
}

.modal-lead-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 20px 12px;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.modal-meta {
  font-size: 12.5px;
  color: var(--muted);
}

.confirm-msg {
  color: var(--text-2);
  padding-bottom: 8px;
}

.dupe-hint {
  display: grid;
  gap: 6px;
  margin: -6px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.dupe-hint:empty {
  display: none;
}

.dupe {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
}

.dupe-same {
  color: var(--danger);
}

/* Settings */
.settings-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.settings-section:first-child {
  padding-top: 4px;
}

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.settings-section h3 + .segmented {
  margin-top: 10px;
}

.plat-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.plat-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.plat-name {
  width: 180px;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form .input {
  flex: 1;
  min-width: 180px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-preview {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  gap: 10px;
  font-size: 14px;
}

.danger-zone {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.sync-state.is-synced .icon {
  color: var(--good-mark);
}

.sync-state.is-error .icon,
.sync-state.is-offline .icon,
.sync-state.is-unavailable .icon {
  color: var(--warn-mark);
}

.sync-state.is-syncing .icon {
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 900;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.toast.leaving {
  animation: toast-out 0.18s ease both;
}

.toast-msg {
  flex: 1;
  min-width: 0;
}

.toast-action {
  border: 0;
  border-radius: 9px;
  padding: 6px 12px;
  background: color-mix(in srgb, var(--bg) 18%, transparent);
  color: inherit;
  font-weight: 700;
  font-size: 13.5px;
}

.toast-action:hover {
  background: color-mix(in srgb, var(--bg) 28%, transparent);
}

.toast-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  opacity: 0.6;
}

.toast-close:hover {
  opacity: 1;
}

.toast-warn {
  border-left: 4px solid var(--warn-mark);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .kpis-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .nav-link span {
    display: none;
  }

  .nav-link {
    padding: 0 12px;
  }

  .pick-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .target-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 56px;
  }

  .hide-mobile {
    display: none !important;
  }

  .topbar-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .nav {
    display: none;
  }

  .sync-text {
    display: none;
  }

  .sync-badge {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .main {
    padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .page-head h1 {
    font-size: 26px;
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-top: 1px solid var(--border);
  }

  .tab {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 6px 0;
    border-radius: 12px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    text-decoration: none;
  }

  .tab[aria-current="page"] {
    color: var(--accent-text);
  }

  .tab[aria-current="page"] .icon {
    transform: translateY(-1px);
  }

  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 31;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #8b7cf6, #5b4bdb 55%, #4a3aa7);
    box-shadow: 0 14px 30px -10px rgba(91, 75, 219, 0.85);
  }

  .toasts {
    bottom: calc(144px + env(safe-area-inset-bottom));
  }

  .toolbar {
    padding: 12px;
  }

  .filter-grid {
    gap: 12px;
  }

  .filter-group,
  .filter-group-end {
    width: 100%;
  }

  .filter-group .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -12px;
    padding: 0 12px 2px;
  }

  .filter-group .chips::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: none;
  }

  .filter-group-end {
    margin-left: 0;
    justify-content: space-between;
  }

  .game-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas:
      "cover main trophy"
      "cover status trophy";
    gap: 6px 12px;
    padding: 10px;
  }

  .game-row .cover {
    --size: 40px !important;
    grid-area: cover;
    align-self: start;
  }

  .row-main {
    grid-area: main;
  }

  .game-row .status-pill {
    grid-area: status;
    justify-self: start;
    height: 30px;
  }

  .game-row .status-pill select {
    width: 128px;
    font-size: 12.5px;
  }

  .trophy-btn {
    grid-area: trophy;
  }

  .pick-stage {
    min-height: 440px;
    padding: 28px 16px !important;
  }

  .pick-title {
    font-size: 23px;
  }

  .hero-figure {
    font-size: 64px;
  }

  .kpi-value {
    font-size: 26px;
  }

  .kpis-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpis-5 > :first-child {
    grid-column: 1 / -1;
  }

  section.card,
  .card.chart-card {
    padding: 16px;
  }

  .target-hero {
    padding: 20px !important;
  }

  dialog.modal,
  dialog.modal-sm,
  dialog.modal-lg {
    width: 100vw;
    max-width: 100vw;
    max-height: calc(100dvh - 24px);
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
  }

  dialog.modal[open] {
    animation-name: sheet-in;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }

  .modal-foot {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .plat-name {
    width: 130px;
  }
}

@media (max-width: 330px) {
  .brand-name {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  .sbar-seg,
  .pbar-fill,
  .meter-fill,
  .chip-dot,
  .status-pill::before {
    forced-color-adjust: none;
  }
}
