.match-screen {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  max-width: none;
  padding: 0 0 10px;
  overflow: hidden;
}

html.is-match-fs,
html.is-match-fs body,
html.is-match-fs #app {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
html.is-match-fs .match-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  height: 100dvh;
  height: 100svh;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.match-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
}
.match-title {
  font-size: 13px;
  overflow: hidden;
  min-width: 0;
}
.match-title .vs {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-event {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-tools {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.match-tools .btn {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}
.tool-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-back {
  background: var(--team-a);
  color: var(--surface);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.match-tools .btn-tool {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.match-tools .btn-end {
  background: var(--ok);
  color: var(--ok-ink);
}

.match-sets {
  padding: 8px 12px 10px;
  font-size: var(--text-sm);
}

.match-sets table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px 4px;
}
.match-sets th, .match-sets td {
  text-align: center;
  padding: 7px 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.match-sets th { color: var(--ink-2); font-size: 11px; }
.match-sets td:first-child, .match-sets th:first-child {
  text-align: left;
  padding-left: 10px;
  font-weight: 800;
}
.match-sets th:first-child {
  background: transparent;
  box-shadow: none;
  padding-left: 4px;
}
.match-sets th:not(:first-child),
.match-sets td {
  background: var(--surface);
  border-radius: 10px;
  min-width: 2.2em;
  box-shadow: 0 1px 2px rgba(12, 32, 39, .06);
}

.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0 12px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 108px;
  box-shadow: var(--shadow-1);
}

.match-screen.flipped .match-board,
.match-screen.flipped .match-actions {
  direction: rtl;
}
.match-screen.flipped .team-col,
.match-screen.flipped .team-actions,
.match-screen.flipped .pair {
  direction: ltr;
}

.team-col {
  position: relative;
  padding: 10px 14px 10px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.team-col.a.serving { background: var(--team-a-soft); }
.team-col.b.serving { background: var(--team-b-soft); }

.serve-ribbon {
  position: absolute;
  left: 8px; top: 16px; bottom: 16px;
  width: 6px;
  border-radius: 99px;
  background: var(--serve);
  display: none;
}

.team-col.serving .serve-ribbon { display: block; }

.team-name {
  font-weight: 700;
  font-size: .95rem;
  width: fit-content;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.team-names {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.team-name.is-serving { color: var(--ink); }

.name-serve {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--serve);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--serve) 28%, transparent);
  flex-shrink: 0;
}

.team-score {
  font-family: var(--font-display);
  font-size: calc(var(--score-xl) * 0.7);
  line-height: .88;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}

.serve-no {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--serve-ink);
  background: var(--serve);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

.team-col.serving .serve-no { display: flex; }

.match-flag {
  text-align: center;
  min-height: 26px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--accent-ink);
}

.match-flag.match { color: var(--alert); }

.match-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 12px;
}

.team-actions { display: grid; gap: 8px; }

.act {
  min-height: var(--s7);
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: .04em;
  background: var(--btn-soft);
  color: var(--ink);
}

.team-actions.a .act { background: var(--team-a-soft); color: var(--team-a); }
.team-actions.b .act { background: var(--team-b-soft); color: var(--team-b); }
.act-win.a { background: var(--team-a) !important; color: #fff !important; }
.act-win.b { background: var(--team-b) !important; color: #fff !important; }
.act-ace { background: var(--serve) !important; color: var(--serve-ink) !important; }
.act-ue { background: var(--alert) !important; color: #fff !important; }
.act-fe { background: var(--ink) !important; color: var(--surface) !important; }

.act:active { transform: scale(.97); }
.act.dim { opacity: .35; pointer-events: none; }

.act-point {
  min-height: var(--s8);
  font-size: var(--score-md);
}
.act-point.a { background: var(--team-a) !important; color: #fff !important; }
.act-point.b { background: var(--team-b) !important; color: #fff !important; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.match-bottom {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 4px 12px 8px;
}

.match-bottom .btn {
  min-width: 76px;
  min-height: var(--s7);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: .04em;
}
.match-bottom .btn:not(.btn-alert) {
  background: var(--btn);
  color: var(--btn-ink);
}
.match-bottom .btn-alert {
  background: var(--alert);
  color: #fff;
}

.wizard-step { display: flex; flex-direction: column; gap: 12px; }
.wizard-nav { display: flex; gap: 10px; margin-top: 20px; }

.stat-table {
  width: 100%;
  font-size: var(--text-sm);
}
.stat-table td { padding: 8px 0; }
.stat-table .lbl { text-align: center; color: var(--ink-2); }
.stat-table .num { text-align: center; width: 28%; font-variant-numeric: tabular-nums; }

.player-stat-table th,
.player-stat-table td { padding: 8px 10px; }
.player-stat-table .lbl { text-align: left; }
.player-stat-table th { font-weight: 800; }

.bar-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  background: var(--surface);
}
.bar-row .fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--accent-soft);
  border-radius: var(--radius);
  z-index: 0;
}
.bar-row span { position: relative; z-index: 1; }
.bar-row .bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 1;
  gap: var(--s2);
}
.bar-row.lead {
  flex-direction: column;
  align-items: stretch;
  gap: var(--s1);
}
.bar-row .bar-note {
  position: relative;
  z-index: 1;
  color: var(--ink-2);
}
.chart-card .bar-row,
.share-card .bar-row {
  background: var(--surface-sunk);
}

.toggle {
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  border: 0;
}
.toggle.on { background: var(--accent); }
.toggle i {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: left 120ms;
}
.toggle.on i { left: 23px; }

/* Papan skor TV */
.board-page {
  flex: 1;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 1.2vh 2vw 1.8vh;
}

.board-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  padding: 0 0 1vh;
}

.board-ico {
  width: 40px;
  min-height: 40px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--ink);
}

.board-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
}

.board-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.6vw 1vh;
  flex-shrink: 0;
}

.board-flag {
  font-weight: 800;
  letter-spacing: .04em;
  font-size: clamp(1rem, 2.4vw, 1.8rem);
}

.board-score {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  min-height: 0;
}

.board-head,
.board-line {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) auto minmax(22vw, 0.75fr);
  align-items: center;
  gap: 2vw;
}

.board-head {
  padding: 0 2.4vw;
  color: var(--ink-3);
  font-size: clamp(0.85rem, 1.8vw, 1.3rem);
  font-weight: 700;
  letter-spacing: .08em;
}

.board-line {
  flex: 1;
  background: var(--surface);
  border-radius: 28px;
  padding: 1.6vh 2.4vw;
  min-height: 0;
  box-shadow: var(--shadow-1);
}

.board-line.serving { background: var(--accent-soft); }

.board-name {
  font-size: clamp(2.2rem, 6.5vw, 6.2rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .95;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-width: 0;
}

.board-name .who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.board-name .who.is-serving { color: var(--ink); }

.board-name .who-sep {
  color: var(--ink-3);
  font-weight: 600;
}

.dot-serve.mini {
  width: clamp(12px, 1.4vw, 18px);
  height: clamp(12px, 1.4vw, 18px);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--serve) 28%, transparent);
}

.board-sets {
  display: flex;
  gap: clamp(12px, 2.4vw, 36px);
  justify-content: center;
  align-items: center;
}

.board-set,
.board-head .board-sets span {
  font-size: clamp(2rem, 7vw, 6.4rem);
  font-weight: 800;
  text-align: center;
  min-width: 1.15em;
  font-variant-numeric: tabular-nums;
}

.board-head .board-sets span {
  font-size: clamp(0.85rem, 1.8vw, 1.3rem);
  color: var(--ink-3);
}

.board-pts-label {
  text-align: right;
  font-size: clamp(0.85rem, 1.8vw, 1.3rem);
  letter-spacing: .08em;
}

.board-pts {
  font-family: var(--font-display);
  font-size: clamp(4.8rem, 18vw, 14rem);
  font-weight: 700;
  text-align: right;
  min-width: 1.2em;
  line-height: .85;
}

.dot-serve {
  width: clamp(14px, 1.6vw, 22px);
  height: clamp(14px, 1.6vw, 22px);
  border-radius: 50%;
  background: var(--serve);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--serve) 28%, transparent);
  flex-shrink: 0;
}

.dot-serve.off { background: transparent; box-shadow: none; }

.board-empty {
  text-align: center;
  color: var(--ink-2);
  padding: 80px 20px;
  font-size: clamp(1.2rem, 3vw, 2rem);
}

@media (min-width: 700px) {
  .match-screen {
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr 1.15fr 1fr;
  }
  .match-screen .topbar { grid-column: 1 / -1; }
  .match-mid { grid-column: 2; }
  .match-actions { display: contents; }
  .team-actions.a { grid-column: 1; grid-row: 2; padding: 16px; }
  .team-actions.b { grid-column: 3; grid-row: 2; padding: 16px; }
  .match-bottom { grid-column: 1 / -1; }
  .match-screen.flipped .team-actions.a { grid-column: 3; }
  .match-screen.flipped .team-actions.b { grid-column: 1; }
  .act { min-height: var(--s8); font-size: var(--score-md); }
  .act-point { min-height: 72px; }
}

.best-card {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  gap: var(--s3);
  align-items: center;
  background: var(--team-a-soft);
  border-radius: var(--radius-lg);
  padding: var(--s3);
  margin: 0 0 var(--s4);
  overflow: hidden;
}
.best-who {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}
.best-trophy {
  width: var(--s7);
  height: var(--s7);
  flex-shrink: 0;
  color: var(--team-a);
}
.best-trophy svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.best-who-text { min-width: 0; }
.best-card .best-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--team-a);
  margin: 0;
}
.best-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.best-stats {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  overflow: hidden;
}
.best-gauge {
  width: var(--s8);
  flex-shrink: 0;
}
.best-gauge .gauge-svg {
  display: block;
  width: 100%;
  height: auto;
}
.best-gauge b {
  display: block;
  margin-top: calc(var(--s1) * -1);
  text-align: center;
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}
.best-stat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1) var(--s2);
  flex: 1;
  min-width: 0;
  font-size: var(--text-xs);
  color: var(--ink-2);
}
.best-stat-list div {
  display: flex;
  justify-content: space-between;
  gap: var(--s1);
}
.best-stat-list b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.rank-row {
  position: relative;
  overflow: hidden;
}
.rank-row .fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--metric-wins);
  border-radius: var(--radius);
  z-index: 0;
}
.rank-row > *:not(.fill) { position: relative; z-index: 1; }
.rank-num {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  width: 28px;
  flex-shrink: 0;
  color: var(--ink-2);
}
.rank-row.is-best {
  box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--team-a);
}
.rank-row.is-best .rank-num { color: var(--team-a); }

.donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto;
}
.donut-wrap .chart-pie { width: 140px; height: 140px; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.donut-center b {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.donut-center span {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.match-hero { margin: 0 0 var(--s4); }
.match-hero-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s2);
  align-items: center;
}
.hero-side {
  border-radius: var(--radius);
  padding: var(--s3);
  text-align: center;
}
.hero-side .who { font-weight: 700; }
.hero-side.side-a { background: var(--team-a-soft); color: var(--team-a); }
.hero-side.side-b { background: var(--team-b-soft); color: var(--team-b); }
.hero-side.won { box-shadow: inset 0 0 0 1.5px currentColor; }
.hero-score {
  font-family: var(--font-display);
  font-size: var(--score-md);
  text-align: center;
  margin: 0;
  padding: 0 var(--s2);
}

.cmp-row { margin: 0 0 var(--s3); }
.cmp-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--s2);
  align-items: center;
  font-size: var(--text-sm);
}
.cmp-meta .num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.cmp-meta .num:first-child { text-align: left; color: var(--team-a); }
.cmp-meta .num:last-child { text-align: right; color: var(--team-b); }
.cmp-meta .lbl {
  text-align: center;
  color: var(--ink-2);
  font-size: var(--text-xs);
}
.cmp-track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1);
  height: var(--s2);
  margin-top: var(--s1);
}
.cmp-left, .cmp-right {
  background: var(--surface-sunk);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.cmp-left { display: flex; justify-content: flex-end; }
.cmp-left i, .cmp-right i {
  display: block;
  height: 100%;
  min-height: var(--s2);
}
.cmp-left i { background: var(--team-a); }
.cmp-right i { background: var(--team-b); }

.shot-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
  text-align: center;
}
.shot-split .chart-pie {
  width: 100%;
  max-width: 140px;
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2);
}
