:root {
  --red: #e30613;
  --red-dark: #a8050f;
  --white: #ffffff;
  --ink: #1a0a0c;
  --bg: #140608;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --muted: rgba(255, 255, 255, 0.62);
  --ok: #4ade80;
  --ok-dim: rgba(74, 222, 128, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--white);
  background:
    linear-gradient(180deg, rgba(20, 6, 8, 0.88) 0%, rgba(20, 6, 8, 0.94) 100%),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(227, 6, 19, 0.35) 0%, transparent 55%),
    #140608;
  background-attachment: fixed;
}

body.has-stadium {
  background-image:
    linear-gradient(180deg, rgba(20, 6, 8, 0.78) 0%, rgba(20, 6, 8, 0.9) 55%, rgba(20, 6, 8, 0.95) 100%),
    url("philipsstadion.jpg"),
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(227, 6, 19, 0.35) 0%, transparent 55%);
  background-size: cover, cover, auto;
  background-position: center, center center, center;
  background-attachment: fixed, fixed, fixed;
  background-repeat: no-repeat;
}

@media (max-width: 768px) {
  body.has-stadium {
    background-attachment: scroll, scroll, scroll;
    background-position: center, center top, center;
  }
}

a { color: #fecaca; }
a:hover { color: #fff; }

.wrap {
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-badge {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.55rem;
  background: linear-gradient(145deg, var(--red), var(--red-dark));
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 900;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
}

.brand-logo {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.15rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.brand small {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  opacity: 0.7;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nav a {
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: #fff;
  white-space: nowrap;
}

.nav a.active, .nav a:hover {
  border-color: rgba(227, 6, 19, 0.6);
  background: rgba(227, 6, 19, 0.2);
}

.hero {
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero p {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
}

.pill.open { border-color: rgba(74,222,128,0.45); color: var(--ok); }
.pill.closed { opacity: 0.65; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(6px);
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.card h2 span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.35rem 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.table tr.leader td {
  background: rgba(227, 6, 19, 0.12);
  font-weight: 700;
}

.rank {
  width: 2rem;
  font-weight: 800;
  color: #fecaca;
}

.pts { font-weight: 800; text-align: right; }

.delta {
  text-align: right;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}
.delta.plus { color: var(--ok); }
.delta.min { color: #fca5a5; }

.move {
  width: 1.75rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
}
.move-up { color: var(--ok); }
.move-down { color: #fca5a5; }
.move-flat { color: var(--muted); opacity: 0.5; }

.week-block {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  margin-bottom: 0.65rem;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.week-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  padding: 0.75rem 0.9rem;
  font-weight: 700;
  user-select: none;
}
.week-summary::-webkit-details-marker { display: none; }
.week-summary::after {
  content: "▾";
  opacity: 0.55;
  font-size: 0.85rem;
}
details[open] > .week-summary::after { content: "▴"; }
.week-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.week-tag {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(227, 6, 19, 0.35);
  border: 1px solid rgba(227, 6, 19, 0.55);
}
.week-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}
.week-body {
  padding: 0 0.9rem 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.match-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.match-row:last-child { border-bottom: 0; }

.match-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.match-title {
  font-weight: 800;
  font-size: 0.95rem;
}

.match-result {
  font-size: 0.85rem;
  color: #fecaca;
  font-weight: 700;
}

.pred-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

@media (max-width: 640px) {
  .pred-grid { grid-template-columns: 1fr; }
}

.pred-box {
  background: rgba(0,0,0,0.22);
  border-radius: 0.65rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.78rem;
}

.pred-box strong {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.pred-line {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

.locked-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%);
  box-shadow: 0 8px 22px rgba(227, 6, 19, 0.35);
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
  color: #fff;
}

.field {
  margin-bottom: 0.85rem;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #fecaca;
}

.field input, .field select {
  width: 100%;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  color: #fff;
  padding: 0.7rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: rgba(227, 6, 19, 0.7);
}

.score-pair {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.score-pair input {
  width: 3.5rem;
  text-align: center;
  font-weight: 800;
}

.msg {
  min-height: 1.25rem;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.65rem;
}
.msg.err { color: #fca5a5; }
.msg.ok { color: var(--ok); font-weight: 600; font-size: 1rem; }

.foot {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
}

.rules {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}
.rules li { margin: 0.25rem 0 0.25rem 1rem; }
.rules-sub {
  list-style: decimal;
  margin: 0.4rem 0 0.2rem 0.1rem;
  padding-left: 1.2rem;
  font-size: 0.78rem;
}
.rules-sub li {
  margin: 0.15rem 0;
  color: var(--muted);
}

.section-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.section-block {
  margin-bottom: 1.25rem;
}

.section-banner {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fecaca;
  margin-bottom: 0.65rem;
  padding: 0.35rem 0.15rem;
  border-bottom: 1px solid var(--line);
}

.duo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

@media (max-width: 640px) {
  .duo-grid { grid-template-columns: 1fr; }
}

.duo-card {
  margin-bottom: 0;
  min-height: 6rem;
}

.card-title-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(254, 202, 202, 0.45);
}

.card-title-link:hover {
  color: #fff;
  border-bottom-color: #fff;
}

.duo-card .pred-line {
  font-size: 0.82rem;
  padding: 0.28rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.table-compact {
  font-size: 0.82rem;
  margin: 0;
}
.table-compact th,
.table-compact td {
  padding: 0.32rem 0.35rem;
}
.table-compact th.num,
.table-compact td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pred-table {
  width: 100%;
}
.bonus-table th.num {
  font-size: 0.72rem;
  line-height: 1.25;
  max-width: 6.5rem;
  white-space: normal;
}

/* Exact goed (correct score / exact Opta) */
.cell-ok {
  background: rgba(34, 197, 94, 0.28) !important;
  color: #bbf7d0 !important;
  font-weight: 700;
  border-radius: 0.25rem;
}
/* 1×2 goed, score niet exact */
.cell-partial {
  background: rgba(34, 197, 94, 0.12) !important;
  color: #d1fae5 !important;
  font-weight: 600;
  border-radius: 0.25rem;
}
.cell-pts {
  color: #bbf7d0;
  font-weight: 700;
}

.bonus-card {
  margin-top: 0.75rem;
  margin-bottom: 0.85rem;
}
.bonus-card .match-meta {
  margin-bottom: 0.45rem;
}
.bonus-correct-line {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 0.55rem;
  line-height: 1.4;
}
.bonus-correct-line strong {
  color: var(--ok);
  font-weight: 800;
}

.locked-note.loading {
  color: #fecaca;
  font-weight: 600;
}

.match-focus {
  margin-bottom: 0.55rem;
}

.card-wide {
  border-color: rgba(227, 6, 19, 0.35);
}

.week-open-block {
  margin-bottom: 1.1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.week-open-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fecaca;
  margin-bottom: 0.45rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.week-open-title span {
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--muted);
}

.receipt-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 540px) {
  .receipt-modal {
    align-items: center;
    padding: 1rem;
  }
}
.hidden { display: none !important; }
.receipt-modal.hidden { display: none !important; }
body.receipt-open {
  overflow: hidden;
  touch-action: none;
}
.receipt-card {
  width: 100%;
  max-width: 28rem;
  max-height: min(88vh, 100%);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #1a0a0c;
  border: 1px solid var(--line);
  border-radius: 1rem 1rem 0 0;
  padding: 1.15rem 1.15rem calc(1.15rem + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -8px 32px rgba(0,0,0,0.45);
}
@media (min-width: 540px) {
  .receipt-card {
    border-radius: 1rem;
    padding: 1.15rem;
  }
}
.receipt-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
  color: var(--ok);
}
.receipt-card .receipt-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  line-height: 1.35;
}
.receipt-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.72rem;
  line-height: 1.4;
  background: rgba(0,0,0,0.35);
  border-radius: 0.55rem;
  padding: 0.75rem;
  margin: 0.75rem 0 1rem;
  max-height: 32vh;
  overflow: auto;
  color: #fecaca;
}
.receipt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
