/* GeoRanker for socials — themed after geotrivia.com/georankle:
   Sora typeface, warm amber accent, neo-brutalist cards (solid borders +
   hard offset shadows), bright category colours. */

:root {
  --bg: #fff8ec;
  --fg: #1b1b1f;
  --muted: #6b6b73;
  --card: #ffffff;
  --border: #1b1b1f;
  --accent: #fbb25c;
  --accent-strong: #f79a2b;
  --yellow: #f8cd55;
  --green: #8ccd60;
  --blue: #51acf9;
  --purple: #c9aaff;
  --gold: #ffd766;
  --red: #ff8a8a;
  --shadow: 4px 4px 0 0 var(--border);
  --shadow-sm: 2px 2px 0 0 var(--border);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  background-image: radial-gradient(var(--accent) 0.5px, transparent 0.5px);
  background-size: 22px 22px;
}

.wrap {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 3px solid var(--border);
  background: var(--accent);
  padding: 22px 0;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  font-size: 40px;
  line-height: 1;
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px;
  box-shadow: var(--shadow-sm);
}
.site-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-accent {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 0 8px;
  box-shadow: var(--shadow-sm);
}
.tagline {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 0.92rem;
}
.updated {
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
}

/* ── Summary chips ──────────────────────────────────────────────────────── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 26px 0;
}
.chip {
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  text-align: center;
}
.chip .num {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}
.chip .lbl {
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Card grid ──────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}
.card {
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
}
.card.wide {
  grid-column: 1 / -1;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .tag {
  font-size: 1.3rem;
}
.card .accent-bar {
  height: 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  margin: -4px -4px 14px;
}
.c-yellow .accent-bar { background: var(--yellow); }
.c-green .accent-bar { background: var(--green); }
.c-blue .accent-bar { background: var(--blue); }
.c-purple .accent-bar { background: var(--purple); }
.c-amber .accent-bar { background: var(--accent); }
.c-gold .accent-bar { background: var(--gold); }
.c-red .accent-bar { background: var(--red); }

/* ── Tables ─────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 7px 8px;
}
thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
tbody tr + tr td {
  border-top: 1px solid #eee;
}
td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.82rem;
  background: #f4f4f4;
}
tr.leader .pos { background: var(--gold); }
tr.leader td { font-weight: 700; }

/* ── Record / list items ────────────────────────────────────────────────── */
.record-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.record-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
}
.record-list .emoji {
  font-size: 1.5rem;
}
.record-list .label {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: capitalize;
}
.record-list .holder {
  font-size: 0.78rem;
  color: var(--muted);
}
.record-list .detail {
  margin-left: auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.big-callout {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
}
.big-callout strong {
  font-weight: 800;
}
.empty {
  color: var(--muted);
  font-style: italic;
  font-size: 0.86rem;
}

.pill {
  display: inline-block;
  background: var(--accent);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: var(--shadow-sm);
}

/* ── Recent results ─────────────────────────────────────────────────────── */
.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.result-row .date {
  font-weight: 700;
  font-size: 0.82rem;
  min-width: 92px;
}
.result-row .winner {
  font-weight: 800;
}
.result-row .scores {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}

/* ── States / footer ────────────────────────────────────────────────────── */
.loading, .error {
  text-align: center;
  padding: 60px 0;
  font-weight: 700;
}
.error {
  color: #b00020;
}
.site-footer {
  border-top: 3px solid var(--border);
  background: var(--card);
  padding: 18px 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 640px) {
  .brand-mark { font-size: 32px; }
  .grid { grid-template-columns: 1fr; }
}

/* ── Disclaimer banner ──────────────────────────────────────────────────── */
.disclaimer {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 22px 0 16px;
  padding: 16px 18px;
  background: var(--yellow);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.95rem;
  line-height: 1.45;
}
.disclaimer-mark {
  font-size: 1.8rem;
  line-height: 1;
}
.disclaimer strong { font-weight: 800; }

/* ── Export uploader ────────────────────────────────────────────────────── */
.uploader {
  margin: 0 0 22px;
  background: var(--card);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.uploader > summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 800;
  list-style: none;
  user-select: none;
}
.uploader > summary::-webkit-details-marker { display: none; }
.uploader[open] > summary { border-bottom: 2px solid var(--border); }
.uploader-body { padding: 16px 18px; }
.uploader-help {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.uploader-help code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0 5px;
}
.uploader-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.uploader-row input {
  font: inherit;
  padding: 9px 11px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.uploader-row input[type="password"] { min-width: 160px; }
.uploader-row input[type="file"] { flex: 1 1 220px; }
.uploader-row button {
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 9px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}
.uploader-row button:hover { background: var(--accent-strong); }
.uploader-row button:disabled { opacity: 0.6; cursor: progress; }
.uploader-status {
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.uploader-status.ok { background: var(--green); }
.uploader-status.err { background: var(--red); }
.uploader-status.warn, .uploader-status.busy { background: var(--yellow); }
.uploader-status pre.announce {
  margin: 12px 0 0;
  padding: 12px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  max-height: 320px;
  overflow: auto;
}

/* ── DQ tag on recent results ───────────────────────────────────────────── */
.dq-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
