/* VEGAN Badminton: shared design system (base + components). View-specific rules live in
   public.css / admin.css / scoring.css. Every colour/font references a token from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
html { background: var(--c-paper); color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 450;
  line-height: 1.5;
  color: var(--c-ink);
  background:
    radial-gradient(60vmax 50vmax at 8% -10%, oklch(88% 0.165 95 / 0.10), transparent 60%),
    radial-gradient(55vmax 45vmax at 105% 110%, oklch(82% 0.160 78 / 0.08), transparent 60%),
    var(--c-paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
::selection { background: var(--c-accent); color: var(--c-accent-ink); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- type ---------- */
.display, h1, h2, h3 {
  font-family: var(--font-display);
  font-style: normal;
  font-stretch: var(--wide);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); text-transform: uppercase; }
h2 { font-size: var(--text-xl); text-transform: uppercase; }
h3 { font-size: var(--text-lg); }
p { margin: 0; }
.kicker {
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700;
  font-size: var(--text-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-accent);
}
.muted { color: var(--c-muted); }
.faint { color: var(--c-faint); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.accent { color: var(--c-accent); }

/* ---------- layout ---------- */
.wrap { width: min(1120px, 100%); margin-inline: auto; padding-inline: var(--space-4); }
.view { padding-block: var(--space-6) calc(var(--tabbar-h) + var(--space-10)); }
@media (min-width: 768px) { .view { padding-bottom: var(--space-16); } }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.grid-cards { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr)); }
@media (min-width: 640px) { .grid-cards { gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); } }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; }
.section-head .kicker { display: block; margin-bottom: var(--space-1); }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: oklch(14% 0.006 95 / 0.82);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--c-rule);
}
.topbar__in { display: flex; align-items: center; gap: var(--space-4); height: 60px; }
.brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; flex: none; }
.brand img { height: 18px; width: auto; }
.brand__tag {
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; font-size: 10px;
  letter-spacing: 0.22em; color: var(--c-faint); text-transform: uppercase; white-space: nowrap;
}
@media (max-width: 420px) { .brand__tag { display: none; } }
@media (max-width: 359px) {
  .topbar__in { gap: var(--space-2); }
  .brand img { height: 15px; }
  .topbar__right .btn span { display: none; }
  .topbar__right .btn { width: 38px; padding: 0; }
}
.topnav { display: none; gap: var(--space-1); margin-left: var(--space-4); }
@media (min-width: 768px) { .topnav { display: flex; } }
.topnav a, .tabbar a {
  text-decoration: none; color: var(--c-muted); white-space: nowrap;
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; font-size: var(--text-xs);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.topnav a { padding: 8px 12px; border-radius: var(--r-pill); transition: color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.topnav a:hover { color: var(--c-ink); background: var(--c-paper-3); }
.topnav a[aria-current="page"] { color: var(--c-accent-ink); background: var(--c-accent); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill);
  background: oklch(66% 0.22 25 / 0.16); color: var(--c-ink); text-decoration: none;
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 800; font-size: 11px; letter-spacing: 0.14em;
}
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--c-live); box-shadow: 0 0 0 0 var(--c-live); animation: livePulse 1.6s var(--ease-out) infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 oklch(66% 0.22 25 / 0.55); } 100% { box-shadow: 0 0 0 10px oklch(66% 0.22 25 / 0); } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: oklch(14% 0.006 95 / 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--c-rule);
}
@media (min-width: 768px) { .tabbar { display: none; } }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 9.5px; letter-spacing: 0.08em; position: relative; }
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--c-accent); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--c-accent); border-radius: 0 0 2px 2px; }

.demo-banner {
  background: var(--c-accent); color: var(--c-accent-ink); text-align: center; padding: 6px 12px;
  font-size: var(--text-xs); font-weight: 700;
}

/* ---------- icons ---------- */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 24px; height: 24px; }

/* ---------- buttons (8 states) ---------- */
.btn {
  --btn-bg: var(--c-paper-3); --btn-fg: var(--c-ink); --btn-bd: var(--c-rule-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 42px; padding: 10px 16px; border-radius: var(--r-md);
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.04em;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), opacity var(--dur-micro) var(--ease-out);
}
.btn:hover { --btn-bg: var(--c-paper-4); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.is-loading { pointer-events: none; opacity: 0.8; }
.btn.is-loading::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-primary { --btn-bg: var(--c-accent); --btn-fg: var(--c-accent-ink); --btn-bd: var(--c-accent); }
.btn-primary:hover { --btn-bg: var(--c-accent-2); --btn-bd: var(--c-accent-2); }
.btn-ghost { --btn-bg: transparent; --btn-bd: var(--c-rule-2); }
.btn-ghost:hover { --btn-bg: var(--c-paper-3); }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--c-loss); --btn-bd: oklch(70% 0.19 25 / 0.5); }
.btn-danger:hover { --btn-bg: oklch(70% 0.19 25 / 0.12); }
.btn-wa { --btn-bg: oklch(72% 0.17 150 / 0.14); --btn-fg: var(--c-wa); --btn-bd: oklch(72% 0.17 150 / 0.45); }
.btn-wa:hover { --btn-bg: oklch(72% 0.17 150 / 0.22); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn-lg { min-height: 52px; padding: 14px 22px; font-size: var(--text-md); }
.btn-icon { min-height: 38px; width: 38px; padding: 0; border-radius: var(--r-md); }
.btn-block { width: 100%; }

/* ---------- surfaces ---------- */
.panel {
  background: var(--c-paper-2); border: 1px solid var(--c-rule); border-radius: var(--r-lg);
  padding: var(--space-5);
}
.panel-tight { padding: var(--space-4); }
.cut { clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)); }
.hud {
  position: relative; background: linear-gradient(160deg, var(--c-paper-3), var(--c-paper-2));
  border: 1px solid var(--c-rule); border-radius: var(--r-lg); padding: var(--space-5);
}
.hud::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, var(--c-accent-line), transparent 30%) top left / 100% 1px no-repeat;
}
.divider { height: 1px; background: var(--c-rule); border: 0; margin: var(--space-4) 0; }

/* list rows */
.list { display: flex; flex-direction: column; border: 1px solid var(--c-rule); border-radius: var(--r-lg); overflow: hidden; background: var(--c-paper-2); }
.list-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); text-decoration: none; min-width: 0; }
.list-item + .list-item { border-top: 1px solid var(--c-rule); }
a.list-item:hover, button.list-item:hover { background: var(--c-paper-3); }
button.list-item { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item__sub { font-size: var(--text-sm); color: var(--c-muted); }

/* chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--c-paper-3); border: 1px solid var(--c-rule); color: var(--c-muted);
  font-size: var(--text-xs); font-weight: 700; white-space: nowrap;
}
.chip-accent { background: var(--c-accent-dim); border-color: var(--c-accent-line); color: var(--c-accent); }
.chip-win { color: var(--c-win); border-color: oklch(80% 0.17 150 / 0.4); background: oklch(80% 0.17 150 / 0.1); }
.chip-loss { color: var(--c-loss); border-color: oklch(70% 0.19 25 / 0.4); background: oklch(70% 0.19 25 / 0.1); }
.chip-live { color: var(--c-ink); border-color: oklch(66% 0.22 25 / 0.5); background: oklch(66% 0.22 25 / 0.18); }
.tier {
  --t: var(--t-rookie);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 6px;
  border: 1px solid color-mix(in oklch, var(--t) 55%, transparent); color: var(--t);
  background: color-mix(in oklch, var(--t) 12%, transparent);
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 800; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
}
.tier::before { content: ""; width: 7px; height: 7px; transform: rotate(45deg); background: var(--t); }
[data-tier="bronze"] { --t: var(--t-bronze); } [data-tier="silver"] { --t: var(--t-silver); } [data-tier="gold"] { --t: var(--t-gold); }
[data-tier="platinum"] { --t: var(--t-platinum); } [data-tier="diamond"] { --t: var(--t-diamond); } [data-tier="master"] { --t: var(--t-master); }
[data-tier="rookie"] { --t: var(--t-rookie); }
.form-dots { display: inline-flex; gap: 4px; }
.form-dots span { width: 18px; height: 18px; border-radius: 4px; display: grid; place-items: center; font-size: 10px; font-weight: 800; font-family: var(--font-display); }
.form-dots .w { background: oklch(80% 0.17 150 / 0.18); color: var(--c-win); }
.form-dots .l { background: oklch(70% 0.19 25 / 0.18); color: var(--c-loss); }

/* avatar (round cutout or initials) */
.avatar {
  --sz: 40px; width: var(--sz); height: var(--sz); border-radius: 50%; flex: none; overflow: hidden; position: relative;
  background: radial-gradient(circle at 50% 75%, oklch(88% 0.165 95 / 0.35), var(--c-paper-4) 70%);
  border: 1px solid var(--c-rule-2); display: grid; place-items: center;
  font-family: var(--font-display); font-stretch: var(--wide); font-weight: 800; font-size: calc(var(--sz) * 0.36); color: var(--c-ink);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.avatar-sm { --sz: 28px; } .avatar-lg { --sz: 56px; }
.avatars { display: inline-flex; } .avatars .avatar + .avatar { margin-left: -10px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label {
  font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: var(--text-xs);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted);
}
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-md);
  background: var(--c-paper); border: 1px solid var(--c-rule-2); color: var(--c-ink);
  transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--c-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--c-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--c-accent); background: var(--c-paper-2); box-shadow: 0 0 0 3px var(--c-accent-dim); }
.input[aria-invalid="true"] { border-color: var(--c-loss); }
.input:disabled, .select:disabled { opacity: 0.5; cursor: not-allowed; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23d8d4c4' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.hint { font-size: var(--text-xs); color: var(--c-faint); }
.field-error { font-size: var(--text-xs); color: var(--c-loss); }
.form-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--c-paper); border: 1px solid var(--c-rule-2); }
.seg button, .seg label {
  border: 0; background: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--c-muted);
  font-family: var(--font-display); font-stretch: 112%; font-weight: 700; font-size: var(--text-xs); letter-spacing: 0.06em; white-space: nowrap;
}
.seg button:hover, .seg label:hover { color: var(--c-ink); }
.seg button[aria-pressed="true"], .seg input:checked + label, .seg label.is-on { background: var(--c-accent); color: var(--c-accent-ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { width: 44px; height: 26px; border-radius: 99px; background: var(--c-paper-4); border: 1px solid var(--c-rule-2); position: relative; flex: none; transition: background-color var(--dur-micro) var(--ease-out); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--c-muted); transition: transform var(--dur-short) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--c-accent); border-color: var(--c-accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--c-accent-ink); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--c-focus); outline-offset: 2px; }

/* range slider (attribute ratings) */
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--c-accent) var(--p, 50%), var(--c-paper-4) var(--p, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 99px; background: var(--c-paper-4); }
.range::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--c-accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--c-ink); border: 3px solid var(--c-accent); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--c-ink); border: 3px solid var(--c-accent); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--c-accent-dim); }

/* checkbox chips (attendance picker) */
.pick { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--c-rule-2); background: var(--c-paper); cursor: pointer; min-width: 0; }
.pick:hover { border-color: var(--c-faint); }
.pick input { width: 18px; height: 18px; accent-color: oklch(88% 0.165 95); flex: none; }
.pick:has(input:checked) { border-color: var(--c-accent-line); background: var(--c-accent-dim); }

/* ---------- player card: HUD broadcast (bingkai hologram, siku kuning, scanline) ---------- */
.pcard {
  --t: var(--t-rookie);
  position: relative; isolation: isolate; display: flex; flex-direction: column; text-decoration: none; color: var(--c-ink);
  aspect-ratio: 3 / 4.25; padding: var(--space-3); overflow: hidden; border-radius: 12px;
  background:
    radial-gradient(120% 65% at 50% 82%, color-mix(in oklch, var(--t) 32%, transparent), transparent 70%),
    radial-gradient(90% 45% at 50% -5%, var(--c-holo-dim), transparent 70%),
    linear-gradient(180deg, var(--c-stage-2), var(--c-stage));
  box-shadow: inset 0 0 0 1px var(--c-holo-line), inset 0 0 28px -10px var(--c-holo), 0 14px 30px -20px oklch(5% 0 0 / 0.9);
  transition: transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out);
}
.pcard::before { /* siku HUD kuning di 4 sudut */
  content: ""; position: absolute; inset: 5px; z-index: 4; pointer-events: none;
  --b: 2px; --l: 16px; --k: var(--c-accent);
  background:
    linear-gradient(var(--k) 0 0) left top / var(--l) var(--b), linear-gradient(var(--k) 0 0) left top / var(--b) var(--l),
    linear-gradient(var(--k) 0 0) right top / var(--l) var(--b), linear-gradient(var(--k) 0 0) right top / var(--b) var(--l),
    linear-gradient(var(--k) 0 0) left bottom / var(--l) var(--b), linear-gradient(var(--k) 0 0) left bottom / var(--b) var(--l),
    linear-gradient(var(--k) 0 0) right bottom / var(--l) var(--b), linear-gradient(var(--k) 0 0) right bottom / var(--b) var(--l);
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 4px oklch(88% 0.165 95 / 0.55));
}
.pcard::after { /* scanline + garis lapangan */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0.55;
  background:
    repeating-linear-gradient(0deg, oklch(96% 0.006 95 / 0.035) 0 1px, transparent 1px 4px),
    linear-gradient(90deg, transparent calc(50% - 0.5px), var(--c-holo-dim) calc(50% - 0.5px), var(--c-holo-dim) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(0deg, transparent 34%, var(--c-holo-dim) 34%, var(--c-holo-dim) calc(34% + 1px), transparent calc(34% + 1px));
}
a.pcard:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px var(--c-holo), inset 0 0 34px -8px var(--c-holo), 0 0 26px -8px var(--c-holo); }
a.pcard:active { transform: translateY(-1px); }
a.pcard:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
.pcard__top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); position: relative; z-index: 3; padding: 4px 2px 0; }
.pcard__ovr { display: flex; flex-direction: column; line-height: 0.9; }
.pcard__ovr b { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 900; font-size: 2.1rem; color: var(--c-accent); font-variant-numeric: tabular-nums; text-shadow: 0 0 18px oklch(88% 0.165 95 / 0.35); }
.pcard__ovr span { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; font-size: 9px; letter-spacing: 0.2em; color: var(--c-holo); margin-top: 4px; }
.pcard__rank { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-family: var(--font-display); font-stretch: var(--wide); font-weight: 800; font-size: 11px; letter-spacing: 0.1em; color: var(--c-muted); text-align: right; }
.pcard__rank b { display: block; font-size: 1.15rem; color: var(--c-ink); letter-spacing: 0; line-height: 1; }
.pcard__photo { position: absolute; z-index: 1; inset: 12% 4% 30% 4%; display: grid; place-items: end center; }
.pcard__photo img { width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 10px 16px oklch(5% 0.01 240 / 0.75)); -webkit-mask-image: linear-gradient(180deg, black 72%, transparent 99%); mask-image: linear-gradient(180deg, black 72%, transparent 99%); }
.pcard__photo svg { width: 70%; height: auto; color: oklch(96% 0.006 95 / 0.16); }
.pcard__foot { margin-top: auto; position: relative; z-index: 3; display: flex; flex-direction: column; gap: 5px; padding: 0 2px 2px; }
.pcard__foot::before { content: ""; position: absolute; inset: -44px calc(-1 * var(--space-3)) calc(-1 * var(--space-3)); z-index: -1; background: linear-gradient(0deg, var(--c-stage) 35%, oklch(13% 0.018 240 / 0)); }
.pcard__name { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 900; font-size: 1.05rem; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--c-accent); padding-left: 6px; }
.pcard__meta { display: flex; gap: 6px; align-items: center; justify-content: space-between; font-size: 11px; color: var(--c-muted); font-weight: 600; min-width: 0; }
.pcard__meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard__wl { font-family: var(--font-display); font-weight: 800; color: var(--c-ink); font-variant-numeric: tabular-nums; flex: none; }
.pcard__bars { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--c-holo-line); padding-top: 6px; }
.sbar { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) 1.7em; align-items: center; gap: 6px; }
.sbar > span { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; font-size: 8.5px; letter-spacing: 0.12em; color: var(--c-holo); }
.sbar > b { font-family: var(--font-display); font-weight: 800; font-size: 0.82rem; text-align: right; font-variant-numeric: tabular-nums; }
.sbar .segbar { --h: 9px; --seg: 4px; --gap: 2px; padding: 1px; }
@media (max-width: 400px) {
  :is(.grid-cards, .card-rail) .pcard__ovr b { font-size: 1.75rem; }
  :is(.grid-cards, .card-rail) .pcard__rank b { font-size: 1rem; }
  :is(.grid-cards, .card-rail) .pcard .tier { font-size: 8.5px; padding: 2px 5px 2px 4px; letter-spacing: 0.06em; gap: 4px; }
  :is(.grid-cards, .card-rail) .pcard .tier::before { width: 5px; height: 5px; }
}
.pcard-lg { max-width: 340px; width: 100%; padding: var(--space-5); }
.pcard-lg::before { --l: 24px; --b: 3px; inset: 8px; }
.pcard-lg .pcard__ovr b { font-size: 3.4rem; }
.pcard-lg .pcard__name { font-size: 1.7rem; border-left-width: 4px; padding-left: 10px; }
.pcard-lg .pcard__meta { font-size: var(--text-sm); }
.pcard-lg .sbar > span { font-size: 10px; }
.pcard-lg .sbar > b { font-size: 1.05rem; }
.pcard-lg .sbar .segbar { --h: 12px; --seg: 6px; --gap: 3px; }

/* bar bersegmen (power rating & kartu): isi merah ke kuning, segmen redup = sisa */
.segbar {
  --h: 16px; --seg: 7px; --gap: 3px;
  position: relative; display: block; height: var(--h); padding: 2px; border-radius: 4px; min-width: 0;
  border: 1px solid oklch(86% 0.16 88 / 0.5); background: oklch(10% 0.012 240 / 0.7);
  transform: skewX(-14deg); box-shadow: 0 0 10px -4px oklch(86% 0.16 88 / 0.6);
}
.segbar::before, .segbar i { content: ""; position: absolute; inset: 2px; -webkit-mask: repeating-linear-gradient(90deg, black 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--gap))); mask: repeating-linear-gradient(90deg, black 0 var(--seg), transparent var(--seg) calc(var(--seg) + var(--gap))); }
.segbar::before { background: oklch(96% 0.006 95 / 0.09); }
.segbar i { background: linear-gradient(90deg, var(--c-heat-1), var(--c-heat-2) 55%, var(--c-accent)); clip-path: inset(0 calc(100% - var(--v, 0%)) 0 0); animation: segFill var(--dur-long) var(--ease-out) both; }
@keyframes segFill { from { clip-path: inset(0 100% 0 0); } }

/* ---------- radar chart ---------- */
.radar { width: 100%; height: auto; overflow: visible; }
.radar .ring { fill: none; stroke: var(--c-rule); stroke-width: 1; }
.radar .ring-outer { stroke: var(--c-rule-2); }
.radar .axis { stroke: var(--c-rule); stroke-width: 1; }
.radar .shape-prev { fill: none; stroke: var(--c-faint); stroke-width: 1.2; stroke-dasharray: 4 4; }
.radar .shape { fill: oklch(88% 0.165 95 / 0.22); stroke: var(--c-accent); stroke-width: 2.2; stroke-linejoin: round; filter: drop-shadow(0 0 6px oklch(88% 0.165 95 / 0.55)); }
.radar .shape-g { transform-origin: 50% 50%; transform-box: view-box; animation: radarIn var(--dur-long) var(--ease-out) both; }
.radar .vtx { fill: var(--c-ink); stroke: var(--c-accent); stroke-width: 2; }
.radar .lbl { fill: var(--c-muted); font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.radar .val { fill: var(--c-ink); font-family: var(--font-display); font-weight: 800; font-size: 13px; }
@keyframes radarIn { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.radar-card { display: flex; flex-direction: column; gap: var(--space-3); }
.radar-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.radar-card__score { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 900; font-size: 2rem; color: var(--c-accent); line-height: 1; font-variant-numeric: tabular-nums; }

/* stat bars */
.statbar { display: grid; grid-template-columns: 74px minmax(0, 1fr) 30px; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.statbar span:first-child { font-family: var(--font-display); font-stretch: var(--wide); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--c-muted); font-size: 10px; }
.statbar i { height: 6px; border-radius: 99px; background: var(--c-paper-4); overflow: hidden; display: block; }
.statbar i b { display: block; height: 100%; width: var(--v); background: linear-gradient(90deg, var(--c-accent-2), var(--c-accent)); border-radius: inherit; }
.statbar em { font-style: normal; font-family: var(--font-display); font-weight: 800; text-align: right; }

/* ---------- scoreboard (public live + preview) ---------- */
.scoreboard { position: relative; overflow: hidden; border-radius: var(--r-lg); background: linear-gradient(160deg, var(--c-paper-3), var(--c-paper-2)); border: 1px solid var(--c-rule); }
.scoreboard__bar { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--c-rule); font-size: var(--text-xs); color: var(--c-muted); }
.scoreboard__bar .kicker { color: var(--c-muted); }
.sb-team { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--space-3); padding: var(--space-4); }
.sb-team + .sb-team { border-top: 1px solid var(--c-rule); }
.sb-team.is-serving .sb-names small { color: var(--c-accent); }
.sb-team.is-serving .sb-names small::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c-accent); box-shadow: 0 0 8px var(--c-accent); vertical-align: 1px; }
.sb-who { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.sb-names { min-width: 0; font-family: var(--font-display); font-stretch: var(--wide); font-weight: 800; text-transform: uppercase; font-size: var(--text-md); line-height: 1.15; overflow-wrap: anywhere; }
.sb-names small { display: block; font-family: var(--font-body); font-stretch: 100%; text-transform: none; font-weight: 500; font-size: var(--text-xs); color: var(--c-faint); }
.sb-sets { display: flex; gap: 4px; }
.sb-sets span { min-width: 30px; padding: 4px 6px; border-radius: 6px; background: var(--c-paper); text-align: center; font-family: var(--font-display); font-weight: 800; font-size: var(--text-sm); color: var(--c-faint); font-variant-numeric: tabular-nums; }
.sb-sets span.won { color: var(--c-ink); background: var(--c-paper-4); }
.sb-pts { min-width: 2.2ch; text-align: right; font-family: var(--font-display); font-stretch: var(--wide); font-weight: 900; font-size: clamp(2.4rem, 9vw, 4.2rem); line-height: 1; font-variant-numeric: tabular-nums; }
.sb-team.is-leading .sb-pts { color: var(--c-accent); }
.sb-team.is-winner .sb-names { color: var(--c-accent); }
.sb-pts.bump { animation: bump var(--dur-short) var(--ease-out); }
.sb-meta { white-space: nowrap; }
@media (max-width: 479px) {
  .scoreboard__bar { padding: var(--space-2) var(--space-3); }
  .sb-team { padding: var(--space-3); gap: var(--space-2); }
  .sb-who .avatars { display: none; }
  .sb-names { font-size: var(--text-sm); }
  .sb-sets span { min-width: 26px; padding: 3px 4px; font-size: var(--text-xs); }
  .list-item { padding: var(--space-3); }
  .list-item__title { white-space: normal; overflow-wrap: anywhere; }
}
@keyframes bump { from { transform: scale(1.18); } to { transform: scale(1); } }

/* ---------- empty / skeleton ---------- */
.empty { text-align: center; padding: var(--space-10) var(--space-4); color: var(--c-muted); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.empty svg { width: 34px; height: 34px; color: var(--c-faint); }
.empty h3 { color: var(--c-ink); font-size: var(--text-lg); text-transform: uppercase; }
.skel { background: linear-gradient(90deg, var(--c-paper-3), var(--c-paper-4), var(--c-paper-3)); background-size: 200% 100%; animation: skel 1.2s linear infinite; border-radius: var(--r-md); }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tabbar-h) + var(--space-4) + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--space-2); width: min(420px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 768px) { .toasts { bottom: var(--space-6); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--space-3); padding: 12px 14px; border-radius: var(--r-md); background: var(--c-paper-4); border: 1px solid var(--c-rule-2); box-shadow: var(--shadow-lift); font-size: var(--text-sm); font-weight: 600; animation: toastIn var(--dur-short) var(--ease-out); }
.toast.ok svg { color: var(--c-win); } .toast.err svg { color: var(--c-loss); } .toast.info svg { color: var(--c-accent); }
.toast.out { animation: toastOut calc(var(--dur-short) * 0.75) var(--ease-in) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- modal (dialog) ---------- */
.modal { border: 0; padding: 0; background: transparent; color: var(--c-ink); width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow: visible; }
.modal::backdrop { background: var(--c-scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal[open] { animation: modalIn var(--dur-long) var(--ease-out); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal__box { background: var(--c-paper-2); border: 1px solid var(--c-rule-2); border-radius: var(--r-lg); max-height: calc(100dvh - 32px); overflow: auto; overflow-wrap: anywhere; box-shadow: var(--shadow-lift); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--c-rule); position: sticky; top: 0; background: var(--c-paper-2); z-index: 1; }
.modal__head h2 { font-size: var(--text-lg); }
.modal__body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--c-rule); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--c-paper-2); }
.modal-wide { width: min(880px, calc(100% - 24px)); }

/* ---------- motion: page reveal ---------- */
.reveal { animation: reveal var(--dur-long) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 150ms !important; animation-iteration-count: 1 !important; transition-duration: 150ms !important; }
  .reveal, .radar .shape-g, .modal[open], .toast { animation-name: fadeOnly !important; }
  @keyframes fadeOnly { from { opacity: 0; } }
  .dot-live { animation: none; }
  a.pcard:hover, .btn:hover { transform: none; }
}
