:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #4b5563;
  --faint: #6b7280;
  --border: #e5e7eb;
  --input-border: #d1d5db;
  --red: #a10c12;
  --red-dark: #7a090d;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-dark: #15803d;
  --yellow: #eab308;
  --yellow-dark: #ca8a04;
  --grey-btn: #4b5563;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--blue); }
[hidden] { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 0; border-radius: 6px; padding: 0.6rem 1.1rem;
  font: inherit; font-size: 1rem; color: #fff; cursor: pointer; text-decoration: none;
  transition: background-color 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.btn-red { background: var(--red); } .btn-red:hover:not(:disabled) { background: var(--red-dark); }
.btn-blue { background: var(--blue); } .btn-blue:hover:not(:disabled) { background: var(--blue-dark); }
.btn-green { background: var(--green); } .btn-green:hover:not(:disabled) { background: var(--green-dark); }
.btn-yellow { background: var(--yellow); } .btn-yellow:hover:not(:disabled) { background: var(--yellow-dark); }
.btn-grey { background: var(--grey-btn); } .btn-grey:hover:not(:disabled) { background: #374151; }
.btn-light { background: #d1d5db; color: #374151; } .btn-light:hover:not(:disabled) { background: #c4c8cf; }
.btn-link { background: none; color: var(--blue); padding: 0; }

label { display: block; font-weight: 600; font-size: 0.95rem; color: #374151; margin-bottom: 0.35rem; }
input[type=text], input[type=email], input[type=number], input[type=password], select {
  width: 100%; padding: 0.65rem 0.9rem; font: inherit; color: var(--text);
  border: 1px solid var(--input-border); border-radius: 6px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field { margin-bottom: 1.25rem; }

.alert { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.95rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04); }

/* ---------- public page ---------- */
.public { max-width: 540px; margin: 0 auto; padding: 2rem 16px 3rem; }
.logo { display: block; width: 110px; height: auto; margin: 0 auto 1.25rem; }
.intro { font-size: 1.1rem; margin: 0 0 1.25rem; }
.title { color: var(--red); text-align: center; font-size: 2.5rem; font-weight: 700; margin: 0 0 1.5rem; line-height: 1.2; }
.entry-card { padding: 1.75rem 1.75rem 1.5rem; }
.match-head { text-align: center; margin-bottom: 1.5rem; }
.match-head h2 { margin: 0 0 0.4rem; font-size: 1.6rem; font-weight: 600; }
.match-head .teams { font-size: 1.2rem; margin: 0; }
.match-head .when { color: var(--muted); margin: 0.15rem 0 0; }
.score-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; align-items: center; }
.score-row input { text-align: center; }
.score-row .dash { font-weight: 700; font-size: 1.3rem; }
.score-labels { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.6rem; font-size: 0.8rem; color: var(--muted); text-align: center; margin-top: 0.3rem; }
.score-labels span:nth-child(2) { visibility: hidden; font-size: 1.3rem; line-height: 0; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; color: #374151; margin-bottom: 0.9rem; cursor: pointer; }
.check input { margin-top: 0.3rem; width: 1rem; height: 1rem; flex: none; accent-color: var(--red); }
.submit { width: 100%; padding: 0.8rem; font-size: 1.05rem; margin-top: 0.4rem; }
.terms { margin-top: 2rem; padding: 1.5rem 1.75rem; }
.terms h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.terms ul { margin: 0; padding-left: 1.2rem; color: #374151; font-size: 0.95rem; }
.terms li { margin-bottom: 0.25rem; }
.notice { text-align: center; padding: 0.5rem 0 0.25rem; }
.notice p { margin: 0.4rem 0; }
.success { text-align: center; padding: 1rem 0; }
.success .tick { width: 3rem; height: 3rem; color: var(--green); }
.success h2 { margin: 0.5rem 0; }
.footer { text-align: center; margin-top: 2rem; color: var(--faint); font-size: 0.875rem; }
.footer a { color: var(--faint); }
.footer .settings { display: inline-flex; margin-top: 0.75rem; color: var(--faint); }
.prose { padding: 1.75rem; }
.prose h1 { color: var(--red); font-size: 1.7rem; line-height: 1.25; margin-top: 0; }
.prose h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

/* ---------- admin ---------- */
.admin-wrap { max-width: 1400px; margin: 0 auto; padding: 2rem 16px 4rem; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; padding: 0 2.5rem; }
.brand { display: flex; align-items: center; gap: 1.25rem; }
.brand img { width: 76px; height: auto; }
.brand h1 { color: var(--red); margin: 0; font-size: 2.6rem; line-height: 1.1; }
.brand p { margin: 0.2rem 0 0; color: var(--muted); font-size: 1.1rem; }
.head-actions { display: flex; gap: 1.1rem; }
.admin-main { max-width: 1380px; margin: 0 auto; padding: 0 10%; display: grid; gap: 2rem; }
.panel { padding: 1.75rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { display: flex; align-items: center; gap: 0.6rem; margin: 0; font-size: 1.5rem; font-weight: 600; }
.panel-head h2 .icon { width: 1.6rem; height: 1.6rem; color: var(--muted); }
.panel-tools { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.panel-tools select { width: 330px; max-width: 100%; padding: 0.4rem 0.9rem; }
.panel-tools .icon { color: var(--muted); }
.panel > p.muted { margin: 0 0 1.75rem; font-size: 1.05rem; }

.pred { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 1.2rem; }
.pred > button { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 1.2rem; padding: 1.4rem 1.25rem; cursor: pointer; flex-wrap: wrap; }
.pred > button:focus-visible { outline: 2px solid var(--blue); border-radius: 6px; }
.pred .who { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.1rem; }
.pred .meta { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 1.05rem; }
.pred .icon { color: var(--faint); }
.pill { background: #f3f4f6; border-radius: 4px; padding: 0.15rem 0.6rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem; }
.pred .time { margin-left: auto; color: var(--faint); display: flex; align-items: center; gap: 0.75rem; }
.pred .chev { transition: transform 0.15s; }
.pred.open .chev { transform: rotate(90deg); }
.pred-detail { border-top: 1px solid var(--border); padding: 1rem 1.25rem 1.2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem 1.5rem; font-size: 0.95rem; }
.pred-detail b { color: #374151; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem; color: var(--muted); }
.pager .btns { display: flex; gap: 0.5rem; }
.empty { text-align: center; padding: 2rem 0; color: var(--faint); }

.fx { border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem 1.25rem; margin-bottom: 1.25rem; }
.fx-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.fx h3 { margin: 0; font-size: 1.15rem; }
.fx .when { color: var(--muted); margin: 0.1rem 0 0; }
.badge { padding: 0.25rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.badge-done { background: #dcfce7; color: #166534; }
.badge-needed { background: #fef3c7; color: #92400e; }
.fx-result { display: flex; justify-content: space-between; align-items: center; background: #f9fafb; border-radius: 6px; padding: 0.9rem 1rem; margin: 1rem 0; }
.fx-result .score { font-size: 1.35rem; font-weight: 700; }
.fx-none { color: var(--faint); font-style: italic; margin: 1rem 0; }
.fx-actions { display: flex; gap: 0.6rem; }
.fx-actions .grow { flex: 1; }

.winner-box { border-top: 1px solid var(--border); margin-top: 1.25rem; padding-top: 1.25rem; }
.winner-inner { border: 1px solid var(--border); border-radius: 8px; padding: 1.75rem; }
.winner-inner h4 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 1.25rem; font-size: 1.25rem; font-weight: 600; }
.winner-inner h4 .icon { color: var(--yellow); width: 1.5rem; height: 1.5rem; }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); background: #f9fafb; border-radius: 6px; padding: 0.8rem 0.9rem; margin-bottom: 1.25rem; color: var(--muted); gap: 0.5rem; }
.summary b { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-left: 0.4rem; }
.found { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 1.25rem; color: #166534; }
.found-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.found-head strong { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; }
.found-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 2rem; }
.found-grid .k { font-weight: 600; font-size: 0.95rem; }
.found-grid .v { color: #14532d; font-size: 1.1rem; font-weight: 600; }
.found-grid .v.mono { font-weight: 400; font-size: 1rem; }
.found-grid .full { grid-column: 1 / -1; }
.found-grid .reason { font-weight: 400; font-size: 1rem; }
.nowin { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 6px; padding: 1.25rem; }
.nowin-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 1.25rem; }
.stat { border-radius: 6px; padding: 0.9rem; text-align: center; }
.stat b { display: block; font-size: 1rem; }
.stat-blue { background: #eff6ff; color: #1d4ed8; } .stat-blue b { color: #1e3a8a; }
.stat-yellow { background: #fefce8; color: #a16207; } .stat-yellow b { color: #713f12; }
.stat-purple { background: #faf5ff; color: #9333ea; } .stat-purple b { color: #581c87; }
.winner-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.9rem; color: var(--muted); gap: 1rem; flex-wrap: wrap; }

.result-form { max-width: 1380px; margin: 0 auto; padding: 0 10%; }
.result-form .card { padding: 1.75rem; }
.result-form .inner { border: 1px solid var(--border); border-radius: 8px; padding: 1.75rem; }
.result-form h2 { margin: 0 0 0.75rem; font-size: 1.6rem; font-weight: 600; }
.result-form .meta p { margin: 0.25rem 0; color: var(--muted); }
.result-form .meta b { color: #374151; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.5rem; }
.confirm { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 6px; padding: 0.9rem 1rem; margin-bottom: 1rem; }

.drop { border: 2px dashed #d1d5db; border-radius: 8px; padding: 2.5rem 1rem; text-align: center; color: #374151; transition: background 0.15s, border-color 0.15s; }
.drop.over { background: #fef2f2; border-color: var(--red); }
.drop .icon { width: 3.2rem; height: 3.2rem; color: var(--faint); }
.drop p { font-size: 1.2rem; margin: 0.5rem 0 0.6rem; }
.drop .small { color: var(--faint); margin-top: 0.75rem; font-size: 0.95rem; }
.upload-help { font-size: 1.05rem; color: #374151; margin: 0 0 1.5rem; }
.upload-help code { background: #f3f4f6; padding: 0.05rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

.admins-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.admins-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); gap: 1rem; }
.inline-form { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 220px; }

.login { max-width: 420px; margin: 4rem auto; padding: 0 16px; }
.login .card { padding: 2rem; }
.login img { display: block; width: 80px; margin: 0 auto 1rem; }
.login h1 { text-align: center; color: var(--red); margin: 0 0 1.5rem; font-size: 1.8rem; }
.login .btn { width: 100%; }

@media (max-width: 800px) {
  .admin-head { padding: 0; }
  .brand h1 { font-size: 1.9rem; }
  .brand img { width: 56px; }
  .admin-main, .result-form { padding: 0; }
  .summary, .stats, .found-grid, .two { grid-template-columns: 1fr; }
  .panel-tools select { width: 100%; }
  .pred .time { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) {
  .title { font-size: 2rem; }
  .entry-card, .terms { padding: 1.25rem; }
  .form-actions { grid-template-columns: 1fr; }
}

/* ---------- additions: nav, search, stats, upcoming ---------- */
.section-nav { position: sticky; top: 0; z-index: 5; display: flex; gap: 0.4rem; overflow-x: auto; background: rgba(243,244,246,0.92); backdrop-filter: blur(6px); padding: 0.6rem 10%; margin: -0.5rem 0 1.25rem; scrollbar-width: none; }
.section-nav a { white-space: nowrap; text-decoration: none; color: #374151; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.92rem; }
.section-nav a:hover { border-color: var(--red); color: var(--red); }
.panel { scroll-margin-top: 4rem; }
.pred-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 0 0 1.25rem; }
.pred-tools input[type=search] { flex: 1; min-width: 220px; padding: 0.6rem 0.9rem; font: inherit; border: 1px solid var(--input-border); border-radius: 6px; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.chip { background: #f3f4f6; border-radius: 999px; padding: 0.25rem 0.8rem; font-size: 0.88rem; color: #374151; white-space: nowrap; }
.chip b { color: var(--text); }
.sub-head { display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; font-weight: 600; margin: 2rem 0 0.75rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.sub-head .icon { color: var(--muted); }
.up-list { list-style: none; margin: 0; padding: 0; }
.up-list li { display: grid; grid-template-columns: 9.5rem 1fr auto; gap: 1rem; align-items: center; padding: 0.7rem 0.25rem; border-bottom: 1px solid var(--border); }
.up-list li:last-child { border-bottom: 0; }
.up-list .d { color: var(--muted); font-variant-numeric: tabular-nums; }
.up-list .o { font-weight: 600; }
.up-list .today { background: #fef2f2; border-radius: 6px; padding-left: 0.6rem; }
.tag { font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--red); color: #fff; margin-left: 0.5rem; font-weight: 500; }
@media (max-width: 800px) {
  .section-nav { padding: 0.6rem 0; }
  .up-list li { grid-template-columns: 1fr auto; }
  .up-list .d { grid-column: 1 / -1; }
}
