:root {
  --ink: #17211e;
  --muted: #65706b;
  --paper: #fbfcf8;
  --line: #dfe6de;
  --field: #ffffff;
  --grass: #2f7d4f;
  --mint: #dff5e7;
  --coral: #d94d3f;
  --gold: #d8a739;
  --teal: #117b82;
  --navy: #1d3443;
  --shadow: 0 18px 50px rgba(23, 33, 30, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--grass);
  color: white;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 0 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.hidden {
  display: none !important;
}

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

.hero {
  position: relative;
  min-height: clamp(300px, 42vh, 440px);
  display: grid;
  align-items: end;
  overflow: hidden;
  color: white;
}

.hero-image,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(12, 23, 26, 0.83), rgba(12, 23, 26, 0.38) 55%, rgba(12, 23, 26, 0.18)),
    linear-gradient(0deg, rgba(12, 23, 26, 0.78), rgba(12, 23, 26, 0.08) 45%);
}

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

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px clamp(18px, 5vw, 60px);
}

.brand,
.session-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 850;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold);
  color: #17211e;
}

.session-box button {
  min-height: 36px;
  background: rgba(255, 255, 255, 0.17);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.password-menu {
  position: relative;
}

.password-menu summary {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.17);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

.password-menu form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  width: min(300px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
  box-shadow: var(--shadow);
}

.password-field {
  display: grid;
  gap: 6px;
}

.password-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.password-input-wrap input {
  min-width: 0;
  border: 0;
  border-radius: 0;
}

.password-toggle {
  min-height: 100%;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #edf3ef;
  color: var(--ink);
  padding: 0 10px;
}

.password-menu .form-message {
  color: var(--muted);
}

.password-save {
  background: #2f7d4f !important;
  color: white;
}

.password-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.password-gate-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 23, 26, 0.64);
  backdrop-filter: blur(2px);
}

.password-gate-panel {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.password-gate-panel h2 {
  margin-bottom: 0;
}

.hero-content {
  width: min(920px, calc(100% - 36px));
  margin: 0 auto;
  padding: 86px 0 46px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0;
  font-weight: 850;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 740px;
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 5.5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.55;
}

main {
  width: min(1180px, calc(100% - 28px));
  margin: -24px auto 64px;
}

.login-panel,
.dashboard {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(223, 230, 222, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  display: grid;
  justify-items: center;
  padding: clamp(18px, 4vw, 34px);
}

.login-panel h2,
.dashboard h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.login-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: end;
  width: min(760px, 100%);
}

.login-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.register-entry {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 16px;
  text-align: center;
}

.register-entry span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--coral);
  font-weight: 750;
}

.modal {
  width: min(420px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.modal[open] {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

.modal::backdrop {
  background: rgba(12, 23, 26, 0.54);
}

.modal-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal-card h2 {
  margin-bottom: 0;
}

.dashboard {
  padding: clamp(14px, 3vw, 28px);
}

.dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

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

.score-strip div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f7faf5;
}

.score-strip span {
  font-size: 1.35rem;
  font-weight: 850;
}

.score-strip small {
  color: var(--muted);
  font-weight: 700;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3ef;
  margin-bottom: 20px;
}

.tab {
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--navy);
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.match-card,
.panel,
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.match-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.match-meta,
.status-line,
.tip-row,
.approval-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--mint);
  color: #155b36;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.warn {
  background: #fff2d1;
  color: #765311;
}

.pill.bad {
  background: #ffe2df;
  color: #8c2a22;
}

.pill.info {
  background: #e0f1f2;
  color: #0e656b;
}

.kickoff,
.status-line {
  color: var(--muted);
  font-weight: 650;
}

.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  font-size: 1.28rem;
}

.teams strong:last-child {
  text-align: right;
}

.prediction-form,
.result-form,
.approved-result-form,
.admin-prediction-form,
.panel {
  display: grid;
  gap: 12px;
}

.match-card .result-form {
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.result-form h3 {
  margin: 0;
  font-size: 1rem;
}

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

.panel {
  padding: 18px;
}

.panel + .panel {
  margin-top: 14px;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf5;
  padding: 12px;
}

.history-panel h3 {
  margin-bottom: 8px;
  font-size: 0.96rem;
}

.history-panel p {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-panel p:last-child {
  margin-bottom: 0;
}

.history-panel strong {
  color: var(--ink);
}

.muted {
  color: var(--muted);
}

.result-card {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

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

.bracket-scroll {
  overflow-x: auto;
  padding-bottom: 6px;
}

.bracket-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.35fr 1fr 0.82fr 0.82fr;
  gap: 12px;
  min-width: 980px;
  align-items: start;
}

.bracket-round {
  display: grid;
  gap: 10px;
}

.bracket-round h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.bracket-match {
  display: grid;
  gap: 8px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf5;
  padding: 10px;
}

.bracket-match-head,
.bracket-teams {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bracket-match-head {
  flex-wrap: wrap;
}

.bracket-no {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.bracket-teams {
  justify-content: space-between;
}

.bracket-teams span {
  min-width: 0;
  flex: 1;
  font-weight: 750;
}

.bracket-teams span:last-child {
  text-align: right;
}

.bracket-teams strong {
  color: var(--muted);
}

.bracket-winner {
  color: #155b36;
  font-weight: 800;
}

.bracket-note {
  margin: 8px 0 0;
}

.group-table {
  padding: 12px;
}

.group-table table {
  min-width: 0;
  table-layout: auto;
}

.group-table th,
.group-table td {
  padding: 9px 8px;
  white-space: nowrap;
}

.group-table th:nth-child(2),
.group-table td:nth-child(2) {
  white-space: normal;
  min-width: 96px;
}

.group-table .pill {
  min-height: 24px;
  padding: 0 7px;
  font-size: 0.74rem;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td strong {
  font-weight: 850;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.approval-row {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

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

.password-reset-row .approval-actions input {
  width: min(220px, 100%);
}

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

.danger {
  background: var(--coral);
}

.secondary {
  background: #e8eeeb;
  color: var(--ink);
}

.prediction-form button.edit-mode,
.result-form button.edit-mode {
  background: #efd895;
  color: #4b3710;
}

@media (max-width: 820px) {
  .login-panel,
  .login-form,
  .match-grid,
  .history-grid,
  .group-grid,
  .dashboard-head,
  .score-strip {
    grid-template-columns: 1fr;
  }

  .dashboard-head {
    display: grid;
  }

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

  .session-box {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 540px) {
  main {
    width: calc(100% - 18px);
    margin-top: -30px;
  }

  .hero-content {
    width: calc(100% - 28px);
    padding-bottom: 38px;
  }

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

  .teams span,
  .teams strong:last-child {
    text-align: left;
  }

  .score-inputs {
    grid-template-columns: 1fr;
  }
}
