/* ============================================================
   ku jom? — a Kosovo geography game
   editorial, warm, understated
   ============================================================ */

:root {
  --paper: #f6f3ec;
  --paper-2: #efeade;
  --card: #fffdf8;
  --ink: #1b1813;
  --muted: #75705f;
  --line: #e2dccb;
  --blue: #24439c;
  --blue-deep: #1a327a;
  --gold: #c99b3f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(27, 24, 19, 0.06), 0 12px 32px -12px rgba(27, 24, 19, 0.22);
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Instrument Sans", -apple-system, sans-serif;
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

em { font-style: italic; }

/* ---------- screens ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: none;
}
.screen.is-active { display: block; }

.screen-overlay {
  background: rgba(27, 24, 19, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
}
.screen-overlay.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* ---------- buttons ---------- */

.btn {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 13px 28px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px; /* comfortable tap target */
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(36, 67, 156, 0.55);
}
.btn-primary:hover:not(:disabled) { background: var(--blue-deep); }
.btn-primary:disabled {
  background: #b9b3a4;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }

.btn-lg { font-size: 17px; padding: 16px 40px; }
.btn-block { width: 100%; }

/* ============================================================
   LANDING
   ============================================================ */

.screen-home {
  background: var(--paper);
}

.home-grid {
  height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 56px 72px;
}

.home-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 22px;
}

.home-map {
  position: relative;
  height: min(72vh, 640px);
  display: flex;
  flex-direction: column;
}

#dotmap {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.home-map-caption {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  padding-top: 10px;
}

.home-logo {
  width: 76px;
  height: auto;
  margin-bottom: -6px;
  filter: drop-shadow(0 6px 14px rgba(144, 19, 29, 0.25));
}

.card-logo {
  width: 44px;
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.home-kicker {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(72px, 14vw, 150px);
  line-height: 0.95;
  letter-spacing: -0.01em;
}
.home-title em { color: var(--blue); }

.home-sub {
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 42ch;
}

.home-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.home-note {
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0.75;
}

.home-footer {
  position: absolute;
  bottom: 18px;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  opacity: 0.6;
  z-index: 2;
}

/* ============================================================
   GAME
   ============================================================ */

.screen-game { background: #dcd8cc; }

.pano-wrap {
  position: absolute;
  inset: 0;
}

#pano {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* subtle cinematic frame so UI reads on any imagery */
.pano-vignette {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10, 8, 6, 0.32) 0%, transparent 14%),
    linear-gradient(0deg, rgba(10, 8, 6, 0.3) 0%, transparent 16%),
    radial-gradient(ellipse at center, transparent 62%, rgba(10, 8, 6, 0.18) 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* brand chip — sits over the embed's location label */
.hud {
  position: absolute;
  z-index: 10;
}

.hud-brand {
  top: 0;
  left: 0;
  padding: 14px 26px 14px 18px;
  background: rgba(22, 19, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-right-radius: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 34px -6px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 285px;
  min-height: 88px;
  justify-content: flex-start;
}

.hud-logo {
  width: 34px;
  height: auto;
  flex: none;
}

.hud-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-wordmark {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  color: #f5f2ea;
}
.hud-wordmark em { color: #a9bcf5; }

.hud-meta {
  display: flex;
  align-items: center;
  font-size: 13.5px;
  color: rgba(245, 242, 234, 0.66);
  font-weight: 500;
}
.hud-dot { margin: 0 8px; opacity: 0.5; }

/* round progress pips */
.hud-pips {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(245, 242, 234, 0.22);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.pip.done { background: var(--gold); }
.pip.now {
  background: #a9bcf5;
  box-shadow: 0 0 0 3px rgba(169, 188, 245, 0.18);
  animation: pip-pulse 2.4s ease-in-out infinite;
}
@keyframes pip-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(169, 188, 245, 0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(169, 188, 245, 0.08); }
}

/* round intro flash */
.round-intro {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  background: rgba(14, 12, 9, 0.55);
  opacity: 0;
  transition: opacity 0.45s ease;
}
.round-intro.show { opacity: 1; }

.round-intro-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(245, 242, 234, 0.65);
  transform: translateY(8px);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.round-intro-num {
  font-family: var(--font-display);
  font-size: 84px;
  line-height: 1;
  color: #f5f2ea;
  transform: translateY(12px);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.round-intro.show .round-intro-kicker,
.round-intro.show .round-intro-num { transform: none; }

/* ---------- guess map card ---------- */

.guess-card {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  background: rgba(22, 19, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  box-shadow: 0 18px 44px -10px rgba(0, 0, 0, 0.55);
  padding: 12px;
  width: 300px;
  transition: width 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guess-card:hover,
.guess-card:focus-within {
  width: 460px;
}

.guess-map-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 0;
}
.guess-map-label em {
  font-family: var(--font-display);
  font-size: 16px;
  color: #f5f2ea;
}
.guess-map-label span {
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(245, 242, 234, 0.55);
  white-space: nowrap;
}

.guess-map-holder {
  position: relative;
}

.guess-map {
  height: 200px;
  border-radius: 11px;
  overflow: hidden;
  transition: height 0.25s ease;
  background: var(--paper-2);
  outline: 1px solid rgba(255, 255, 255, 0.12);
  outline-offset: -1px;
}

/* only shown on the collapsed mobile mini-map */
.guess-mini-hint {
  display: none;
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  z-index: 500;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f5f2ea;
  background: rgba(22, 19, 15, 0.82);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

.guess-card .btn-primary:disabled {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(245, 242, 234, 0.45);
}

.guess-card:hover .guess-map,
.guess-card:focus-within .guess-map {
  height: 330px;
}


.map-close {
  position: absolute;
  z-index: 30;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: none;
}

.only-mobile { display: none; }

/* ============================================================
   RESULT / FINAL cards
   ============================================================ */

.card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 24px 70px -18px rgba(27, 24, 19, 0.45);
  padding: 30px;
  width: min(480px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  text-align: center;
  animation: card-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.result-kicker {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.result-distance {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.1;
}

.result-points {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
}
.result-points span { color: var(--gold); font-weight: 600; }

.score-track {
  height: 6px;
  background: var(--paper-2);
  border-radius: 999px;
  margin: 16px 0;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: 999px;
  transition: width 0.9s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.result-map {
  height: 240px;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 18px;
  background: var(--paper-2);
}

/* final */
.final-score {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 58px;
  line-height: 1;
}
.final-total {
  font-size: 22px;
  color: var(--muted);
}

.final-verdict {
  font-size: 15.5px;
  color: var(--muted);
  margin: 12px 0 20px;
}

.final-rounds {
  list-style: none;
  text-align: left;
  border-top: 1px solid var(--line);
  margin-bottom: 22px;
}
.final-rounds li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.final-rounds .r-label { color: var(--muted); white-space: nowrap; }
.final-rounds .r-bar {
  flex: 1;
  height: 5px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
}
.final-rounds .r-bar i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}
.final-rounds .r-pts { font-weight: 600; white-space: nowrap; }

.final-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}
.final-actions .btn { flex: 1; }

.final-vs {
  font-size: 14.5px;
  font-weight: 600;
  margin: -8px 0 16px;
}
.final-vs.won { color: var(--blue); }
.final-vs.lost { color: #a05427; }

.btn-challenge {
  background: var(--paper-2);
  color: var(--ink);
  border: 1px dashed var(--gold);
}
.btn-challenge:hover { background: #f3ecd9; }

.final-best {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- party lobby ---------- */

.lobby-code {
  font-family: var(--font-display);
  font-size: 52px;
  letter-spacing: 0.14em;
  line-height: 1;
  color: var(--blue);
  margin-bottom: 18px;
}

.lobby-name-row {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}
#lobby-name {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
#lobby-name:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: transparent;
}

.lobby-players {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 4px 0 20px;
  min-height: 38px;
}
.lobby-players li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.lobby-players li.host { border-color: var(--gold); }
.lobby-players li::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf7d;
}
.lobby-players li .host-tag {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lobby-wait {
  font-size: 14px;
  color: var(--muted);
  margin-top: 14px;
  animation: wait-pulse 2s ease-in-out infinite;
}
@keyframes wait-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

.lobby-leave {
  margin-top: 18px;
  background: none;
  border: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- live standings ---------- */

.standings {
  list-style: none;
  text-align: left;
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
}
.standings li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.standings .s-rank {
  width: 20px;
  color: var(--muted);
  font-size: 12.5px;
}
.standings .s-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.standings li.me .s-name { font-weight: 600; color: var(--blue); }
.standings .s-status {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.standings .s-pts { font-weight: 600; white-space: nowrap; }

/* ---------- leaderboard ---------- */

.linkish {
  background: none;
  border: none;
  font: inherit;
  color: var(--blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { color: var(--blue-deep); }

.lb-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  margin-bottom: 18px;
}

.lb-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-bottom: 18px;
}

.lb-submit {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
#lb-name {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
#lb-name:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: transparent;
}
.lb-submit .btn { padding: 11px 20px; font-size: 14px; }

.lb-tabs {
  display: flex;
  gap: 4px;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 12px;
}
.lb-tab {
  flex: 1;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease, color 0.18s ease;
}
.lb-tab.is-on {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(27, 24, 19, 0.12);
}

.lb-empty {
  font-size: 13.5px;
  color: var(--muted);
  padding: 10px 0 4px;
}

.standings li.medal-1 .s-rank { color: var(--gold); font-weight: 700; }
.standings li.medal-2 .s-rank,
.standings li.medal-3 .s-rank { color: var(--ink); font-weight: 600; }
.standings .s-when { font-size: 12px; color: var(--muted); }

/* ---------- leaflet pins ---------- */

.pin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.pin-guess { background: var(--blue); }
.pin-actual { background: var(--gold); }

.leaflet-container {
  font-family: var(--font-body);
  background: var(--paper-2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  /* let the landing scroll instead of clipping on short screens.
     the screen itself is the flex column so the in-flow footer is
     counted, rather than pushing past a 100%-tall grid. */
  .screen-home.is-active {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .home-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto; /* base rule is height:100%, which double-counts the footer */
    flex: 1 0 auto;
    min-height: 0;
    gap: 14px;
    padding: 22px 22px 12px;
  }
  .home-inner {
    align-items: center;
    text-align: center;
    gap: 12px;
    max-width: 26rem;
  }
  .home-sub { font-size: 15px; line-height: 1.55; max-width: 33ch; }
  .home-map {
    width: 100%;
    max-width: 21rem;
    height: min(30vh, 250px);
    flex: none;
  }
  .home-map-caption { font-size: 12.5px; padding-top: 6px; }
  /* in flow, so it can never overlap the content */
  .home-footer {
    position: static;
    flex: none;
    margin-top: 4px;
    padding: 0 22px calc(10px + env(safe-area-inset-bottom));
    font-size: 11.5px;
    line-height: 1.5;
  }
}

/* ------------------------------------------------------------
   Touch layout — keyed on hover capability, not just width, so
   tablets (which can't hover) get the tap-to-open sheet too.
   ------------------------------------------------------------ */
@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  .only-desktop { display: none; }
  .only-mobile { display: block; }

  .hud-brand {
    min-width: 0;
    width: 100%;
    border-radius: 0;
    min-height: 76px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px
             calc(16px + env(safe-area-inset-left));
  }
  .hud-wordmark { font-size: 22px; }

  /* ---- collapsed: a small always-visible map, like GeoGuessr mobile ---- */
  .guess-card {
    left: auto;
    right: calc(10px + env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    width: min(48vw, 215px) !important;
    padding: 7px;
    gap: 0;
    border-radius: 15px;
    transform: none;
    cursor: pointer;
  }
  .guess-card .guess-map {
    height: 112px !important;
    pointer-events: none; /* taps expand the card instead of dropping a pin */
  }
  .guess-card .guess-map-label,
  .guess-card #btn-guess { display: none; }
  /* hide zoom buttons on the mini map but keep the required attribution */
  .guess-card .leaflet-control-zoom { display: none; }
  .guess-card .leaflet-control-attribution {
    font-size: 8px;
    padding: 0 3px;
    line-height: 1.4;
  }
  .guess-mini-hint { display: block; }

  /* ---- expanded: bottom sheet ---- */
  .guess-card.open {
    inset: auto 0 0 0 !important;
    width: 100% !important;
    max-width: none;
    border-radius: 20px 20px 0 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    gap: 10px;
    cursor: default;
  }
  .guess-card.open .guess-map {
    height: min(42dvh, 340px) !important;
    pointer-events: auto;
  }
  .guess-card.open .guess-map-label { display: flex; }
  .guess-card.open #btn-guess { display: block; }
  .guess-card.open .leaflet-control-zoom { display: block; }
  .guess-card.open .leaflet-control-attribution { font-size: 11px; padding: 0 5px; }
  .guess-card.open .guess-mini-hint { display: none; }

  .guess-card.open ~ .map-close { display: block; }

  .map-close {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
  }

  .card { padding: 24px 20px; }
  .result-distance { font-size: 34px; }
  .final-score { font-size: 46px; }

  /* 16px minimum stops iOS Safari from zooming on focus */
  #lobby-name, #lb-name { font-size: 16px; }
}

/* ------------------------------------------------------------
   Narrow phones — stack side-by-side controls so labels
   never get clipped.
   ------------------------------------------------------------ */
@media (max-width: 400px) {
  .final-actions { flex-direction: column; }
  .lb-submit { flex-direction: column; }
  .lb-submit .btn { width: 100%; }
  .lobby-name-row { flex-direction: column; }
  .lobby-name-row .btn { width: 100%; }
  .home-actions { width: 100%; flex-direction: column; }
  .home-actions .btn { width: 100%; }

  .card { padding: 22px 16px; }
  .home-title { font-size: clamp(60px, 20vw, 96px); }
  .lobby-code { font-size: 42px; }
  .guess-map-label em { font-size: 15px; }
  .guess-map-label span { font-size: 11px; }
}

/* ------------------------------------------------------------
   Short viewports — landscape phones. Everything has to fit
   in ~360px of height.
   ------------------------------------------------------------ */
@media (max-height: 520px) and (orientation: landscape) {
  /* back to two columns so the short viewport isn't a tall stack */
  .home-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    grid-template-rows: auto;
    align-items: center;
    justify-items: center;
    padding: 18px 28px;
    gap: 20px;
    min-height: 100%;
  }
  .home-inner { align-items: flex-start; text-align: left; gap: 10px; max-width: none; }
  .home-title { font-size: clamp(44px, 9vh, 72px); }
  .home-sub { font-size: 14px; line-height: 1.5; }
  .home-kicker { font-size: 11px; }
  .home-map { height: min(66vh, 230px); max-width: 20rem; }
  .home-map-caption { font-size: 11px; padding-top: 4px; }
  .home-footer { display: none; }

  /* collapsed mini-map stays small in landscape */
  .guess-card .guess-map { height: 92px !important; }
  .guess-card { width: min(32vw, 190px) !important; }

  /* expanded: a right-hand panel keeps the panorama visible */
  .guess-card.open {
    inset: auto 0 0 auto !important;
    width: min(64vw, 460px) !important;
    border-radius: 18px 0 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .guess-card.open .guess-map { height: min(52dvh, 180px) !important; }
  .guess-card.open .btn { padding: 10px 20px; font-size: 14px; min-height: 40px; }
  .guess-map-label { padding-top: 0; }

  .hud-brand { min-height: 62px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .hud-wordmark { font-size: 19px; }

  .round-intro-num { font-size: 46px; }
  .round-intro-kicker { font-size: 11px; letter-spacing: 0.26em; }

  .card { padding: 16px 18px; }
  .result-kicker { margin-bottom: 6px; font-size: 11px; }
  .result-distance { font-size: 26px; }
  .result-points { font-size: 13px; margin-top: 2px; }
  .score-track { margin: 10px 0; }
  .result-map { height: 120px; margin-bottom: 12px; }
  .final-score { font-size: 34px; }
  .final-total { font-size: 16px; }
  .final-verdict { font-size: 13.5px; margin: 8px 0 12px; }
  .lb-title { font-size: 26px; margin-bottom: 12px; }
  .lb-block { padding-top: 12px; margin-bottom: 12px; }
  .final-rounds li { padding: 7px 4px; font-size: 13px; }
  .standings li { padding: 7px 4px; font-size: 13px; }
  .lobby-code { font-size: 34px; margin-bottom: 12px; }
  .lobby-players { margin: 2px 0 12px; min-height: 0; }
  .lobby-players li { padding: 6px 12px; font-size: 13px; }
  .lobby-leave { margin-top: 10px; }
}

/* very short (landscape on small phones) — cards must scroll cleanly */
@media (max-height: 420px) {
  .card { max-height: calc(100dvh - 16px); }
  .screen-overlay.is-active { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
