/* Nušić Basketball — court green + ball orange */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #f3f6f2;
  --bg-deep: #0c2a1f;
  --surface: #ffffff;
  --ink: #122018;
  --muted: #5a6b62;
  --line: #d5ddd7;
  --accent: #e85d04;
  --accent-dark: #c44d03;
  --live: #c1121f;
  --ok: #2d6a4f;
  --warn: #b08900;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(12, 42, 31, 0.08);
  --font: 'Manrope', system-ui, sans-serif;
  --display: 'Bebas Neue', Impact, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(232, 93, 4, 0.12), transparent 55%),
    linear-gradient(180deg, #e8efe9 0%, var(--bg) 40%, #eef2ec 100%);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Top bar */
.topbar {
  background: var(--bg-deep);
  color: #f5faf7;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08);
}

.brand-text {
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
  color: #ffd6b0;
}

.brand:hover .brand-text {
  color: inherit;
}

.auth-brand {
  margin-bottom: 1rem;
}

.auth-brand .brand {
  color: var(--ink);
  font-size: 1.35rem;
}

.auth-brand .brand:hover {
  color: var(--accent-dark);
}

.page-scoreboard .scoreboard-brand {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  opacity: 0.55;
  pointer-events: none;
  z-index: 2;
}

.page-scoreboard .scoreboard-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.page-scoreboard .scoreboard-brand span {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: #444;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 0.35rem 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.nav a {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.nav a:hover,
.nav a.is-active {
  color: #fff;
}

/* Sections */
.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow);
}

.section h1,
.section h2 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  letter-spacing: 0.03em;
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.section h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.muted {
  color: var(--muted);
}

.live-title {
  font-family: var(--display);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  margin: 0.2rem 0 0.5rem;
  letter-spacing: 0.03em;
}

/* Scoreboard */
.score-hero {
  text-align: center;
  background:
    linear-gradient(160deg, #0c2a1f 0%, #164a36 55%, #0f3326 100%);
  color: #f7fff9;
  border: none;
}

.score-hero .muted {
  color: rgba(255, 255, 255, 0.7);
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0 0.5rem;
}

.score-side {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.score-side:last-child {
  align-items: flex-end;
  text-align: right;
}

.score-side:first-child {
  align-items: flex-start;
  text-align: left;
}

.team-name {
  font-weight: 700;
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
}

.team-score {
  font-family: var(--display);
  font-size: clamp(3.5rem, 12vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: #ffb347;
  transition: transform 0.15s ease;
}

.score-vs {
  font-family: var(--display);
  font-size: 2rem;
  opacity: 0.5;
}

.live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(193, 18, 31, 0.6);
  animation: pulse 1.4s ease infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(193, 18, 31, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(193, 18, 31, 0); }
  100% { box-shadow: 0 0 0 0 rgba(193, 18, 31, 0); }
}

.actions-bar {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* Grid */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 860px) {
  .teams-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* Tables */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.table tbody tr:hover {
  background: rgba(12, 42, 31, 0.03);
}

.table-admin .stat-cell,
.stat-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  text-align: center;
}

.stat-value {
  display: inline-block;
  min-width: 1.6rem;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.is-pending {
  opacity: 0.65;
}

.stat-btn {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f7faf7;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1;
  color: var(--ink);
  touch-action: manipulation;
}

.stat-btn.plus {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.stat-btn.minus:hover {
  background: #e8ece9;
}

.stat-btn.plus:hover {
  background: var(--accent-dark);
}

.stat-btn.is-busy {
  opacity: 0.5;
  pointer-events: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e4ebe6;
  color: var(--ink);
}

.badge-live {
  background: var(--live);
  color: #fff;
}

.badge-scheduled {
  background: #dce8ff;
  color: #1a3a6b;
}

.badge-finished {
  background: #e4ebe6;
  color: var(--muted);
}

/* Buttons & forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  background: #e8ece9;
  color: var(--ink);
}

.btn:hover {
  text-decoration: none;
  filter: brightness(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: inherit;
}

.score-hero .btn-ghost {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.btn-danger {
  background: #c1121f;
  color: #fff;
}

.btn-danger:hover {
  background: #9b0e18;
  color: #fff;
}

.btn-ghost-dark {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.btn-ghost-dark:hover {
  background: #f0f4f1;
}

.team-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.team-block-head h2 {
  margin: 0;
}

.player-list li {
  justify-content: space-between;
}

.player-list-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.form-row.compact {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

input,
select {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 10rem;
  color: var(--ink);
  background: #fff;
}

.inline {
  display: inline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Auth */
.page-auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-box {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.auth-box h1 {
  font-family: var(--display);
  margin: 0 0 0.25rem;
  letter-spacing: 0.04em;
  font-size: 2rem;
}

/* Flash */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 1rem 0 0;
  font-weight: 600;
}

.flash-ok {
  background: #d8f3dc;
  color: var(--ok);
}

.flash-with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.undo-form {
  margin: 0;
}

.flash-error {
  background: #ffe5e5;
  color: #9b2226;
}

.flash-warn {
  background: #fff3cd;
  color: #7a5c00;
}

/* Lists */
.player-list,
.match-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.player-list li,
.match-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.jersey {
  font-weight: 700;
  color: var(--accent);
  min-width: 2rem;
}

.jersey-lg {
  color: var(--accent);
  margin-right: 0.35rem;
}

.team-block + .team-block {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

/* Player profile */
.player-hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.03em;
  margin: 0 0 1rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .stat-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: linear-gradient(160deg, #0c2a1f, #1a4735);
  color: #fff;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-card-value {
  display: block;
  font-family: var(--display);
  font-size: 2.4rem;
  line-height: 1;
  color: #ffb347;
}

.stat-card-label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
  margin-top: 0.35rem;
}

.stat-card-avg {
  display: block;
  font-size: 0.8rem;
  opacity: 0.65;
  margin-top: 0.15rem;
}

.captain-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #9b1c1f;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  vertical-align: middle;
  line-height: 1;
}

.page-public .captain-badge {
  background: var(--accent);
  color: #fff;
}

.captain-badge-lg {
  min-width: 1.6rem;
  height: 1.6rem;
  font-size: 0.9rem;
  margin-left: 0.25rem;
}

.check-label {
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem !important;
  min-width: auto;
  padding-bottom: 0.35rem;
}

.check-label input {
  width: auto;
  min-width: 0;
}

/* ========== Admin theme (dark crimson) ========== */
body.page-admin {
  --bg: #f7f1f1;
  --bg-deep: #4a0d12;
  --surface: #ffffff;
  --ink: #1a0a0c;
  --muted: #6e5558;
  --line: #e4d0d2;
  --accent: #9b1c1f;
  --accent-dark: #7a1216;
  --ok: #7a1216;
  --shadow: 0 10px 30px rgba(74, 13, 18, 0.1);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(155, 28, 31, 0.14), transparent 55%),
    linear-gradient(180deg, #f3e6e7 0%, var(--bg) 40%, #f8f2f2 100%);
}

body.page-admin .topbar {
  background: linear-gradient(90deg, #3a0a0e 0%, #5c1016 55%, #3a0a0e 100%);
  box-shadow: 0 2px 16px rgba(58, 10, 14, 0.35);
}

body.page-admin .brand:hover {
  color: #ffc9c9;
}

body.page-admin .btn-primary {
  background: var(--accent);
  color: #fff;
}

body.page-admin .btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

body.page-admin .score-hero {
  background: linear-gradient(160deg, #3a0a0e 0%, #6b1419 55%, #2a070a 100%);
}

body.page-admin .stat-card {
  background: linear-gradient(160deg, #3a0a0e, #6b1419);
}

body.page-auth {
  --bg-deep: #4a0d12;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(155, 28, 31, 0.18), transparent 55%),
    linear-gradient(180deg, #f3e6e7, #f7f1f1);
}

body.page-auth .auth-box h1 {
  color: #4a0d12;
}

/* Team cards on admin/teams */
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.1rem;
  margin-top: 1rem;
}

@media (min-width: 860px) {
  .team-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  border-top: 4px solid #9b1c1f;
  position: relative;
}

.team-card.accent-a { border-top-color: #9b1c1f; background: linear-gradient(180deg, #fff5f5 0%, #fff 28%); }
.team-card.accent-b { border-top-color: #1d3557; background: linear-gradient(180deg, #f3f7fb 0%, #fff 28%); }
.team-card.accent-c { border-top-color: #b08900; background: linear-gradient(180deg, #fffaf0 0%, #fff 28%); }
.team-card.accent-d { border-top-color: #3d405b; background: linear-gradient(180deg, #f4f4f8 0%, #fff 28%); }

.team-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.team-card-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  letter-spacing: 0.03em;
  font-weight: 400;
}

.team-card-label {
  margin: 0 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.team-card-meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}

.team-card .edit-only {
  display: none;
}

.team-card.is-editing .edit-only {
  display: block;
}

.team-card.is-editing .actions.edit-only {
  display: flex;
}

.team-edit-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.team-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.team-inline-edit,
.player-edit-row {
  margin: 0.75rem 0;
  padding: 0.85rem;
  background: rgba(155, 28, 31, 0.05);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.player-edit-row {
  list-style: none;
}

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-head-row h2 {
  margin: 0;
}

.is-collapsed {
  display: none !important;
}

.flash-with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.undo-form {
  margin: 0;
}

/* Player photos */
.player-thumb {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  vertical-align: middle;
  background: #eee;
}

.player-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  background: #ececec;
}

.photo-cell {
  width: 3rem;
}

.player-photo-preview img,
.player-hero-photo {
  width: 7rem;
  height: 7rem;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  margin-bottom: 0.75rem;
  border: 2px solid var(--line);
}

.player-edit-box {
  margin: 1rem 0 1.25rem;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(155, 28, 31, 0.04);
}

.check-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem !important;
}

/* ===== Scoreboard / Semafor — light, tablet-first ===== */
body.page-scoreboard {
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  background: #f0f0ee;
  color: #111;
  display: grid;
  place-items: stretch;
  overflow: hidden;
  position: relative;
  font-family: var(--font, system-ui, sans-serif);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.scoreboard-board {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  display: grid;
  /* Primary: tablet landscape — two huge score columns + colon */
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: 1fr auto;
  align-items: stretch;
  gap: 0;
  padding: clamp(2.2rem, 5vh, 3rem) clamp(0.35rem, 1.2vw, 0.85rem) 0;
}

.scoreboard-side {
  grid-row: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  height: 100%;
  padding: 0 0.15rem;
}

.scoreboard-side.home { grid-column: 1; }
.scoreboard-side.away { grid-column: 3; }

.scoreboard-team {
  flex: 0 0 auto;
  font-family: var(--display, Impact, sans-serif);
  font-size: clamp(1rem, 2.8vw, 2rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 clamp(0.15rem, 0.8vh, 0.5rem);
  color: #444;
  line-height: 1.05;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreboard-points {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: var(--display, Impact, sans-serif);
  /* ~30% larger than previous tablet sizes */
  font-size: min(75vmin, 49vw, 36rem);
  line-height: 0.82;
  color: #0a0a0a;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.scoreboard-points.is-pulse {
  animation: scorePulseLight 0.35s ease;
}

@keyframes scorePulseLight {
  0% { transform: scale(1); color: #0a0a0a; }
  40% { transform: scale(1.05); color: #9b1c1f; }
  100% { transform: scale(1); color: #0a0a0a; }
}

.scoreboard-divider {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 0.15rem;
  border: none;
  background: transparent;
}

.scoreboard-colon {
  font-family: var(--display, Impact, sans-serif);
  font-size: min(28vmin, 18vw, 14rem);
  line-height: 0.8;
  color: #222;
  font-weight: 400;
}

.scoreboard-end {
  grid-column: 1 / -1;
  grid-row: 2;
  display: none;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
  padding: clamp(0.85rem, 2.8vh, 1.6rem) 1rem;
  background: #c1121f;
  color: #fff;
  font-family: var(--display, Impact, sans-serif);
  font-size: clamp(1.6rem, 5.5vw, 3.25rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
}

.scoreboard-end.is-visible,
body.page-scoreboard.is-finished .scoreboard-end {
  display: flex;
}

.scoreboard-waiting {
  grid-column: 1 / -1;
  grid-row: 1;
  text-align: center;
  align-self: center;
  font-family: var(--display, Impact, sans-serif);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  letter-spacing: 0.04em;
  color: #666;
}

/* Portrait: still side-by-side on tablet, slightly smaller digits */
@media (orientation: portrait) {
  .scoreboard-points {
    font-size: min(55vmin, 62vw, 23rem);
  }

  .scoreboard-colon {
    font-size: min(18vmin, 14vw, 8rem);
  }

  .scoreboard-team {
    font-size: clamp(1rem, 4vw, 1.75rem);
    white-space: normal;
  }
}

/* Phone portrait: stack teams */
@media (max-width: 600px) and (orientation: portrait) {
  .scoreboard-board {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr auto;
  }

  .scoreboard-side.home { grid-column: 1; grid-row: 1; }
  .scoreboard-divider { grid-column: 1; grid-row: 2; height: auto; padding: 0.2rem; }
  .scoreboard-side.away { grid-column: 1; grid-row: 3; }
  .scoreboard-end { grid-row: 4; }

  .scoreboard-colon {
    font-size: min(12vmin, 10vw, 4rem);
    transform: rotate(90deg);
  }

  .scoreboard-points {
    font-size: min(47vmin, 70vw, 16rem);
  }
}

/* ===== Admin match entry — mobile-first ===== */
html,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

.admin-stats-mobile {
  display: none;
}

.admin-stats-desktop {
  display: block;
}

.player-stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.75rem;
  background: #fff;
}

.player-stat-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  min-width: 0;
}

.player-stat-num {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: #f3e8e9;
  color: #7a1216;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.player-stat-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.player-stat-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.player-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-top: 1px solid #f0e6e7;
}

.player-stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--muted);
  min-width: 2.5rem;
}

/* Large touch targets only on mobile cards */
@media (max-width: 720px) {
  body.page-admin-match .stat-btn {
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    border-radius: 10px;
    font-size: 1.35rem;
    -webkit-tap-highlight-color: transparent;
  }

  body.page-admin-match .stat-value {
    min-width: 2rem;
    font-size: 1.15rem;
    font-weight: 800;
  }
}

body.page-admin-match .admin-scoreboard .team-score {
  font-size: clamp(2.4rem, 14vw, 4.5rem);
}

body.page-admin-match .admin-scoreboard .team-name {
  font-size: clamp(0.85rem, 3.5vw, 1.1rem);
  overflow-wrap: anywhere;
  max-width: 100%;
}

body.page-admin-match .section {
  padding: 1rem;
  margin: 0.85rem 0;
  overflow: hidden;
}

body.page-admin-match .wrap {
  width: min(1100px, calc(100% - 1.25rem));
}

/* Compact sticky nav on phones */
@media (max-width: 720px) {
  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.7rem 0;
  }

  .topbar .brand {
    font-size: 1.25rem;
  }

  .topbar .nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
  }

  .topbar .nav::-webkit-scrollbar {
    display: none;
  }

  .topbar .nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
  }

  .admin-stats-desktop {
    display: none !important;
  }

  .admin-stats-mobile {
    display: block;
  }

  .teams-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  body.page-admin-match .admin-scoreboard {
    gap: 0.35rem;
  }

  body.page-admin-match .actions-bar {
    flex-wrap: wrap;
  }

  body.page-admin-match .actions-bar .btn {
    width: 100%;
  }

  .table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  input,
  select {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .section {
    padding: 0.9rem;
  }
}

@media (max-width: 420px) {
  body.page-admin-match .stat-btn {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
  }
}
