/* Glizzy Globe (/globe → globe.html): a full-screen MapLibre GL globe of every spot. js/globe.js drives it.
   Wide screens: brand + search + "Flat map" on top, the World domination scoreboard bottom-left, labeled buttons on the
   right, the 🎲 at the bottom. Phones (< 700 px): a one-line scoreboard pill under the search and a bottom toolbar. */
:root {
  --ketchup: #c8102e; --ketchup-d: #9e0b23; --mustard: #ffc629; --mustard-d: #e0a800;
  --ink: #1f1a17; --bun: #fff6e6; --muted: #6d625a; --space: #05060f;
  --glass: rgb(8 9 22 / .78); --line: rgb(255 255 255 / .14); --soft: #d9d0c7;
  --head: "Bricolage Grotesque", system-ui, sans-serif; --body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.gl { background: var(--space); color: #fff; font-family: var(--body); overflow: hidden; overscroll-behavior: none; }

/* Starfield behind the planet: CSS only, no image files */
.gl-stars { position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 72%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 33%, #fffb 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 84%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 12%, #fff8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 79% 57%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 28%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 88%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 91%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 35% 6%, #fff6 50%, transparent 51%),
    radial-gradient(ellipse at 50% 120%, #1b1440 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, #0b0d24 0%, var(--space) 70%);
  background-size: 340px 340px, 420px 420px, 520px 520px, 380px 380px, 460px 460px, 610px 610px, 300px 300px, 540px 540px, 470px 470px, 390px 390px, 100% 100%, 100% 100%;
}
/* The map fills the page by itself (width/height as well as inset, so it never measures 0×0 while MapLibre starts) */
.gl-map { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; }
.gl-map .maplibregl-canvas { outline: none; }

/* Loading: a glowing planet with a 🌭 in orbit, where the real globe will appear */
.gl-loading { position: fixed; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 18px; pointer-events: none; transition: opacity .6s; }
.gl-loading.done { opacity: 0; }
.gl-orb { width: min(46vmin, 360px); aspect-ratio: 1; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #2f6fd6 0%, #123a86 45%, #071a45 75%);
  box-shadow: 0 0 60px 8px #1b6bd855, inset -24px -30px 60px #000a; animation: gl-breathe 2.4s ease-in-out infinite; }
.gl-orbit { position: absolute; inset: -14%; border-radius: 50%; border: 1.5px dashed #ffffff2e; animation: gl-orbit 3.2s linear infinite; }
.gl-orbit i { position: absolute; top: -16px; left: 50%; margin-left: -16px; font-style: normal; font-size: 30px; line-height: 32px; transform: rotate(90deg); }
.gl-loading p { margin: 0; font: 700 17px var(--head); color: #fffd; text-shadow: 0 2px 10px #000; }
@keyframes gl-orbit { to { transform: rotate(360deg); } }
@keyframes gl-breathe { 50% { box-shadow: 0 0 80px 14px #1b6bd877, inset -24px -30px 60px #000a; } }

/* Top bar */
.gl-top { position: fixed; top: 0; left: 0; right: 0; z-index: 6; display: flex; gap: 10px; align-items: center;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); pointer-events: none; }
.gl-top > * { pointer-events: auto; }
.gl-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #fff; background: var(--glass); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 16px 6px 6px; flex: none; }
.gl-brand img { width: 32px; height: 32px; border-radius: 50%; }
.gl-brand b { font: 800 19px var(--head); letter-spacing: -.01em; }
.gl-brand b span { color: var(--mustard); }
.gl-search { flex: 1; max-width: 480px; margin: 0 auto; position: relative; }
.gl-search input { width: 100%; font: 500 16px var(--body); color: var(--ink); background: #fffef9; border: 2px solid var(--mustard); border-radius: 999px;
  padding: 11px 16px 11px 42px; outline: none; box-shadow: 0 6px 24px #0006; }
.gl-search input:focus { border-color: var(--ketchup); }
.gl-search::before { content: "🔎"; position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 15px; pointer-events: none; }
.gl-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fffef9; color: var(--ink); border-radius: 16px; box-shadow: 0 12px 34px #0009;
  overflow: auto; max-height: min(60vh, 440px); display: none; padding: 4px 0; }
.gl-results.on { display: block; }
.gl-results button { display: block; width: 100%; text-align: left; border: 0; background: none; font: 600 15px var(--body); padding: 10px 16px; cursor: pointer; color: inherit; }
.gl-results button small { color: var(--muted); display: block; font-size: 12.5px; font-weight: 500; margin-top: 1px; }
.gl-results button:hover, .gl-results button[aria-selected="true"] { background: #fff0cc; outline: none; }
.gl-results p { margin: 0; padding: 10px 16px; font-size: 14px; color: var(--muted); }
.gl-results p.hd { font: 800 12px var(--head); letter-spacing: .08em; text-transform: uppercase; color: var(--ketchup); padding: 8px 16px 2px; }
.gl-back { flex: none; color: #fff; text-decoration: none; font: 700 14px var(--body); background: var(--glass); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; backdrop-filter: blur(8px); white-space: nowrap; }
.gl-back:hover { background: #222c; }
.gl-hint { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 62px); transform: translateX(-50%); margin: 0; color: #fffd; font-size: 13px; z-index: 4;
  background: #0008; padding: 5px 12px; border-radius: 99px; pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.gl-hint.off { opacity: 0; }

/* Buttons: a labeled stack on the right */
/* (no transform or filter on .gl-ctrls itself: it would become the containing block of the fixed-position 🎲) */
.gl-ctrls { position: fixed; right: 16px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; gap: 8px; z-index: 5; pointer-events: none; }
.gl-ctrls > * { pointer-events: auto; }
.gl-ctrls button { display: flex; align-items: center; gap: 8px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: #fff;
  font: 700 14px var(--body); cursor: pointer; backdrop-filter: blur(8px); padding: 0 16px 0 12px; white-space: nowrap; }
.gl-ctrls button i { font-style: normal; font-size: 19px; line-height: 1; }
.gl-ctrls button:hover { background: #262a3dd9; }
.gl-ctrls button.on { background: var(--mustard); color: var(--ink); border-color: var(--mustard-d); }
.gl-zoom { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.gl-zoom button { width: 44px; height: 40px; border: 0; border-radius: 0; padding: 0; justify-content: center; font-size: 22px; font-weight: 600; }
.gl-zoom button + button { border-top: 1px solid var(--line); }
.gl :is(.gl-ctrls button, .gl-back, .gl-brand, .gl-pill, .gl-more, .gl-fronts button, .gl-x):focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

/* The big 🎲: lives in the button group but sits bottom-center on wide screens */
.gl-ctrls .gl-dice { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); height: auto; font: 800 18px var(--head); color: var(--ink); background: var(--mustard);
  border: 3px solid var(--ink); padding: 13px 24px; box-shadow: 0 5px 0 var(--ink), 0 14px 34px #000a; backdrop-filter: none; }
.gl-ctrls .gl-dice:hover { background: #ffd24f; }
.gl-ctrls .gl-dice:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.gl-ctrls .gl-dice i { font-size: 22px; }
.gl-dice .short { display: none; }

/* World domination scoreboard */
.gl-meter { position: fixed; left: 16px; bottom: 24px; z-index: 5; }
.gl-pill { display: none; }
.gl-panel { width: 280px; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 12px; box-shadow: 0 12px 40px #0008; }
.gl-meter:not(.open) .gl-panel { display: none; }
.gl-meter:not(.open) .gl-pill { display: flex; }
.gl-ph { display: flex; align-items: center; justify-content: space-between; }
.gl-ph h2 { margin: 0; font: 800 13px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--mustard); }
.gl-x { border: 0; background: none; color: #fffa; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; border-radius: 6px; }
.gl-x:hover { color: #fff; }
.gl-big { margin-top: 6px; line-height: 1.05; }
.gl-big b { font: 800 34px var(--head); color: #fff; }
.gl-big small { font: 600 14px var(--body); color: var(--soft); }
.gl-bar { height: 10px; border-radius: 99px; background: #ffffff1f; margin: 9px 0 7px; overflow: hidden; }
.gl-bar i { display: block; height: 100%; width: 1%; background: linear-gradient(90deg, var(--ketchup), var(--mustard)); border-radius: inherit; transition: width 1s; }
.gl-sub { margin: 0; font-size: 13px; color: var(--soft); }
.gl-sub b { color: #fff; }
.gl-panel h3 { margin: 12px 0 4px; font: 800 12px var(--head); letter-spacing: .08em; text-transform: uppercase; color: #fffc; }
.gl-panel h3 small { font: 500 11px var(--body); letter-spacing: 0; text-transform: none; color: #fff8; margin-left: 4px; }
.gl-fronts { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow: auto; }
.gl-fronts button { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: #fff; font: 600 13.5px var(--body);
  padding: 6px 4px 8px; cursor: pointer; text-align: left; border-radius: 8px; }
.gl-fronts button:hover { background: #ffffff14; }
.gl-fronts .fl { font-size: 16px; width: 22px; text-align: center; }
.gl-fronts .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-fronts .ct { font-variant-numeric: tabular-nums; color: var(--mustard); font-weight: 700; }
.gl-fronts button i { position: absolute; left: 34px; right: 4px; bottom: 3px; height: 3px; border-radius: 3px; background: #ffffff12; }
.gl-fronts button i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--ketchup), var(--mustard)); }
.gl-more { margin: 4px 0 0; border: 0; background: none; color: var(--mustard); font: 700 13px var(--body); cursor: pointer; padding: 4px; }
.gl-more:hover { text-decoration: underline; }
.gl-legend { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12px; color: #e8e0d8; }
.gl-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; border: 2px solid var(--mustard); background: #fff; }
.gl-legend .lw::before { border-color: var(--ketchup); }
.gl-legend .ls::before { border-color: #7a4a22; }
.gl-legend .lq::before { border-color: #8a8f99; }
.gl-pill { align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); color: #fff; font: 600 14px var(--body);
  border-radius: 999px; padding: 9px 14px; cursor: pointer; box-shadow: 0 6px 20px #0007; white-space: nowrap; }
.gl-pill b { font: 800 15px var(--head); color: var(--mustard); }
.gl-pill .of { color: var(--soft); margin-right: 3px; }
.gl-pill .chev { font-size: 11px; color: var(--soft); }

/* Spot card (MapLibre popup) */
.gl .maplibregl-popup-content { padding: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px #0009; font-family: var(--body); color: var(--ink); }
.gl .maplibregl-popup-close-button { font-size: 22px; width: 32px; height: 32px; color: var(--ink); }
.gl-card { width: 260px; }
.gl-card .hd { background: var(--bun); padding: 12px 14px 10px; border-bottom: 3px solid var(--mustard); }
.gl-card .hd b { display: block; font: 800 18px/1.15 var(--head); padding-right: 24px; }
.gl-card .hd small { color: var(--muted); font-size: 13px; }
.gl-card .bd { padding: 10px 14px 12px; font-size: 13px; }
.gl-tag { display: inline-block; font: 700 11px var(--body); text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 99px; margin: 0 4px 6px 0; }
.gl-tag.w { background: var(--ketchup); color: #fff; }
.gl-tag.j { background: var(--mustard); color: var(--ink); }
.gl-tag.s { background: #7a4a22; color: #fff; }
.gl-tag.q { background: #8a8f99; color: #fff; }
.gl-tag.st { background: #f3ece2; color: #4b4039; text-transform: none; letter-spacing: 0; font-weight: 600; }
.gl-card .acts { display: flex; gap: 6px; margin-top: 6px; }
.gl-card a.go { flex: 1; text-align: center; background: var(--ketchup); color: #fff; text-decoration: none; font: 700 14px var(--body); padding: 9px; border-radius: 10px; }
.gl-card a.go:hover { background: var(--ketchup-d); }
.gl-card .again { flex: none; width: 42px; border: 2px solid var(--ink); background: var(--mustard); border-radius: 10px; font-size: 18px; cursor: pointer; }
.gl-card .again:hover { background: #ffd24f; }

.gl-toast { position: fixed; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 64px); transform: translateX(-50%); background: #000d; color: #fff; font: 700 14px var(--body);
  padding: 9px 16px; border-radius: 99px; z-index: 7; opacity: 0; transition: opacity .25s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.gl-toast.on { opacity: 1; }
.gl .maplibregl-ctrl-attrib { font-size: 11px; }

/* Tablets and small laptops: the scoreboard moves under the top bar (as a pill until tapped), clear of the 🎲 */
@media (max-width: 1099px) {
  .gl-meter { top: calc(max(12px, env(safe-area-inset-top)) + 64px); bottom: auto; }
  .gl-hint { left: auto; right: 16px; transform: none; }
}

/* Phones: search on top, scoreboard pill under it, and a bottom toolbar (labels under the icons, the 🎲 raised in the middle) */
@media (max-width: 699px) {
  .gl-top { gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .gl-brand b, .gl-back .lbl { display: none; }
  .gl-brand { padding: 5px; }
  .gl-back { padding: 9px 11px; font-size: 16px; }
  .gl-hint { display: none; }
  .gl-toast { top: calc(max(10px, env(safe-area-inset-top)) + 108px); }
  .gl-meter { left: 12px; right: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 58px); bottom: auto; display: flex; flex-direction: column; align-items: flex-start; }
  .gl-pill { font-size: 13px; padding: 7px 12px; }
  .gl-meter.open { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .gl-meter.open .gl-panel { width: 100%; max-height: 100%; overflow: auto; }
  .gl-fronts { max-height: none; }
  .gl-ctrls { left: 0; right: 0; top: auto; bottom: 0; flex-direction: row; pointer-events: auto; align-items: flex-end; justify-content: space-around; gap: 0;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, #05060fee 38%); }
  .gl-ctrls button { flex-direction: column; gap: 3px; height: auto; padding: 6px 4px; min-width: 62px; border: 0; background: none; backdrop-filter: none; font: 600 11px var(--body); color: #fffd; border-radius: 12px; }
  .gl-ctrls button i { font-size: 22px; width: 42px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); }
  .gl-ctrls button.on { background: none; color: var(--mustard); }
  .gl-ctrls button.on i { background: var(--mustard); border-color: var(--mustard-d); }
  .gl-ctrls button:hover { background: none; }
  .gl-ctrls .gl-dice { position: static; order: 0; transform: translateY(-6px); padding: 8px 12px 6px; min-width: 84px; border: 3px solid var(--ink); border-radius: 20px;
    background: var(--mustard); color: var(--ink); font: 800 13px var(--head); box-shadow: 0 4px 0 var(--ink), 0 10px 26px #000a; }
  .gl-ctrls .gl-dice i { background: none; border: 0; width: auto; height: 28px; font-size: 26px; }
  .gl-ctrls .gl-dice:active { transform: translateY(-3px); box-shadow: 0 1px 0 var(--ink); }
  .gl-ctrls .gl-dice:hover { background: var(--mustard); }
  .gl-dice .long { display: none; }
  .gl-dice .short { display: inline; }
  #glSpin { order: -2; } #glMe { order: -1; } #glQuick { order: 1; } #glHome { order: 2; }
  .gl-zoom { display: none; }
  .gl .maplibregl-ctrl-bottom-right { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .gl-bar i, .gl-toast, .gl-hint, .gl-loading { transition: none; }
  .gl-orb, .gl-orbit { animation: none; }
}
