/* ==========================================================================
   Guess the Gaff — light theme matched to guesstheparty.co.uk
   ========================================================================== */
:root {
  --bg: #f1f1f4;
  --card: #ffffff;
  --ink: #0a0a0a;
  --muted: #6b6b73;
  --line: #e6e6ea;
  --correct: #16a34a;
  --wrong: #dc2626;
  --warn: #f59e0b;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --radius: 14px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header (mirrors UK/US sites) ---------- */
header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.game-switcher {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  min-width: 0;
}
.game-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.game-tab:hover { border-color: #c8c8d0; }
.game-tab.active { background: var(--ink); border-color: var(--ink); }
.game-tab-name {
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.game-tab-name:hover { color: var(--ink); }
.game-tab.active .game-tab-name { color: #fff; cursor: default; }
.game-tab.active .game-tab-name:hover { color: #fff; }
.game-tab-name .short { display: none; }
.game-tab-sep { color: var(--line); font-size: 0.7rem; }
.game-tab.active .game-tab-sep { color: rgba(255,255,255,0.35); }
.game-tab-stats-link {
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.game-tab-stats-link:hover { color: var(--ink); }
.game-tab.active .game-tab-stats-link { color: rgba(255,255,255,0.7); }
.game-tab.active .game-tab-stats-link:hover { color: #fff; }

@media (max-width: 680px) {
  .game-tab-name .full { display: none; }
  .game-tab-name .short { display: inline; }
}

.modes {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.mode {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.mode:hover { color: var(--ink); }
.mode.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.stats {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.stat-value { font-size: 1.05rem; font-weight: 700; color: var(--ink); }

.header-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.header-x:hover { transform: scale(1.08); background: #1f1f24; }
.header-x svg { width: 13px; height: 13px; fill: #fff; }
@media (max-width: 480px) { .header-x { width: 28px; height: 28px; } }

/* ---------- main game area ---------- */
main {
  max-width: 1280px;
  margin: 1.25rem auto;
  padding: 0 1rem;
}
[hidden] { display: none !important; }
.game {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
}
.game-gp { display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; }
.vs {
  align-self: center;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
@media (max-width: 720px) {
  .game { grid-template-columns: 1fr; }
  .vs { padding: 0.25rem 0; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- photos carousel ---------- */
.photos {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: min(32vh, 280px);
  background: #ececef;
  overflow: hidden;
}
.photos img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .15s;
}
.photos img.active { opacity: 1; }
.photos img.is-floorplan { object-fit: contain; background: #fff; }
.photos .empty-state {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem;
}
.thumbs {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 2;
}
.thumbs span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.55);
  transition: background .15s;
}
.thumbs span.active { background: #fff; }
.thumbs span.is-floorplan.active { background: var(--warn); }
.photos .nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.45);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  z-index: 2;
}
.photos:hover .nav { opacity: 1; }
.photos .nav.prev { left: 8px; }
.photos .nav.next { right: 8px; }
.photos .floorplan-hint {
  position: absolute;
  top: 50%; right: 50px;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  z-index: 2;
  pointer-events: none;
}
.photos .floorplan-hint.fading { opacity: 0; transition: opacity .3s; }

/* ---------- map ---------- */
.map {
  height: clamp(120px, 18vh, 180px);
  background: #ececef;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.map .empty-state {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem;
}

/* ---------- meta block under photos ---------- */
.meta { padding: 0.85rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.address { margin: 0; font-weight: 600; font-size: 0.95rem; }
.details { margin: 0; font-size: 0.85rem; color: var(--muted); }
.price {
  margin: 0.25rem 0 0;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.price.correct { color: var(--correct); }
.price.wrong { color: var(--wrong); }

/* ---------- HL action buttons ---------- */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}
.gaff-btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .15s;
  background: var(--ink);
  color: #fff;
}
.gaff-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.gaff-btn:active { transform: translateY(0); }
.gaff-btn.higher { background: var(--correct); }
.gaff-btn.lower  { background: var(--wrong); }
.gaff-btn.submit { width: 100%; margin-top: 0.5rem; padding: 1rem; font-size: 1rem; }

/* ---------- GP slider ---------- */
.slider-area { margin-top: 0.5rem; }
.slider-readout {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 0.4rem;
}
.slider-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.slider-value { font-size: 1.6rem; font-weight: 800; }
#gp-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px;
  background: linear-gradient(to right, var(--ink) var(--pct, 50%), var(--line) var(--pct, 50%));
  border-radius: 999px;
  outline: none;
  margin: 0.25rem 0;
}
#gp-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
#gp-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--ink);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
#gp-slider:disabled { opacity: 0.6; }
.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.gp-result { margin: 0.75rem 0; text-align: center; }
.result-line { margin: 0.25rem 0; font-size: 0.95rem; }
.actual-price { font-weight: 700; }
.round-score { font-size: 2rem; font-weight: 800; color: var(--correct); }
.round-score.mid { color: var(--warn); }
.round-score.poor { color: var(--wrong); }
.round-score-suffix { color: var(--muted); font-size: 0.95rem; }
.round-delta { display: block; margin-top: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.tier-label {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--correct);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
}
.tier-label.mid { background: var(--warn); }
.tier-label.poor { background: var(--wrong); }

/* ---------- empty / loading overlay ---------- */
.overlay {
  max-width: 460px;
  margin: 3rem auto;
  padding: 2rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.overlay h2 { margin: 0 0 0.5rem; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  margin: 1rem auto 0;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lower section: history + stats ---------- */
#lower {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}
.lower-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.tabs { display: inline-flex; gap: 0.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tab {
  border: 0; background: transparent;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-radius: 6px;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; font-weight: 600; }

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--ink); border-color: #c8c8d0; }

.history-empty, .empty-block {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin: 0;
  background: var(--card);
}
.history-list, .stats-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.history-entry {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .15s;
}
.history-entry:hover { border-color: #c8c8d0; }
.he-photo {
  position: relative;
  width: 88px; height: 66px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #ececef;
}
.he-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.he-photo.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.7rem; }
.he-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.he-badge {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 0.15rem;
}
.he-badge.hl { background: rgba(22,163,74,.12); color: var(--correct); }
.he-badge.gp { background: rgba(245,158,11,.15); color: var(--warn); }
.he-address { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.he-detail { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.he-result { text-align: right; }
.he-actual { font-weight: 700; font-size: 0.95rem; }
.he-status {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  display: inline-block;
  margin-top: 0.15rem;
}
.he-status.correct { background: rgba(22,163,74,.12); color: var(--correct); }
.he-status.wrong   { background: rgba(220,38,38,.12); color: var(--wrong); }
.he-status.mid     { background: rgba(245,158,11,.15); color: var(--warn); }

.stats-block { margin-bottom: 1.5rem; }
.stats-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.6rem;
}
.search-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  font: inherit;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--ink); }
.search-hint { font-size: 0.75rem; color: var(--muted); margin: 0.4rem 0 0.7rem; }

/* ---------- footer (consistent across all pages) ---------- */
.site-footer {
  margin-top: 3rem;
  padding: 2rem 1rem 2.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer .by { font-weight: 600; color: var(--ink); }
.site-footer .footer-row {
  margin: 1rem auto 0;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 4px 14px rgba(0,0,0,.04);
}
.site-footer .footer-row a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s ease;
}
.site-footer .footer-row a:hover { color: var(--muted); }
.site-footer .bmc { display: inline-flex; align-items: center; gap: 0.35rem; }
.site-footer .sep { color: var(--line); font-weight: 700; user-select: none; }
