/* =========================================================
   RESPONSIVE <= 760px
   ========================================================= */

@media (max-width: 760px) {

  .app-shell {
    width: min(1180px, 100%);

    padding:
      14px max(18px, env(safe-area-inset-right)) 34px max(18px, env(safe-area-inset-left));
  }

  body {
    font-size: 0.96rem;
  }

  h1 {
    font-size:
      clamp(1.35rem, 7vw, 2rem);

    line-height: 1.12;
  }

  h2 {
    font-size:
      clamp(1.45rem, 7vw, 2.1rem);

    line-height: 1.16;
  }

  h3 {
    font-size: 1rem;
  }

  button {
    font-size: 0.9rem;

    padding:
      0.76rem 0.86rem;
  }

  input,
  textarea,
  select {
    font-size: 0.98rem;

    padding:
      0.7rem 0.76rem;
  }

  label,
  legend,
  .hint {
    font-size: 0.88rem;
  }

  .topbar,
  .workspace-header,
  .panel-heading,
  .button-row,
  .inline-form {
    align-items: stretch;

    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;

    align-items: stretch;

    flex-direction: column;
  }

  .app-menu {
    display: grid;

    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    max-width: none;
  }

  .brand-lockup {
    width: 100%;

    align-items: center;

    gap: 10px;
  }

  .brand-logo {
    width: min(58vw, 156px);
    max-height: 88px;
  }

  .language-picker {
    min-width: 0;
  }

  .share-box {
    text-align: left;
  }

  .intro {
    width: 100%;
    min-height: 90svh;

    margin-top: -14px;

    padding:
      18px 16px 20px;

    background-position:
      48% center;
  }

  .intro-copy {
    gap: 16px;

    padding:
      56px 0 96px;
  }

  .landing-actions {
    width:
      min(84vw, 420px);

    grid-template-columns: 1fr;
  }

  .landing-actions > :last-child:nth-child(odd) {
    width: 100%;
  }

  .landing-cta {
    min-height: 54px;

    font-size:
      clamp(1rem, 5vw, 1.35rem);
  }

  .intro-copy p {
    font-size:
      clamp(1rem, 5.2vw, 1.45rem);
  }

  .landing-developer-logo {
    width:
      min(36vw, 150px);
  }

  .landing-badge {
    width:
      min(34vw, 146px);
  }

  .view-grid {
    grid-template-columns: 1fr;

    gap: 14px;
  }

  .resume-panel {
    grid-template-columns: 1fr;
  }

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

  .court-edit-row,
  .large-score-board,
  .large-score-actions {
    grid-template-columns: 1fr;
  }

  .large-score-dialog {
    width: 100vw;
    height: 100vh;
  }

  .large-score-team {
    min-height: 240px;
  }

  .quick-score-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .versus {
    text-align: left;
  }

  .admin-subtabs {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .status-grid,
  .round-summary,
  .player-status-grid,
  .overview-stats,
  .tennis-scoreboard,
  .player-now-grid {
    grid-template-columns: 1fr 1fr;
  }

  .compact-list li,
  .standings li {
    align-items: stretch;

    flex-direction: column;
  }

  .player-actions {
    justify-content: space-between;

    width: 100%;
  }

  .standing-stats {
    justify-items: start;

    text-align: left;
  }

  .player-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   RESPONSIVE <= 900px
   ========================================================= */

@media (max-width: 900px) {

  .intro {
    background-size: auto 100%;
  }

  .workspace-active .topbar {
    top: 8px;
  }

  .workspace-active .workspace {
    position: relative;

    padding-top: 8px;
  }

  .workspace-active main {
    padding-bottom: 84px;
  }

  .workspace-header {
    padding-right: 64px;
  }

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

  .match-toolbar {
    justify-content: stretch;
  }

  .match-toolbar label {
    width: 100%;
  }
}

/* Final review cascade: classic surfaces intentionally follow all compatibility rules. */
body[data-theme="classic"] .workspace,
body[data-theme="classic"] .setup-panel {
  border-color: rgba(159, 207, 255, 0.20);
  background:
    linear-gradient(180deg, rgba(14, 28, 48, 0.92), rgba(6, 13, 24, 0.97)),
    #070d17;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

@media (min-width: 1100px) {
  body[data-theme="classic"] .view-grid[data-section="admin"] > .command-panel {
    grid-column: 1 / -1;
  }

  body[data-theme="classic"] .view-grid[data-section="player"] > .next-match,
  body[data-theme="classic"] .view-grid[data-section="player"] > .player-profile-panel {
    min-height: 100%;
  }
}

body[data-theme="classic"] {
  --background: #070d17;
  --surface: rgba(12, 23, 39, 0.90);
  --surface-secondary: rgba(16, 31, 52, 0.94);
  --surface-elevated: rgba(26, 48, 77, 0.90);
  --surface-glass: rgba(91, 173, 255, 0.09);
  --text-primary: #eef7ff;
  --text-secondary: #a9bfd5;
  --text-muted: #a9bfd5;
  --accent: #4fa8ff;
  --accent-hover: #62b6ff;
  --border-subtle: rgba(159, 207, 255, 0.20);
  --gold: #4fa8ff;
  --gold-light: #d8efff;
  --gold-bright: #62b6ff;
  --gold-dark: #236ca8;
  --gold-deep: #123a63;
  --gold-rgb: 79, 168, 255;
  --gold-light-rgb: 216, 239, 255;
  --gold-bright-rgb: 98, 182, 255;
  --gold-dark-rgb: 35, 108, 168;
  --line: rgba(98, 182, 255, 0.30);
  --ink: #eef7ff;
  --cream: #f4f9ff;
  --muted: #a9bfd5;
  --live: #ff7180;
  --player-accent: #4fa8ff;
  --player-accent-light: #d8efff;
  --player-accent-dark: #236ca8;
  --player-accent-rgb: 79, 168, 255;
}

body[data-theme="classic"] {
  background:
    radial-gradient(circle at 76% -8%, rgba(71, 155, 255, 0.16), transparent 34rem),
    linear-gradient(180deg, rgba(7, 13, 23, 0.84), rgba(7, 13, 23, 0.97)),
    url("../assets/backgrounds/bg_img-1600.jpg") center top / cover fixed;
}

body[data-theme="classic"] .topbar,
body[data-theme="classic"] .workspace-header,
body[data-theme="classic"] .panel,
body[data-theme="classic"] .next-match,
body[data-theme="classic"] .setup-card,
body[data-theme="classic"] .match-card,
body[data-theme="classic"] .intro {
  border-color: rgba(159, 207, 255, 0.20);
  background:
    linear-gradient(145deg, rgba(91, 173, 255, 0.10), transparent 44%),
    rgba(12, 23, 39, 0.90);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body[data-theme="classic"] .intro {
  background:
    linear-gradient(120deg, rgba(8, 17, 30, 0.95), rgba(12, 28, 48, 0.82) 62%, rgba(46, 89, 143, 0.34)),
    url("../assets/backgrounds/bg_img-1600.jpg") center / cover;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body[data-theme="classic"] .app-menu,
body[data-theme="classic"] .admin-subtabs {
  border-color: rgba(159, 207, 255, 0.20);
  background: rgba(5, 14, 26, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px rgba(0, 0, 0, 0.24);
}

body[data-theme="classic"] .app-menu {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

body[data-theme="classic"] .app-menu .module-link.active,
body[data-theme="classic"] .subtab.active,
body[data-theme="classic"] .landing-cta:first-child,
body[data-theme="classic"] button.primary,
body[data-theme="classic"] .button-primary {
  color: #03101d;
  background: linear-gradient(135deg, #e6f6ff, #62b6ff);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(79, 168, 255, 0.26);
}

body[data-theme="classic"] .match-card,
body[data-theme="classic"] .status-grid > div,
body[data-theme="classic"] .round-summary > div,
body[data-theme="classic"] .profile-stat-grid > div,
body[data-theme="classic"] .share-details > div,
body[data-theme="classic"] .cup-team-builder,
body[data-theme="classic"] .admin-identity-panel,
body[data-theme="classic"] .player-now-grid > div,
body[data-theme="classic"] .rules-list > div {
  border-color: rgba(159, 207, 255, 0.15);
  border-radius: 12px;
  background: rgba(5, 15, 28, 0.62);
}

body[data-theme="classic"] .match-card.match-playing,
body[data-theme="classic"] .highlight-match {
  border-color: rgba(20, 124, 255, 0.72);
  background: linear-gradient(135deg, rgba(20, 124, 255, 0.16), transparent 54%), rgba(13, 28, 49, 0.88);
  box-shadow: 0 16px 36px rgba(20, 124, 255, 0.12);
}

body[data-theme="classic"] .next-match {
  background: linear-gradient(135deg, rgba(69, 153, 239, 0.34), rgba(12, 36, 67, 0.92));
}

body[data-theme="classic"] .landing-cta-secondary,
body[data-theme="classic"] button.secondary,
body[data-theme="classic"] .button-secondary {
  border-color: rgba(98, 182, 255, 0.54);
  background: rgba(4, 14, 26, 0.70);
  color: #eef7ff;
}

body[data-theme="classic"] input,
body[data-theme="classic"] textarea,
body[data-theme="classic"] select {
  border-color: rgba(159, 207, 255, 0.20);
  background: rgba(3, 12, 24, 0.72);
  color: #eef7ff;
}

body[data-theme="classic"] .status-chip,
body[data-theme="classic"] .role-indicator,
body[data-theme="classic"] .share-box,
body[data-theme="classic"] .status-pill {
  border-color: rgba(98, 182, 255, 0.28);
  background: rgba(5, 15, 28, 0.58);
}

/* Neutral by default (offline / not yet synced); green only when the
   realtime connection is actually up, so "Offline" never reads as healthy. */
body[data-theme="classic"] .status-pill {
  padding: 5px 11px 5px 9px;
  border: 1px solid rgba(154, 167, 184, 0.32);
  border-radius: 999px;
  background: rgba(154, 167, 184, 0.08);
  box-shadow: none;
  color: #9aa7b8;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

body[data-theme="classic"] .status-pill::before {
  box-shadow: none;
}

body[data-theme="classic"] .status-pill[data-status="connected"] {
  border-color: rgba(85, 230, 154, 0.32);
  background: rgba(85, 230, 154, 0.09);
  color: #55e69a;
}

body[data-theme="classic"] .status-pill[data-status="connected"]::before {
  box-shadow: 0 0 8px currentColor;
  animation: statusPillPulse 2.4s ease-in-out infinite;
}

body[data-theme="classic"] .status-pill[data-status="connecting"],
body[data-theme="classic"] .status-pill[data-status="reconnecting"] {
  border-color: rgba(var(--gold-bright-rgb), 0.4);
  background: rgba(var(--gold-bright-rgb), 0.08);
  color: var(--gold-bright);
}

body[data-theme="classic"] .status-pill[data-status="error"],
body[data-theme="classic"] .status-pill[data-status="disconnected"] {
  border-color: rgba(255, 47, 63, 0.4);
  background: rgba(255, 47, 63, 0.08);
  color: #ff2f3f;
}

@keyframes statusPillPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

body.setup-active .account-panel {
  padding-top: clamp(28px, 5vw, 72px);
  scroll-margin-top: 110px;
}

/* The landing page uses the same app shell and menu as every workspace view. */
body:not(.workspace-active):not(.setup-active) .topbar {
  display: flex;
}

@media (max-width: 760px) {
  body[data-theme="classic"] .panel,
  body[data-theme="classic"] .next-match,
  body[data-theme="classic"] .setup-card {
    border-radius: 12px;
  }
}

/* Shared accessibility and feedback surfaces. */
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  min-height: 44px;
  padding: 0.72rem 1rem;
  border: 2px solid #ffffff;
  border-radius: 8px;
  background: rgba(3, 12, 24, 0.96);
  color: #ffffff;
  transform: translateY(-180%);
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

.app-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 180;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid rgba(159, 207, 255, 0.42);
  border-radius: 12px;
  background: rgba(5, 15, 28, 0.96);
  color: #eef7ff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.app-confirm-dialog {
  width: min(440px, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid rgba(159, 207, 255, 0.34);
  border-radius: 16px;
  background: #0c1727;
  color: #eef7ff;
}

.app-confirm-dialog::backdrop {
  background: rgba(1, 6, 14, 0.72);
  backdrop-filter: blur(3px);
}

.app-confirm-card { display: grid; gap: 1rem; padding: 1.25rem; }
.app-confirm-card h2 {
  min-width: 0;
  max-width: none;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.app-confirm-card p { color: #a9bfd5; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

@media (max-width: 480px) {
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .app-module, .app-module.module-entering { opacity: 1; transform: none; transition: none; }
  .skip-link { transition: none; }
}

/* =========================================================
   SCORECARD DESIGN DIRECTION
   ========================================================= */

@font-face {
  font-family: "Anton";
  src: url("../assets/fonts/Anton-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --card-navy: #06152c;
  --card-navy-deep: #020b19;
  --card-blue: #147cff;
  --card-blue-soft: #7dafff;
  --card-line: rgba(93, 164, 255, 0.32);
}

body {
  background:
    radial-gradient(circle at 50% 18%, rgba(18, 72, 139, 0.22), transparent 38%),
    linear-gradient(180deg, #020816 0%, #06152c 52%, #020812 100%);
}

body.workspace-active {
  background:
    radial-gradient(circle at 50% 12%, rgba(20, 124, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #020816 0%, #06152c 58%, #020812 100%);
}

.panel,
.match-card,
.next-match,
.player-identity-card,
.round-summary,
.live-overview {
  border-color: var(--card-line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(19, 64, 120, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(5, 21, 43, 0.96), rgba(2, 11, 25, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(177, 218, 255, 0.08),
    0 20px 50px rgba(0, 0, 0, 0.28);
}

.match-card {
  gap: 22px;
  padding: clamp(18px, 3vw, 30px);
  border-width: 1px;
  border-radius: 32px;
  overflow: hidden;
}

.match-card::before {
  width: 3px;
  border-radius: 18px 0 0 18px;
}

.match-top {
  align-items: center;
  padding-bottom: 2px;
}

.match-meta {
  color: var(--card-blue-soft);
  font-size: clamp(1rem, 1.7vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.match-meta span + span::before {
  content: "•";
  margin-right: 0.45rem;
  color: var(--card-blue);
}

.match-court {
  color: var(--cream);
  font-size: clamp(1.1rem, 2vw, 1.8rem);
  font-weight: 800;
  text-transform: uppercase;
}

.match-status {
  border-color: rgba(var(--gold-bright-rgb), 0.66);
  background: transparent;
  color: var(--card-blue-soft);
  padding-inline: 0.85rem;
}

.match-headline {
  color: var(--cream);
  font-size: clamp(1.35rem, 2.35vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.scorecard-matchup {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 1.45fr) minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(12px, 1.5vw, 24px);
  padding-top: 44px;
}

.scorecard-matchup::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  border-top: 1px solid var(--card-blue);
  opacity: 0.9;
}

.scorecard-team {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 22px clamp(18px, 2vw, 34px);
  border: 1px solid rgba(var(--player-accent-rgb), 0.46);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(var(--player-accent-rgb), 0.16), rgba(2, 11, 25, 0.76) 62%);
}

.scorecard-team h3 {
  justify-self: center;
  min-width: min(58%, 220px);
  margin-top: -44px;
  padding: 10px 24px 12px;
  border: 1px solid rgba(var(--player-accent-rgb), 0.42);
  border-top: 0;
  border-radius: 0 0 28px 28px;
  background: rgba(5, 21, 43, 0.84);
  color: var(--player-accent-light);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.scorecard-players {
  display: grid;
  align-content: center;
  gap: 12px;
}

.scorecard-players .team-player {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(var(--player-accent-rgb), 0.26);
}

.scorecard-players .team-player:last-child { border-bottom: 0; }
.scorecard-players .team-player-badge { font-size: clamp(1rem, 1.8vw, 1.34rem); }

.scorecard-center {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  min-width: 0;
  container-type: inline-size;
  padding: 16px 0;
}

.scorecard-emblem {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-top: -48px;
  font-size: 1.8rem;
}

.scorecard-emblem img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(20, 124, 255, 0.22));
}

.scorecard-score-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  width: 100%;
  min-width: 0;
}

.scorecard-score-pair > * { min-width: 0; }

.scorecard-score-pair .scorecard-point-button,
.scorecard-score-pair .scorecard-point-value {
  display: grid;
  place-items: center;
  min-height: 154px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  border: 2px solid var(--card-blue);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(20, 124, 255, 0.2), rgba(2, 11, 25, 0.88));
  color: var(--cream);
  font-size: clamp(3rem, 15cqw, 7rem);
  font-family: "Anton", sans-serif;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 0.85;
  text-shadow: 0 0 22px rgba(126, 191, 255, 0.22);
}

.scorecard-point-button {
  width: 100%;
  padding: 0.5rem;
  cursor: pointer;
}

.scorecard-point-button:not(:disabled):hover {
  background: linear-gradient(145deg, rgba(45, 145, 255, 0.38), rgba(2, 11, 25, 0.88));
  box-shadow: 0 0 24px rgba(20, 124, 255, 0.28);
}

.scorecard-point-button:disabled { cursor: not-allowed; }

.scorecard-score-pair span {
  color: var(--card-blue);
  font-size: clamp(1rem, 1.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.scorecard-vs-icon {
  display: block;
  width: clamp(56px, 8cqw, 104px);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(20, 124, 255, 0.28));
}

.scorecard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(96, 166, 255, 0.28);
  border-radius: 18px;
  background: rgba(2, 11, 25, 0.52);
  overflow: hidden;
}

.scorecard-stats > div {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-items: center;
  row-gap: 4px;
  min-height: clamp(88px, 9vw, 132px);
  padding: 16px clamp(12px, 2vw, 30px);
  text-align: center;
  border-right: 1px solid rgba(96, 166, 255, 0.28);
}

.scorecard-stats > div:last-child { border-right: 0; }
.scorecard-stat-icon { display: none; }
.scorecard-stats span:not(.scorecard-stat-icon) { color: var(--card-blue); font-size: clamp(1rem, 1.6vw, 1.55rem); font-weight: 700; text-transform: uppercase; }
.scorecard-stats strong { color: var(--cream); font-size: clamp(1.45rem, 2.8vw, 2.6rem); line-height: 1; }

.teams {
  gap: clamp(14px, 2vw, 28px);
  padding: clamp(16px, 2.8vw, 28px);
  border: 1px solid rgba(96, 166, 255, 0.22);
  border-radius: 18px;
  background: rgba(2, 11, 25, 0.64);
}

.team {
  gap: 0.8rem;
}

.team > small {
  color: var(--card-blue-soft);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

.match-card .team-player-badge {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--cream);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: none;
}

.versus {
  color: var(--card-blue);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.tennis-scoreboard {
  gap: 0;
  border: 1px solid rgba(96, 166, 255, 0.22);
  border-radius: 18px;
  background: rgba(2, 11, 25, 0.52);
  overflow: hidden;
}

.tennis-scoreboard > div {
  min-height: 92px;
  align-content: center;
  border: 0;
  border-right: 1px solid rgba(96, 166, 255, 0.24);
  border-radius: 0;
  padding: 1rem 1.25rem;
  background: transparent;
}

.tennis-scoreboard > div:last-child { border-right: 0; }
.tennis-scoreboard small { color: var(--card-blue-soft); }
.tennis-scoreboard strong { color: var(--cream); font-size: clamp(1.5rem, 3vw, 2rem); }

.match-note {
  justify-items: center;
  color: var(--card-blue-soft);
}

.match-note .hint { color: var(--card-blue-soft); text-align: center; }

#joinAvatarPreviewFrame { --player-accent: var(--gold); --player-accent-light: var(--gold-light); --player-accent-rgb: var(--gold-rgb); }

.admin-subtabs {
  border-color: var(--card-line);
  border-radius: 18px;
  background: rgba(2, 11, 25, 0.74);
}

.admin-subtabs .subtab.active {
  border-radius: 14px;
  background: linear-gradient(135deg, #dff3ff, #5caeff);
  color: #03101d;
  box-shadow: 0 10px 28px rgba(20, 124, 255, 0.28);
}

@media (max-width: 680px) {
  .scorecard-matchup { grid-template-columns: 1fr; }
  .scorecard-center { order: -1; }
  .scorecard-score-pair .scorecard-point-button,
  .scorecard-score-pair .scorecard-point-value { min-height: 104px; font-size: 4.2rem; }
  .scorecard-stats > div { padding: 12px; column-gap: 8px; }
  .scorecard-stat-icon { font-size: 1.25rem; }
  .versus { justify-self: center; }
  .tennis-scoreboard > div { min-height: 72px; padding: 0.8rem; }
}

@media (min-width: 681px) and (max-width: 900px) {
  .scorecard-score-pair .scorecard-point-button,
  .scorecard-score-pair .scorecard-point-value { min-height: 116px; font-size: clamp(2rem, 15cqw, 4.5rem); }
}

/* Reference match-card pass: one blue scoreboard system, player color only on avatars. */
.match-card.match-playing::before,
.match-card.match-waiting::before {
  background: var(--card-blue);
}

.scorecard-matchup::before {
  border-top-color: var(--card-blue);
  background:
    radial-gradient(circle at calc(50% - 78px), var(--card-blue) 0 4px, transparent 5px),
    radial-gradient(circle at calc(50% + 78px), var(--card-blue) 0 4px, transparent 5px);
  background-repeat: no-repeat;
}

.scorecard-team {
  min-height: clamp(270px, 23vw, 380px);
  border-color: rgba(20, 124, 255, 0.48);
  background: linear-gradient(145deg, rgba(20, 124, 255, 0.09), rgba(2, 11, 25, 0.88) 60%);
}

.scorecard-team h3 {
  border-color: rgba(20, 124, 255, 0.42);
  color: var(--card-blue);
  background: rgba(2, 11, 25, 0.9);
}

.scorecard-players .team-player {
  border-bottom-color: rgba(20, 124, 255, 0.28);
}

.scorecard-score-pair .scorecard-point-button,
.scorecard-score-pair .scorecard-point-value {
  min-height: clamp(138px, 17vw, 274px);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(20, 124, 255, 0.2), rgba(2, 11, 25, 0.92));
  font-size: clamp(3rem, 15cqw, 7rem);
}

.scorecard-stats {
  border-color: rgba(20, 124, 255, 0.24);
  background: rgba(2, 11, 25, 0.68);
}

.scorecard-stats > div {
  border-right-color: rgba(20, 124, 255, 0.24);
}

.match-card .match-status {
  border-color: rgba(20, 124, 255, 0.72);
  background: rgba(20, 124, 255, 0.12);
  color: var(--card-blue-soft);
  min-height: 24px;
  padding: 0.28rem 0.58rem;
  font-size: 0.72rem;
  text-transform: uppercase;
}

body[data-theme="classic"] .match-card.match-playing,
body[data-theme="classic"] .match-card.match-waiting,
body[data-theme="classic"] .highlight-match {
  border-color: rgba(20, 124, 255, 0.72);
  background: linear-gradient(135deg, rgba(20, 124, 255, 0.12), transparent 54%), rgba(5, 21, 43, 0.96);
  box-shadow: 0 16px 36px rgba(20, 124, 255, 0.1);
}

body[data-theme="classic"] .match-card.match-playing {
  border-color: rgba(126, 191, 255, 0.92);
  background: linear-gradient(135deg, rgba(126, 191, 255, 0.18), transparent 54%), rgba(7, 27, 54, 0.98);
  box-shadow: 0 16px 36px rgba(20, 124, 255, 0.2);
}

.scorecard-team h3 {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  margin: 0;
  transform: translateX(-50%);
}

.scorecard-team {
  position: relative;
  padding-top: 70px;
}

.scorecard-emblem {
  width: 88px;
  height: 88px;
}

.scorecard-emblem img {
  width: 78px;
  height: 78px;
}

.scorecard-matchup::before {
  height: 1px;
  border-top: 0;
  background:
    radial-gradient(circle at calc(50% - 78px), var(--card-blue) 0 4px, transparent 5px),
    radial-gradient(circle at calc(50% + 78px), var(--card-blue) 0 4px, transparent 5px),
    linear-gradient(var(--card-blue), var(--card-blue)) left center / calc(50% - 100px) 1px no-repeat,
    linear-gradient(var(--card-blue), var(--card-blue)) right center / calc(50% - 100px) 1px no-repeat;
}

@media (max-width: 680px) {
  .match-card {
    gap: 16px;
    padding: 16px;
    border-radius: 24px;
  }

  .match-top {
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .match-meta {
    min-width: 0;
    width: calc(50% - 64px);
    max-width: calc(50% - 64px);
    flex: 0 1 calc(50% - 64px);
  }

  .match-meta > span:first-child {
    display: block;
    overflow-wrap: anywhere;
  }

  .match-top-actions {
    min-width: 0;
    width: calc(50% - 64px);
    max-width: calc(50% - 64px);
    flex: 0 1 calc(50% - 64px);
    justify-content: flex-end;
  }

  .match-meta { font-size: 0.92rem; }
  .match-court { font-size: 1.05rem; }
  .match-headline { font-size: 1.3rem; }

  .scorecard-matchup {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding-top: 38px;
  }

  .scorecard-team {
    min-height: 220px;
    gap: 12px;
    padding: 62px 12px 16px;
  }

  .scorecard-team-one { grid-column: 1; grid-row: 2; }
  .scorecard-team-two { grid-column: 2; grid-row: 2; }

  .scorecard-center {
    grid-column: 1 / -1;
    grid-row: 1;
    order: 0;
    padding: 38px 0 0;
  }

  .scorecard-emblem {
    width: 58px;
    height: 58px;
    margin-top: -38px;
  }

  .scorecard-emblem img { width: 64px; height: 64px; }
  .scorecard-players .team-player { gap: 8px; padding: 10px 0; }
  .scorecard-players .team-player-badge { font-size: 0.9rem; letter-spacing: 0.04em; }

  .scorecard-score-pair .scorecard-point-button,
  .scorecard-score-pair .scorecard-point-value {
    min-height: 132px;
    border-radius: 18px;
    font-size: clamp(2.6rem, 15cqw, 4.2rem);
  }

  .scorecard-stats > div { min-height: 82px; padding: 12px 8px; }
  .scorecard-stats span:not(.scorecard-stat-icon) { font-size: 0.86rem; }
  .scorecard-stats strong { font-size: 1.45rem; }
}

@media (max-width: 420px) {
  .scorecard-team-one,
  .scorecard-team-two { grid-column: 1; }
  .scorecard-team-one { grid-row: 1; }
  .scorecard-center { grid-row: 2; }
  .scorecard-team-two { grid-row: 3; }
  .scorecard-team { min-height: 184px; padding-top: 56px; }
  .scorecard-players { grid-template-columns: 1fr 1fr; gap: 8px; }
  .scorecard-players .team-player { display: grid; justify-items: center; text-align: center; border-bottom: 0; }
  .scorecard-players .team-player-badge { overflow-wrap: anywhere; }
}

/* Final match-card polish: keep the brand mark anchored to the card edge
   while giving the VS artwork enough presence on every card width. */

.match-card {
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.scorecard-center {
  position: static;
}

.scorecard-matchup {
  position: static;
}

.scorecard-team h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.scorecard-players .team-player-badge {
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.scorecard-players .team-player {
  align-items: flex-start;
}

.scorecard-players .scorecard-avatar {
  flex: 0 0 auto;
}

.scorecard-players .team-player.name-wraps {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.checkbox-card {
  border-color: rgba(96, 166, 255, 0.46);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.16), transparent 58%),
    rgba(3, 16, 34, 0.9);
}

.checkbox-card:has(input:checked) {
  border-color: var(--card-blue);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.28), transparent 64%),
    rgba(3, 16, 34, 0.96);
  box-shadow: 0 12px 28px rgba(20, 124, 255, 0.14);
}

.checkbox-card input {
  accent-color: var(--card-blue);
}

.workspace-header {
  min-width: 0;
  padding-inline: clamp(16px, 2vw, 26px);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.workspace-header > div:first-child {
  min-width: 0;
}

.workspace-header h2,
.workspace-header .eyebrow {
  overflow-wrap: anywhere;
}

.workspace-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.workspace-header-actions .share-box {
  flex: 1 1 100%;
}

.view-grid[data-section="admin"] > .panel {
  grid-column: 1 / -1;
}

.match-card .cancel-match-button,
.match-card .walkover-row .walkover-button {
  border-color: rgba(96, 166, 255, 0.42);
  background: rgba(20, 124, 255, 0.1);
  color: var(--card-blue-soft);
}

.match-card .cancel-match-button:hover:not(:disabled),
.match-card .walkover-row .walkover-button:hover:not(:disabled) {
  border-color: var(--card-blue);
  background: rgba(20, 124, 255, 0.2);
  color: var(--cream);
}

.match-card .cancel-match-button:focus-visible,
.match-card .walkover-row .walkover-button:focus-visible {
  outline-color: var(--card-blue);
  outline-offset: 3px;
}

.round-summary > div {
  border-color: var(--card-line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(19, 64, 120, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(5, 21, 43, 0.96), rgba(2, 11, 25, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(177, 218, 255, 0.08),
    0 20px 50px rgba(0, 0, 0, 0.28);
}

.overview-stats > div {
  border-color: var(--card-line);
  background:
    linear-gradient(145deg, rgba(19, 64, 120, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(5, 21, 43, 0.96), rgba(2, 11, 25, 0.98));
}

@media (max-width: 760px) {
  .workspace-header-actions {
    width: 100%;
  }
}

.match-headline {
  font-family: var(--font-ui);
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.match-court {
  font-family: var(--font-ui);
  font-weight: 600;
}

.workspace-header .danger-button {
  border-color: rgba(20, 124, 255, 0.52);
  background: rgba(20, 124, 255, 0.12);
  color: var(--card-blue-soft);
}

.workspace-header .danger-button:hover {
  border-color: var(--card-blue);
  background: rgba(20, 124, 255, 0.22);
  color: var(--cream);
}

.player-session-actions button {
  border-color: rgba(20, 124, 255, 0.52);
  background: rgba(20, 124, 255, 0.12);
  color: var(--card-blue-soft);
}

.player-session-actions button:hover {
  border-color: var(--card-blue);
  background: rgba(20, 124, 255, 0.22);
  color: var(--cream);
}

.next-match .team-player-badge {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--cream);
  box-shadow: none;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.standings li {
  border-color: rgba(96, 166, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.12), transparent 58%),
    rgba(3, 16, 34, 0.94);
}

.standings .player-name-badge {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--cream);
  box-shadow: none;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scorecard-score-pair {
  gap: clamp(8px, 1vw, 14px);
}

.scorecard-vs-icon {
  width: clamp(110px, 24cqw, 190px);
}

@media (max-width: 680px) {
  .scorecard-vs-icon {
    width: clamp(104px, 24cqw, 150px);
  }
}

@media (max-width: 420px) {
  .scorecard-vs-icon {
    width: clamp(96px, 32cqw, 128px);
  }
}

.join-preview {
  border-color: rgba(96, 166, 255, 0.46);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.16), transparent 58%),
    rgba(3, 16, 34, 0.9);
}

#showExistingPlayersButton {
  border-color: rgba(96, 166, 255, 0.46);
  background: rgba(20, 124, 255, 0.1);
  color: var(--card-blue-soft);
}

#showExistingPlayersButton:hover {
  border-color: var(--card-blue);
  background: rgba(20, 124, 255, 0.2);
  color: var(--cream);
}

#profileAvatarPicker > label {
  border-color: rgba(96, 166, 255, 0.46);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.14), transparent 60%),
    rgba(3, 16, 34, 0.9);
  color: var(--cream);
}

#profileAvatarPicker > label:hover,
#profileAvatarPicker > label:has(input:checked) {
  border-color: var(--card-blue);
  background: linear-gradient(135deg, #e6f6ff, #62b6ff);
  color: #03101d;
  box-shadow: 0 10px 24px rgba(20, 124, 255, 0.18);
}

#profileForm > .button-row {
  gap: 12px;
  margin-top: 14px;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
}

.match-group > .match-card + .match-card {
  margin-top: 24px;
}

.scorecard-emblem {
  position: absolute;
  top: -20px;
  left: 50%;
  z-index: 2;
  width: 96px;
  height: 96px;
  margin: 0;
  transform: translateX(-50%);
}

.scorecard-emblem img {
  width: 92px;
  height: 92px;
}

.scorecard-vs-icon {
  width: clamp(140px, 32cqw, 240px);
  max-width: 100%;
}

@media (max-width: 680px) {
  .scorecard-emblem {
    top: -15px;
    width: 74px;
    height: 74px;
  }

  .scorecard-emblem img {
    width: 72px;
    height: 72px;
  }

  .scorecard-vs-icon {
    width: clamp(120px, 30cqw, 170px);
  }
}

@media (max-width: 420px) {
  .scorecard-emblem {
    top: -11px;
    width: 66px;
    height: 66px;
  }

  .scorecard-emblem img {
    width: 64px;
    height: 64px;
  }

  .scorecard-vs-icon {
    width: clamp(108px, 42cqw, 142px);
  }
}

/* =========================================================
   ADMIN PLAYER LIST
   ========================================================= */

#playersList > li {
  border-color: rgba(96, 166, 255, 0.28);
  background:
    linear-gradient(145deg, rgba(20, 124, 255, 0.12), transparent 58%),
    rgba(3, 16, 34, 0.94);
}

#playersList .player-name-badge {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--cream);
  box-shadow: none;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#playersList .join-source-chip {
  border-color: rgba(96, 166, 255, 0.34);
  background: rgba(20, 124, 255, 0.1);
  color: var(--card-blue-soft);
}

#playersList .player-actions strong {
  color: var(--cream);
}

#playersList .danger-button {
  border-color: rgba(96, 166, 255, 0.42);
  background: rgba(20, 124, 255, 0.1);
  color: var(--card-blue-soft);
}

#playersList .danger-button:hover:not(:disabled) {
  border-color: var(--card-blue);
  background: rgba(20, 124, 255, 0.2);
  color: var(--cream);
}

#playersList .player-edit-grid {
  border-top: 1px solid rgba(96, 166, 255, 0.2);
  padding-top: 10px;
}

/* The VS artwork is cropped to its symbol, so the center column needs less width. */

.scorecard-vs-icon {
  width: clamp(120px, 40cqw, 180px);
}

.scorecard-matchup::before {
  display: none;
}

@media (max-width: 680px) {
  .scorecard-vs-icon {
    width: clamp(108px, 36cqw, 150px);
  }
}

@media (max-width: 420px) {
  .scorecard-vs-icon {
    width: clamp(96px, 48cqw, 128px);
  }

  .scorecard-players .team-player.name-wraps {
    align-items: center;
    text-align: center;
  }
}

/* Give the landing hero a little more breathing room below the fixed nav. */

.intro-copy {
  transform: translateY(clamp(36px, 8vh, 96px));
}

@media (max-width: 760px) {
  .intro-copy {
    transform: translateY(clamp(16px, 4vh, 40px));
  }
}

/* One desktop scorecard layout: reserve space for the score pair so the
   points remain readable without shrinking the team cards into columns. */
@media (min-width: 681px) {
  .match-card .scorecard-matchup {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 1.1fr) minmax(0, 1fr);
    gap: 12px;
  }

  .match-card .scorecard-team,
  .match-card .scorecard-players,
  .match-card .scorecard-players .team-player {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .match-card .scorecard-players .team-player-badge {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .match-card .scorecard-score-pair {
    grid-template-columns: minmax(40px, 1fr) minmax(80px, auto) minmax(40px, 1fr);
    gap: clamp(6px, 1vw, 14px);
  }

  .match-card .scorecard-vs-icon {
    width: clamp(80px, 34cqw, 140px);
  }
}
