:root {
  --ink: #14181f;
  --paper: #fbf6ec;
  --accent: #e23b41;
  --navy: #15233b;
  --gold: #ffd23f;
  --line: #e6ddc9;
  --map-h: 1140px;
  --hard: 0 5px 0 rgba(20, 24, 31, 0.18);
  --wrap: 1320px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(226, 59, 65, 0.06), transparent 40%),
    radial-gradient(circle at 88% 4%, rgba(36, 86, 166, 0.06), transparent 38%),
    var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { line-height: 1; margin: 0; }

/* ---------- hero ---------- */
.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 40px 22px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 34px;
  align-items: center;
}

.kicker {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  font-size: 0.74rem;
  color: #fff;
  background: var(--accent);
  padding: 5px 11px;
  border-radius: 999px;
  margin: 0 0 14px;
  transform: rotate(-1.5deg);
}

.hero-left h1 {
  font-family: "Anton", sans-serif;
  font-size: clamp(3rem, 7vw, 5.6rem);
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.hero-left h1 .hl { color: var(--accent); }

.quote {
  margin: 16px 0 0;
  padding: 4px 0 4px 16px;
  border-left: 4px solid var(--accent);
  font-size: 1.18rem;
  font-weight: 500;
  font-style: italic;
  color: #1c2230;
}
.quote cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-weight: 600;
  font-size: 0.82rem;
  color: #6b7280;
}

.sub {
  font-size: 1.08rem;
  max-width: 660px;
  margin: 14px 0 0;
  color: #2c3340;
}

/* ---------- stats box / scoreboard ---------- */
.stats-box {
  background: var(--navy);
  color: #fff;
  border-radius: 18px;
  padding: 18px 22px 20px;
  box-shadow: 0 12px 30px rgba(21, 35, 59, 0.28);
  border: 3px solid var(--ink);
}

.score-top { display: flex; align-items: center; gap: 14px; }

.big-number {
  font-family: "Anton", sans-serif;
  font-size: clamp(2.8rem, 6vw, 4rem);
  line-height: 0.82;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.big-number-label {
  margin: 0;
  max-width: 150px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  font-size: 0.78rem;
  color: #cdd6e4;
}

.reckons h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aeb9cc;
  font-weight: 600;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 12px;
  margin: 14px 0 8px;
}

#reckons-list { list-style: none; margin: 0; padding: 0; }
#reckons-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  font-weight: 500;
  font-size: 0.92rem;
}
#reckons-list .dot { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
#reckons-list .n {
  margin-left: auto;
  font-family: "Anton", sans-serif;
  color: var(--gold);
  font-size: 1.08rem;
}

/* ---------- layout ---------- */
main { max-width: var(--wrap); margin: 0 auto; padding: 8px 22px 40px; }

/* ---------- control strip (badge picker above the map) ---------- */
.control-strip {
  position: relative;
  z-index: 1000;
  display: grid;
  grid-template-columns: 2.3fr 1.1fr 1fr auto;
  gap: 14px;
  align-items: end;
  background: #fffdf8;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--hard);
  margin-bottom: 22px;
}

.ctrl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctrl-label { font-weight: 600; font-size: 0.8rem; }

.ctrl input {
  padding: 13px 13px;
  border: 2px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}
.ctrl input:focus { outline: none; border-color: var(--ink); }

/* ---------- flat icon chip ---------- */
.flat-chip {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #b9b2a3;
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.flat-chip svg { width: 60%; height: 60%; display: block; }

/* ---------- mega dropdown ---------- */
.megadrop { position: relative; }

.dd-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.dd-trigger[aria-expanded="true"] { border-color: var(--ink); }
.dd-text {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-caret {
  width: 0; height: 0; flex: 0 0 auto;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--ink);
}

.dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 2000;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(20, 24, 31, 0.28);
  max-height: 380px;
  overflow-y: auto;
}

.dd-opt {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 11px;
  border-radius: 11px;
  cursor: pointer;
}
.dd-opt:hover, .dd-opt.active { background: #f4eede; }
.dd-opt .flat-chip { width: 44px; height: 44px; }
.dd-opt-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dd-opt-label { font-weight: 700; font-size: 1.02rem; }
.dd-opt-sub { font-size: 0.78rem; color: #6b7280; line-height: 1.3; }

/* ---------- submit ---------- */
.ctrl-submit { justify-content: flex-end; }
#submit-btn {
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 5px 0 #a82a2f;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  white-space: nowrap;
}
#submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 0 #a82a2f; }
#submit-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 #a82a2f; }
#submit-btn:disabled { background: #cdbfa4; box-shadow: 0 5px 0 #b3a589; cursor: not-allowed; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note {
  grid-column: 1 / -1;
  min-height: 1.1em;
  margin: 2px 2px 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent);
}

/* ---------- full width map ---------- */
.map-full { position: relative; z-index: 0; margin-top: 4px; }
#map {
  height: var(--map-h);
  width: 100%;
  border-radius: 18px;
  border: 4px solid var(--ink);
  box-shadow: var(--hard);
}
.map-hint { margin: 10px 2px 0; font-size: 0.78rem; color: #6b7280; text-align: center; }

.map-pin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}
.map-pin svg { width: 60%; height: 60%; display: block; }

/* themed clusters (Leaflet.markercluster) */
.marker-cluster {
  background: rgba(21, 35, 59, 0.32);
}
.marker-cluster div {
  background: var(--navy);
  color: #fff;
}
.marker-cluster span { font-family: "Fredoka", sans-serif; font-weight: 700; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 22px;
  max-width: var(--wrap);
  margin: 18px auto 0;
}
.disclaimer {
  max-width: 880px;
  margin: 0 auto 8px;
  text-align: center;
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.45;
}
.disclaimer:last-child { margin-bottom: 0; }
.disclaimer strong { color: #4b5563; }
.disclaimer a { color: var(--accent); }

/* ---------- cookie consent banner ---------- */
.cookie-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 6000;
  max-width: 720px;
  margin: 0 auto;
  background: var(--navy);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 0.88rem; line-height: 1.45; }
.cookie-banner a { color: var(--gold); }
.cookie-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.cookie-btn {
  border: none; border-radius: 10px; padding: 11px 18px;
  font-family: "Fredoka", sans-serif; font-weight: 700; font-size: 0.9rem; cursor: pointer;
  white-space: nowrap;
}
.cookie-accept { background: var(--accent); color: #fff; }
.cookie-reject { background: rgba(255, 255, 255, 0.14); color: #fff; }
.cookie-btn:hover { filter: brightness(1.08); }
@media (max-width: 560px) {
  .cookie-banner { flex-direction: column; align-items: stretch; left: 10px; right: 10px; }
  .cookie-actions { justify-content: flex-end; }
}

/* ---------- responsive ---------- */

/* Tablet landscape and small laptops: the four-column control strip gets tight
   between roughly 1000 and 1180px, so give the dropdown a little more room and
   trim the map down from its full desktop height. */
@media (max-width: 1180px) and (min-width: 901px) {
  :root { --map-h: 700px; }
  .control-strip { grid-template-columns: 2fr 1.1fr 1fr auto; gap: 12px; padding: 14px; }
}

/* Tablet portrait and below: stack the hero. Keep the control strip as a tidy
   two-column grid (reason spans the top, name + postcode share a row, the
   button spans the bottom) so it does not waste a whole tall column each. */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  :root { --map-h: 700px; }

  .control-strip {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
  .ctrl-badge { grid-column: 1 / -1; }
  .ctrl-submit { grid-column: 1 / -1; }
  .ctrl-submit .ctrl-label { display: none; }
  #submit-btn { width: 100%; }
}

/* Phones: single column throughout, a shorter map, and comfortable touch
   targets. The map is capped in viewport height so it never dwarfs the screen. */
@media (max-width: 560px) {
  :root { --map-h: 62vh; }

  .hero { padding: 28px 16px 12px; }
  main { padding: 8px 16px 32px; }
  footer { padding: 22px 16px; }

  #map { min-height: 440px; max-height: 620px; }

  .control-strip { grid-template-columns: 1fr; }
  .ctrl-badge, .ctrl-submit { grid-column: auto; }

  .ctrl input { padding: 14px 13px; }      /* >= 44px tall touch target */
  .dd-trigger { padding: 11px 12px; }
  .dd-opt { padding: 12px 11px; }          /* roomier rows for touch */
}

/* ---------- share card modal ---------- */
.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(12, 16, 24, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.share-overlay[hidden] { display: none; }

.share-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 40px);   /* never taller than the screen */
  overflow-y: auto;                  /* scroll inside the modal if it is */
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  padding: 16px;
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.share-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

/* the shareable card itself */
.share-card {
  background:
    radial-gradient(circle at 80% 0%, rgba(226, 59, 65, 0.25), transparent 55%),
    var(--navy);
  color: #fff;
  border-radius: 14px;
  padding: 24px 22px 20px;
  text-align: center;
}
.sc-brand {
  font-family: "Anton", sans-serif;
  text-transform: uppercase;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}
.sc-brand span { color: var(--accent); }
.sc-chip {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  margin: 16px auto 14px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}
.sc-chip svg { width: 58%; height: 58%; }
.sc-name { font-size: 1.35rem; font-weight: 700; }
.sc-line { color: #b9c3d4; font-size: 0.92rem; margin-top: 4px; }
.sc-reason {
  font-family: "Anton", sans-serif;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 1.5rem;
  line-height: 1.08;
  margin: 4px 4px 14px;
  min-height: 2.3em;            /* reserve two lines so long reasons never clip in the export */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.sc-tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 5px 14px;
  border-radius: 999px;
}

/* share actions */
.share-actions { padding: 16px 4px 4px; text-align: center; }
.share-prompt { margin: 0 0 12px; font-weight: 600; color: #2c3340; }
.share-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sb {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;                /* let the grid track govern width, not the label */
  overflow: hidden;
  padding: 11px 6px;
  min-height: 44px;           /* comfortable touch target */
  border: none;
  border-radius: 11px;
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}
.sb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }
.sb:hover { filter: brightness(1.08); }
.sb-copy { grid-column: 1 / -1; background: var(--ink); margin-top: 8px; }

/* the image button is a grid pill like the rest, gold with ink text */
.sb-image { background: var(--gold); color: var(--ink); }

.share-img-note { min-height: 1em; margin: 8px 0 0; font-size: 0.8rem; color: #2c3340; }

.share-done {
  margin-top: 14px;
  padding: 10px 12px;          /* easier to tap */
  background: none;
  border: none;
  color: #6b7280;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- share modal on narrow phones ---------- */
@media (max-width: 480px) {
  .share-overlay { padding: 12px; }

  .share-modal { padding: 14px; }

  /* Five brand buttons read better two-up than crammed three-up. The Reddit
     button keeps its own row; the copy button already spans the full width. */
  .share-buttons { grid-template-columns: 1fr 1fr; }

  .share-close {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }

  .sc-reason { font-size: 1.35rem; }
}
