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

html { background: var(--surface); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { color: var(--brand-snow); }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.025em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 600; }

code, .mono { font-family: var(--font-mono); font-size: 0.875em; }

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

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

.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); font-size: 0.8125rem; }
.eyebrow {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--brand-green);
}

/* ---------- Backdrop (hero gradient + grid, as on the public site) ---------- */
.backdrop { position: relative; isolation: isolate; }
.backdrop::before,
.backdrop::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
.backdrop::before { background-image: var(--hero-gradient); }
.backdrop::after {
  background-image: var(--grid-lines);
  background-size: 48px 48px;
  mask-image: radial-gradient(at top, #000 20%, transparent 70%);
}

/* ---------- Brand ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 0.625rem;
  color: var(--text); font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em;
}
.brand:hover { color: var(--text); }
.brand img { width: 32px; height: 32px; }
.brand small {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.5rem; padding: 0.5rem 1.125rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-full);
  background: rgb(255 255 255 / 0.04); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.875rem; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.btn:hover { background: rgb(255 255 255 / 0.08); color: var(--text); }
.btn-primary { background: var(--brand-blue); border-color: transparent; box-shadow: var(--shadow-glow); }
.btn-primary:hover { background: var(--brand-blue-light); }
.btn-success { background: var(--brand-green); border-color: transparent; color: var(--brand-ink); }
.btn-success:hover { background: #4ade80; color: var(--brand-ink); }
.btn-danger { border-color: rgb(239 68 68 / 0.5); color: #fca5a5; background: transparent; }
.btn-danger:hover { background: rgb(239 68 68 / 0.12); color: #fecaca; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 2rem; padding: 0.25rem 0.75rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 1.125rem; }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.field { display: grid; gap: 0.375rem; }
.field label { font-size: 0.8125rem; font-weight: 600; color: #cbd5e1; }
.field .help { font-size: 0.75rem; color: var(--text-subtle); }
.field .errorlist, .form-errors {
  margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; color: #fca5a5;
}
.form-errors {
  padding: 0.75rem 1rem; border-radius: var(--radius-md);
  background: rgb(239 68 68 / 0.1); border: 1px solid rgb(239 68 68 / 0.3);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], select {
  width: 100%; min-height: 2.625rem; padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-sunken); color: var(--text); font: inherit;
}
input::placeholder { color: var(--text-subtle); }
input:focus, select:focus {
  outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px #2563eb4d;
}
textarea {
  width: 100%; padding: 0.75rem 0.875rem; resize: vertical;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-sunken); color: var(--text);
  font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6;
}
textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px #2563eb4d; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
input[type="date"] { width: auto; min-height: 2.625rem; padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-sunken); color: var(--text); font: inherit; color-scheme: dark; }

.field-checkbox { display: flex; align-items: flex-start; gap: 0.75rem; }
.field-checkbox input { width: 1.125rem; height: 1.125rem; margin-top: 0.15rem; accent-color: var(--brand-blue); }

.form-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -1.5rem; padding: 0 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left; font-weight: 600; font-size: 0.75rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-subtle);
  padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--border);
}
td { padding: 0.75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.125rem 0.625rem; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border-strong); color: #cbd5e1;
}
.badge-super_admin { background: #2563eb26; border-color: #2563eb66; color: #93c5fd; }
.badge-admin { background: #22c55e26; border-color: #22c55e66; color: #86efac; }
.badge-player { background: rgb(255 255 255 / 0.04); }
.badge-active::before, .badge-inactive::before {
  content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%;
}
.badge-active::before { background: var(--brand-green); }
.badge-inactive::before { background: var(--text-subtle); }

/* ---------- Messages ---------- */
.messages { display: grid; gap: 0.5rem; margin: 0 0 1.25rem; padding: 0; list-style: none; }
.message {
  padding: 0.75rem 1rem; border-radius: var(--radius-md); font-size: 0.875rem;
  border: 1px solid var(--border-strong); background: var(--surface-raised);
}
.message-success { border-color: #22c55e66; background: #22c55e1a; }
.message-error { border-color: rgb(239 68 68 / 0.4); background: rgb(239 68 68 / 0.1); }
.message-info, .message-warning { border-color: #2563eb66; background: #2563eb1a; }

/* ---------- Auth layout ---------- */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand { margin-bottom: 1.5rem; }
.auth-card h1 { margin-bottom: 0.375rem; }
.auth-card .lead { margin: 0 0 1.5rem; color: var(--text-muted); }
.auth-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-top: 1.5rem; font-size: 0.8125rem;
}

/* ---------- Console layout ---------- */
.console { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.5rem 1rem;
  background: var(--surface-overlay);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(12px);
}
.sidebar .brand { padding: 0 0.5rem; }
.nav { display: grid; gap: 0.25rem; }
.nav-label {
  padding: 0.75rem 0.75rem 0.25rem; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-subtle);
}
.nav a {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-md);
  color: #cbd5e1; font-weight: 500; font-size: 0.9rem;
}
.nav a:hover { background: rgb(255 255 255 / 0.05); color: var(--text); }
.nav a[aria-current="page"] { background: #2563eb26; color: var(--text); box-shadow: inset 2px 0 0 var(--brand-blue); }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; }

.sidebar-footer { margin-top: auto; display: grid; gap: 0.75rem; padding: 0 0.5rem; }
.user-chip { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--brand-blue-light), var(--brand-blue-dark));
  font-weight: 700; font-size: 0.875rem;
}
.user-chip .name { font-weight: 600; font-size: 0.875rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; }
.inline-form select { min-height: 2rem; padding: 0.25rem 0.5rem; font-size: 0.8125rem; }

.main { min-width: 0; padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; }
.page-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
}
.page-header p { margin: 0.375rem 0 0; color: var(--text-muted); }

.topbar, .topbar-close { display: none; }

/* ---------- Dashboard ---------- */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 1.25rem; }
.stat { padding: 1.25rem 1.5rem; }
.stat .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat .label { color: var(--text-muted); font-size: 0.8125rem; }

.event-list { margin: 0; padding: 0; list-style: none; }
.event-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.875rem;
}
.event-list li:last-child { border-bottom: 0; }

/* ---------- Filters / tabs / pagination ---------- */
.filters { display: grid; gap: 0.75rem; grid-template-columns: 2fr 1fr 1fr auto; margin-bottom: 1.25rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.tabs a {
  padding: 0.5rem 1rem; border-radius: var(--radius-full); border: 1px solid var(--border);
  color: #cbd5e1; font-size: 0.875rem; font-weight: 500;
}
.tabs a[aria-current="page"] { background: var(--brand-blue); border-color: transparent; color: var(--text); }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 1.25rem; font-size: 0.875rem; }

.changes { margin: 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--text-muted); }

/* ---------- Secret reveal ---------- */
.secret-box {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; margin: 1.25rem 0;
  border-radius: var(--radius-md); border: 1px dashed #22c55e80; background: #22c55e14;
  font-family: var(--font-mono); font-size: 1.125rem; word-break: break-all;
}

/* ---------- Play placeholder ---------- */
.play-hero { text-align: center; max-width: 640px; margin: 4rem auto; }
.play-hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0.75rem 0; }
.play-hero p { color: var(--text-muted); font-size: 1.0625rem; }
.tiles { display: flex; justify-content: center; gap: 1rem; margin: 2.5rem 0; }
.tile {
  width: 56px; height: 112px; border-radius: 12px; background: var(--brand-snow);
  display: grid; grid-template-rows: 1fr 1fr; padding: 8px; box-shadow: var(--shadow-glow);
  position: relative;
}
.tile::after {
  content: ""; position: absolute; left: 10px; right: 10px; top: calc(50% - 1px);
  height: 2px; border-radius: 1px; background: var(--brand-green);
}
.tile:nth-child(1) { transform: rotate(-12deg); }
.tile:nth-child(3) { transform: rotate(12deg); }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); place-items: center; }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-ink); }
.pips i.off { background: transparent; }
.play-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border); background: var(--surface-overlay);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.site-header nav { display: flex; align-items: center; gap: 0.5rem; }

/* ---------- Public legal pages ---------- */
.lang-switch { display: flex; gap: 0.25rem; }
.lang-switch a { padding: 0.25rem 0.75rem; border-radius: var(--radius-full); color: var(--text-muted); font-size: 0.8125rem; }
.lang-switch a[aria-current] { background: #2563eb26; color: var(--text); }
.legal { max-width: 760px; margin: 0 auto; padding: 2.5rem 16px 3rem; }
.legal-text h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); }
.legal-text h2 { font-size: 1.1875rem; margin: 2rem 0 0.5rem; }
.legal-text p, .legal-text li { color: #cbd5e1; font-size: 1rem; line-height: 1.7; }
.legal-text p { margin: 0 0 1rem; }
.legal-text ul { margin: 0 0 1rem; padding-left: 1.25rem; display: grid; gap: 0.375rem; }
.legal-text strong { color: var(--text); }
.legal-text a { text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.legal-meta { margin: 0.5rem 0 1.75rem !important; color: var(--text-subtle) !important; font-size: 0.875rem !important; }
.legal-form { margin-top: 2rem; display: grid; gap: 1rem; }
.legal-form .form-actions { justify-content: flex-start; margin-top: 1rem; }
.legal-secondary { flex-wrap: wrap; }
.legal-footer {
  max-width: 760px; margin: 0 auto; padding: 1.5rem 16px 3rem;
  border-top: 1px solid var(--border); display: grid; gap: 0.5rem;
}
.legal-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.875rem; }

/* ---------- Notification templates ---------- */
.notify-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.notify-layout > .card { margin-bottom: 0; }
.notify-layout + .card { margin-top: 1.25rem; }
.notify-language { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.25rem 0.25rem; margin: 0 0 1.25rem; }
.notify-language legend { padding: 0 0.5rem; font-weight: 600; }
.notify-preview { position: sticky; top: 1rem; }
.notify-subjects { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.75rem; margin: 0 0 1rem; font-size: 0.875rem; }
.notify-subjects dt { color: var(--text-muted); }
.notify-subjects dd { margin: 0; overflow-wrap: anywhere; }
.email-frame { display: block; width: 100%; height: 760px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #F3F4F6; }
.notify-look { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.notify-logo { width: 48px; height: 48px; border-radius: 12px; flex: none; }
.notify-swatch { display: inline-block; width: 0.875rem; height: 0.875rem; border-radius: 4px; vertical-align: -2px; margin-right: 0.375rem; border: 1px solid var(--border); }
/* The list: one card per email, with a live, scaled-down preview of it on top. */
.notify-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 1.25rem; }
.notify-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin-bottom: 0; }
.notify-thumb { display: block; position: relative; height: 330px; overflow: hidden; background: #F3F4F6; border-bottom: 1px solid var(--border); }
.notify-thumb iframe { position: absolute; top: 0; left: 0; width: 200%; height: 200%; border: 0; transform: scale(0.5); transform-origin: 0 0; pointer-events: none; background: #F3F4F6; }
.notify-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 70%, var(--surface-raised, #141B2D) 100%); opacity: 0.9; }
.notify-card-body { padding: 1rem 1.25rem 1.25rem; display: grid; gap: 0.5rem; flex: 1; }
.notify-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.notify-card-head h2 { margin: 0; font-size: 1.0625rem; }
.notify-card-body .muted { margin: 0; font-size: 0.875rem; }
.notify-subject { margin: 0; font-size: 0.875rem; overflow-wrap: anywhere; }
.notify-subject .subtle { margin-right: 0.375rem; }
.notify-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: auto; padding-top: 0.5rem; font-size: 0.8125rem; }

/* ---------- Activity ---------- */
.live-dot {
  display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.5rem; border-radius: 50%;
  background: var(--brand-green); box-shadow: 0 0 0 0 #22c55e80; animation: live-pulse 2s infinite;
  vertical-align: 0.2em;
}
@keyframes live-pulse { 70% { box-shadow: 0 0 0 0.45rem #22c55e00; } 100% { box-shadow: 0 0 0 0 #22c55e00; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.stats > .card { margin-top: 0; }
.app-activity .stats { margin-bottom: 0; }
.app-activity .stat { padding: 0.25rem 0; }
.app-activity + .stats { margin-top: 1.25rem; }
.kind-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.kind {
  display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.125rem 0.625rem;
  border-radius: var(--radius-full); border: 1px solid var(--border-strong);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; color: #cbd5e1;
}
.kind-row .kind { font-size: 0.8125rem; padding: 0.375rem 0.875rem; }
.kind-online { background: #22c55e1f; border-color: #22c55e66; color: #86efac; }
.kind-computer { background: #2563eb26; border-color: #2563eb66; color: #93c5fd; }
.kind-practice { background: #f59e0b1f; border-color: #f59e0b66; color: #fcd34d; }
.kind-score { background: #14b8a61f; border-color: #14b8a666; color: #5eead4; }
.kind-lobby { background: #a855f71f; border-color: #a855f766; color: #d8b4fe; }
.kind-away { color: var(--text-subtle); }
.player-cell { display: grid; color: var(--text); }
.player-cell:hover strong { text-decoration: underline; }
.table-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.room { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; background: var(--surface-sunken); }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.room-code { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; }
.room-label { margin: 0.375rem 0 0.75rem; font-size: 0.875rem; color: var(--text-muted); }
.room-players { margin: 0 0 0.5rem; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.room-players li { display: grid; gap: 0.125rem; }
.room p.subtle { margin: 0; }
.note { margin: 1rem 0 0; }
.grid-2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-top: 1.25rem; }
.grid-2 > .card { margin-top: 0; }
.grid-2 + .card, .card + .grid-2 { margin-top: 1.25rem; }
.chart { display: block; width: 100%; height: 150px; overflow: visible; }
.chart-ticks { display: flex; justify-content: space-between; margin-top: 0.375rem; color: var(--text-subtle); font-size: 0.6875rem; }
.chart-bar { fill: var(--brand-blue); }
.chart-bar:hover { fill: var(--brand-green); }
.chart-base { stroke: var(--border-strong); stroke-width: 1; }
.share-card h2 { margin-bottom: 0.75rem; }
.share-card p.subtle { margin: -0.25rem 0 0.75rem; }
.share-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.75rem; }
.share-list li { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.75rem; font-size: 0.875rem; }
.share-label { overflow-wrap: anywhere; }
.share-value { font-weight: 600; text-align: right; white-space: nowrap; }
.meter { grid-column: 1 / -1; width: 100%; height: 6px; }
.meter-track { fill: rgb(255 255 255 / 0.06); }
.meter-fill { fill: var(--brand-blue); }
.share-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 1.25rem; }
.share-grid > .card { margin-top: 0; }

/* ---------- Player pictures and profile ---------- */
.player-pic { flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-sunken); border: 1px solid var(--border-strong); }
.player-pic-sm { width: 32px; height: 32px; }
.player-pic-lg { width: 96px; height: 96px; border-width: 2px; }
.player-pic-initial {
  display: grid; place-items: center; font-weight: 700; color: var(--text);
  background: linear-gradient(135deg, var(--brand-blue-light), var(--brand-blue-dark));
}
.player-pic-sm.player-pic-initial { font-size: 0.8125rem; }
.player-pic-lg.player-pic-initial { font-size: 2.25rem; }
.player-cell-pic { display: flex; align-items: center; gap: 0.625rem; }
.player-cell-text { display: grid; min-width: 0; }
.profile-head { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.profile-who h2 { font-size: 1.375rem; }
.profile-username { color: var(--text-muted); margin-top: 0.125rem; }
.profile-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.profile-facts {
  display: grid; gap: 0.875rem 1.5rem; margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--border);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.profile-facts dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-subtle); }
.profile-facts dd { margin: 0.25rem 0 0; font-size: 0.9375rem; overflow-wrap: anywhere; }
.profile-card + .stats { margin-top: 1.25rem; }

/* ---------- Errors ---------- */
.value-danger { color: #fca5a5; }
.value-sm { font-size: 1.125rem !important; letter-spacing: 0 !important; }
.app-activity .stat a { color: inherit; }
.badge-crash { background: rgb(239 68 68 / 0.15); border-color: rgb(239 68 68 / 0.5); color: #fca5a5; }
.status-open { background: #f59e0b1f; border-color: #f59e0b66; color: #fcd34d; }
.status-resolved { background: #22c55e1f; border-color: #22c55e66; color: #86efac; }
.status-ignored { color: var(--text-subtle); }
.source-app { background: #2563eb26; border-color: #2563eb66; color: #93c5fd; }
.source-worker { background: #14b8a61f; border-color: #14b8a666; color: #5eead4; }
.source-api { background: #a855f71f; border-color: #a855f766; color: #d8b4fe; }
.source-console { color: #cbd5e1; }
.filters-errors { grid-template-columns: 2fr repeat(4, 1fr) auto; }
.issue-cell a { display: grid; gap: 0.125rem; color: var(--text); }
.issue-cell a:hover strong { text-decoration: underline; }
.issue-message { color: var(--text-muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.issue-headline { color: var(--text) !important; font-size: 1rem; overflow-wrap: anywhere; }
.issue-note { margin: 0.5rem 0 0; color: var(--text-muted); font-size: 0.875rem; }
.status-card .card-header { margin-bottom: 0.75rem; }
.status-card .card-header .subtle { margin-left: 0.5rem; }
.status-form { display: grid; gap: 0.75rem; }
.stack {
  margin: 0.75rem 0 0; padding: 1rem; overflow-x: auto; max-height: 520px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-sunken);
  font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.6; color: var(--text-subtle); white-space: pre;
}
.stack .frame-own { color: var(--text); background: #2563eb1f; display: inline-block; min-width: 100%; }
.sub-heading { margin: 1.25rem 0 0.5rem; font-size: 0.9375rem; }
.steps { margin: 0.5rem 0 0; padding-left: 1.5rem; display: grid; gap: 0.125rem; font-size: 0.75rem; color: var(--text-muted); }
.reports { display: grid; gap: 0.5rem; grid-template-columns: minmax(0, 1fr); }
.report { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-sunken); }
.status-card + .stats { margin-top: 1.25rem; }
.issue-cell .badge { justify-self: start; }
.report summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.875rem;
  padding: 0.75rem 1rem; cursor: pointer; font-size: 0.875rem;
}
.report[open] summary { border-bottom: 1px solid var(--border); }
.report-body { padding: 0.25rem 1rem 1rem; font-size: 0.875rem; }
.report-body p { margin: 0.5rem 0; overflow-wrap: anywhere; }
.meter-danger { fill: #f87171; }
.share-grid-tight { margin-top: 0; grid-template-columns: 1fr; }

/* ---------- Moderation ---------- */
.standing-active { background: #22c55e1f; border-color: #22c55e66; color: #86efac; }
.standing-suspended { background: #f59e0b1f; border-color: #f59e0b66; color: #fcd34d; }
.standing-blocked { background: rgb(239 68 68 / 0.15); border-color: rgb(239 68 68 / 0.5); color: #fca5a5; }
.standing-restricted { background: #a855f71f; border-color: #a855f766; color: #d8b4fe; }
.moderation-form textarea { width: 100%; }
.moderation-actions { display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.close-form, .block-devices { margin: 0.75rem 0 1rem; }
.close-form input, .block-devices input { flex: 1 1 16rem; min-width: 0; }
.report-picture {
  display: block; width: 160px; height: 160px; object-fit: cover; margin: 0.75rem 0;
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.chat-lines { list-style: none; margin: 0.75rem 0; padding: 0; display: grid; gap: 0.375rem; }
.chat-lines li {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline;
  padding: 0.375rem 0.625rem; border-radius: var(--radius-md); overflow-wrap: anywhere;
}
.chat-line-reported { background: rgb(239 68 68 / 0.1); }
.appeal-head { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; padding: 0.875rem 1rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .notify-layout { grid-template-columns: 1fr; }
  .notify-preview { position: static; }
}
@media (max-width: 900px) {
  .filters-errors { grid-template-columns: 1fr 1fr; }
  .console { grid-template-columns: 1fr; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.875rem 1rem; border-bottom: 1px solid var(--border);
    background: var(--surface-overlay); position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(12px);
  }
  .sidebar {
    display: none; position: fixed; inset: 0; z-index: 30; height: 100vh;
    background: var(--surface); border-right: 0;
  }
  .sidebar.is-open { display: flex; }
  .topbar-close { display: inline-flex; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: 1 / -1; }
  .main { padding-top: 1.25rem; }
}

@media (max-width: 520px) {
  .filters { grid-template-columns: 1fr; }
  .card { padding: 1.125rem; border-radius: var(--radius-lg); }
  .table-wrap { margin: 0 -1.125rem; padding: 0 1.125rem; }
}

/* A player's picture, large (templates/layouts/console.html, static/js/app.js). */
[data-zoom] { cursor: zoom-in; }
[data-zoom]:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
.zoom-dialog {
  padding: 1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); max-width: calc(100vw - 2rem);
  text-align: center;
}
.zoom-dialog::backdrop { background: rgb(0 0 0 / 0.75); }
.zoom-picture {
  display: block; width: min(512px, calc(100vw - 4rem), calc(100vh - 8rem)); height: auto; aspect-ratio: 1;
  object-fit: contain; margin: 0 auto 0.75rem; border-radius: var(--radius-md); background: var(--surface-sunken);
  cursor: zoom-out;
}

/* ---------- Levels and XP ---------- */
.level-badge {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  background: var(--surface-sunken); color: var(--brand-ink);
  font-weight: 800; border: 2px solid rgb(255 255 255 / 0.25); line-height: 1;
}
.level-badge-sm { width: 2.25rem; height: 2.25rem; font-size: 0.9375rem; }
.level-badge-lg { width: 4.5rem; height: 4.5rem; font-size: 1.75rem; }
img.level-badge { object-fit: contain; background: transparent; border-color: transparent; cursor: zoom-in; }
.level-cell { display: inline-flex; align-items: center; gap: 0.625rem; color: var(--text); }
.level-preview { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.level-preview-text { display: grid; gap: 0.25rem; flex: 1 1 14rem; min-width: 0; }
.level-preview-name { font-size: 1.125rem; font-weight: 700; }
.level-preview .meter { width: 100%; max-width: 24rem; }
.adjust-form { display: grid; gap: 0.75rem; grid-template-columns: minmax(7rem, 1fr) 3fr auto; align-items: end; }
@media (max-width: 640px) { .adjust-form { grid-template-columns: 1fr; } }
input[type="file"] { color: var(--text-muted); font: inherit; font-size: 0.875rem; }

/* ---------- Suggestions ---------- */
.status-new { background: #2563eb26; border-color: #2563eb66; color: #93c5fd; }
.status-read { color: #cbd5e1; }
.status-planned { background: #f59e0b1f; border-color: #f59e0b66; color: #fcd34d; }
.status-done { background: #22c55e1f; border-color: #22c55e66; color: #86efac; }
.status-dismissed { color: var(--text-subtle); }
.filters-suggestions { grid-template-columns: minmax(0, 16rem) auto; justify-content: start; }
.suggestion-text { margin: 0; font-size: 1rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
