@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  /* 建新杯物料：蓝金主视觉 */
  --pitch: #003a7a;
  --pitch-2: #0052a3;
  --turf: #0077c8;
  --cyan: #2bb3e8;
  --lime: #d4a017;
  --lime-dim: #b8860b;
  --gold: #e8c547;
  --ink: #0b1a2e;
  --paper: #f2f6fb;
  --muted: #6b7c8f;
  --line: rgba(0, 58, 122, 0.12);
  --card: #ffffff;
  --warn: #e85d04;
  --danger: #d00000;
  --ok: #0a7a4b;
  --shadow: 0 12px 40px rgba(0, 40, 90, 0.12);
  --radius: 14px;
  --side: 248px;
  --font-display: "Barlow Condensed", "Noto Sans SC", sans-serif;
  --font-body: "Noto Sans SC", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
}

body {
  background:
    radial-gradient(1200px 600px at 8% -12%, rgba(43, 179, 232, 0.22), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(212, 160, 23, 0.14), transparent 50%),
    linear-gradient(180deg, #e8f1fa 0%, var(--paper) 42%, #e3ebf5 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

/* —— Side —— */
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 20px;
  background:
    linear-gradient(165deg, rgba(43, 179, 232, 0.18), transparent 42%),
    linear-gradient(195deg, rgba(212, 160, 23, 0.12), transparent 35%),
    linear-gradient(180deg, #004a96 0%, var(--pitch) 45%, #00224d 100%);
  color: #eaf4ff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px;
  align-items: stretch;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  margin: 0 2px 4px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.22);
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
}

.brand .tagline {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(234, 244, 255, 0.78);
  text-align: center;
}

.brand .eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 600;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(234, 244, 255, 0.65);
  line-height: 1.45;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(234, 244, 255, 0.78);
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav a.active {
  background: var(--lime);
  color: var(--ink);
  font-weight: 700;
}

.nav .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.nav a.active .dot {
  opacity: 1;
}

.side-foot {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(234, 244, 255, 0.55);
}

.side-foot strong {
  color: var(--lime);
  font-weight: 600;
}

/* —— Main —— */
.main {
  padding: 28px 32px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--pitch);
}

.topbar .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 58, 122, 0.1);
}

.btn:active {
  transform: none;
}

.btn-primary {
  background: var(--pitch);
  color: var(--lime);
  border-color: transparent;
}

.btn-accent {
  background: var(--lime);
  color: var(--ink);
  border-color: transparent;
}

.btn-danger {
  background: #fff5f5;
  color: var(--danger);
  border-color: rgba(208, 0, 0, 0.2);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* —— Layout helpers —— */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbff, #fff);
}

.panel-h h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--pitch);
}

.panel-b {
  padding: 16px 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 58, 122, 0.06);
  color: var(--pitch);
}

.chip-lime {
  background: rgba(212, 160, 23, 0.22);
  color: #8a6a08;
}

.chip-warn {
  background: rgba(232, 93, 4, 0.12);
  color: var(--warn);
}

.chip-ok {
  background: rgba(10, 122, 75, 0.12);
  color: var(--ok);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* —— Stats —— */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat .k {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.stat .v {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: var(--pitch);
}

.stat .v em {
  font-style: normal;
  color: var(--lime-dim);
  font-size: 18px;
  margin-left: 4px;
}

table.data .pts.card-y {
  color: #c9a227;
}

table.data .pts.card-r {
  color: #c0392b;
}

/* —— Tables —— */
.table-wrap {
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th,
table.data td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data th {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: #f3f8fd;
}

table.data tr:hover td {
  background: rgba(212, 160, 23, 0.08);
}

table.data .rank {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--pitch);
  width: 36px;
}

table.data .pts {
  font-weight: 800;
  color: var(--pitch);
  font-family: var(--font-display);
  font-size: 20px;
}

.team-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* —— Match cards —— */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.match-card:hover {
  border-color: rgba(0, 119, 200, 0.4);
  box-shadow: 0 10px 28px rgba(0, 58, 122, 0.1);
}

.match-card:active {
  transform: scale(0.995);
}

.mc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mc-meta {
  min-width: 0;
}

.mc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--pitch);
  line-height: 1.3;
}

.mc-num {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(0, 58, 122, 0.08);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--pitch);
}

.mc-when {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.mc-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.mc-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--pitch);
  background: rgba(0, 58, 122, 0.08);
}

.mc-cta.edit {
  color: #fff;
  background: linear-gradient(135deg, #0066b8, var(--pitch));
}

.mc-teams {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid var(--line);
}

.mc-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.mc-row .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-row .score {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  min-width: 36px;
  text-align: right;
  color: var(--pitch);
  line-height: 1;
}

.mc-row.winner .name,
.mc-row.winner .score {
  color: var(--pitch);
}

.mc-row.loser {
  opacity: 0.48;
}

.topbar-logo {
  display: none;
}

.day-block {
  margin-bottom: 22px;
}

.day-block > h4 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--pitch);
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-block > h4::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* —— Bracket —— */
.bracket {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.bracket-col h4 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--pitch);
}

.bracket-slot {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(0, 58, 122, 0.25);
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.bracket-slot.ready {
  border-style: solid;
  border-color: var(--line);
  background: #fff;
}

.bracket-slot.done {
  border-color: rgba(0, 119, 200, 0.4);
  background: linear-gradient(135deg, #fff, #eaf5ff);
}

.bracket-slot .vs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}

.bracket-slot .tag {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.final-hero {
  padding: 22px;
  border-radius: var(--radius);
  background:
    linear-gradient(120deg, rgba(232, 197, 71, 0.3), transparent 48%),
    linear-gradient(160deg, #0066b8 0%, var(--pitch) 55%, #001f4d 100%);
  color: #fff;
  text-align: center;
}

.final-hero .tag {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
  font-weight: 700;
}

.final-hero .names {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.final-hero .scoreline {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  color: var(--lime);
}

.podium {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.podium .place {
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: center;
}

.podium .place .n {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--pitch);
}

.podium .place .t {
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.podium .place.gold {
  background: linear-gradient(180deg, #fff9db, #fff);
  border-color: #e6c200;
}

/* —— Teams —— */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.team-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}

.team-card:hover {
  transform: translateY(-2px);
}

.team-card .head {
  padding: 16px;
  color: #fff;
  position: relative;
}

.team-card .head .gid {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  opacity: 0.85;
}

.team-card .head h3 {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
}

.team-card .body {
  padding: 12px 16px 16px;
  font-size: 12px;
  color: var(--muted);
}

.roster-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f3f8fd;
  font-size: 13px;
  font-weight: 500;
}

.roster-item .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--pitch);
  min-width: 22px;
}

/* —— Modal —— */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(5, 18, 40, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal-back.modal-center {
  align-items: center;
  padding: 24px 16px;
}

.modal {
  width: min(720px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: 18px 18px 12px 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.22s ease;
}

.modal-back.modal-center .modal {
  width: min(420px, 100%);
  max-height: none;
  border-radius: 18px;
  animation: fadeScale 0.2s ease;
}

.modal-back.modal-center .modal-actions {
  justify-content: stretch;
}

.modal-back.modal-center .modal-actions .btn {
  flex: 1;
  min-height: 48px;
  font-size: 16px;
}

.login-head {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: relative;
}

.login-head #modalClose {
  position: absolute;
  top: 14px;
  right: 14px;
}

.login-brand {
  text-align: center;
  padding: 8px 28px 0 8px;
}

.login-logo {
  display: block;
  width: min(240px, 78%);
  height: auto;
  margin: 0 auto 12px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 58, 122, 0.08);
}

@keyframes fadeScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-h {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  border-bottom: 1px solid var(--line);
}

.modal-h h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--pitch);
}

.modal-b {
  padding: 18px 20px 24px;
}

.score-entry {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.score-entry .team-name {
  font-weight: 700;
  font-size: 15px;
}

.score-entry .team-name.right {
  text-align: right;
}

.score-entry input[type="number"] {
  width: 72px;
  height: 64px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  border: 2px solid var(--pitch);
  border-radius: 12px;
  color: var(--pitch);
  background: #f0f7fd;
}

.score-entry .colon {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--muted);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.form-row label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.form-row input[type="number"],
.form-row input[type="text"],
.form-row select,
.form-row textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.form-row textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}

.section-label {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.goal-rows,
.card-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-row,
.card-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 70px auto auto;
  gap: 8px;
  align-items: center;
}

.hint {
  font-size: 12px;
  color: var(--warn);
  margin-top: 6px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--pitch);
  color: var(--lime);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.rules-box {
  font-size: 13px;
  line-height: 1.7;
  color: #243447;
}

.rules-box h4 {
  margin: 16px 0 6px;
  font-size: 14px;
  color: var(--pitch);
}

.rules-box ul {
  margin: 0;
  padding-left: 18px;
}

/* —— Tab bar / more sheet (mobile only) —— */
.tabbar {
  display: none;
}

.sheet-back {
  display: none;
}

.menu-btn {
  display: none;
}

.topbar-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.auth-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 58, 122, 0.08);
  color: var(--pitch);
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 40;
}

.scrim.show {
  display: block;
}

/* 防止 iOS 聚焦放大：表单控件至少 16px */
input,
select,
textarea {
  font-size: 16px;
}

@media (max-width: 900px) {
  :root {
    --tabbar-h: 64px;
  }

  html,
  body {
    overscroll-behavior: none;
  }

  .app {
    grid-template-columns: 1fr;
  }

  /* 侧栏改为抽屉，默认隐藏；底部 Tab 为主导航 */
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 88vw);
    height: 100%;
    height: 100dvh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .side.open {
    transform: none;
  }

  .side .nav {
    display: none; /* 手机用底部 Tab */
  }

  .menu-btn {
    display: none; /* 有底部导航后不再需要汉堡 */
  }

  .main {
    padding: 12px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
    min-height: 100dvh;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: -12px -14px 12px;
    padding: 10px 14px 10px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    align-items: center;
    gap: 10px;
  }

  .topbar-logo {
    display: block;
    height: 28px;
    width: auto;
    flex-shrink: 0;
    background: #fff;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--line);
  }

  .topbar h2 {
    font-size: 22px;
  }

  .topbar .sub {
    display: none;
  }

  .top-actions {
    display: none;
  }

  .auth-badge {
    margin-top: 2px;
    font-size: 10px;
  }

  .stat-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .stat {
    padding: 12px 12px;
  }

  .stat .v {
    font-size: 26px;
  }

  .grid-2,
  .grid-3,
  .bracket,
  .podium {
    grid-template-columns: 1fr;
  }

  .final-hero .names {
    font-size: 24px;
  }

  .final-hero .scoreline {
    font-size: 36px;
  }

  .panel-h {
    padding: 12px 14px;
  }

  .panel-h h3 {
    font-size: 17px;
  }

  .panel-b {
    padding: 12px 12px;
  }

  .match-list {
    gap: 8px;
  }

  .match-card {
    padding: 12px 12px 14px;
    gap: 10px;
    border-radius: 12px;
  }

  .mc-title {
    font-size: 13px;
  }

  .mc-row {
    min-height: 34px;
    font-size: 15px;
  }

  .mc-row .score {
    font-size: 28px;
    min-width: 40px;
  }

  .mc-cta {
    min-height: 30px;
    padding: 0 12px;
  }

  .day-block {
    margin-bottom: 18px;
  }

  .day-block > h4 {
    font-size: 16px;
    position: sticky;
    top: calc(52px + env(safe-area-inset-top));
    z-index: 10;
    background: rgba(242, 246, 251, 0.94);
    backdrop-filter: blur(8px);
    padding: 8px 0;
    margin: 0 0 8px;
  }

  /* 积分表：横向滑，队名粘住 */
  .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
    -webkit-overflow-scrolling: touch;
  }

  table.data {
    font-size: 12px;
  }

  table.data th,
  table.data td {
    padding: 10px 8px;
  }

  /* 手机横滑时固定积分列（第 1 列） */
  table.data th:nth-child(1),
  table.data td:nth-child(1) {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    box-shadow: 4px 0 8px rgba(0, 0, 0, 0.04);
  }

  table.data thead th:nth-child(1) {
    background: #f3f8fd;
  }

  .goal-row,
  .card-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .goal-row > *,
  .card-row > * {
    min-height: 44px;
  }

  .goal-row select,
  .card-row select,
  .goal-row input,
  .card-row input {
    width: 100%;
  }

  /* 比分录入：更大触控 */
  .score-entry {
    gap: 8px;
  }

  .score-entry .team-name {
    font-size: 13px;
    line-height: 1.3;
    word-break: break-all;
  }

  .score-entry input[type="number"] {
    width: 64px;
    height: 64px;
    font-size: 36px;
    border-radius: 14px;
  }

  .btn {
    min-height: 40px;
    touch-action: manipulation;
  }

  .btn-sm {
    min-height: 36px;
  }

  /* 底部导航：主项均分 + 「更多」固定宽度，避免挤没 */
  .tabbar {
    display: flex;
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(0, 58, 122, 0.06);
  }

  .tabbar-primary {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    text-decoration: none;
  }

  .tab .tab-ico {
    font-size: 18px;
    line-height: 1;
    font-style: normal;
  }

  .tab.active {
    color: var(--pitch);
  }

  .tab.active .tab-ico {
    color: var(--lime);
  }

  .tab.active span:last-child {
    color: var(--pitch);
  }

  .tab-more {
    flex: 0 0 64px;
    width: 64px;
    margin-left: 4px;
    border-left: 1px solid var(--line);
    border-radius: 12px;
    color: var(--pitch);
  }

  .tab-more .tab-ico {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #edf3fa;
    font-size: 16px;
    color: var(--pitch);
  }

  .tab-more.active .tab-ico,
  .tab-more:active .tab-ico {
    background: var(--pitch);
    color: #fff;
  }

  .tab-more.active {
    color: var(--pitch);
  }

  /* 更多底部抽屉 */
  .sheet-back {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(5, 18, 40, 0.45);
    padding: 0;
    align-items: flex-end;
  }

  .sheet-back:not([hidden]) {
    display: flex;
  }

  .sheet-back[hidden] {
    display: none !important;
  }

  .sheet {
    width: 100%;
    background: #fff;
    border-radius: 18px 18px 0 0;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
    animation: slideUp 0.22s ease;
    max-height: 85dvh;
    overflow: auto;
  }

  .sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: #c5d2e0;
    margin: 4px auto 12px;
  }

  .sheet-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: var(--pitch);
    padding: 4px 10px 10px;
  }

  .sheet-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 16px 14px;
    border: none;
    background: #f3f8fd;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
  }

  .sheet-item.danger {
    color: var(--danger);
    background: #fff5f5;
  }

  .sheet-div {
    height: 8px;
  }

  .sheet-cancel {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--muted);
    font-family: inherit;
    cursor: pointer;
  }

  /* 模态：全宽底部 sheet；登录框仍居中 */
  .modal-back {
    padding: 0;
    align-items: flex-end;
  }

  .modal-back.modal-center {
    align-items: center;
    padding: 24px 16px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .modal {
    width: 100%;
    max-height: min(94dvh, 100%);
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .modal-back.modal-center .modal {
    width: min(420px, 100%);
    border-radius: 18px;
    padding-bottom: 0;
    max-height: min(90dvh, 100%);
  }

  .modal-h {
    padding: 14px 16px;
    padding-top: 16px;
  }

  .modal-h h3 {
    font-size: 22px;
  }

  .modal-b {
    padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, transparent, #fff 28%);
    padding: 14px 0 4px;
    margin: 8px 0 0 !important;
    gap: 8px;
    justify-content: stretch;
  }

  .modal-actions .btn {
    flex: 1;
    min-height: 48px;
    font-size: 16px;
  }

  .toast {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
    max-width: calc(100vw - 32px);
    text-align: center;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .roster-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }

  .score-entry input[type="number"] {
    width: 56px;
    height: 56px;
    font-size: 30px;
  }

  .tab {
    font-size: 9px;
  }
}
