:root {
  --ink: #17120f;
  --muted: #71665c;
  --paper: #fff7ea;
  --paper-strong: #fffdf7;
  --green: #0a6b47;
  --green-deep: #063d32;
  --red: #b51f24;
  --gold: #dba73c;
  --line: rgba(23, 18, 15, 0.12);
  --shadow: 0 24px 70px rgba(18, 12, 8, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(135deg, #042b25 0%, #0b593e 42%, #8d171f 100%);
  background-size: 44px 44px, 44px 44px, auto;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  padding: 16px clamp(18px, 5vw, 70px) 44px;
  color: #fffdf7;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(0,0,0,0.42), rgba(0,0,0,0.06) 55%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.09) 0 2px, transparent 2px 86px);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -180px;
  width: 520px;
  height: 520px;
  transform: translateX(-50%);
  border: 3px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  pointer-events: none;
}

.topbar,
.hero-grid,
main {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.brand-wrap {
  display: flex;
  justify-content: center;
}

.brand-logo {
  width: min(108px, 30vw);
  height: auto;
  display: block;
}

.topbar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.76);
}

.topbar-meta strong {
  color: #fff;
  font-size: 0.95rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
  max-width: 1160px;
  margin: 48px auto 0;
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2.35rem, 6.4vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-text {
  max-width: 520px;
  margin: 16px 0 0;
  color: rgba(255,255,255,0.82);
  font-size: 0.98rem;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: var(--red);
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.closing-note,
.prize-note {
  width: fit-content;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.76);
  background: rgba(9, 24, 21, 0.34);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.closing-note strong {
  color: #fff;
}

.prize-note {
  max-width: 580px;
  border-color: rgba(219, 167, 60, 0.42);
  color: #fff6d8;
}

main {
  max-width: 1160px;
  margin: -24px auto 0;
  padding: 0 clamp(16px, 4vw, 28px) 52px;
}

.lookup-mode .hero {
  min-height: 210px;
  padding-bottom: 30px;
}

.lookup-mode .hero::after {
  display: none;
}

.lookup-mode .hero-grid {
  margin-top: 28px;
}

.lookup-mode .hero-copy h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
}

.lookup-mode main {
  margin-top: -18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 20px;
  padding: 26px;
  background: var(--paper-strong);
  border: 1px solid rgba(255,255,255,0.62);
  box-shadow: var(--shadow);
}

.section-heading.compact {
  margin-top: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.primary-action {
  min-height: 48px;
  border: 0;
  padding: 0 22px;
  color: #fff;
  background: var(--red);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 26px rgba(181, 31, 36, 0.26);
}

.primary-action:hover:not(:disabled) {
  background: #96171c;
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.44;
  box-shadow: none;
}

.primary-action.full {
  width: 100%;
}

.secondary-action {
  min-height: 48px;
  border: 1px solid rgba(255,255,255,0.28);
  padding: 0 18px;
  color: #fffdf7;
  background: rgba(255,255,255,0.08);
  font-weight: 900;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: rgba(255,255,255,0.48);
  background: rgba(255,255,255,0.13);
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.bet-action-row {
  display: flex;
  justify-content: flex-end;
  margin: 18px 0 0;
  padding: 18px;
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid rgba(255,255,255,0.62);
}

.match-card {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(255,247,234,0.97)),
    repeating-linear-gradient(0deg, transparent 0 38px, rgba(10,107,71,0.08) 38px 40px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 16px 34px rgba(18, 12, 8, 0.18);
}

.match-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -90px auto;
  width: 210px;
  height: 210px;
  border: 20px solid rgba(10,107,71,0.08);
  border-radius: 50%;
}

.match-card-top,
.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.match-card-top strong {
  color: var(--red);
  font-size: 1rem;
}

.teams {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 180px;
}

.team-box {
  display: grid;
  grid-template-rows: 56px minmax(42px, auto) 70px;
  gap: 10px;
  align-items: center;
  justify-items: center;
  min-width: 0;
}

.flag {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  color: #fff;
  background: var(--green);
  border: 3px solid var(--gold);
  border-radius: 50%;
  font-size: 0.92rem;
  font-weight: 1000;
}

.team-box strong {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.score-input {
  width: 86px;
  height: 66px;
  border: 2px solid var(--line);
  color: var(--ink);
  background: #fff;
  text-align: center;
  font-size: 2rem;
  font-weight: 1000;
  outline: 0;
}

.score-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(10, 107, 71, 0.14);
}

.versus {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 1000;
}

.empty-state,
.locked-band,
.upcoming-band,
.lookup-panel,
.ranking-panel {
  margin-top: 22px;
  padding: 24px;
  background: rgba(255, 253, 247, 0.92);
  border: 1px solid rgba(255,255,255,0.62);
}

.empty-state {
  display: grid;
  gap: 6px;
}

.locked-list,
.upcoming-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.locked-item {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.locked-item span {
  width: fit-content;
  padding: 4px 9px;
  color: #fff;
  background: var(--green-deep);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.locked-item strong {
  line-height: 1.1;
}

.locked-item small,
.muted {
  color: var(--muted);
}

.lookup-panel {
  display: grid;
  gap: 18px;
  max-width: 760px;
  margin-inline: auto;
  box-shadow: var(--shadow);
}

.lookup-panel h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.lookup-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.phone-input-shell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  min-width: 0;
  min-height: 54px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
}

.phone-input-shell span {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 82px;
  padding: 0 14px;
  color: var(--green-deep);
  background: var(--gold);
  font-weight: 1000;
  letter-spacing: 0;
}

.phone-input-shell input {
  width: 100%;
  min-width: 0;
  height: 54px;
  border: 0;
  padding: 0 14px;
  color: #fff;
  background: transparent;
  outline: 0;
}

.phone-input-shell:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(219, 167, 60, 0.18);
}

.phone-input-shell.light {
  margin-bottom: 0;
  border-color: var(--line);
  background: #fff;
}

.phone-input-shell.light input {
  color: var(--ink);
}

.phone-input-shell.light:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(10, 107, 71, 0.12);
}

.lookup-form > input {
  min-width: 0;
  height: 52px;
  border: 1px solid var(--line);
  padding: 0 14px;
  background: #fff;
  outline: 0;
}

.lookup-form > input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(10, 107, 71, 0.12);
}

.lookup-error {
  color: var(--red);
  font-weight: 900;
}

.lookup-results {
  display: grid;
  gap: 14px;
}

.my-ranking-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(219, 167, 60, 0.2), rgba(255,255,255,0.96) 48%),
    #fff;
  border: 1px solid rgba(219, 167, 60, 0.55);
}

.my-ranking-card h3 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1;
}

.my-ranking-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.my-ranking-stats span {
  padding: 7px 10px;
  color: #fff;
  background: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.ranking-panel {
  max-width: 900px;
  margin-inline: auto;
  box-shadow: var(--shadow);
}

.ranking-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.ranking-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.ranking-heading small {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 90px minmax(190px, auto);
  gap: 12px;
  align-items: center;
  min-height: 82px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.ranking-row.podium {
  background:
    linear-gradient(90deg, rgba(219, 167, 60, 0.18), rgba(255,255,255,0.98) 42%),
    #fff;
  border-color: rgba(219, 167, 60, 0.5);
}

.rank-number {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #fff;
  background: var(--green-deep);
  border: 3px solid var(--gold);
  border-radius: 50%;
  font-size: 1.2rem;
}

.ranking-row h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  line-height: 1.05;
}

.ranking-row span,
.ranking-row small {
  color: var(--muted);
}

.ranking-row small {
  font-weight: 800;
  text-align: right;
}

.ranking-points {
  display: grid;
  justify-items: center;
  gap: 0;
  color: var(--red);
}

.ranking-points strong {
  font-size: 2rem;
  line-height: 1;
}

.ranking-points span {
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.bet-result-card {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.bet-result-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
}

.bet-result-top strong {
  color: var(--ink);
}

.bet-score-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: var(--green-deep);
  background: rgba(219, 167, 60, 0.16);
  border: 1px solid rgba(219, 167, 60, 0.35);
}

.bet-score-summary strong {
  font-size: 1.35rem;
}

.bet-score-summary span {
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.receipt-lines.light div {
  color: var(--ink);
  background: rgba(10, 107, 71, 0.07);
}

.lookup-prediction-line small {
  grid-column: 1 / -1;
  justify-self: center;
}

.lookup-prediction-line .points-breakdown {
  color: var(--green-deep);
  font-weight: 1000;
  text-transform: uppercase;
}

.result-pill {
  display: inline-grid;
  place-items: center;
  min-height: 26px;
  padding: 0 10px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.result-pill.won {
  background: var(--green);
}

.result-pill.lost {
  background: var(--red);
}

.result-pill.pending {
  background: var(--ink);
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(3, 12, 10, 0.72);
  backdrop-filter: blur(8px);
}

.phone-dialog form,
.receipt-card,
.replace-card {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  color: #fffdf7;
  background:
    linear-gradient(145deg, rgba(6,61,50,0.98), rgba(23,18,15,0.98)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 60px);
  box-shadow: var(--shadow);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.dialog-header img,
.receipt-card img {
  width: 150px;
  height: auto;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,0.26);
  color: #fff;
  background: transparent;
  cursor: pointer;
}

.phone-dialog h2,
.receipt-card h2,
.replace-card h2 {
  margin: 26px 0 8px;
  font-size: 2rem;
}

.phone-dialog p,
.replace-card p {
  margin: 0 0 20px;
  color: rgba(255,255,255,0.76);
}

.phone-dialog label {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
}

.phone-dialog > form > input {
  width: 100%;
  height: 54px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.28);
  padding: 0 14px;
  color: #fff;
  background: rgba(255,255,255,0.08);
  outline: 0;
}

.phone-dialog > form > input:focus {
  border-color: var(--gold);
}

.form-error {
  min-height: 20px;
  color: #ffd2d2 !important;
  font-weight: 800;
}

.receipt-card {
  text-align: center;
}

.receipt-card img {
  margin: 0 auto;
}

.receipt-card h2 {
  color: var(--gold);
  font-size: 2.5rem;
}

.replace-card {
  position: relative;
  overflow: hidden;
}

.replace-card::after {
  content: "";
  position: absolute;
  right: -84px;
  bottom: -92px;
  width: 210px;
  height: 210px;
  border: 22px solid rgba(219, 167, 60, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.replace-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--green-deep);
  background: var(--gold);
  border-radius: 50%;
  font-size: 1.6rem;
  font-weight: 1000;
}

.replace-card h2 {
  color: #fff;
}

.replace-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.receipt-lines {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.receipt-lines div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: rgba(255,255,255,0.1);
}

.receipt-lines strong {
  color: var(--gold);
  font-size: 1.25rem;
}

@media (max-width: 860px) {
  .hero-grid,
  .match-grid,
  .locked-list,
  .upcoming-list,
  .ranking-row {
    grid-template-columns: 1fr;
  }

  .ranking-row small {
    text-align: left;
  }

  .my-ranking-card,
  .bet-score-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .my-ranking-stats {
    justify-content: flex-start;
  }

  .hero-grid {
    margin-top: 42px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: 390px;
    padding: 14px 16px 42px;
  }

  .topbar {
    justify-content: center;
    gap: 10px;
  }

  .brand-logo {
    width: 94px;
  }

  .hero-copy h1 {
    font-size: 2.45rem;
  }

  .hero-text {
    font-size: 0.94rem;
  }

  .hero-notes {
    align-items: stretch;
    flex-direction: column;
  }

  .closing-note,
  .prize-note {
    width: 100%;
  }

  main {
    margin-top: -28px;
    padding-inline: 12px;
  }

  .section-heading,
  .match-card,
  .bet-action-row,
    .empty-state,
    .locked-band,
    .upcoming-band,
    .lookup-panel,
    .ranking-panel {
    padding: 18px;
  }

  .lookup-form,
  .ranking-heading,
  .bet-result-top {
    grid-template-columns: 1fr;
    align-items: stretch;
    flex-direction: column;
  }

  .bet-action-row .primary-action {
    width: 100%;
  }

  .replace-actions {
    grid-template-columns: 1fr;
  }

  .teams {
    grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
    gap: 8px;
  }

  .score-input {
    width: 72px;
    height: 60px;
  }

  .versus {
    width: 34px;
    height: 34px;
  }
}
