/* ---------- design tokens: one place for colour, type, space, shape and motion ---------- */
:root {
  /* surfaces (dark ink, solid enough to read outdoors over any basemap) */
  --bg: #0d1120;
  --surface: rgba(16, 21, 38, 0.94);
  --surface-2: #161c33;
  --raise: rgba(255, 255, 255, 0.06);
  --raise-2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef1fa;
  --muted: #9aa2bd;
  /* meaning */
  --me: #22c55e;          /* the player's own colour, set from their profile */
  --ink-on-me: #08110a;
  --gold: #fbbf24;        /* XP, levels, landmarks */
  --danger: #f87171;      /* conflict: attacks, challenges, losses */
  --danger-strong: #ef4444;
  --explore: #22d3ee;     /* discovery, fog of war */
  --ok: #4ade80;
  --warn: #f59e0b;
  /* type */
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
  /* shape & space */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-pill: 999px;
  --gap: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  --top: max(12px, env(safe-area-inset-top));
  --bottom: max(12px, env(safe-area-inset-bottom));
  /* motion */
  --fast: 0.15s; --mid: 0.25s;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* components set display:flex/grid, which would otherwise override hidden */
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; background: var(--bg); }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }
a { color: var(--me); }
.logo { font: 700 20px var(--display); letter-spacing: 3px; color: var(--me); }
.logo.big { font-size: 44px; text-align: center; }

/* floating surfaces (kept as .glass: the text pages use it too) */
.glass { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ---------- buttons ---------- */
button { font-family: var(--font); }
button.primary, button.ghost, .btn-link { border: 0; border-radius: var(--r-md); padding: 12px 16px; min-height: 44px; font: 700 15px var(--font); cursor: pointer;
  transition: transform var(--fast) var(--ease), background var(--fast), opacity var(--fast); }
button.primary { background: var(--me); color: var(--ink-on-me); }
button.ghost, .btn-link { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover, .btn-link:hover { background: var(--raise); }
button.primary:active, button.ghost:active, .fab:active, .chip:active { transform: scale(0.96); }
button:disabled { opacity: 0.55; cursor: progress; }
button.wide { width: 100%; margin-top: 12px; }
.btn-link { display: inline-flex; align-items: center; text-decoration: none; font-size: 13px; padding: 8px 12px; min-height: 40px; }
.small-btn { padding: 7px 12px !important; min-height: 36px !important; font-size: 13px !important; }
.danger { color: var(--danger) !important; border-color: rgba(248, 113, 113, 0.4) !important; }
button.primary.danger-btn { background: var(--danger-strong); color: #fff; }
.icon-btn { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--raise); color: var(--text); font-size: 15px; cursor: pointer; }
.icon-btn:hover { background: var(--raise-2); }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- top HUD ---------- */
#hud { position: fixed; z-index: 1000; top: var(--top); left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: var(--r-lg); }
#hud .logo { margin-right: auto; }
.chip { display: flex; align-items: center; gap: 8px; min-height: 40px; background: var(--raise); border: 1px solid var(--line); color: var(--text); border-radius: var(--r-pill); padding: 4px 6px 4px 6px; font: 600 14px var(--font); cursor: pointer; max-width: 55vw; }
#player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip b { background: var(--me); color: var(--ink-on-me); border-radius: var(--r-pill); padding: 2px 9px; transition: transform 0.3s var(--ease); }
.chip b.bump { transform: scale(1.35); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--me); flex: none; }

/* GPS status pill: the colour AND the words say what's going on */
.gps { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 10px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--raise); color: var(--text); font: 600 12px var(--font); cursor: pointer; white-space: nowrap; }
.gps i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.gps[data-s=ok] i { background: var(--ok); }
.gps[data-s=weak] i, .gps[data-s=locating] i { background: var(--warn); }
.gps[data-s=locating] i { animation: blink 1s ease-in-out infinite; }
.gps[data-s=denied], .gps[data-s=lost], .gps[data-s=offline] { border-color: rgba(248, 113, 113, 0.5); color: var(--danger); }
.gps[data-s=denied] i, .gps[data-s=lost] i, .gps[data-s=offline] i { background: var(--danger); }
.gps[data-s=dev] i { background: #a78bfa; }
@keyframes blink { 50% { opacity: 0.25; } }

/* map data loading: a thin bar under the status bar, never a spinner over the map */
#loadbar { position: fixed; z-index: 1003; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; opacity: 0; transition: opacity var(--mid);
  background: linear-gradient(90deg, transparent, var(--me), transparent) 0 0 / 40% 100% no-repeat; }
body.loading #loadbar { opacity: 1; animation: load 1s linear infinite; }
@keyframes load { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ---------- map controls ---------- */
#fabs { position: fixed; z-index: 1000; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; }
.fab { position: relative; width: 48px; height: 48px; border-radius: var(--r-md); display: grid; place-items: center; cursor: pointer; color: var(--text); transition: transform var(--fast) var(--ease), border-color var(--fast); }
.fab:hover { border-color: var(--me); }
.fab svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.fab-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger-strong); border: 2px solid var(--surface-2); }

.panel { position: fixed; z-index: 1001; right: 72px; top: 50%; transform: translateY(-50%); width: 250px; padding: 14px; border-radius: var(--r-lg); animation: pop var(--mid) var(--ease); }
.panel h3, dialog h3 { margin: 10px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.panel h3:first-child { margin-top: 0; }
@keyframes pop { from { opacity: 0; scale: 0.96; } }

/* segmented control */
.seg { display: flex; background: var(--raise); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 9px 6px; border-radius: 11px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; transition: background var(--mid), color var(--mid); }
.seg input:checked + span { background: var(--me); color: var(--ink-on-me); }
.seg input:focus-visible + span { outline: 2px solid #fff; }

/* toggles */
.toggle { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 14px; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { width: 38px; height: 22px; border-radius: var(--r-pill); background: var(--raise-2); position: relative; transition: background var(--mid); flex: none; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--mid) var(--ease); }
.toggle input:checked + span { background: var(--me); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid #fff; }

/* ---------- bottom dock: tapped tile sheet + "where you are" card ---------- */
#dock { position: fixed; z-index: 1000; left: 12px; right: 12px; bottom: var(--bottom); max-width: 480px; margin: 0 auto; display: grid; gap: 8px; pointer-events: none; }
#dock > * { pointer-events: auto; }
#card { border-radius: var(--r-lg); padding: 10px; display: grid; gap: 10px; }
.claim { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
#ring { width: 44px; height: 44px; flex: none; transform: rotate(-90deg); }
#ring circle { fill: none; stroke-width: 5; }
#ring .track { stroke: var(--raise-2); }
#ring .bar { stroke: var(--me); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset 0.25s linear; }
#ring.attack .bar { stroke: var(--danger-strong); }
#ring.locked .bar { stroke: #f43f5e; }
#status { font-weight: 800; }
#substatus:empty { display: none; }
.lm-line { font-size: 13px; color: var(--gold); font-weight: 700; margin-top: 2px; }
#action { margin-top: 0; }
#action.attack { background: var(--danger-strong); color: #fff; }

#sheet { border-radius: var(--r-lg); padding: 6px 14px 14px; display: grid; gap: 10px; animation: rise-in var(--mid) var(--ease); }
#sheet.dragging { transition: none; }
.sheet-handle { height: 18px; margin: 0 -14px -6px; cursor: grab; touch-action: none; display: grid; place-items: center; }
.sheet-handle::before { content: ""; width: 40px; height: 5px; border-radius: var(--r-pill); background: var(--raise-2); }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font: 700 19px/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head p { margin: 2px 0 0; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; background: transparent; border: 2px dashed var(--muted); }
.swatch.filled { border: 2px solid rgba(255, 255, 255, 0.7); }
#sheet-body { display: grid; gap: 6px; font-size: 14px; }
#sheet-body:empty { display: none; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }
.fact { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--raise); font-size: 13px; font-weight: 600; }
.fact.green { color: var(--ok); }
.fact.gold { color: var(--gold); }
.fact.bad { color: var(--danger); }
.hint { margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--raise); font-size: 14px; }
.hint.go { background: color-mix(in srgb, var(--me) 16%, transparent); }
.skeleton { height: 26px; border-radius: var(--r-pill); width: 60%; background: linear-gradient(90deg, var(--raise), var(--raise-2), var(--raise)) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-actions:empty { display: none; }
.sheet-actions > * { flex: 1 1 auto; }
@keyframes rise-in { from { transform: translateY(16px); opacity: 0; } }

/* ---------- toast ---------- */
#toast { position: fixed; z-index: 1002; left: 50%; top: calc(var(--top) + 62px); max-width: calc(100vw - 24px); transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--me); font-weight: 700; padding: 10px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow);
  transition: opacity var(--mid) var(--ease), transform var(--mid) var(--ease); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- dialogs: centred cards on desktop, bottom sheets on phones ---------- */
dialog { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; width: min(400px, 92vw); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
dialog[open] { animation: pop var(--mid) var(--ease); }
dialog::backdrop { background: rgba(5, 8, 20, 0.6); }
dialog h2 { margin: 0 0 14px; font-family: var(--display); }
.auth-box, #dev-form, #welcome-form { display: grid; gap: 10px; }
.auth-box p { margin: 0; text-align: center; }
#google-btn { display: flex; justify-content: center; min-height: 44px; }
#google-btn:empty { display: none; }
.field { display: grid; gap: 6px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; min-height: 32px; }
.check input { flex: none; width: 20px; height: 20px; margin-top: 0; accent-color: var(--me); }
#welcome-err, #auth-err, #ask-err { color: var(--danger); margin: 0; min-height: 1.2em; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }
textarea, input:not([type]), input[type=password] { padding: 12px 14px; min-height: 44px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--text); font: inherit; font-size: 16px; }
textarea { resize: vertical; min-height: 70px; }
select { background: var(--raise); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px; min-height: 40px; font: inherit; font-size: 13px; }
select option { background: var(--surface-2); }
.row { display: flex; justify-content: space-between; gap: 10px; }

/* profile */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.stats div { background: var(--raise); border-radius: var(--r-md); padding: 10px 12px; }
.stats b { display: block; font: 700 24px var(--display); color: var(--me); font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }
.stats .span { grid-column: 1 / -1; }
#palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
#palette button { aspect-ratio: 1; min-width: 28px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform var(--fast) var(--ease); }
#palette button:hover { transform: scale(1.12); }
#palette button[aria-pressed=true] { border-color: #fff; }
.custom { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; color: var(--muted); }
.custom input { width: 44px; height: 32px; border: 0; background: none; padding: 0; cursor: pointer; }
.zone-box { background: rgba(244, 63, 94, 0.08); border: 1px solid rgba(244, 63, 94, 0.3); border-radius: var(--r-md); padding: 12px; margin: 10px 0; }
.zone-box p { margin: 4px 0 8px; }
.zone-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.zone-row button { padding: 8px 12px; min-height: 40px; font-size: 13px; }
#battles { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; font-size: 13px; }
#battles li { background: var(--raise); border-radius: var(--r-sm); padding: 8px 10px; }
#battles .win { color: var(--ok); font-weight: 700; }
#battles .loss { color: var(--danger); font-weight: 700; }
.safety { padding: 0; list-style: none; display: grid; gap: 10px; margin: 0 0 12px; }
.safety li { background: var(--raise); border-radius: var(--r-md); padding: 10px 12px; font-size: 14px; }

/* progression */
.lvl { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; background: var(--gold); color: #1a1205; font: 800 12px var(--font); }
.xpbar { background: var(--raise); border-radius: var(--r-md); padding: 10px 12px; margin: 8px 0; }
.xpbar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; gap: 8px; }
.xpbar-top b { font: 700 16px var(--display); }
.xpbar p { margin: 6px 0 0; }
.bar-track { height: 8px; border-radius: var(--r-pill); background: var(--raise-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gold); transition: width 0.6s var(--ease); }
.streak { font: 700 18px var(--display); margin: 4px 0 10px; }
.quest-list { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.quest-list li { background: var(--raise); border-radius: var(--r-md); padding: 10px 12px; display: grid; gap: 6px; font-size: 14px; }
.quest-list .q-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.quest-list .q-xp { color: var(--gold); font-weight: 800; white-space: nowrap; }
.quest-list li.done { opacity: 0.6; }
.quest-list li.done .q-title::before { content: "✓ "; color: var(--ok); font-weight: 800; }
.quest-list .bar-track { height: 6px; }
.quest-list .bar-track i { background: var(--me); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; margin-bottom: 8px; }
.ach { border-radius: var(--r-sm); padding: 8px; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4); font-size: 11px; }
.ach b { display: block; font-size: 12px; color: var(--gold); }
.ach.locked { background: transparent; border-color: var(--line); color: var(--muted); }
.ach.locked b { color: var(--muted); }

/* ask dialog */
#ask-form { display: grid; gap: 10px; }
#ask-form h2 { margin: 0; }
#ask-msg { margin: 0; }
#ask-msg:empty { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip-btn { border: 1px solid var(--line); background: var(--raise); color: var(--text); border-radius: var(--r-pill); padding: 8px 12px; min-height: 36px; font: 600 13px var(--font); cursor: pointer; }
.chip-btn:hover, .chip-btn[aria-pressed=true] { border-color: var(--me); background: var(--raise-2); }

/* leaderboard */
#board-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
#board-list li { position: relative; overflow: hidden; border-radius: var(--r-sm); }
#board-list .entry { width: 100%; min-height: 44px; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--raise); position: relative; overflow: hidden; }
#board-list .entry:hover { background: var(--raise-2); }
#board-list li.me { outline: 2px solid var(--me); }
#board-list .bar { position: absolute; inset: 0 auto 0 0; opacity: 0.18; }
#board-list .rank { font-weight: 800; color: var(--muted); }
#board-list .name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
#board-list .lvl { height: 20px; min-width: 20px; font-size: 10px; padding: 0 4px; }

/* someone is attacking my tile */
#alert { position: fixed; z-index: 1001; top: calc(var(--top) + 62px); left: 50%; transform: translateX(-50%); width: min(440px, calc(100vw - 24px)); padding: 8px 8px 8px 14px; border-radius: var(--r-md); display: flex; gap: 10px; align-items: center; border-color: var(--danger-strong); font-weight: 700; animation: shake 0.5s; }
#alert span { flex: 1; }
#alert button { background: var(--danger-strong); color: #fff; }
@keyframes shake { 25% { transform: translateX(calc(-50% - 6px)); } 75% { transform: translateX(calc(-50% + 6px)); } }

/* viewing another player's turf */
#viewing { position: fixed; z-index: 1000; top: calc(var(--top) + 62px); left: 12px; width: min(300px, calc(100vw - 84px)); padding: 14px; border-radius: var(--r-lg); display: grid; gap: 10px; animation: slide var(--mid) var(--ease); }
#viewing .who { display: flex; align-items: center; gap: 8px; font: 700 18px var(--display); min-width: 0; }
#viewing .who b { overflow: hidden; text-overflow: ellipsis; }
.pill { margin-left: auto; font: 700 12px var(--font); background: var(--raise-2); padding: 3px 8px; border-radius: var(--r-pill); }
.v-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.v-stats div { background: var(--raise); border-radius: var(--r-sm); padding: 8px; text-align: center; }
.v-stats b { display: block; font: 700 20px var(--display); }
.v-stats span { font-size: 11px; color: var(--muted); }
#viewing p { margin: 0; }
@keyframes slide { from { transform: translateX(-20px); opacity: 0; } }

/* ---------- map art ---------- */
.leaflet-container { font-family: var(--font); }
.leaflet-container:focus-visible { outline: 3px solid var(--me); outline-offset: -3px; }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.45) !important; color: #bbb !important; font-size: 10px; }
.leaflet-control-attribution a { color: #ddd !important; }

/* hex states */
.here { animation: march 1s linear infinite; transition: fill-opacity 0.25s linear; }   /* the tile you're standing in */
@keyframes march { to { stroke-dashoffset: -20; } }
.sel { animation: sel 1.4s ease-in-out infinite; }                                       /* the tile you tapped */
@keyframes sel { 50% { stroke-opacity: 0.45; } }
.captured { animation: captured 1s ease-out forwards; }                                 /* just claimed */
@keyframes captured { from { fill-opacity: 0.85; stroke-width: 8; } to { fill-opacity: 0; stroke-width: 2; } }
.fog { transition: fill-opacity 0.4s; }

.me-marker { width: 20px; height: 20px; border-radius: 50%; background: var(--me); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5); position: relative; }
.me-marker::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--me); animation: pulse 2s ease-out infinite; }
.me-marker.stale { background: var(--muted); }
.me-marker.stale::after { display: none; }
@keyframes pulse { to { transform: scale(2.6); opacity: 0; } }

.burst { position: relative; width: 0; height: 0; }
.burst::before { content: ""; position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 4px solid var(--c); animation: ring 1.2s ease-out forwards; }
.burst span { position: absolute; left: -40px; width: 80px; text-align: center; top: -12px; font: 700 22px var(--display); color: var(--c); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); animation: rise 1.4s ease-out forwards; }
@keyframes ring { to { transform: scale(9); opacity: 0; } }
@keyframes rise { to { transform: translateY(-60px); opacity: 0; } }

.zone-tip { background: #f43f5e; color: #fff; border: 0; font-weight: 700; box-shadow: none; }
.zone-tip::before { display: none; }

/* landmarks: tier = ring colour + size + label in the sheet (never colour alone) */
.lm { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; background: #fff;
      border: 3px solid var(--t); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); cursor: pointer; transition: transform var(--fast) var(--ease); }
.lm:hover, .lm.picked { transform: scale(1.2); }
.lm.common { --t: #4ade80; } .lm.rare { --t: #38bdf8; } .lm.epic { --t: #a855f7; }
.lm.legendary { --t: #fbbf24; width: 38px; height: 38px; font-size: 19px; animation: shine 2.5s ease-in-out infinite; }
@keyframes shine { 50% { box-shadow: 0 0 18px var(--t), 0 2px 6px rgba(0, 0, 0, 0.4); } }
.lm.visited { opacity: 0.6; filter: saturate(0.5); }
.lm.visited::after { content: "✓"; position: absolute; transform: translate(12px, -12px); background: #16a34a; color: #fff; border-radius: 50%;
                     width: 15px; height: 15px; font: 800 10px/15px var(--font); text-align: center; }
.tier { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font: 800 10px var(--font); text-transform: uppercase; letter-spacing: 0.5px; color: #0b1020; }
.tier.common { background: #4ade80; } .tier.rare { background: #38bdf8; } .tier.epic { background: #c084fc; } .tier.legendary { background: #fbbf24; }

/* ---------- layout ---------- */
@media (max-width: 560px) {
  #fabs { top: calc(var(--top) + 64px); transform: none; }   /* clear of the bottom sheet */
  .panel { right: 72px; left: 12px; width: auto; top: calc(var(--top) + 64px); transform: none; }
  /* dialogs become bottom sheets, in thumb reach */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; }
  dialog[open] { animation: rise-in var(--mid) var(--ease); }
  .gps span { display: none; }   /* dot only on small phones; the card spells problems out */
  .gps[data-s=denied] span, .gps[data-s=lost] span, .gps[data-s=offline] span { display: inline; }
}
@media (max-width: 899px) {
  .leaflet-bottom { bottom: calc(var(--dock-h, 80px) + var(--bottom) + 4px); }
  .leaflet-control-attribution { max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px; cursor: pointer; border-radius: 6px 0 0 0; }
  .leaflet-control-attribution.open { max-width: calc(100vw - 24px); white-space: normal; }
}
@media (min-width: 900px) {
  /* desktop: the dock becomes a left-hand column so the map keeps its full width */
  #dock { left: 16px; right: auto; width: 380px; margin: 0; }
  #viewing { left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
