/* UzbGuessr — flag colours (sky, white, green, thin red) on warm sand and Samarkand lapis. */

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

:root {
  --sky: #0099b5;
  --sky-ink: #007890;
  --green: #1eb53a;
  --green-ink: #15912d;
  --red: #ce1126;
  --gold: #c99a2e;
  --lapis: #13233f;
  --lapis-2: #1c3157;

  --bg: #f4efe4;
  --surface: #fffdf8;
  --surface-2: #ebe3d3;
  --text: #13233f;
  --muted: #6c6a63;
  --border: rgba(19, 35, 63, 0.13);
  --shadow: 0 10px 30px rgba(19, 35, 63, 0.14);
  --map-filter: none;

  --display: "Unbounded", "Arial Black", sans-serif;
  --body: "Onest", system-ui, sans-serif;
  --radius: 16px;

  /* 8-point star lattice, used as a mask so it follows the theme colour */
  --girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='black' stroke-width='1.1'%3E%3Cpath d='M19 19h22v22H19zM30 14.4 45.6 30 30 45.6 14.4 30z'/%3E%3Cpath d='M30 0v14.4M30 45.6V60M0 30h14.4M45.6 30H60M0 0l19 19M60 0 41 19M0 60l19-19M60 60 41 41'/%3E%3C/g%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --sky: #2bb7d3;
  --sky-ink: #63cfe4;
  --green: #36c853;
  --green-ink: #2aa845;
  --red: #f04157;
  --gold: #e0b44e;
  --lapis: #1a2c4e;
  --lapis-2: #233a63;

  --bg: #0c1424;
  --surface: #131e33;
  --surface-2: #1a2742;
  --text: #edf1f8;
  --muted: #94a1b8;
  --border: rgba(237, 241, 248, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --map-filter: brightness(0.82) saturate(0.85);
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.25s,
    color 0.25s;
}

button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}

.girih {
  position: relative;
  isolation: isolate;
}
.girih::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: currentColor;
  opacity: 0.06;
  -webkit-mask: var(--girih) 0 0 / 60px 60px repeat;
  mask: var(--girih) 0 0 / 60px 60px repeat;
  pointer-events: none;
}

/* ---------- buttons ---------- */
.btn {
  height: 52px;
  padding: 0 24px;
  border: none;
  border-radius: 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition:
    background 0.15s,
    transform 0.1s,
    opacity 0.15s,
    border-color 0.15s;
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--green-ink);
}
.btn-sky {
  background: var(--sky);
  color: #fff;
}
.btn-sky:hover:not(:disabled) {
  background: var(--sky-ink);
}
.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
}
.btn-ghost:hover {
  border-color: var(--text);
}

/* ---------- top bar ---------- */
.flag-band {
  height: 13px;
  background: linear-gradient(
    to bottom,
    var(--sky) 0 4px,
    var(--red) 4px 5px,
    #fff 5px 8px,
    var(--red) 8px 9px,
    var(--green) 9px 13px
  );
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.01em;
}
.brand b {
  color: var(--sky);
  font-weight: 800;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lang-switch {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}
.lang-switch button {
  border: none;
  background: transparent;
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.lang-switch button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  color: var(--text);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-moon,
:root[data-theme="dark"] .icon-sun {
  display: none;
}
:root[data-theme="dark"] .icon-moon {
  display: block;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: var(--lapis);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 5000;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ================= MENU ================= */
.menu {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

/* hero */
.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 32px;
  align-items: center;
  padding: 40px 44px;
  border-radius: 24px;
  background:
    radial-gradient(120% 90% at 85% 40%, rgba(43, 183, 211, 0.22), transparent 60%),
    linear-gradient(135deg, var(--lapis), var(--lapis-2));
  color: #fff;
  overflow: hidden;
}
.kicker {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9fe3f1;
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(38px, 5.2vw, 62px);
  line-height: 1;
  letter-spacing: -0.03em;
}
.hero p {
  margin-top: 18px;
  max-width: 440px;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
}
.facts {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.facts div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}
.facts b {
  font-family: var(--display);
  font-size: 18px;
  color: #fff;
}
.hero-map {
  color: #fff;
  border-radius: 18px;
  padding: 10px;
}
.hero-map::before {
  opacity: 0.07;
  border-radius: inherit;
}
#uz-map {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.uz-shape {
  fill: rgba(255, 255, 255, 0.07);
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 5;
  stroke-linejoin: round;
}
.uz-dots circle {
  fill: rgba(255, 255, 255, 0.28);
  transition:
    fill 0.3s,
    r 0.3s;
}
.uz-dots circle.on {
  fill: #5fe07a;
  r: 11;
}
.uz-city {
  fill: #fff;
  stroke: var(--lapis);
  stroke-width: 5;
}
.uz-labels text {
  fill: #fff;
  font-family: var(--body);
  font-weight: 600;
  font-size: 34px;
  paint-order: stroke;
  stroke: var(--lapis);
  stroke-width: 9;
  stroke-linejoin: round;
}

/* setup */
.setup {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.setup .card-title {
  margin-bottom: 0;
}
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.field-note {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--muted);
  min-height: 1.5em;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.areas {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.area {
  position: relative;
  text-align: left;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.area:hover {
  border-color: var(--muted);
}
.area.active {
  border-color: var(--sky);
  background: color-mix(in srgb, var(--sky) 10%, var(--surface));
}
.area.active::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sky)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 13px no-repeat;
}
.area-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14.5px;
  padding-right: 22px;
}
.area-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  flex: 1;
}
.area-badges {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.area-progress {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 20%, transparent);
}
.area > .area-count {
  margin-top: 6px;
}
.area-count {
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green-ink);
}
:root[data-theme="dark"] .area-count {
  color: var(--green);
}

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: 14px;
  background: var(--surface-2);
}
.segmented button {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--muted);
  transition:
    background 0.15s,
    color 0.15s;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.active {
  background: var(--sky);
  color: #fff;
}

.btn-play {
  height: 64px;
  width: 100%;
  font-size: 19px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--green) 35%, transparent);
}
.btn-play:hover {
  background: var(--green-ink);
}
.btn-play svg {
  transition: transform 0.2s;
}
.btn-play:hover svg {
  transform: translateX(4px);
}


/* with friends */
.friends {
  border-top: 1px dashed var(--border);
  padding-top: 18px;
}
.friends-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 15px;
}
.friends-head svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--sky);
  stroke-width: 2;
  stroke-linecap: round;
}
.friends .field-note {
  margin: 6px 0 14px;
}
.friends-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.join-form {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.join-form input {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  padding: 0 14px;
  font-family: var(--display);
  font-size: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  outline: none;
}
.join-form input::placeholder {
  font-family: var(--body);
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 14px;
}
.join-form input:focus {
  border-color: var(--sky);
}
.friends.off .friends-row {
  opacity: 0.45;
  pointer-events: none;
}
.friends.off .field-note {
  color: var(--red);
}

/* side: profile + history */
.side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.profile input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 0 14px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
}
.profile input:focus {
  border-color: var(--sky);
}
.stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stats div {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stats b {
  font-family: var(--display);
  font-size: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.history {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.history li:first-child {
  border-top: none;
  padding-top: 0;
}
.history .history-empty {
  color: var(--muted);
  font-size: 14px;
}
.h-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.h-main b {
  font-weight: 600;
  font-size: 14.5px;
}
.h-main span {
  font-size: 12.5px;
  color: var(--muted);
}
.h-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.h-score b {
  font-family: var(--display);
  font-size: 15px;
}
.h-score i {
  width: 72px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--green) var(--p), var(--surface-2) var(--p));
}

/* how to */
.howto {
  grid-column: 1 / -1;
  padding: 6px 2px 0;
}
.howto ol {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.howto li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.howto li span {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  color: #fff;
  background: var(--sky);
}
.howto li:nth-child(2) span {
  background: var(--gold);
}
.howto li:nth-child(3) span {
  background: var(--green);
}
.howto p {
  font-size: 14.5px;
  color: var(--muted);
  padding-top: 6px;
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .menu {
    grid-template-columns: 1fr;
  }
  .hero {
    grid-template-columns: 1fr;
    padding: 30px 24px;
  }
  .hero-map {
    max-width: 560px;
  }
}
@media (max-width: 640px) {
  .topbar,
  .menu,
  .foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .topbar {
    height: 64px;
  }
  .brand {
    font-size: 18px;
  }
  .hero {
    padding: 26px 20px;
    border-radius: 20px;
  }
  .areas,
  .field-row,
  .howto ol {
    grid-template-columns: 1fr;
  }
  .friends-row {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 18px;
  }
}

/* ================= GAME ================= */
.game-body {
  overflow: hidden;
  background: #000;
}
#player {
  position: fixed;
  inset: 0;
}
/* hide the Yandex address line and "open in Yandex Maps": they give the answer away */
#player [class*="panorama-gotoymaps"],
#player [class*="panorama-control__name"],
#player [class*="panorama-control__close"],
#player [class*="panorama-control__fullscreen"] {
  display: none !important;
}

.hud {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 1000;
}
.hud-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  pointer-events: auto;
}
.hud-logo,
.chip,
.hud-btn {
  background: rgba(12, 20, 36, 0.8);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 14px;
}
.hud-logo {
  display: grid;
  place-items: center;
  width: 52px;
}
.chip {
  padding: 7px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 74px;
}
.chip-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.65;
}
.chip-value {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.25;
}
.chip.timer.warn .chip-value {
  color: #ffc94d;
}
.chip.timer.low .chip-value {
  color: #ff7a8a;
}
/* the last 15 seconds pulse, faster in the last 10 */
.chip.timer.warn {
  animation: timer-pulse 1s ease-in-out infinite;
}
.chip.timer.low {
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
  box-shadow: 0 0 0 2px rgba(206, 17, 38, 0.6);
}
@keyframes timer-pulse {
  50% {
    transform: scale(1.08);
  }
}
/* low time: red creeps in from the edges and corners, over the panorama but under the HUD */
.danger-vignette {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}
.danger-vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(206, 17, 38, 0.35) 78%, rgba(150, 0, 20, 0.75) 100%);
  box-shadow: inset 0 0 140px rgba(206, 17, 38, 0.55);
  animation: heartbeat 1.1s ease-in-out infinite;
}
.danger-vignette.on {
  opacity: calc(0.45 + 0.55 * var(--danger, 0));
}
.danger-vignette.fast::after {
  animation-duration: 0.6s;
}
@keyframes heartbeat {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .chip.timer.warn,
  .chip.timer.low,
  .danger-vignette::after {
    animation: none;
  }
}
.round-dots {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.round-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
}
.round-dots i.now {
  background: #fff;
}
.round-dots i.hi {
  background: #36c853;
}
.round-dots i.mid {
  background: #e0b44e;
}
.round-dots i.lo {
  background: #f04157;
}

.hud-btn {
  height: 48px;
  border: none;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  align-self: flex-start;
}
.hud-btn:hover:not(:disabled) {
  background: rgba(12, 20, 36, 0.95);
}
.hud-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.hud-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hud-btn .tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 7px;
  background: #1eb53a;
}
.hud-btn .tag.cost {
  background: #ce1126;
}

.hint-banner {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sky);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 1000;
  display: none;
  white-space: nowrap;
}
.hint-banner.show {
  display: block;
}

/* minimap */
#minimap-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: width 0.25s;
}
#minimap-container:not(.pinned) {
  opacity: 0.85;
}
#minimap-container:hover,
#minimap-container.pinned {
  opacity: 1;
}
#minimap-container:hover,
#minimap-container.big {
  width: min(580px, calc(100vw - 32px));
}
.map-toolbar {
  display: flex;
  gap: 6px;
}
.map-toolbar button {
  flex: 1;
  height: 34px;
  border: none;
  border-radius: 10px;
  background: rgba(12, 20, 36, 0.8);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
}
.map-toolbar button.active {
  background: var(--sky);
}
.map-toolbar .size-btn {
  flex: 0 0 34px;
  display: grid;
  place-items: center;
}
.map-toolbar .size-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
#minimap-container.pinned .size-btn {
  background: var(--sky);
}
#minimap {
  height: 250px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: height 0.25s;
  cursor: crosshair;
  background: #dfe3e0;
}
#minimap-container:hover #minimap,
#minimap-container.big #minimap {
  height: min(430px, calc(100vh - 230px));
}
.btn-guess {
  width: 100%;
  background: var(--green);
  color: #fff;
}
.btn-guess:hover:not(:disabled) {
  background: var(--green-ink);
}
.btn-guess:disabled {
  background: rgba(12, 20, 36, 0.8);
  opacity: 1;
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--body);
  font-weight: 500;
}

.leaflet-container {
  font-family: var(--body);
}
.leaflet-control-attribution {
  font-size: 9px !important;
}
.city-label {
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: var(--body);
  font-size: 11.5px;
  font-weight: 700;
  color: #13233f;
  text-shadow:
    0 0 3px #fff,
    0 0 3px #fff,
    0 0 3px #fff;
  padding: 0;
}
.city-label::before {
  display: none;
}

.map-fab {
  display: none;
}

@media (max-width: 700px) {
  .hud {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .hud-logo {
    display: none;
  }
  .chip {
    padding: 6px 10px;
    min-width: 0;
  }
  .chip-value {
    font-size: 16px;
  }
  .hud-btn {
    height: 44px;
    padding: 0 12px;
  }
  .hud-btn .label {
    display: none;
  }
  .hint-banner {
    top: 76px;
    white-space: normal;
    max-width: calc(100vw - 32px);
  }
  #minimap-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    display: none;
  }
  #minimap-container.open {
    display: flex;
    opacity: 1;
  }
  #minimap-container:hover,
  #minimap-container.big {
    width: auto;
  }
  #minimap,
  #minimap-container:hover #minimap,
  #minimap-container.big #minimap {
    height: 55vh;
  }
  .map-toolbar .size-btn {
    display: none;
  }
  .map-fab {
    display: inline-flex;
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 1001;
    height: 56px;
    background: var(--sky);
    color: #fff;
    box-shadow: var(--shadow);
  }
  #minimap-container.open ~ .map-fab {
    bottom: auto;
    top: 70px;
  }
}


/* ================= LIVE ROOM ================= */
.lobby {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.lobby[hidden] {
  display: none;
}
.lobby-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow);
}
.lobby-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.lobby-top .field-label {
  margin-bottom: 2px;
}
.lobby-code {
  font-family: var(--display);
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 0.12em;
  line-height: 1.1;
}
.lobby-share {
  margin-left: auto;
  height: 46px;
  padding: 0 16px;
  font-size: 13px;
}
.lobby-name-row {
  display: flex;
  gap: 8px;
}
.lobby-name-row input {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  padding: 0 14px;
  font-size: 16px;
  font-weight: 500;
  outline: none;
}
.lobby-name-row input:focus {
  border-color: var(--sky);
}
.lobby-body {
  display: flex;
  flex-direction: column;
}
.lobby-body .field-note {
  margin-top: 12px;
}
.lobby-settings-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}
.lobby-settings {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lobby-edit {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.lobby-edit.active {
  background: var(--sky);
  color: #fff;
}
.lobby-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: -4px 0 18px;
  padding: 16px;
  border-radius: 16px;
  border: 1.5px solid color-mix(in srgb, var(--sky) 45%, transparent);
  background: color-mix(in srgb, var(--sky) 5%, var(--surface));
}
.lobby-editor[hidden] {
  display: none;
}
.lobby-editor .field-label {
  margin-bottom: 8px;
}
.lobby-editor .field-note {
  margin-top: 8px;
  font-size: 13px;
}
.lobby-editor .field-row {
  gap: 12px;
}
.segmented.wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.segmented.wrap button {
  height: auto;
  min-height: 40px;
  padding: 6px 4px;
  font-size: 13.5px;
  line-height: 1.2;
}
.lobby-settings span {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
.lobby-players {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lobby-players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  font-weight: 600;
}
.lobby-players li.offline {
  opacity: 0.55;
}
.lobby-players i,
.room-strip i,
.pdot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 12px;
}
.lobby-players span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-players em {
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  color: var(--text);
}
.lobby-players em.you {
  background: color-mix(in srgb, var(--sky) 18%, transparent);
}
.lobby-players em.off {
  background: var(--surface-2);
}
.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lobby-actions .btn {
  width: 100%;
}
.lobby-wait {
  text-align: center;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 0;
}

.room-strip {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 44vw;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.room-strip[hidden] {
  display: none;
}
.room-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(12, 20, 36, 0.8);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
}
.room-strip span.me {
  color: #fff;
}
.room-strip span.done::after {
  content: "✓";
  color: #36c853;
  font-weight: 800;
}
.room-strip i {
  width: 9px;
  height: 9px;
  flex-basis: 9px;
}

.rounds-table tr.me td {
  font-weight: 700;
  background: color-mix(in srgb, var(--sky) 9%, transparent);
}
.rounds-table .pdot {
  width: 10px;
  height: 10px;
  margin-right: 8px;
  vertical-align: 0;
}
.overlay-actions .btn.waiting {
  cursor: default;
  color: var(--muted);
  font-family: var(--body);
  font-weight: 500;
}
.pin-label {
  background: rgba(12, 20, 36, 0.85);
  color: #fff;
  border: none;
  border-radius: 8px;
  box-shadow: none;
  font-family: var(--body);
  font-weight: 600;
  font-size: 12px;
  padding: 3px 8px;
}
.pin-label::before {
  display: none;
}

/* shown while the room connection is down */
body.conn-lost::after {
  content: attr(data-conn-lost);
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 6000;
  background: var(--red);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: var(--shadow);
}

@media (max-width: 700px) {
  .room-strip {
    top: 66px;
    max-width: calc(100vw - 20px);
  }
  .in-room .hint-banner {
    top: 110px;
  }
  .lobby-top {
    flex-wrap: wrap;
  }
  .lobby-share {
    margin-left: 0;
    width: 100%;
  }
  .lobby-name-row {
    flex-direction: column;
  }
  .lobby-editor .field-row {
    grid-template-columns: 1fr;
  }
  .lobby-card {
    padding: 18px;
  }
}

/* loading / errors */
.loader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding: 16px;
}
.loader.hidden {
  display: none;
}
.loader-mark {
  animation: drop 1.1s ease-in-out infinite;
}
.loader.error .loader-mark {
  animation: none;
  filter: grayscale(0.6);
}
@keyframes drop {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}
.loader-text {
  font-size: 16px;
  font-weight: 500;
  max-width: 460px;
  line-height: 1.55;
}
.loader:not(.error) .loader-text {
  color: var(--muted);
}
.loader-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* result overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  color: var(--text);
  display: none;
  grid-template-columns: 380px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.overlay.show {
  display: grid;
}
.overlay-side {
  min-height: 0;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.ov-sub {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ov-title {
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.score-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  color: #fff;
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(43, 183, 211, 0.3), transparent 60%),
    linear-gradient(135deg, var(--lapis), var(--lapis-2));
}
.score-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.score-value {
  font-family: var(--display);
  font-weight: 800;
  font-size: 54px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.score-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  margin-top: 10px;
  overflow: hidden;
}
.score-bar > div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(to right, #2bb7d3, #36c853);
  transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.score-meta {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}
.score-meta b {
  color: #fff;
  font-weight: 600;
}
.place-card {
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--bg);
  font-size: 13.5px;
  color: var(--muted);
}
.place-card:empty {
  display: none;
}
.place-card b {
  display: block;
  margin-top: 2px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}
.place-card #ov-address,
.place-card .place-line {
  display: block;
  margin-top: 4px;
}
.place-card .place-line {
  color: var(--text);
  font-weight: 500;
}
.place-card .place-map {
  display: inline-block;
  margin-top: 10px;
  font-weight: 600;
  color: var(--sky-ink);
  text-decoration: none;
}
.place-card .place-map:hover {
  text-decoration: underline;
}
.metro-label {
  background: transparent;
  border: none;
  box-shadow: none;
  font-family: var(--body);
  font-size: 11px;
  font-weight: 700;
  color: #1c4f8a;
  text-shadow:
    0 0 3px #fff,
    0 0 3px #fff,
    0 0 3px #fff;
  padding: 0;
}
.metro-label::before {
  display: none;
}
.leaflet-container:not(.metro-names) .metro-label {
  display: none;
}
.legend {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.legend .l-actual::before {
  background: #1eb53a;
}
.legend .l-guess::before {
  background: #0099b5;
}
.overlay-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.overlay-actions .btn {
  width: 100%;
}
.overlay-map {
  position: relative;
  min-height: 300px;
}
.overlay-map > div {
  position: absolute;
  inset: 0;
  filter: var(--map-filter);
}

.rounds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.rounds-table:empty {
  display: none;
}
.rounds-table td {
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
}
.rounds-table td:first-child {
  color: var(--muted);
  width: 26px;
}
.rounds-table td:last-child {
  text-align: right;
  font-family: var(--display);
  font-weight: 700;
}
.rounds-table tr {
  cursor: pointer;
}
.rounds-table tr:hover td {
  background: color-mix(in srgb, var(--sky) 8%, transparent);
}

@media (max-width: 760px) {
  .overlay {
    grid-template-columns: 1fr;
    grid-template-rows: 40vh minmax(0, 1fr);
  }
  .overlay-map {
    order: -1;
  }
  .overlay-side {
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 18px 16px;
    gap: 14px;
  }
  .ov-title {
    font-size: 26px;
  }
  .score-value {
    font-size: 44px;
  }
}

/* in a room every player has their own pin colour, shown in the table */
.in-room .legend .l-guess {
  display: none;
}
