/* LivePulse — styles. Dark is the default; [data-theme="light"] swaps the tokens. */

:root, [data-theme="dark"] {
  --bg: #0B0E13;
  --header: #0E1218;
  --surface: #11161E;
  --surface-2: #151B24;
  --border: #1E252F;
  --border-2: #2A3442;
  --row-line: #171D26;
  --text: #E6EAF0;
  --sub: #C3CAD5;
  --muted: #8E98A7;
  --chip: #182130;
  --chip-border: #253045;
  --track: #1E2632;
  --accent: #6A5AF0;
  --accent-text: #B9B0FF;
  --accent-soft: #221D45;
  --warn: #F2C14E;
  --good: #3DDC97;
  --bad: #FF7A6B;
  --backdrop: #06080B;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F4F5F2;
  --header: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F0F1EE;
  --border: #E2E4DF;
  --border-2: #D3D6CF;
  --row-line: #EEF0EB;
  --text: #15181D;
  --sub: #373E48;
  --muted: #5A626D;
  --chip: #EEF0EB;
  --chip-border: #DEE1DA;
  --track: #E7E9E4;
  --accent-text: #4A3AD0;
  --accent-soft: #ECE9FF;
  --warn: #A66A00;
  --good: #12804F;
  --bad: #C8372A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'Space Grotesk', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent-text); }
a:hover { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.narrow { max-width: 920px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
.sub { color: var(--sub); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.block { display: block; }
.grow { flex-grow: 1; }
.min0 { min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row-gap { display: flex; align-items: center; gap: 8px; }
.wrap-row { flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.spacer { flex-grow: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text); text-decoration: none; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
.btn-outline { border-color: var(--border-2); }
.btn-outline:hover { background: var(--surface-2); }
.btn-outline[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.btn-ghost { color: var(--sub); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 48px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--sub); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; text-decoration: underline; }
.copied { color: var(--good) !important; }

/* ---------- header ---------- */
.topbar { background: var(--header); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 14px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
}
.search input { flex-grow: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; border: 1px solid var(--border-2); border-radius: 4px; padding: 1px 6px; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button {
  height: 36px; padding: 0 12px; border: 0; border-radius: 8px; display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--muted); font-weight: 500; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-theme="dark"] .i-moon, [data-theme="light"] .i-sun { display: none; }
.user { display: flex; align-items: center; gap: 10px; color: var(--sub); }
.user img { border-radius: 50%; }
.user form { margin: 0; }

.flash { margin-top: 16px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); }
.flash-ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.flash-error { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.flash-error div + div { margin-top: 4px; }

/* ---------- browser ---------- */
.browser { padding-top: 24px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 20px; flex-grow: 1; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font: 600 26px 'JetBrains Mono', monospace; margin-top: 6px; }

.browser-body { display: flex; flex-direction: column; gap: 20px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.filter-group.options { margin-left: auto; }
.filter-title { display: none; font-weight: 700; }
.game-list { display: flex; flex-wrap: wrap; gap: 8px; }
.game {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2);
  background: transparent; color: var(--sub); cursor: pointer;
}
.game[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.game-add { border-style: dashed; color: var(--muted); }
.field { display: flex; align-items: center; gap: 8px; color: var(--sub); }
.field select, .input {
  height: 36px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-2);
  border-radius: 8px; padding: 0 10px;
}
.check { display: flex; align-items: center; gap: 6px; color: var(--sub); flex-direction: row-reverse; cursor: pointer; padding: 0 2px; }
.check input, .check-inline input { accent-color: var(--accent); width: 16px; height: 16px; }

.results { min-width: 0; transition: opacity .15s; }
.results .loading, #results.loading { opacity: .55; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.empty-state.small { padding: 24px; }

/* table */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
.t-row {
  display: grid; min-width: 1060px;
  grid-template-columns: 44px minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, 1.1fr) 170px 110px 200px 104px;
  gap: 12px; align-items: center; padding: 0 16px; min-height: 58px; border-bottom: 1px solid var(--row-line);
}
.t-row:last-child { border-bottom: 0; }
.t-row:not(.t-head):hover { background: var(--surface-2); }
.t-head { min-height: 44px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; border-bottom-color: var(--border); }
.t-head button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.t-head button.active, .t-head button:hover { color: var(--text); }
.t-flags { display: flex; gap: 4px; color: var(--muted); }
.flag { display: inline-flex; color: var(--muted); }
.flag.warn { color: var(--warn); }
.t-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t-title a { color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-title a:hover { color: var(--accent-text); }
.t-sub { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-players { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.addr {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  font: 12.5px 'JetBrains Mono', monospace; color: var(--muted);
}
.addr:hover { color: var(--text); }
.addr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--chip); color: var(--sub); border: 1px solid var(--chip-border); white-space: nowrap; }
.chip-warn { color: var(--warn); }
.badge-verified {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-family: 'Space Grotesk', sans-serif;
}
.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--sub); }

.bar { height: 4px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-full span { background: var(--bad); }

/* cards view: filters become a sidebar */
.browser[data-view="cards"] .browser-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
.browser[data-view="cards"] .filters { flex-direction: column; align-items: stretch; gap: 20px; position: sticky; top: 92px; }
.browser[data-view="cards"] .filter-group { flex-direction: column; align-items: stretch; gap: 10px; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.browser[data-view="cards"] .filter-title { display: block; margin: 2px 2px 2px; }
.browser[data-view="cards"] .game-list { flex-direction: column; gap: 2px; }
.browser[data-view="cards"] .game { border: 0; border-radius: 10px; text-align: left; height: 42px; padding: 0 12px; color: var(--text); font-weight: 500; }
.browser[data-view="cards"] .game[aria-pressed="true"] { font-weight: 700; }
.browser[data-view="cards"] .game-add { color: var(--accent-text); font-weight: 600; }
.browser[data-view="cards"] .field { flex-direction: column; align-items: stretch; gap: 6px; }
.browser[data-view="cards"] .field select { height: 44px; border-radius: 10px; }
.browser[data-view="cards"] .check { justify-content: space-between; min-height: 32px; color: var(--text); flex-direction: row; }
.browser[data-view="cards"] .check input { width: 18px; height: 18px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.card-banner { display: block; height: 84px; background: var(--surface-2) center / cover no-repeat; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; flex-grow: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { display: block; font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.card-title:hover { color: var(--accent-text); }
.card-players { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.card-players .bar { height: 6px; }
.card-actions { display: flex; gap: 8px; }
.card-actions .btn { height: 42px; }
.card-actions .icon-btn { height: 42px; background: transparent; }

.pager { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.pager button {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2);
  background: transparent; color: var(--sub); cursor: pointer;
}
.pager button[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.pager button[disabled] { opacity: .4; cursor: default; }
.pager span { align-self: center; padding: 0 4px; }

/* ---------- server detail ---------- */
.detail-page { padding-top: 20px; padding-bottom: 40px; max-width: 1060px; flex-grow: 1; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--sub); text-decoration: none; margin-bottom: 14px; }
.detail { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.detail-banner { height: 200px; background: var(--surface-2) center / cover no-repeat; border-bottom: 1px solid var(--border); }
.detail-banner-empty { height: 96px; }
.detail-banner-claim { height: auto; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: var(--accent-soft); }
.detail-banner-claim div { display: flex; flex-direction: column; gap: 2px; }
.detail-banner-claim span { color: var(--sub); }
.detail-head { padding: 0 28px 24px; display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.detail-logo {
  width: 96px; height: 96px; margin-top: -48px; border-radius: 20px; border: 4px solid var(--surface);
  background: var(--surface-2) center / cover no-repeat; display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: var(--muted); flex-shrink: 0;
}
.detail-title { flex: 1 1 320px; min-width: 0; padding-top: 18px; }
.detail-title h1 { margin: 10px 0 4px; font-size: 26px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.detail-offline { margin: 20px 28px 0; padding: 14px 16px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent); display: flex; flex-direction: column; gap: 2px; }
.detail-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.detail-side { padding: 24px 28px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface-2); border-radius: 10px; padding: 12px; min-width: 0; }
.tile-wide { grid-column: span 2; }
.tile-label { color: var(--muted); font-size: 12px; }
.tile-value { font-size: 18px; margin-top: 4px; overflow-wrap: anywhere; }
.small-value { font-size: 15px; }
.side-title { font-size: 14px; margin: 0 0 6px; }
.prose { margin: 0; color: var(--sub); line-height: 1.6; overflow-wrap: anywhere; }
.detail-main { padding: 20px 28px 28px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.tabs button { height: 44px; padding: 0 14px; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
[role="tabpanel"] { display: flex; flex-direction: column; gap: 6px; }
[role="tabpanel"][hidden] { display: none; }
.p-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 80px 100px; gap: 12px; align-items: center; }
.r-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.list-head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 0 8px; }
.list-row { padding: 8px; border-radius: 8px; background: var(--surface-2); }

/* ---------- claim / manage ---------- */
.page-title { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.lead { margin: 8px 0 0; color: var(--sub); line-height: 1.6; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.panel-title { margin: 0 0 12px; font-size: 20px; }
.claim-page { padding-top: 32px; padding-bottom: 48px; max-width: 1200px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; flex-grow: 1; }
.claim-steps { display: flex; flex-direction: column; gap: 16px; }
.step { display: flex; flex-direction: column; gap: 12px; }
.step.is-disabled { opacity: .55; }
.step-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input, .form-stack .input { height: 44px; border-radius: 10px; padding: 0 12px; width: 100%; }
.found { display: flex; align-items: center; gap: 8px; color: var(--sub); flex-wrap: wrap; }
.found svg { color: var(--good); }
.code-box { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--accent); }
.code { flex-grow: 1; font: 500 26px 'JetBrains Mono', monospace; letter-spacing: .12em; color: var(--accent-text); }
.snippet { font-size: 12.5px; color: var(--sub); background: var(--bg); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: nowrap; }
[data-expires].expired .code { text-decoration: line-through; color: var(--muted); }
.status-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--warn); }
.status-wait .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.owned-list { display: flex; flex-direction: column; gap: 10px; }
.owned { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.owned a.strong { color: var(--text); text-decoration: none; }
.owned-logo { width: 44px; height: 44px; border-radius: 10px; background: var(--chip) center / cover no-repeat; flex-shrink: 0; }

.manage-page { padding-top: 20px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 18px; flex-grow: 1; }
.form-stack { display: flex; flex-direction: column; gap: 18px; padding: 22px; }
.form-stack .field { flex-direction: column; align-items: stretch; gap: 6px; }
.form-stack textarea.input { height: auto; min-height: 120px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.dropzone {
  position: relative; border-radius: 12px; border: 1px dashed var(--border-2); background: var(--surface-2) center / cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; overflow: hidden;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-hint { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px; }
.dropzone.has-image .drop-hint { opacity: 0; transition: opacity .15s; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 8px; padding: 8px 12px; }
.dropzone.has-image:hover .drop-hint { opacity: 1; }
.banner-drop { aspect-ratio: 4 / 1; width: 100%; }
.logo-drop { width: 96px; height: 96px; border-radius: 18px; }
.logo-desc { display: flex; gap: 16px; align-items: flex-start; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--sub); font-size: 13px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.site-footer { padding-top: 24px; padding-bottom: 32px; color: var(--muted); font-size: 12.5px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-group.options { margin-left: 0; }
}
@media (max-width: 860px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .browser[data-view="cards"] .browser-body { grid-template-columns: 1fr; }
  .browser[data-view="cards"] .filters { position: static; }
  .card-grid { grid-template-columns: 1fr; }
  .detail-grid, .claim-page { grid-template-columns: 1fr; }
  .detail-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .detail-head, .detail-side, .detail-main { padding-left: 18px; padding-right: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .logo-desc { flex-direction: column; align-items: stretch; }
  .hide-sm { display: none; }
  .search { order: 10; flex-basis: 100%; }
  .stat-value { font-size: 22px; }
}

/* ---------- added games ---------- */
.game-custom { display: inline-flex; align-items: center; }
.game-custom .game:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.game-remove {
  height: 36px; width: 32px; border: 1px solid var(--border-2); border-left: 0; border-radius: 0 999px 999px 0;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1;
}
.game-remove:hover { color: var(--bad); }
.game-custom .game[aria-pressed="true"] + .game-remove { border-color: var(--accent); background: var(--accent-soft); }
a.game { display: inline-flex; align-items: center; text-decoration: none; }
.add-app-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.add-app-form .input { height: 36px; width: 210px; }
.add-app-form[hidden] { display: none; }
.add-app-error { color: var(--bad); font-size: 13px; }
.browser[data-view="cards"] .game-custom { display: flex; }
.browser[data-view="cards"] .game-custom .game { flex-grow: 1; border-radius: 10px; }
.browser[data-view="cards"] .game-remove { border: 0; border-radius: 10px; height: 42px; }
.browser[data-view="cards"] .game-custom .game[aria-pressed="true"] + .game-remove { background: transparent; }
.browser[data-view="cards"] a.game { height: 42px; padding: 0 12px; color: var(--accent-text); }
.browser[data-view="cards"] .add-app-form .input { width: 100%; height: 44px; }

/* ---------- favorites / notes ---------- */
[data-fav][aria-pressed="true"] svg { fill: currentColor; }
.btn-outline[data-fav][aria-pressed="true"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: transparent; }
.fav-btn { width: 36px; height: 36px; background: transparent; }
.fav-btn[aria-pressed="true"] { color: var(--warn); }
.detail-note { border-color: var(--border-2); }
.user-link { display: flex; align-items: center; gap: 10px; color: var(--sub); text-decoration: none; }
.user-link:hover { color: var(--text); }
.panel-title svg { vertical-align: -3px; color: var(--muted); }

/* ---------- profile ---------- */
.profile-page { padding-top: 28px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 20px; flex-grow: 1; max-width: 1200px; }
.pf-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 22px; }
.pf-avatar { width: 96px; height: 96px; border-radius: 20px; object-fit: cover; flex-shrink: 0; }
.pf-avatar-empty { background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 36px; font-weight: 700; color: var(--muted); }
.pf-head .page-title { margin-bottom: 6px; }
.pf-counts { display: flex; gap: 28px; }
.pf-counts div { display: flex; flex-direction: column-reverse; }
.pf-counts .stat-value { margin-top: 2px; }
.pf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.pf-list { display: flex; flex-direction: column; gap: 8px; }
.pf-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.pf-row a.strong { color: var(--text); text-decoration: none; }
.pf-row a.strong:hover { color: var(--accent-text); }
@media (max-width: 860px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-row .btn-sm { display: none; }
}
.t-row .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.t-row > div:nth-child(3) { min-width: 0; }
.pf-live { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-2); flex-shrink: 0; }
.is-online .live-dot { background: var(--good); }
.is-online .pf-live { color: var(--sub); }
.is-offline .live-dot { background: var(--bad); }
.pf-row [hidden] { display: none; }

/* ---------- admin ---------- */
.admin-page { padding-top: 24px; padding-bottom: 48px; display: flex; flex-direction: column; gap: 18px; flex-grow: 1; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.admin-tabs a { height: 44px; display: inline-flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; }
.admin-tabs a:hover { color: var(--text); }
.admin-tabs a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.admin-table { overflow-x: auto; }
.a-row { display: grid; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--row-line); min-width: 720px; }
.a-row:last-child { border-bottom: 0; }
.a-head { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding-top: 0; border-bottom-color: var(--border); }
.a-row.lists { grid-template-columns: minmax(0, 2fr) 90px 90px 120px minmax(0, 1.4fr) 110px; }
.a-row.games { grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) 110px 90px 120px; }
.a-row.servers { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) 110px minmax(0, 2fr); }
.a-row.users { grid-template-columns: minmax(0, 2.2fr) 110px 70px 90px minmax(0, 2.6fr); }
.a-row a.strong { color: var(--text); text-decoration: none; }
.a-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.input-sm { height: 36px !important; width: 170px; }
.a-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); flex-shrink: 0; object-fit: cover; }
.btn-danger { border: 1px solid color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.pill { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--sub); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill-ok { color: var(--good); }
.pill-warn { color: var(--warn); }
.pill-bad { color: var(--bad); }
.pill-accent { background: var(--accent-soft); color: var(--accent-text); }
.admin-search { display: flex; gap: 8px; }
.admin-search .input, .narrow-form .input { height: 44px; border-radius: 10px; padding: 0 12px; width: 100%; }
.narrow-form { max-width: 520px; }
.log-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--row-line); overflow-wrap: anywhere; }
.log-row:last-child { border-bottom: 0; }
