@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800;900&display=swap");

:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #65726b;
  --line: #d9e1dc;
  --paper: #fbfcf9;
  --surface: #ffffff;
  --accent: #0d7c66;
  --accent-dark: #075746;
  --accent-shadow: rgba(13, 124, 102, 0.18);
  --accent-slider-shadow: rgba(13, 124, 102, 0.22);
  --gold: #d59f28;
  --rose: #b65764;
  --control-soft: #edf4f0;
  --control-soft-hover: #2f3944;
  --status-ink: #365449;
  --hero-bg: #10251d;
  --hero-shade:
    linear-gradient(90deg, rgba(7, 18, 13, 0.8), rgba(7, 18, 13, 0.18) 62%, rgba(7, 18, 13, 0.34)),
    linear-gradient(0deg, rgba(7, 18, 13, 0.24), rgba(7, 18, 13, 0.05));
  --shadow: 0 18px 48px rgba(23, 32, 27, 0.12);
  --theme-transition: 900ms ease;
}

body[data-palette="anne"] {
  --ink: #28151f;
  --muted: #7b6071;
  --line: #f0c8dc;
  --paper: #fff7fb;
  --surface: #ffffff;
  --accent: #d63384;
  --accent-dark: #a61e5c;
  --accent-shadow: rgba(214, 51, 132, 0.2);
  --accent-slider-shadow: rgba(214, 51, 132, 0.26);
  --gold: #e6a4c1;
  --rose: #c2256f;
  --control-soft: #fde8f3;
  --control-soft-hover: #7f1d4e;
  --status-ink: #7c2852;
  --hero-bg: #30101f;
  --hero-shade:
    linear-gradient(90deg, rgba(51, 13, 31, 0.82), rgba(86, 21, 54, 0.18) 62%, rgba(73, 16, 45, 0.34)),
    linear-gradient(0deg, rgba(88, 24, 58, 0.26), rgba(64, 14, 38, 0.06));
  --shadow: 0 18px 48px rgba(80, 23, 52, 0.13);
}

body[data-palette="juan"] {
  --ink: #24173a;
  --muted: #6b5b82;
  --line: #dacbf6;
  --paper: #fbf8ff;
  --surface: #ffffff;
  --accent: #7c3aed;
  --accent-dark: #5b21b6;
  --accent-shadow: rgba(124, 58, 237, 0.2);
  --accent-slider-shadow: rgba(124, 58, 237, 0.28);
  --gold: #b790ff;
  --rose: #8b5cf6;
  --control-soft: #efe7ff;
  --control-soft-hover: #4c1d95;
  --status-ink: #5b3694;
  --hero-bg: #1f123a;
  --hero-shade:
    linear-gradient(90deg, rgba(31, 18, 58, 0.84), rgba(49, 24, 91, 0.18) 62%, rgba(39, 18, 74, 0.36)),
    linear-gradient(0deg, rgba(62, 33, 111, 0.28), rgba(45, 22, 86, 0.06));
  --shadow: 0 18px 48px rgba(49, 24, 91, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  padding-top: 350px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-variant-numeric: tabular-nums;
  transition:
    color var(--theme-transition),
    background-color var(--theme-transition);
}

body::before,
body::after {
  content: "";
  position: fixed;
  top: 370px;
  bottom: 0;
  z-index: 0;
  width: min(42vw, 540px);
  background: url("assets/juan-anne-football-header.png") center top / cover no-repeat;
  opacity: 0.15;
  pointer-events: none;
}

body::before {
  left: 0;
}

body::after {
  right: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition:
    transform 160ms ease,
    color var(--theme-transition),
    background-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

[hidden] {
  display: none !important;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 10px 20px var(--accent-shadow);
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(213, 159, 40, 0.45);
  outline-offset: 2px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
  transition:
    border-color var(--theme-transition),
    color var(--theme-transition),
    background-color var(--theme-transition);
}

select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 36px 9px 11px;
  color: var(--ink);
  background: #fff;
  transition:
    border-color var(--theme-transition),
    color var(--theme-transition),
    background-color var(--theme-transition);
}

input:disabled {
  color: #6d7871;
  background: #f1f5f2;
  cursor: not-allowed;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  transition: color var(--theme-transition);
}

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

.app-hero {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  min-height: 350px;
  overflow: hidden;
  background: var(--hero-bg);
  transition: background-color var(--theme-transition);
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  z-index: 0;
  left: 34%;
  width: 66%;
  object-fit: cover;
  object-position: center 39%;
  transform: scale(1.16);
  transform-origin: center 39%;
  opacity: 0.94;
}

.hero-shade {
  z-index: 1;
  background: var(--hero-shade);
}

.hero-content {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 650px);
  gap: 18px;
  align-items: end;
  justify-content: start;
  width: min(1120px, calc(100% - 32px));
  min-height: 350px;
  margin: 0 auto;
  padding: 54px 0 36px;
  color: #fff;
}

.eyebrow {
  margin-bottom: 10px;
  color: #f1d99a;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--theme-transition);
}

h1 {
  max-width: 640px;
  font-size: clamp(2.45rem, 7vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: min(360px, 100%);
}

.score-box {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
}

.score-box span,
.score-box strong {
  display: block;
}

.score-box span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.84rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-box strong {
  margin-top: 5px;
  font-size: 2.25rem;
  line-height: 1;
}

.app-shell {
  display: grid;
  gap: 22px;
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.toolbar,
.summary-strip,
.section-heading {
  display: grid;
  gap: 16px;
}

.toolbar {
  grid-template-columns: 1fr;
  align-items: center;
}

.match-form {
  display: grid;
  gap: 12px;
  align-items: end;
}

.secondary-action {
  color: var(--ink);
  background: var(--control-soft);
  transition:
    color var(--theme-transition),
    background-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

.secondary-action:hover {
  color: #fff;
  background: var(--control-soft-hover);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: end;
}

.mode-toggle {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(62px, 1fr));
  flex: 0 1 280px;
  min-width: min(280px, 100%);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  background: var(--control-soft);
  isolation: isolate;
  transition:
    border-color var(--theme-transition),
    background-color var(--theme-transition);
}

.mode-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  z-index: 0;
  width: calc((100% - 6px) / 3);
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 0 8px 18px var(--accent-slider-shadow);
  pointer-events: none;
  transform: translateX(calc(var(--active-mode-index, 0) * 100%));
  transition:
    transform var(--theme-transition),
    background-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

.mode-toggle[data-active-index="0"] {
  --active-mode-index: 0;
}

.mode-toggle[data-active-index="1"] {
  --active-mode-index: 1;
}

.mode-toggle[data-active-index="2"] {
  --active-mode-index: 2;
}

.mode-toggle button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 0.9rem;
  font-weight: 850;
  white-space: nowrap;
  transition:
    color var(--theme-transition),
    background-color var(--theme-transition);
}

.mode-toggle button:hover {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.mode-toggle button.active {
  color: #fff;
}

.round-filter {
  flex: 1 1 280px;
  min-width: min(280px, 100%);
}

.old-match-toggle {
  display: inline-flex;
  flex: 0 1 auto;
  min-height: 42px;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color var(--theme-transition),
    color var(--theme-transition),
    background-color var(--theme-transition);
}

.old-match-toggle input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.old-match-toggle span {
  white-space: nowrap;
}

.section-heading h2 {
  font-size: 1.3rem;
}

.match-form {
  grid-template-columns: 150px 1fr 1fr 1fr auto;
}

.summary-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  padding: 16px 0;
  transition: border-color var(--theme-transition);
}

.summary-strip div {
  min-width: 0;
}

.summary-strip span,
.summary-strip strong {
  display: block;
}

.summary-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: color var(--theme-transition);
}

.summary-strip strong {
  overflow: hidden;
  margin-top: 4px;
  font-size: 1.45rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.state-lines {
  display: grid;
  gap: 3px;
  justify-items: end;
  text-align: right;
}

#save-state,
#sync-state {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  transition: color var(--theme-transition);
}

#sync-state {
  max-width: min(560px, 72vw);
  font-size: 0.78rem;
}

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

.match-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color var(--theme-transition),
    background-color var(--theme-transition),
    box-shadow var(--theme-transition);
}

.match-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.match-meta {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  transition: color var(--theme-transition);
}

.match-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  transition: color var(--theme-transition);
}

.match-card h3 {
  overflow-wrap: anywhere;
  font-size: 1.22rem;
  line-height: 1.2;
}

.match-title {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}

.team-name {
  display: inline-flex;
  min-width: 0;
  gap: 6px;
  align-items: baseline;
}

.country-flag {
  flex: 0 0 auto;
  font-size: 0.96em;
  line-height: 1;
}

.versus {
  color: var(--muted);
  font-size: 0.86em;
  font-weight: 800;
  transition: color var(--theme-transition);
}

.delete-match {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--status-ink);
  background: var(--control-soft);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: capitalize;
  transition:
    color var(--theme-transition),
    background-color var(--theme-transition);
}

.result-row {
  display: grid;
  grid-template-columns: auto 74px auto 74px;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 100%;
}

.result-row.display-only {
  grid-template-columns: auto auto auto auto;
}

.result-row[hidden] {
  display: none;
}

.result-row > span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.result-row input,
.prediction-row input {
  text-align: center;
}

.result-value {
  min-width: 1.2em;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.dash {
  color: var(--muted);
  font-weight: 800;
}

.prediction-grid {
  display: grid;
  gap: 10px;
}

.prediction-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 64px auto 64px minmax(110px, 1.2fr);
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  transition: border-color var(--theme-transition);
}

.prediction-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--theme-transition);
}

.points-badge {
  justify-self: end;
  min-width: 0;
  border-radius: 999px;
  padding: 7px 10px;
  color: #2d2613;
  background: #f5e5bd;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.points-badge.pending {
  color: var(--muted);
  background: #edf2ef;
}

.points-badge.hidden {
  color: var(--muted);
  background: #edf2ef;
}

.points-badge.points-0 {
  color: #ffffff;
  background: #c93434;
}

.points-badge.points-1 {
  color: #3a2c00;
  background: #f4d45d;
}

.points-badge.points-2 {
  color: #183d24;
  background: #b8e7bf;
}

.points-badge.points-3 {
  color: #ffffff;
  background: #167344;
}

.points-badge.locked {
  color: #6b3140;
  background: #f5dfe4;
}

.prediction-row.locked .prediction-name::after {
  content: " locked";
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.prediction-row.hidden-prediction input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 34px 18px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .hero-content,
  .toolbar,
  .match-form,
  .match-list {
    grid-template-columns: 1fr;
  }

  .hero-content {
    align-items: end;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions button,
  .round-filter,
  .old-match-toggle,
  .mode-toggle {
    flex: 1 1 120px;
  }
}

@media (max-width: 560px) {
  body {
    padding-top: 0;
  }

  .app-hero {
    position: relative;
    min-height: 340px;
  }

  .hero-content {
    min-height: 340px;
    padding: 34px 0 24px;
  }

  body::before {
    display: none;
  }

  body::after {
    display: none;
  }

  .hero-image {
    left: 0;
    width: 100%;
    object-position: center 34%;
    transform: scale(1.16);
    transform-origin: center 34%;
  }

  h1 {
    font-size: clamp(2.2rem, 12vw, 3.8rem);
  }

  .score-box {
    padding: 12px;
  }

  .scoreboard,
  .summary-strip,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .state-lines {
    justify-items: start;
    text-align: left;
  }

  #sync-state {
    max-width: 100%;
  }

  .old-match-toggle {
    justify-content: center;
  }

  .old-match-toggle span {
    white-space: normal;
  }

  .prediction-row {
    grid-template-columns: minmax(0, 1fr) 58px auto 58px;
  }

  .points-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }
}
