:root {
  --bg: #f4f6f1;
  --surface: #ffffff;
  --surface-2: #eef2ea;
  --ink: #13201a;
  --muted: #5d6b63;
  --line: #dbe3d8;
  --brand: #0f3d2e;
  --brand-ink: #ffffff;
  --ball: #d7e84a;
  --c110: #2459d6;
  --c111: #e2611b;
  --warn-bg: #fff6d6;
  --warn-ink: #6b4e00;
  --radius: 14px;
  --tap: 48px;
  --sidebar-w: 248px;
  --tabbar-h: 64px;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1511;
    --surface: #15201a;
    --surface-2: #1c2a22;
    --ink: #e8efe9;
    --muted: #9aaba1;
    --line: #2a3a31;
    --brand: #1f6b4f;
    --c110: #6b93ff;
    --c111: #ff8a4c;
    --warn-bg: #3a3112;
    --warn-ink: #f3dc8a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1511; --surface: #15201a; --surface-2: #1c2a22; --ink: #e8efe9;
  --muted: #9aaba1; --line: #2a3a31; --brand: #1f6b4f; --c110: #6b93ff;
  --c111: #ff8a4c; --warn-bg: #3a3112; --warn-ink: #f3dc8a; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }

/* ---------- Bố cục ---------- */
.layout { min-height: 100dvh; display: flex; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  outline: none;
}

.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--brand); color: var(--brand-ink);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; }
.brand small { font-weight: 500; opacity: .8; font-size: .78rem; }
.brand-ball {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 30% 30%, rgba(0,0,0,.18) 2px, transparent 3px),
    radial-gradient(circle at 70% 35%, rgba(0,0,0,.18) 2px, transparent 3px),
    radial-gradient(circle at 45% 70%, rgba(0,0,0,.18) 2px, transparent 3px),
    var(--ball);
}

/* Thanh menu dưới cùng (điện thoại) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tap);
  color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab[aria-current="page"] { color: var(--ball); } }

/* Máy tính: menu chuyển thành thanh bên */
@media (min-width: 900px) {
  .tabbar, .topbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 24px;
    position: sticky; top: 0; height: 100dvh;
    width: var(--sidebar-w); flex: none;
    padding: 24px 16px;
    background: var(--brand); color: var(--brand-ink);
  }
  .nav { display: flex; flex-direction: column; gap: 4px; }
  .nav .tab {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 0 14px; border-radius: 10px;
    color: rgba(255,255,255,.82); font-size: .95rem;
  }
  .nav .tab:hover { background: rgba(255,255,255,.08); }
  .nav .tab[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; }
  .sidebar-account { margin-top: auto; }
  .view { padding: 32px 32px 48px; }
}

/* ---------- Thành phần ---------- */
.banner {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: .92rem;
}
@media (min-width: 900px) { .banner { margin: 24px 32px 0; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--brand); color: var(--brand-ink);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.topbar .btn-ghost, .sidebar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; padding: 8px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.list-item:last-child { border-bottom: 0; }
.list-item .chev { color: var(--muted); }

/* Trang chủ: thẻ đối đầu hai lớp */
.versus {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  text-align: center;
}
.versus .cls { font-weight: 800; font-size: clamp(1.3rem, 6vw, 2rem); }
.versus .c110 { color: var(--c110); }
.versus .c111 { color: var(--c111); }
.versus .vs { font-weight: 800; color: var(--muted); }
.tug { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin-top: 14px; }
.tug span:first-child { background: var(--c110); }
.tug span:last-child { background: var(--c111); }

.account { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.account img { width: 32px; height: 32px; border-radius: 50%; }
.account .who { line-height: 1.25; min-width: 0; }
.account .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.empty { text-align: center; padding: 32px 16px; }
.empty svg { width: 56px; height: 56px; color: var(--muted); margin-bottom: 8px; }

/* ---------- Biểu mẫu ---------- */
.small { font-size: .85rem; }
code { font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.note { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
input[type=text], input[type=number], input[type=time], input[type=search], input:not([type]), select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
}
textarea { resize: vertical; min-height: 120px; }
input:disabled, select:disabled { opacity: .55; }
:is(input, select, textarea, button, a, summary):focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 600; }
.field-help { color: var(--muted); font-size: .84rem; }
.field-help:empty { display: none; }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.form-grid h2 { grid-column: 1 / -1; margin: 0; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .check, .form-grid .court-names { grid-column: 1 / -1; } }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 40px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.check small { color: var(--muted); }
.court-names { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.preset-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.preset {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); color: inherit; font: inherit;
}
.preset span { color: var(--muted); font-size: .85rem; }
.preset:disabled { opacity: .5; cursor: not-allowed; }
.sticky-actions {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  display: flex; justify-content: flex-end;
}
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.nowrap { flex-wrap: nowrap; }
.btn-danger { background: #b42318; color: #fff; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-between h2 { margin: 0; }
.row-between input[type=search] { max-width: 260px; }

/* ---------- Người chơi ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.segmented button {
  min-height: 44px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-weight: 700; color: var(--muted); cursor: pointer;
}
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.add-box summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.add-box[open] summary { margin-bottom: 10px; }
.add-box textarea { margin-bottom: 10px; }
.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 12px; background: var(--surface-2); border-left: 5px solid; font-size: .92rem; }
.stat.c110 { border-color: var(--c110); }
.stat.c111 { border-color: var(--c111); }
.stat b { font-size: 1.05rem; }
.stat em { color: var(--warn-ink); font-style: normal; font-weight: 700; }
.player-row { display: flex; align-items: center; gap: 10px; min-height: 60px; border-bottom: 1px solid var(--line); }
.player-row:last-child { border-bottom: 0; }
.pick { width: 22px; height: 22px; flex: none; accent-color: var(--brand); }
.pick-spacer { width: 22px; flex: none; }
.player-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 8px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.player-main .muted { font-size: .85rem; }
.checkin {
  flex: none; min-width: 92px; min-height: 40px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 700; font-size: .85rem;
}
.checkin.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.warn-row { background: var(--warn-bg); border-radius: 10px; padding-inline: 8px; }
.warn-text { color: var(--warn-ink); font-size: .85rem; font-weight: 600; }
dialog {
  width: min(440px, calc(100vw - 32px)); border: 0; border-radius: var(--radius); padding: 20px;
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(0,0,0,.45); }

/* ---------- Lịch ---------- */
h3 { font-size: 1rem; margin: 16px 0 4px; }
.slot-head { color: var(--muted); font-size: .9rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.match-list { margin-bottom: 8px; }
.match-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.match-row:last-child { border-bottom: 0; }
.match-time { display: flex; flex-direction: column; width: 64px; flex: none; }
.match-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.match-row.status-done, .match-row.status-walkover { opacity: .65; }
.pill.live { background: #c62828; color: #fff; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.suggest { font-size: 1.02rem; }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
.segmented.four button { font-size: .82rem; padding: 0 4px; }
.court-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.court-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.lineup-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.lineup { display: flex; flex-direction: column; gap: 6px; }
.walkover { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.preview { border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- Bấm điểm ---------- */
.center { text-align: center; }
.big-line { font-size: 1.15rem; font-weight: 700; margin: 4px 0; }
.match-link { text-decoration: none; color: inherit; }
.scorer { display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.sc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.sync { font-size: .78rem; font-weight: 700; color: var(--brand); }
.sync.pending { color: var(--warn-ink); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; }
.callout { text-align: center; font-size: clamp(3rem, 16vw, 5rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.server-line { text-align: center; margin: 0; }
.court-svg { width: 100%; max-width: 360px; margin: 0 auto; display: block; }
.court-svg .c-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.court-svg .c-net { stroke: var(--ink); stroke-width: 3; }
.court-svg .c-kitchen { stroke: var(--muted); stroke-dasharray: 3 3; }
.court-svg .c-serve { fill: var(--ball); opacity: .85; }
.court-svg .c-label { fill: var(--muted); font-size: 9px; text-anchor: middle; font-family: inherit; }
.rally-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rally-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 180px; padding: 12px; border: 3px solid transparent; border-radius: 18px; cursor: pointer;
  color: #fff; font: inherit; touch-action: manipulation; user-select: none;
}
.rally-btn.c110 { background: var(--c110); }
.rally-btn.c111 { background: var(--c111); }
.rally-btn.cx { background: var(--brand); }
.rally-btn.serving { border-color: var(--ball); box-shadow: 0 0 0 3px var(--ball) inset; }
.rally-btn:active { transform: scale(.98); }
.rally-btn:disabled { opacity: .45; cursor: not-allowed; }
.rally-score { font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rally-name { font-weight: 700; text-align: center; }
.rally-hint { font-size: .78rem; opacity: .85; }
.tool-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tool-row .btn { min-height: 44px; font-size: .88rem; }
.done-box { text-align: center; }
.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20;
  max-width: calc(100vw - 32px); padding: 14px 20px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-weight: 700; font-size: 1.05rem; text-align: center;
}
/* Xem trận */
.mv { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; }
.mv-team { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border-radius: 12px; }
.mv-team.serving { background: var(--surface-2); outline: 3px solid var(--ball); }
.mv-team.winner .mv-name { color: var(--brand); }
.mv-name { font-weight: 800; font-size: 1.1rem; }
.mv-score { font-size: clamp(3rem, 14vw, 4.5rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.mv-vs { color: var(--muted); font-weight: 700; }
.mv-callout { font-size: 1.2rem; }

/* ---------- Điểm lớp, thẻ sân, xếp hạng, nhánh đấu ---------- */
.classbar .versus .cls { display: flex; align-items: baseline; gap: 10px; justify-content: center; flex-wrap: wrap; }
.classbar .versus .cls span { font-size: clamp(1rem, 4.5vw, 1.4rem); }
.cls-score { font-size: clamp(2rem, 9vw, 3rem); font-variant-numeric: tabular-nums; }
.classbar.big .cls-score { font-size: 3.4rem; }
.classbar.big .versus .cls span { font-size: 1.6rem; }
.tug span { transition: flex .6s ease; }
.announce { font-weight: 700; }
.live-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.live-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); text-decoration: none; color: inherit; }
.live-card.idle { opacity: .75; }
.live-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-label { margin: 0; }
.live-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--surface); border-left: 5px solid var(--line); }
.live-row.c110 { border-left-color: var(--c110); }
.live-row.c111 { border-left-color: var(--c111); }
.live-name { display: flex; flex-direction: column; min-width: 0; font-weight: 700; }
.live-score { font-size: 2rem; font-variant-numeric: tabular-nums; }
.ball { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ball); margin-right: 6px; box-shadow: 0 0 0 2px var(--ink); vertical-align: middle; }
.table-wrap { overflow-x: auto; }
.rank { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank th, .rank td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.rank th { color: var(--muted); font-size: .8rem; font-weight: 700; }
.rank td:nth-child(n+3), .rank th:nth-child(n+3) { text-align: right; }
.rank.compact td:nth-child(n+2), .rank.compact th:nth-child(n+2) { text-align: right; }
.rank tr[data-team] { cursor: pointer; }
.rank tr.c110 td:first-child { box-shadow: inset 4px 0 var(--c110); }
.rank tr.c111 td:first-child { box-shadow: inset 4px 0 var(--c111); }
.rank tr.history td { background: var(--surface-2); }
.rank tr.total td { font-weight: 800; }
.bracket { display: grid; gap: 16px; overflow-x: auto; padding-bottom: 4px; }
.br-col { display: flex; flex-direction: column; }
.br-col h3 { margin-top: 0; }
.br-list { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.br-match { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: inherit; }
.br-match.is-live { border-color: #c62828; }
.br-side { display: flex; justify-content: space-between; gap: 8px; }
.br-side.won { font-weight: 800; }
.br-third { margin-top: 16px; max-width: 260px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #c62828; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .live-dot, .ticker-track { animation: none; } .tug span { transition: none; } }

/* ---------- Màn hình TV ---------- */
body.tv-mode .sidebar, body.tv-mode .tabbar, body.tv-mode .topbar, body.tv-mode .banner { display: none !important; }
body.tv-mode .view { max-width: none; padding: 0; }
.tv { min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; padding: 24px 32px; }
.tv-top { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 32px; }
.tv-title { font-size: 1.8rem; font-weight: 800; }
.tv-announce { margin: 0; padding: 12px 18px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 1.4rem; font-weight: 700; text-align: center; }
.tv-main { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.tv-tabs { display: flex; gap: 8px; align-items: center; }
.tv-tabs button { border: 0; background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 700; padding: 8px 16px; border-radius: 999px; cursor: pointer; }
.tv-tabs button[aria-selected="true"] { background: var(--brand); color: #fff; }
.tv-exit { margin-left: auto; color: var(--muted); font-size: .85rem; }
.tv-screen .live-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.tv-screen .live-score { font-size: 3.6rem; }
.tv-screen .live-name { font-size: 1.4rem; }
.tv-screen .live-card { padding: 18px; }
.tv-rank { font-size: 1.4rem; }
.tv-bottom { display: flex; flex-direction: column; gap: 8px; font-size: 1.15rem; }
.tv-next span { margin-left: 16px; }
.ticker { overflow: hidden; white-space: nowrap; border-top: 1px solid var(--line); padding-top: 8px; }
.ticker-track { display: inline-block; animation: ticker 40s linear infinite; }
.ticker-track span { margin-right: 48px; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
@media (max-width: 900px) { .tv { padding: 16px; } .tv-top { grid-template-columns: 1fr; gap: 8px; } .tv-screen .live-grid { grid-template-columns: 1fr; } }

/* ---------- Luật, QR, bình chọn, xuất, nhật ký ---------- */
.rule-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.rule-svg { width: 100%; height: auto; margin: 4px 0 10px; }
.r-court { fill: #2f7d5b; stroke: #fff; stroke-width: 2; }
.r-kitchen { fill: #d98b3a; opacity: .85; stroke: #fff; stroke-width: 2; }
.r-net { stroke: var(--ink); stroke-width: 4; }
.r-line { stroke: #fff; stroke-width: 2; }
.r-text { fill: #fff; font-size: 11px; text-anchor: middle; font-family: inherit; }
.rule-svg:not(:has(.r-court)) .r-text, .r-text.dark { fill: var(--ink); }
.r-text.strong { font-weight: 700; }
.r-text.small { font-size: 9px; }
.r-player { fill: var(--ball); stroke: var(--ink); }
.r-path { fill: none; stroke: var(--ball); stroke-width: 3; stroke-dasharray: 6 4; }
.r-path.alt { stroke: var(--c111); }
.r-arrowhead { fill: var(--ball); }
.r-target { fill: var(--ball); opacity: .3; }
.r-bounce { fill: var(--ink); }
.rule-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.demo-callout { text-align: center; font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.demo-btns { justify-content: center; }
.demo-a { background: var(--c110); }
.demo-b { background: var(--c111); }
.qr-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.qr-card { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: #111; text-align: center; break-inside: avoid; }
.qr-card figcaption { display: flex; flex-direction: column; }
.qr-card figcaption b { font-size: 1.2rem; }
.qr-img { width: 200px; height: 200px; }
.qr-img svg { width: 100%; height: 100%; }
.qr-url { color: #555; word-break: break-all; }
.qr-placeholder { display: grid; place-items: center; height: 100%; color: #777; }
.vote-results { padding-left: 22px; }
.vote-results li.top { font-size: 1.15rem; }
.cert-canvas { width: 100%; max-width: 360px; height: auto; border-radius: 12px; display: block; }
.audit td:nth-child(n+3), .audit th:nth-child(n+3) { text-align: left; }
.undo-row td { color: var(--muted); text-decoration: line-through; }
@media print {
  .sidebar, .tabbar, .topbar, .banner, .no-print { display: none !important; }
  body, .view { background: #fff; padding: 0; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-card { border: 2px solid #000; page-break-inside: avoid; }
}

/* ---------- Tài khoản tên đăng nhập ---------- */
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row input { flex: 1; }
.cred { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; }
.cred dt { font-weight: 600; }
.cred dd { margin: 0; word-break: break-all; }
.cred code { font-size: 1.05rem; user-select: all; }
.created-box { border: 2px solid var(--brand); }
.login-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.login-or { text-align: center; color: var(--muted); font-size: .85rem; margin: 4px 0; }
.login-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 12px; }
