/* Your World, the live map. Same look as the episodes (globe/index.html):
   Nunito 900, gold residents pill, navy chips, white name tags, gold for
   founders. Sized for a phone held in one hand; the controls sit low where
   the thumb is. */
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('/assets/fonts/nunito-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 900; font-display: swap; src: url('/assets/fonts/nunito-latin-900-normal.woff2') format('woff2'); }

:root {
  --ink: #10162e;
  --paper: #ffffff;
  --gold: #ffd23f;
  --gold-edge: #b8901a;
  --green: #34c27a;
  --green-ink: #062b18;
  --night: #0b1024;
  --glass: rgba(18, 28, 66, 0.88);
  --glass-line: rgba(255, 255, 255, 0.22);
  --muted: rgba(255, 255, 255, 0.7);
  --focus: #7cc4ff;
  --hud-shadow: 0 2px 0 rgba(10, 14, 40, 0.55), 0 6px 18px rgba(10, 14, 40, 0.35);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ag-bg: #0b1024; --ag-ink: #ffffff; --ag-btn: #ffd23f; --ag-btn-ink: #10162e; --ag-font: var(--font); --ag-warn: #8a5a00;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--paper); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- the globe ---------------------------------------------------------- */
#stage { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  background: radial-gradient(ellipse at 50% 46%, #0d1a36 0%, #070d1f 50%, #020409 100%); }
#stage.dragging { cursor: grabbing; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl { opacity: 0; transition: opacity 0.7s ease; }
body.live #gl { opacity: 1; }
#flat { transition: opacity 0.7s ease; }
body.live #flat { opacity: 0; }
#pins, #tags { position: fixed; inset: 0; pointer-events: none; font-family: var(--font); }

/* Town pins, seen from orbit: tap one to fly there. */
.pin {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; min-height: 30px;
  border: 0; border-radius: 15px; background: var(--paper); color: var(--ink);
  font-weight: 900; font-size: 13px; line-height: 1; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(10, 14, 40, 0.35); will-change: transform, opacity;
}
.pin b { font-variant-numeric: tabular-nums; background: var(--ink); color: var(--gold); border-radius: 9px; padding: 3px 6px 2px; font-size: 11px; }
.pin::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.pin.lead { background: var(--gold); }
.pin.lead::after { border-top-color: var(--gold); }
/* The tap target is bigger than the pill. */
.pin::before { content: ''; position: absolute; inset: -8px -4px; }

/* Name tags (drawn by globe/scene.js), at half the reel's size. */
.tag {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 10px 5px; border-radius: 12px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 3px 10px rgba(10, 14, 40, 0.28);
  white-space: nowrap; will-change: transform, opacity;
}
.tag::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--paper); }
.tag .name { font-weight: 900; font-size: 15px; line-height: 1.05; }
.tag .where { font-weight: 800; font-size: 10px; line-height: 1.2; opacity: 0.55; }
.tag.founder { background: var(--gold); }
.tag.founder::after { border-top-color: var(--gold); }
.tag .badge { font-weight: 900; font-size: 8px; letter-spacing: 1.5px; line-height: 1; padding: 3px 6px 2px; margin-bottom: 3px; border-radius: 6px; background: var(--ink); color: var(--gold); }
#tags .tag { pointer-events: auto; cursor: pointer; }
.tag.found { outline: 3px solid var(--gold); outline-offset: 2px; animation: found 1.6s ease-in-out infinite; }
@keyframes found { 50% { outline-offset: 6px; outline-color: rgba(255, 210, 63, 0.35); } }

/* ---- the HUD, like the episode's -------------------------------------------- */
#hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(var(--safe-t) + 14px) 16px 0; display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
#hud .day { font-weight: 900; font-size: 38px; line-height: 0.9; letter-spacing: 0.5px; text-shadow: var(--hud-shadow); }
#hud .residents {
  font-weight: 900; font-size: 21px; line-height: 1; padding: 8px 16px 7px; border-radius: 12px;
  background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 var(--gold-edge), 0 8px 20px rgba(10, 14, 40, 0.35);
  font-variant-numeric: tabular-nums;
}
#hud .chips { display: flex; gap: 6px; }
#hud .chip {
  font-weight: 900; font-size: 12px; letter-spacing: 0.8px; line-height: 1; padding: 6px 9px 5px; border-radius: 9px;
  background: var(--glass); border: 1.5px solid var(--glass-line); font-variant-numeric: tabular-nums;
}
#hud .chip.today { background: var(--green); color: var(--green-ink); border-color: transparent; }

.fresh {
  position: fixed; left: 50%; top: calc(var(--safe-t) + 132px); transform: translateX(-50%);
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 22px; cursor: pointer;
  background: var(--paper); color: var(--ink); font-weight: 900; font-size: 14px; box-shadow: 0 6px 18px rgba(10, 14, 40, 0.4);
}

/* ---- the sheet: card, search, links. Bottom third, where the thumb is. -- */
#sheet { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 12px calc(var(--safe-b) + 22px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; transition: transform 0.25s ease; }
#sheet > * { pointer-events: auto; }
.load { align-self: center; width: min(320px, 100%); padding: 10px 14px 12px; border-radius: 16px; background: var(--glass); border: 1.5px solid var(--glass-line); text-align: center; transition: opacity 0.4s ease; }
.load.done { opacity: 0; pointer-events: none; }
.load-text { font-weight: 800; font-size: 14px; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.load-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.load-fill { height: 100%; width: 0; border-radius: 3px; background: var(--gold); transition: width 0.3s ease; }
/* Building has no percentage, so the bar turns into a sweep. A transform
   animation keeps moving while the page is busy building the globe. */
.load.busy .load-fill { width: 38% !important; transition: none; animation: busy 1.1s ease-in-out infinite; }
@keyframes busy { from { transform: translateX(-110%); } to { transform: translateX(270%); } }

.card {
  position: relative; padding: 14px 16px 14px; border-radius: 20px; background: var(--paper); color: var(--ink);
  box-shadow: 0 6px 0 rgba(10, 14, 40, 0.18), 0 14px 36px rgba(10, 14, 40, 0.4);
  animation: rise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.card .kicker { display: inline-block; font-weight: 900; font-size: 11px; letter-spacing: 2px; line-height: 1; padding: 5px 9px 4px; border-radius: 8px; background: var(--gold); color: var(--ink); margin-bottom: 6px; }
.card .kicker.dark { background: var(--ink); color: var(--gold); }
.card .kicker.grey { background: #e7e9f0; color: #4a5068; }
.card h3 { margin: 0; font-weight: 900; font-size: 26px; line-height: 1.05; letter-spacing: -0.3px; word-break: break-word; padding-right: 36px; }
.card p { margin: 6px 0 0; font-weight: 800; font-size: 15px; line-height: 1.35; color: #3a4060; }
.card p b { color: var(--ink); font-variant-numeric: tabular-nums; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 14px; border: 0; cursor: pointer; text-decoration: none; font-weight: 900; font-size: 15px; background: #eef0f6; color: var(--ink); }
.card .btn.primary { background: var(--gold); color: var(--ink); box-shadow: 0 3px 0 var(--gold-edge); }
.card .btn:active { transform: translateY(2px); box-shadow: none; }
.card .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: #6a7090; font-size: 26px; line-height: 1; cursor: pointer; }
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.card .chips button { min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid #d9dce8; background: #fff; font-weight: 800; font-size: 14px; color: var(--ink); cursor: pointer; }

.search { position: relative; }
.bar { display: flex; align-items: center; gap: 8px; height: 54px; padding: 0 6px 0 16px; border-radius: 27px; background: var(--paper); color: var(--ink); box-shadow: 0 8px 28px rgba(5, 8, 25, 0.45); }
.bar:focus-within { box-shadow: 0 0 0 3px var(--focus), 0 8px 28px rgba(5, 8, 25, 0.45); }
.bar svg { width: 22px; height: 22px; flex: none; color: #4a5068; }
.bar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-weight: 800; font-size: 16px; color: var(--ink); }
.bar input::placeholder { color: #7a8099; font-weight: 800; }
.bar input::-webkit-search-cancel-button { display: none; }
.q-clear { width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: #6a7090; font-size: 26px; cursor: pointer; }
.results { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); padding: 6px; border-radius: 20px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 36px rgba(5, 8, 25, 0.5); max-height: 46vh; overflow-y: auto; }
.results .head { font-weight: 900; font-size: 11px; letter-spacing: 1.6px; color: #7a8099; padding: 8px 10px 4px; }
.results .opt { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.results .opt[aria-selected="true"] { background: #eef3ff; outline: 2px solid var(--focus); outline-offset: -2px; }
.results .opt .h { flex: 1; min-width: 0; font-weight: 900; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .opt .h mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; }
.results .badge { flex: none; font-weight: 900; font-size: 11px; letter-spacing: 0.6px; padding: 5px 8px 4px; border-radius: 8px; background: #eef0f6; color: #4a5068; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .badge.founder { background: var(--gold); color: var(--ink); }
.results .none { padding: 10px 10px 8px; }
.results .none h4 { margin: 0 0 4px; font-weight: 900; font-size: 17px; }
.results .none p { margin: 0 0 8px; font-weight: 800; font-size: 14px; color: #3a4060; line-height: 1.35; }
.results .none .btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 14px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 15px; text-decoration: none; }
.results .chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 4px 6px; }
.results .chips button { min-height: 38px; padding: 0 12px; border-radius: 19px; border: 1.5px solid #d9dce8; background: #fff; font-weight: 800; font-size: 14px; color: var(--ink); cursor: pointer; }

.links { display: flex; justify-content: center; gap: 8px; }
.links button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--glass-line); background: var(--glass); color: var(--paper); font-weight: 900; font-size: 13px; cursor: pointer; }
.credit { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-b) + 4px); margin: 0; text-align: center; font-size: 10px; font-weight: 800; color: rgba(255, 255, 255, 0.55); pointer-events: none; }

/* ---- panels: top countries, how it works ---------------------------------- */
.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(4, 6, 18, 0.55); }
.panel { position: fixed; z-index: 11; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; padding: 10px 18px calc(var(--safe-b) + 18px); border-radius: 26px 26px 0 0;
  background: #0e1636; border-top: 1.5px solid var(--glass-line); box-shadow: 0 -18px 50px rgba(5, 8, 25, 0.5); animation: sheet 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); touch-action: pan-y; }
@keyframes sheet { from { transform: translateY(100%); } }
.panel .grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); margin: 0 auto 12px; }
.panel h2 { margin: 0 0 12px; font-weight: 900; font-size: 22px; }
.panel p { margin: 0 0 10px; font-weight: 800; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, 0.86); }
.panel .fine { font-size: 12px; color: rgba(255, 255, 255, 0.6); }
.panel .close { display: block; width: 100%; min-height: 48px; margin-top: 12px; border: 1.5px solid var(--glass-line); border-radius: 16px; background: transparent; color: var(--paper); font-weight: 900; font-size: 15px; cursor: pointer; }
#rows .row { display: grid; grid-template-columns: 26px minmax(0, 8.5em) 1fr 52px; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 4px; border: 0; background: transparent; color: var(--paper); text-align: left; cursor: pointer; border-radius: 12px; }
#rows .row:active { background: rgba(255, 255, 255, 0.06); }
#rows .rank { font-weight: 900; font-size: 17px; opacity: 0.6; text-align: center; }
#rows .place { font-weight: 900; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#rows .track { display: block; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#rows .fill { display: block; height: 100%; border-radius: 6px; background: #7cc4ff; }
#rows .row.lead .fill { background: var(--gold); }
#rows .row.lead .rank { opacity: 1; color: var(--gold); }
#rows .count { font-weight: 900; font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
#rows .empty { font-weight: 800; color: rgba(255, 255, 255, 0.8); padding: 6px 0 10px; line-height: 1.4; }
.panel .cta { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px 14px; min-height: 48px; border-radius: 14px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 17px; text-decoration: none; }
.panel .cta svg { width: 26px; height: 26px; flex: none; }

/* The legal footer (site-legal/footer.html), at the foot of "How it works". */
.yw-legal-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--glass-line); color: rgba(255, 255, 255, 0.62); font-weight: 800; font-size: 13px; line-height: 1.5; }
.yw-legal-footer ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 0 4px; }
.yw-legal-footer a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--paper); font-weight: 900; text-decoration: none; }
.yw-legal-footer a[aria-current="page"] { color: var(--gold); }
.yw-legal-footer p { margin: 0 0 4px; font-size: 12px; color: rgba(255, 255, 255, 0.62); }

.notice { position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t) + 128px); padding: 10px 14px; border-radius: 14px; background: #3a1d24; border: 1.5px solid #8a3a4a; color: #fff; font-weight: 800; font-size: 14px; line-height: 1.35; display: flex; align-items: center; gap: 10px; }
.notice button { flex: none; min-height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--paper); color: var(--ink); font-weight: 900; cursor: pointer; }

@media (min-width: 720px) {
  #sheet { left: 50%; right: auto; width: 460px; transform: translateX(-50%); }
  .panel { left: 50%; right: auto; width: 520px; transform: translateX(-50%); border-radius: 26px; bottom: 24px; }
  @keyframes sheet { from { transform: translate(-50%, 30px); opacity: 0; } }
  #hud .day { font-size: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
