:root {
  --bg: #08130d;
  --bg-soft: #10281b;
  --panel: rgba(20, 48, 33, 0.72);
  --panel-border: rgba(181, 155, 86, 0.35);
  --text: #f4f7f3;
  --muted: #b7c7bd;
  --brand: #1f8f4a;
  --brand-soft: #2aa55a;
  --gold: #b59b56;
  --danger: #be3745;
  --warning: #da9b37;
  --info: #2b8fd1;
  --safe: #57758f;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background: radial-gradient(1200px 500px at -5% -10%, #1f4832 0%, transparent 60%),
    radial-gradient(900px 450px at 105% -10%, #2b3f2e 0%, transparent 55%), var(--bg);
}

.bg-orb {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.22;
}

.bg-orb-1 {
  top: 16%;
  left: -80px;
  width: 260px;
  height: 260px;
  background: #2dbb63;
}

.bg-orb-2 {
  right: -120px;
  bottom: 10%;
  width: 320px;
  height: 320px;
  background: #d9b15a;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.hero {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--panel-border);
  background: linear-gradient(145deg, rgba(20, 54, 37, 0.88), rgba(12, 30, 21, 0.88));
  box-shadow: var(--shadow);
  animation: rise 420ms ease;
}

.hero-brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.fbk-logo {
  width: 78px;
  height: 78px;
  border-radius: 14px;
  background: #f8f8f8;
  padding: 8px;
  border: 2px solid rgba(255, 255, 255, 0.18);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Barlow Condensed", sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  font-size: 0.76rem;
  color: var(--gold);
}

.lede {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

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

#statusText {
  margin: 0;
  color: var(--muted);
}

.desktop-note {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  opacity: 0.9;
}

.btn-reset {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn-reset:hover {
  background: rgba(255, 255, 255, 0.11);
}

.btn-share {
  border: 1px solid rgba(37, 211, 102, 0.55);
  color: #f3fff7;
  background: rgba(37, 211, 102, 0.18);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn-share:hover {
  background: rgba(37, 211, 102, 0.3);
}

.btn-copy {
  border: 1px solid rgba(181, 155, 86, 0.45);
  color: var(--text);
  background: rgba(181, 155, 86, 0.14);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.btn-copy:hover {
  background: rgba(181, 155, 86, 0.26);
}

.panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.auth-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
}

.auth-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-form select,
.auth-form input {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 160px;
}

.auth-state {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.auth-state p {
  margin: 0;
  font-weight: 700;
}

.auth-feedback {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.legend-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.legend-item {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  border-left: 5px solid transparent;
  background: rgba(255, 255, 255, 0.05);
}

.rank-qf {
  border-left-color: var(--brand-soft);
}

.rank-of {
  border-left-color: var(--warning);
}

.rank-safe {
  border-left-color: var(--safe);
}

.rank-out {
  border-left-color: var(--danger);
}

.rounds {
  display: grid;
  gap: 14px;
}

.round-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
}

.round-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(42, 165, 90, 0.2), rgba(181, 155, 86, 0.14));
}

.round-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1160px;
}

th,
td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 8px;
  vertical-align: middle;
}

th {
  text-align: left;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.match-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.mini-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

.tip-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tip-controls input[type="number"] {
  width: 56px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 8px;
  font-weight: 700;
}

.tip-controls input[type="checkbox"] {
  accent-color: var(--brand-soft);
}

.ot-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tip-controls.is-invalid {
  outline: 1px solid rgba(190, 55, 69, 0.75);
  border-radius: 10px;
  padding: 4px;
}

.tip-controls.is-locked {
  opacity: 0.56;
}

.tip-points {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(42, 165, 90, 0.2);
  border: 1px solid rgba(42, 165, 90, 0.35);
}

.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-live {
  background: rgba(218, 155, 55, 0.2);
  border: 1px solid rgba(218, 155, 55, 0.5);
}

.status-finished {
  background: rgba(42, 165, 90, 0.2);
  border: 1px solid rgba(42, 165, 90, 0.5);
}

.status-upcoming {
  background: rgba(87, 117, 143, 0.2);
  border: 1px solid rgba(87, 117, 143, 0.45);
}

.result-cell {
  font-weight: 800;
  white-space: nowrap;
}

.result-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
}

.score-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
  padding: 12px;
}

.score-card h3 {
  margin: 0;
  font-size: 1.4rem;
}

.score-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.score-round-summary {
  margin-top: 12px;
}

.score-round-summary h3 {
  font-size: 1.4rem;
  margin: 0 0 8px;
}

.score-round-table {
  min-width: 0;
}

.score-round-table th,
.score-round-table td {
  font-size: 0.88rem;
  padding: 8px;
}

.round-total {
  color: var(--muted);
  font-size: 0.82rem;
}

.winner-reveal {
  margin-top: 12px;
}

.winner-box {
  border-radius: 12px;
  padding: 12px;
}

.winner-box h3 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.winner-box p {
  margin: 0;
}

.winner-box-locked {
  border: 1px dashed rgba(181, 155, 86, 0.55);
  background: rgba(181, 155, 86, 0.1);
  color: var(--muted);
}

.winner-box-open {
  border: 1px solid rgba(42, 165, 90, 0.55);
  background: linear-gradient(90deg, rgba(42, 165, 90, 0.25), rgba(181, 155, 86, 0.22));
}

.winner-name {
  font-size: 1.1rem;
  font-weight: 800;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 12px;
}

.progress-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.14);
  padding: 10px;
}

.progress-card h3 {
  font-size: 1.4rem;
  margin: 0 0 8px;
}

.progress-stage {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.progress-stage summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
}

.progress-stage summary::-webkit-details-marker {
  display: none;
}

.progress-table {
  min-width: 0;
}

.progress-table th,
.progress-table td {
  font-size: 0.8rem;
  padding: 7px;
}

.col-center {
  text-align: center;
}

.projection-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
}

.projection-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.projection-head {
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.projection-head h3 {
  font-size: 1.45rem;
}

.projection-head p {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.projection-table {
  width: 100%;
  min-width: 0;
}

.projection-table th,
.projection-table td {
  padding: 8px 8px;
  font-size: 0.92rem;
}

.projection-table th {
  font-size: 0.74rem;
}

.projection-table td:nth-child(1) {
  width: 42px;
  font-weight: 800;
}

.projection-table td:nth-child(3),
.projection-table td:nth-child(4),
.projection-table td:nth-child(5),
.projection-table td:nth-child(6) {
  text-align: right;
}

.rank-row-qf {
  background: rgba(42, 165, 90, 0.14);
}

.rank-row-of {
  background: rgba(218, 155, 55, 0.14);
}

.rank-row-safe {
  background: rgba(87, 117, 143, 0.14);
}

.rank-row-out {
  background: rgba(190, 55, 69, 0.16);
}

.empty-note {
  margin: 10px 0;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .score-grid,
  .progress-grid,
  .projection-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .hero {
    padding: 18px;
  }

  .hero-brand {
    align-items: flex-start;
  }

  .fbk-logo {
    width: 62px;
    height: 62px;
  }

  .panel {
    padding: 14px;
  }

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

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