@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #111827;
  --muted: #6b7280;
  --accent: #b23a2f;
  --accent-2: #0c6b7a;
  --paper: #f0f2f7;
  --panel: #ffffff;
  --line: #e2e5ec;
  --green: #1e7e34;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Page layout ---- */

.page {
  max-width: 860px;
  margin: 24px auto 40px;
  padding: 0 16px 24px;
}

/* ---- Header ---- */

header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.app-icon {
  color: var(--accent);
  font-size: 0.75em;
  vertical-align: middle;
  opacity: 0.7;
}

.date,
.venue {
  color: var(--muted);
  font-size: 14px;
  margin-top: 3px;
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-shrink: 0;
}

.nav-links a {
  color: var(--accent-2);
  font-size: 13px;
  text-decoration: none;
}

.nav-links a:hover {
  text-decoration: underline;
}

/* ---- Entry fee banner ---- */

.entry-fee-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1a3a5c 0%, #0c2d4a 100%);
  color: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(10, 40, 70, 0.18);
}

.entry-fee-icon {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
}

.entry-fee-banner strong {
  font-size: 16px;
  font-weight: 700;
}

.entry-fee-sub {
  display: block;
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

/* ---- Countdown timer ---- */

#deadline-bar {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.countdown-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.countdown-units {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.countdown-num {
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  color: var(--accent);
}

.countdown-unit-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.countdown-sep {
  font-size: 36px;
  font-weight: 700;
  color: var(--line);
  margin-bottom: 14px;
  user-select: none;
}

.countdown-sublabel {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

#deadline-bar.deadline-urgent .countdown-num {
  color: #c0392b;
}

#deadline-bar.deadline-urgent {
  border-color: #f5c6c6;
  background: #fff8f8;
}

@media (max-width: 640px) {
  .countdown-num { font-size: 38px; }
  .countdown-unit { min-width: 52px; }
  .countdown-sep { font-size: 28px; }
}

/* ---- Player info strip ---- */

.player-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent-2);
}

.field input[type="text"],
.field input[type="email"],
input[type="text"],
input[type="email"] {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--accent-2);
}

/* ---- Fight cards ---- */

.fight,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
  animation: fadeInUp 0.3s ease both;
}

.fight:nth-child(2), .card:nth-child(2) { animation-delay: 0.05s; }
.fight:nth-child(3), .card:nth-child(3) { animation-delay: 0.10s; }
.fight:nth-child(4), .card:nth-child(4) { animation-delay: 0.15s; }
.fight:nth-child(5), .card:nth-child(5) { animation-delay: 0.20s; }
.fight:nth-child(6), .card:nth-child(6) { animation-delay: 0.25s; }

/* Fight header: red tag + bout title on same line */

.fight-header,
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
}

.tag,
.fight-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.bout {
  font-size: 16px;
  font-weight: normal;
}

.title-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #fff3cd;
  border: 1px solid #e8c84a;
  color: #7a6000;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---- Pick form body: 3-column layout ---- */

.fight-body {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 0;
  padding: 0;
}

.group {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.group:last-child {
  border-right: none;
}

/* Column headers matching pick sheet style */
.group h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* Radio options */
.option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-size: 15px;
  cursor: pointer;
  line-height: 1.3;
}

.option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  background: #fff;
}

.option input[type="radio"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.option input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 1px;
}

/* Round selector */
.rounds {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.round-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  cursor: pointer;
}

.round-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  background: #fff;
}

.round-label input[type="radio"]:checked {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.round-label input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 7px;
  height: 7px;
  background: white;
  border-radius: 1px;
}

.note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

.footer-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  padding-left: 2px;
}

/* ---- Picks summary grid ---- */

.picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

.pick {
  padding: 10px 12px;
  border-right: 1px dashed var(--line);
}

.pick:last-child {
  border-right: none;
}

.pick h3 {
  margin: 0 0 5px;
  font-size: 12px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pick .value {
  font-size: 14px;
  line-height: 1.3;
}

.pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  margin-left: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  vertical-align: middle;
}

/* ---- Buttons ---- */

.btn-primary {
  display: inline-block;
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: #951f15;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}

.btn-secondary:hover {
  border-color: var(--muted);
}

/* ---- Submit bar ---- */

.submit-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.submit-note {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---- Messages ---- */

.msg-error {
  color: #8b1a1a;
  background: #fff5f5;
  border: 1px solid #f0c0c0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin: 10px 0;
}

.msg-success {
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

.locked-banner {
  background: #fff8e1;
  border: 1px solid #e8d060;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 15px;
  color: #6b4f00;
  margin-bottom: 16px;
}

.locked-banner a {
  color: var(--accent-2);
}

.error {
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
}

/* ---- Success screen ---- */

.success-screen {
  text-align: center;
  padding: 40px 20px;
}

.success-icon {
  font-size: 48px;
  color: var(--green);
  line-height: 1;
  margin-bottom: 16px;
}

.success-screen h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
}

.success-screen p {
  color: var(--muted);
  font-size: 15px;
}

.success-screen a {
  color: var(--accent-2);
}

/* ---- OTP / step cards ---- */

.step-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.step-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 10px;
}

.step-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

/* ---- Legend / badge ---- */

.legend {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}

.legend .note {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
}

/* ---- Scores / Standings ---- */

.standings,
.results,
.breakdown {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

.standings-header,
.results-header,
.breakdown-header {
  padding: 10px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.standings-table,
.results-table,
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.standings-table th,
.standings-table td,
.results-table th,
.results-table td,
.breakdown-table th,
.breakdown-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
}

.standings-table th,
.results-table th,
.breakdown-table th {
  background: #f4f5f9;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.standings-table tr:last-child td,
.results-table tr:last-child td,
.breakdown-table tr:last-child td {
  border-bottom: none;
}

.rank-first td {
  background: #fffbf0;
  font-weight: 700;
}

.point-box {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-weight: 700;
  background: #fff;
}

.pending {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

/* ---- Card grid for picks/admin ---- */

.cards {
  display: grid;
  gap: 10px;
}

/* ---- Admin fight footer ---- */

.fight-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
}

/* ---- Animations ---- */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .page { margin: 12px auto 32px; padding: 0 12px 20px; }

  header { grid-template-columns: 1fr; gap: 4px; }
  h1 { font-size: 22px; }

  .player-info { grid-template-columns: 1fr; }
  .field input[type="text"],
  .field input[type="email"],
  input[type="text"],
  input[type="email"] { font-size: 16px; /* prevent iOS zoom */ }

  /* Fight body: 2-col on mobile (Fighter + Method), round below */
  .fight-body { grid-template-columns: 1fr 1fr; }
  .group:nth-child(3) {
    grid-column: 1 / -1;
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .group:nth-child(2) { border-right: 1px solid var(--line); }
  .group:nth-child(1) { border-bottom: none; }

  /* Bigger touch targets for radio options */
  .option { font-size: 15px; margin: 7px 0; }
  .option input[type="radio"] { width: 20px; height: 20px; }
  .option input[type="radio"]:checked::after { top: 3px; left: 3px; width: 10px; height: 10px; }

  .round-label input[type="radio"] { width: 20px; height: 20px; }
  .round-label input[type="radio"]:checked::after { top: 3px; left: 3px; width: 10px; height: 10px; }

  .btn-primary, .btn-secondary { width: 100%; text-align: center; padding: 13px 18px; font-size: 16px; }

  .submit-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .legend { grid-template-columns: 1fr; }

  .picks { grid-template-columns: 1fr; }
  .pick { border-right: none; border-bottom: 1px dashed var(--line); }
  .pick:last-child { border-bottom: none; }

  .step-actions { flex-direction: column; align-items: stretch; }

  /* Tables: allow horizontal scroll */
  .standings, .results, .breakdown { overflow-x: auto; }
}
