/* Dasha Madness — dark court aesthetic */

/* Circus Age → logo only */
@font-face {
  font-family: "Circus Age";
  src: url("/fonts/CircusAge.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0a0f;
  --bg-elevated: #14121c;
  --bg-card: #1a1724;
  --border: rgba(255, 255, 255, 0.1);
  /* Accent red (logo + highlights) */
  --red: #e63946;
  --red-bright: #ff4d5a;
  --border-strong: rgba(230, 57, 70, 0.45);
  /* Light text for dark background — high contrast, easy to read */
  --text: #f0ebe3;
  --text-muted: #9b958c;
  --gold: #e63946;
  --gold-bright: #ff4d5a;
  --purple: #7b5cff;
  --purple-dim: #4a3488;
  --magenta: #c44dff;
  --danger: #ff6b81;
  --success: #4fd18b;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font-logo: "Circus Age", Impact, fantasy, serif;
  /* Clean UI sans — readable at every size on dark UI */
  --font-display: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(123, 92, 255, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(214, 40, 40, 0.16), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, rgba(214, 40, 40, 0.1), transparent 55%);
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-size: 0.9em;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(11, 10, 15, 0.75);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

/* Circus Age wordmark */
.brand-title {
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-home-link {
  display: inline-block;
  line-height: 1;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease;
  color: inherit;
}

.brand-home-link:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.brand-home-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.brand-wordmark {
  display: block;
  height: clamp(2.15rem, 5vw, 2.85rem);
  width: auto;
  max-width: min(240px, 52vw);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 2px 12px rgba(230, 57, 70, 0.25));
}

.brand-wordmark-admin {
  height: 2.2rem;
  max-width: 185px;
}

.brand-admin-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  font-weight: 400;
  color: var(--red);
  line-height: 1;
}

.site-header h1:not(.brand-title) {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: 0.04em;
  font-weight: 400;
  line-height: 1;
  color: var(--red);
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.header-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.round-pill {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(123, 92, 255, 0.25), rgba(214, 40, 40, 0.12));
  color: var(--gold-bright);
}

.timer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  min-width: 7.5rem;
}

.timer-inline {
  align-items: stretch;
  flex-shrink: 0;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(135deg, rgba(123, 92, 255, 0.12), rgba(214, 40, 40, 0.08));
  border-color: var(--border-strong);
}

.timer-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.timer-value {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.timer-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.timer-num {
  font-size: 1.35rem;
  line-height: 1.1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.timer-unit-label {
  font-family: var(--font-body);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.timer-status-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  line-height: 1.2;
}

.timer.closed .timer-num,
.timer.closed .timer-status-text {
  color: var(--danger);
}

.timer.open-no-deadline .timer-status-text {
  color: var(--success);
}

.section-head-with-timer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
}

.section-head-main {
  flex: 1 1 200px;
  min-width: 0;
}

.section-head-main h2 {
  margin: 0;
}

.admin-link {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-link:hover {
  color: var(--gold);
  border-color: var(--border-strong);
  text-decoration: none;
}

/* Tabs */

.site-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  background: rgba(11, 10, 15, 0.85);
  backdrop-filter: blur(10px);
}

.tab-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
  border-color: var(--border);
}

.tab-btn.active {
  color: #1a1200;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  border-color: transparent;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.user-chip {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(123, 92, 255, 0.15);
  color: var(--gold-bright);
}

.linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
}

/* Account / predict / leaderboard */

.auth-gate {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.account-card h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.predict-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.predict-toolbar-bottom {
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.predict-score {
  font-weight: 600;
  color: var(--gold);
}

.predict-round-block {
  margin-bottom: 1.5rem;
}

.predict-round-block h3 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.pts-badge {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.4rem;
  letter-spacing: 0;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.pick-game {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.pick-game.not-ready {
  opacity: 0.55;
}

.pick-game-head {
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

.pick-game-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.25rem;
  padding: 0.55rem;
}

.pick-vs {
  font-family: var(--font-display);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pick-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: inherit;
  font: inherit;
  padding: 0.4rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pick-option:not(:disabled):hover {
  border-color: var(--border-strong);
}

.pick-option.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(214, 40, 40, 0.4);
}

.pick-option.hit {
  border-color: var(--success);
  box-shadow: 0 0 0 1px rgba(79, 209, 139, 0.45);
}

.pick-option.miss {
  border-color: var(--danger);
  opacity: 0.75;
}

.pick-option:disabled {
  cursor: default;
}

.pick-option.empty {
  min-height: 72px;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: default;
}

.pick-thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: #0e0c14;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pick-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* full photo, not cropped */
  display: block;
}

.pick-seed {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.leaderboard-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.leaderboard-table tr.me {
  background: rgba(214, 40, 40, 0.08);
}

.leaderboard-table tr.me td:nth-child(2) {
  color: var(--gold-bright);
  font-weight: 700;
}

.user-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.user-link:hover {
  color: var(--gold-bright);
}

.leaderboard-table tr.me .user-link {
  color: var(--gold-bright);
}

/* Picks viewer modal */

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5, 4, 10, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(960px, 100%);
  margin: 1rem auto 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow), 0 0 60px rgba(123, 92, 255, 0.12);
  max-height: none;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(26, 23, 36, 0.96);
  backdrop-filter: blur(8px);
  z-index: 1;
  border-radius: calc(var(--radius) + 4px) calc(var(--radius) + 4px) 0 0;
}

.modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.modal-head .hint {
  margin: 0.25rem 0 0;
}

.modal-body {
  padding: 1rem 1.15rem 1.5rem;
}

.pick-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 700;
}

.pick-option.selected .pick-tag {
  color: var(--gold-bright);
}

.bracket-section-tab {
  width: auto;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

#btn-download-bracket {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Header share + theme */
.share-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.login-needed-banner {
  margin: 0 0 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(255, 77, 184, 0.12), rgba(123, 92, 255, 0.08));
}

.login-needed-banner p {
  margin: 0;
}

.login-needed-banner .hint {
  margin-top: 0.35rem;
}

/* Comments (collapsed by default) */
#btn-expand-all-comments {
  margin-top: 0.5rem;
}

.matchup-comments-bar {
  padding: 0.4rem 0.75rem 0.55rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.matchup-comments {
  padding: 0.65rem 0.75rem 0.85rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 0.65rem;
}

.comment-item {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.comment-meta strong {
  color: var(--gold-bright);
}

.comment-time {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.comment-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-empty,
.comment-login-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.comment-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  resize: vertical;
  min-height: 2.5rem;
}

.comment-form textarea:focus {
  outline: 2px solid var(--gold);
  border-color: transparent;
}

/* Admin comments table */
.admin-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
}

.admin-comment-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.88rem;
}

.admin-comment-row .ac-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-comment-row .ac-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Mobile bracket */
.bracket-mobile-controls {
  display: none;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.bracket-view-toggle,
.bracket-region-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mobile-only-hint {
  display: none;
}

.desktop-only-hint {
  display: block;
}

.bracket-current-list {
  margin-bottom: 1rem;
}

.bracket-current-title {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.bracket-current-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}

.bracket-current-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.85rem;
}

.bcc-head {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.bcc-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.bcc-row:last-child {
  border-bottom: none;
}

.bcc-row.winner {
  background: rgba(255, 77, 184, 0.12);
  color: var(--gold-bright);
  font-weight: 600;
}

.bcc-seed {
  font-weight: 600;
}

.bcc-votes {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Hide region columns on mobile region view */
@media (max-width: 900px) {
  .bracket-mobile-controls {
    display: flex;
  }

  .mobile-only-hint {
    display: block;
  }

  .desktop-only-hint {
    display: none;
  }

  .bm-board[data-region-view="left"] .bm-side-right,
  .bm-board[data-region-view="left"] .bm-center,
  .bm-board[data-region-view="left"] .bm-region-right {
    display: none;
  }

  .bm-board[data-region-view="right"] .bm-side-left,
  .bm-board[data-region-view="right"] .bm-center,
  .bm-board[data-region-view="right"] .bm-region-left {
    display: none;
  }

  .bm-board[data-region-view="center"] .bm-side-left,
  .bm-board[data-region-view="center"] .bm-side-right,
  .bm-board[data-region-view="center"] .bm-region-left,
  .bm-board[data-region-view="center"] .bm-region-right {
    display: none;
  }

  .bm-board[data-region-view="left"],
  .bm-board[data-region-view="right"],
  .bm-board[data-region-view="center"] {
    grid-template-columns: 1fr;
  }

  .bm-board[data-region-view="left"] .bm-side-left,
  .bm-board[data-region-view="right"] .bm-side-right,
  .bm-board[data-region-view="center"] .bm-center {
    grid-column: 1;
  }

  .bm-board[data-region-view="left"] .bm-region-left,
  .bm-board[data-region-view="right"] .bm-region-right {
    grid-column: 1;
  }

  .bm-board[data-region-view="all"] {
    /* full tree — allow horizontal scroll as usual */
  }

  .site-header {
    gap: 0.65rem;
  }

  .header-status {
    width: 100%;
    justify-content: flex-start;
  }
}

/* Picks vs reality */
.picks-vs-reality {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
}

.picks-vs-reality h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.pvr-summary {
  margin: 0.5rem 0 0.75rem;
  font-size: 0.95rem;
}

.pvr-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 280px;
  overflow-y: auto;
}

.pvr-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.82rem;
}

.pvr-row.hit {
  border-color: rgba(110, 231, 183, 0.4);
  background: rgba(110, 231, 183, 0.08);
}

.pvr-row.miss {
  border-color: rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.06);
}

.pvr-pts {
  font-weight: 700;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.pvr-row.miss .pvr-pts {
  color: var(--text-muted);
}

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

  .pvr-pts {
    grid-column: 2;
    text-align: right;
  }
}

/* Off-screen root used only while rendering a downloadable PNG */
.bracket-export-root {
  position: fixed;
  left: -12000px;
  top: 0;
  z-index: -1;
  padding: 28px 32px 36px;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

.bracket-export-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-strong);
}

.bracket-export-banner img {
  height: 2.4rem;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.bracket-export-banner h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.bracket-export-banner p {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bracket-export-root .mm-bracket {
  /* Ensure full board paints without page scroll clipping */
  overflow: visible;
}

/* Lightweight seed badges used only in export clones (no photos) */
.bracket-export-root .bm-thumb-export {
  width: var(--bm-thumb, 28px);
  height: var(--bm-thumb, 28px);
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.bracket-export-root .bm-game {
  box-shadow: none;
}

.bracket-export-root * {
  /* Faster paint path for capture */
  animation: none !important;
  transition: none !important;
  backdrop-filter: none !important;
  filter: none !important;
  text-shadow: none !important;
}

/* Admin users table */
.users-table-wrap {
  overflow-x: auto;
  margin-top: 0.75rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.users-table th,
.users-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.users-table input[type="text"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  width: min(160px, 100%);
}

.users-table .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
}

.user-edit-stack {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.user-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.users-table input.pw-input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  width: min(160px, 100%);
}

/* Main */

main {
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.status-bar p {
  margin: 0;
}

.photos-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Winner (final champion) */

.winner-banner {
  margin-bottom: 1.5rem;
}

.winner-card {
  text-align: center;
  padding: clamp(1.75rem, 4vw, 2.75rem) 1.5rem;
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(214, 40, 40, 0.22), transparent 55%),
    linear-gradient(180deg, rgba(123, 92, 255, 0.12), transparent 50%),
    var(--bg-card);
  border: 1px solid var(--border-strong);
  box-shadow:
    var(--shadow),
    0 0 80px rgba(214, 40, 40, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: winner-glow 3.5s ease-in-out infinite alternate;
}

@keyframes winner-glow {
  from {
    box-shadow: var(--shadow), 0 0 40px rgba(214, 40, 40, 0.12);
  }
  to {
    box-shadow: var(--shadow), 0 0 90px rgba(214, 40, 40, 0.28);
  }
}

.winner-kicker {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.winner-label {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-bright);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1;
  text-shadow: 0 0 28px rgba(214, 40, 40, 0.45);
}

.winner-photo-wrap {
  width: min(340px, 78vw);
  aspect-ratio: 3 / 4;
  margin: 1.25rem auto 1rem;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--gold);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.55),
    0 0 0 6px rgba(214, 40, 40, 0.12);
  background: var(--bg);
}

.winner-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.winner-photo-wrap .photo-placeholder {
  min-height: 100%;
  font-size: 1rem;
}

.winner-name {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.05em;
  font-weight: 400;
  color: var(--text);
}

.winner-sub {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
}

/* Legacy class aliases (if referenced) */
.champion-banner {
  margin-bottom: 2rem;
}

/* Sections */

.section-head {
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.matchups-section {
  margin-bottom: 2.5rem;
}

/* Matchup cards */

.matchups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.1rem;
}

.matchup-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}

.matchup-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.matchup-card.voted {
  border-color: rgba(79, 209, 139, 0.35);
}

.matchup-card.locked {
  opacity: 0.85;
}

.matchup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.matchup-head strong {
  color: var(--gold);
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  font-weight: 400;
  font-size: 1rem;
}

.matchup-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0.25rem;
  padding: 0.75rem;
}

.vs {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0 0.15rem;
  align-self: center;
}

.photo-option {
  position: relative;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: center;
  color: inherit;
  font: inherit;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.photo-option:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(123, 92, 255, 0.25);
}

.photo-option:not(:disabled):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.photo-option:disabled {
  cursor: default;
}

.photo-option.selected {
  box-shadow: 0 0 0 2px var(--success);
}

.photo-option.winner-option {
  box-shadow: 0 0 0 2px var(--gold);
}

.photo-frame {
  aspect-ratio: 3 / 4;
  background: #0e0c14;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* show full photo (no hard crop) */
  display: block;
  background: #0e0c14;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(
      -45deg,
      #16131f,
      #16131f 8px,
      #1c1828 8px,
      #1c1828 16px
    );
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.5rem;
  text-align: center;
}

.photo-meta {
  margin-top: 0.45rem;
  padding: 0 0.15rem 0.25rem;
}

.photo-seed {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.photo-votes {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vote-bar {
  height: 4px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.vote-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.matchup-foot {
  padding: 0.5rem 0.85rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  min-height: 2rem;
}

.matchup-foot .you-voted {
  color: var(--success);
}

/* ─── March Madness full bracket ─── */

.bracket-section {
  margin-top: 1rem;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 0 clamp(0.75rem, 2vw, 1.5rem);
  box-sizing: border-box;
}

.bracket-scroll {
  overflow: auto;
  max-height: min(92vh, 1400px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(20, 18, 32, 0.95), rgba(12, 10, 18, 0.98)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(255, 255, 255, 0.015) 31px,
      rgba(255, 255, 255, 0.015) 32px
    );
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.35);
}

.mm-bracket {
  min-width: min-content;
  padding: 1rem 1.25rem 1.25rem;
}

.bm-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr;
  gap: 0 0.35rem;
  align-items: stretch;
  --bm-game-h: 72px;
  --bm-thumb: 34px;
  --bm-col-w: 168px;
  --bm-line: rgba(214, 40, 40, 0.28);
  --bm-line-strong: rgba(214, 40, 40, 0.55);
}

.bm-region-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.15rem 0.35rem 0.55rem;
  text-align: center;
}

.bm-region-left {
  grid-column: 1;
  grid-row: 1;
}

.bm-region-right {
  grid-column: 3;
  grid-row: 1;
}

.bm-side {
  display: flex;
  align-items: stretch;
  gap: 0;
  grid-row: 2;
  min-height: calc(16 * var(--bm-game-h) + 2rem);
}

.bm-side-left {
  grid-column: 1;
  justify-content: flex-end;
}

.bm-side-right {
  grid-column: 3;
  justify-content: flex-start;
  flex-direction: row;
}

.bm-center {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  min-width: 200px;
  position: relative;
}

.bm-center.current .bm-col-title {
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(214, 40, 40, 0.45);
}

.bm-col {
  display: flex;
  flex-direction: column;
  width: var(--bm-col-w);
  flex: 0 0 var(--bm-col-w);
  position: relative;
}

.bm-col-title {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.5rem;
  flex: 0 0 auto;
  line-height: 1;
}

.bm-col.current .bm-col-title {
  color: var(--gold-bright);
  text-shadow: 0 0 14px rgba(214, 40, 40, 0.4);
}

.bm-col-games {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-height: 0;
}

.bm-game-wrap {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 3px 0;
}

/* Connector lines — left side flows right toward center */
.bm-side-left .bm-game-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 10px;
  height: 2px;
  background: var(--bm-line);
  transform: translateY(-50%);
  pointer-events: none;
}

.bm-side-left .bm-game {
  margin-right: 10px;
}

/* Pair vertical rails every two games (toward next round) */
.bm-side-left .bm-col:not(:last-child) .bm-game-wrap:nth-child(odd)::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 2px;
  height: 50%;
  background: var(--bm-line);
  pointer-events: none;
}

.bm-side-left .bm-col:not(:last-child) .bm-game-wrap:nth-child(even)::before {
  content: "";
  position: absolute;
  bottom: 50%;
  right: 0;
  width: 2px;
  height: 50%;
  background: var(--bm-line);
  pointer-events: none;
}

/* Right side mirrors connectors (flow left toward center) */
.bm-side-right .bm-game-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 2px;
  background: var(--bm-line);
  transform: translateY(-50%);
  pointer-events: none;
}

.bm-side-right .bm-game {
  margin-left: 10px;
}

.bm-side-right .bm-col:not(:first-child) .bm-game-wrap:nth-child(odd)::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 2px;
  height: 50%;
  background: var(--bm-line);
  pointer-events: none;
}

.bm-side-right .bm-col:not(:first-child) .bm-game-wrap:nth-child(even)::before {
  content: "";
  position: absolute;
  bottom: 50%;
  left: 0;
  width: 2px;
  height: 50%;
  background: var(--bm-line);
  pointer-events: none;
}

/* Hide outer-edge connectors on outermost R64 that look odd — keep them, classic look */

.bm-game {
  background: linear-gradient(180deg, #1e1a2a, #16131f);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  min-height: var(--bm-game-h);
  position: relative;
  z-index: 1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bm-game.current {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(214, 40, 40, 0.25), 0 6px 20px rgba(123, 92, 255, 0.2);
}

.bm-game.decided {
  border-color: rgba(79, 209, 139, 0.22);
}

.bm-slot {
  display: grid;
  grid-template-columns: var(--bm-thumb) 1fr auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.4rem;
  min-height: calc(var(--bm-game-h) / 2);
  border-bottom: 1px solid var(--border);
  background: transparent;
}

.bm-slot:last-child {
  border-bottom: none;
}

.bm-slot.winner {
  background: linear-gradient(90deg, rgba(214, 40, 40, 0.16), transparent 85%);
}

.bm-slot.loser {
  opacity: 0.45;
}

.bm-slot.loser .bm-thumb img {
  filter: grayscale(0.7);
}

.bm-slot.empty {
  opacity: 0.65;
}

.bm-thumb {
  width: var(--bm-thumb);
  height: var(--bm-thumb);
  border-radius: 5px;
  overflow: hidden;
  background: #0c0a12;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.bm-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bm-thumb-empty {
  background:
    repeating-linear-gradient(
      -45deg,
      #14121c,
      #14121c 3px,
      #1a1724 3px,
      #1a1724 6px
    );
}

.bm-thumb-missing {
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.bm-slot-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.bm-name {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.bm-seed {
  display: inline-block;
  min-width: 1.1em;
  margin-right: 0.15rem;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  font-weight: 400;
}

.bm-votes {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-left: 0.15rem;
  min-width: 1.4rem;
}

.bm-slot.winner .bm-name {
  color: var(--gold-bright);
}

.bm-slot.winner .bm-votes {
  color: var(--gold);
  font-weight: 600;
}

/* Final / trophy center */

.bm-final-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.bm-center .bm-game {
  width: 100%;
  min-width: 180px;
  --bm-thumb: 42px;
  min-height: 88px;
  border-color: var(--border-strong);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 30px rgba(214, 40, 40, 0.08);
}

.bm-center .bm-slot {
  min-height: 44px;
  padding: 0.4rem 0.5rem;
}

.bm-center .bm-name {
  font-size: 0.82rem;
}

.bm-trophy {
  text-align: center;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(214, 40, 40, 0.1), rgba(20, 18, 28, 0.9));
  width: 100%;
  min-width: 180px;
}

.bm-trophy.crowned {
  border-color: var(--border-strong);
  box-shadow: 0 0 40px rgba(214, 40, 40, 0.18);
}

.bm-trophy-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.bm-trophy-wait {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bm-champion-mini {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
}

.bm-champion-mini .bm-thumb {
  width: 48px;
  height: 48px;
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(214, 40, 40, 0.35);
}

.bm-champion-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.bm-champ-kicker {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.bm-champ-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.bm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bm-legend span.active {
  color: var(--gold-bright);
}

.bm-legend strong {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-weight: 400;
  margin-right: 0.2rem;
  color: var(--gold);
}

/* Slightly denser on medium widths */
@media (max-width: 1200px) {
  .bm-board {
    --bm-col-w: 148px;
    --bm-thumb: 30px;
    --bm-game-h: 66px;
  }
}

@media (max-width: 900px) {
  .bm-board {
    --bm-col-w: 132px;
    --bm-thumb: 28px;
    --bm-game-h: 62px;
  }

  .bm-name {
    font-size: 0.65rem;
  }
}

/* Footer */

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

/* Toast */

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: #221e30;
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: min(90vw, 420px);
  text-align: center;
  font-size: 0.92rem;
}

.toast.error {
  border-color: rgba(255, 92, 122, 0.5);
  color: #ffb3c0;
}

.toast.success {
  border-color: rgba(79, 209, 139, 0.45);
}

/* Admin */

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

.admin-card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.admin-card.danger-zone {
  border-color: rgba(255, 92, 122, 0.35);
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.admin-form.row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1 1 180px;
}

.admin-form input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

.admin-form input:focus {
  outline: 2px solid var(--purple);
  border-color: transparent;
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), #5a3fd4);
  color: white;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: rgba(123, 92, 255, 0.15);
  border-color: rgba(123, 92, 255, 0.4);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(123, 92, 255, 0.25);
}

.btn-danger {
  background: rgba(255, 92, 122, 0.15);
  border-color: rgba(255, 92, 122, 0.45);
  color: #ffb3c0;
}

.btn-danger:hover {
  background: rgba(255, 92, 122, 0.28);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-lg {
  padding: 0.85rem 1.4rem;
  font-size: 1.05rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 0;
}

.stat-grid > div {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}

.stat-grid dt {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-grid dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  color: var(--gold);
}

.form-error {
  color: var(--danger);
  margin: 0.75rem 0 0;
}

.form-msg {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Photo manager */

.upload-zone {
  margin-top: 0.85rem;
  padding: 1.25rem 1rem;
  border: 1.5px dashed rgba(214, 40, 40, 0.35);
  border-radius: var(--radius);
  background: rgba(214, 40, 40, 0.04);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.upload-zone.dragover {
  border-color: var(--gold);
  background: rgba(123, 92, 255, 0.12);
}

.upload-zone-title {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.upload-zone-sub {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-actions {
  justify-content: center;
  margin-top: 0.9rem;
}

.upload-file-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  text-align: left;
  max-height: 140px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-file-list li {
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
}

.photo-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
}

.photo-manager-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  font-weight: 400;
}

.photo-manager-head h3 span {
  color: var(--gold);
  font-size: 1rem;
  margin-left: 0.35rem;
}

.photo-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.65rem;
}

.photo-slot {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
  padding: 0;
  color: inherit;
  font: inherit;
  display: block;
  width: 100%;
}

.photo-slot:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.photo-slot.filled {
  border-color: rgba(79, 209, 139, 0.3);
}

.photo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-slot-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-content: center;
  gap: 0.15rem;
  background:
    repeating-linear-gradient(
      -45deg,
      #16131f,
      #16131f 6px,
      #1c1828 6px,
      #1c1828 12px
    );
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: center;
  padding: 0.35rem;
}

.photo-slot-seed {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  background: rgba(0, 0, 0, 0.65);
  color: var(--gold);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  line-height: 1.2;
}

.photo-slot-delete {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  z-index: 2;
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffb3c0;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.photo-slot.filled:hover .photo-slot-delete {
  display: flex;
}

.photo-slot-delete:hover {
  background: rgba(255, 92, 122, 0.85);
  color: white;
}

.photo-slot-hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.25rem;
  font-size: 0.65rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.photo-slot:hover .photo-slot-hint {
  opacity: 1;
}

.admin-matchups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
}

.admin-match-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem 0.65rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.admin-match-row .mid {
  font-family: var(--font-display);
  color: var(--gold);
}

.admin-match-row .score {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.admin-match-row .side-a.lead,
.admin-match-row .side-b.lead {
  color: var(--success);
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* Responsive — mobile vote/predict (v=20260814m) */

/* Phones + large phones: always side-by-side matchups (Predict-style) */
@media (max-width: 720px) {
  .matchups-grid {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }

  .matchup-card {
    border-radius: 12px;
  }

  .matchup-head {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.7rem !important;
  }

  .matchup-head strong {
    font-size: 0.88rem !important;
  }

  /* CRITICAL: do NOT stack photos vertically */
  .matchup-body {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    grid-template-rows: auto !important;
    align-items: start !important;
    gap: 0.15rem !important;
    padding: 0.45rem !important;
  }

  .matchup-body > .vs {
    display: grid !important;
    place-items: center;
    padding: 0 0.05rem !important;
    font-size: 0.85rem !important;
    align-self: center !important;
  }

  .photo-option {
    min-width: 0;
  }

  .photo-frame {
    aspect-ratio: 3 / 4 !important;
    max-height: 150px !important;
    height: auto !important;
  }

  .photo-frame img {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
  }

  .photo-meta {
    margin-top: 0.25rem !important;
    padding: 0 0.05rem 0.1rem !important;
  }

  .photo-seed {
    font-size: 0.82rem !important;
  }

  .photo-votes {
    font-size: 0.68rem !important;
    line-height: 1.2;
  }

  .vote-bar {
    margin-top: 0.2rem !important;
    height: 3px !important;
  }

  .matchup-foot {
    padding: 0.35rem 0.6rem 0.4rem !important;
    font-size: 0.72rem !important;
    min-height: 0 !important;
  }

  .matchup-comments-bar {
    padding: 0.2rem 0.45rem 0.4rem !important;
  }

  .matchup-comments-bar .btn {
    font-size: 0.72rem !important;
    padding: 0.2rem 0.45rem !important;
  }

  /* Predict: full photo visible, not cropped squares */
  .pick-grid {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  .pick-game-body {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    padding: 0.4rem !important;
    gap: 0.15rem !important;
  }

  .pick-option {
    padding: 0.25rem !important;
    min-width: 0;
  }

  .pick-thumb {
    width: 100% !important;
    aspect-ratio: 3 / 4 !important;
    max-height: 150px !important;
    height: auto !important;
  }

  .pick-thumb img {
    object-fit: contain !important;
    width: 100% !important;
    height: 100% !important;
  }

  .pick-seed {
    font-size: 0.82rem !important;
  }

  .timer {
    align-items: flex-start;
  }

  .timer-inline {
    width: 100%;
  }

  .timer-unit {
    flex: 1 1 0;
    min-width: 0;
  }

  .admin-match-row {
    grid-template-columns: 2.5rem 1fr;
    grid-template-rows: auto auto;
  }

  .admin-match-row .score {
    grid-column: 2;
    text-align: left;
  }
}

/* Very narrow phones: even tighter */
@media (max-width: 380px) {
  .photo-frame,
  .pick-thumb {
    max-height: 120px !important;
  }

  .vs,
  .pick-vs {
    font-size: 0.75rem !important;
  }
}
