/* Shared look: full-screen map, top bar, bottom sheet, toasts. Games override the variables in their app.css. */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1f2630;
  --line: #2d3540;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #58a6ff;
  --accent-ink: #0d1117;
  --good: #3fb950;
  --bad: #f85149;
  --warn: #d29922;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--font);
  --top-h: 52px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
body { overflow: hidden; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: .4em 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.hidden { display: none !important; }

#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { font-size: 10px; }
/* above the dock (the game's main buttons) */
.maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: 0 10px; padding-top: env(safe-area-inset-top);
  background: linear-gradient(to bottom, rgba(13, 17, 23, .92), rgba(13, 17, 23, .65));
  backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 600 17px var(--display); white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
.top-items { flex: 1; display: flex; gap: 6px; justify-content: flex-end; align-items: center; overflow-x: auto; scrollbar-width: none; }
.top-items::-webkit-scrollbar { display: none; }
.top-btn, .pill {
  border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px;
  height: 34px; min-width: 34px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 13px var(--font); cursor: pointer; white-space: nowrap;
}
.pill .v { color: var(--accent); }
.avatar { font-size: 18px; line-height: 1; }

/* ---------- map buttons ---------- */
.map-btns { position: fixed; right: 12px; bottom: calc(116px + env(safe-area-inset-bottom)); z-index: 15; display: flex; flex-direction: column; gap: 10px; }
.map-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font-size: 20px; display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}

/* ---------- bottom dock (the game's main action) ---------- */
.dock {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; gap: 10px; width: min(560px, calc(100% - 24px)); justify-content: center;
}
.dock > button { flex: 1; height: 54px; font-size: 16px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }

/* ---------- buttons, inputs ---------- */
button { font: 600 14px var(--font); cursor: pointer; border-radius: 10px; border: 1px solid var(--line); padding: 9px 14px; color: var(--text); background: var(--panel-2); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.ghost { background: transparent; }
button.danger { background: transparent; color: var(--bad); border-color: rgba(248, 81, 73, .4); }
button.small { padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
button.busy { position: relative; color: transparent !important; }
button.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text); border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input, select, textarea {
  width: 100%; font: 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 4px 0 8px;
}
input[type=checkbox] { width: auto; margin: 3px 8px 0 0; }
label { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
label.check { display: flex; align-items: flex-start; color: var(--text); font-size: 14px; margin: 8px 0 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 140px; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 12px 0; background: rgba(255, 255, 255, .02); }
details summary { cursor: pointer; color: var(--muted); margin: 10px 0; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.chip.sanct { color: #c9c1a8; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.stat { background: var(--panel-2); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-family: var(--display); }
.stat span { color: var(--muted); font-size: 12px; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.tabs { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; }
.tabs button { flex: none; border-radius: 999px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.links { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* ---------- bottom sheet ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-height: 82vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-top-left-radius: 20px; border-top-right-radius: 20px; border: 1px solid var(--line);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .5); transform: translateY(105%); transition: transform .22s ease-out;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet.open { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 6px; cursor: pointer; }
.sheet-x { position: absolute; z-index: 3; top: 8px; right: 10px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); padding: 4px 8px; }
.sheet-body { padding-top: 6px; }
@media (min-width: 760px) {
  .sheet { left: auto; right: 16px; bottom: 16px; top: calc(var(--top-h) + 12px); width: 420px; max-height: none; border-radius: 18px; transform: translateX(110%); }
  .sheet.wide { width: 560px; }
  .sheet.open { transform: none; }
  .dock { left: calc(50% - 220px); }
}

/* ---------- place header ---------- */
.place-photo { margin: 0 -16px 10px; position: relative; }
.place-photo img { width: 100%; max-height: 220px; object-fit: cover; display: block; }
.place-photo figcaption { position: absolute; right: 6px; bottom: 6px; font-size: 10px; background: rgba(0, 0, 0, .55); padding: 2px 6px; border-radius: 6px; color: #ddd; }
.place-photo figcaption a { color: #ddd; }
.place-title h2 { margin-bottom: 4px; padding-right: 26px; }
.place-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.place-desc { color: var(--muted); font-size: 14px; }
.place-wiki { font-size: 13px; }

/* ---------- toasts, banners, modal ---------- */
#toasts { position: fixed; top: calc(var(--top-h) + 10px); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); transition: opacity .35s, transform .35s; }
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-8px); }
.gps-banner { position: fixed; top: calc(var(--top-h) + 8px); left: 12px; right: 12px; z-index: 14; text-align: center; font-size: 13px; padding: 7px 12px; border-radius: 10px; background: rgba(210, 153, 34, .16); border: 1px solid rgba(210, 153, 34, .5); color: #f0d48a; margin: 0 auto; max-width: 520px; }
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; max-width: 380px; width: 100%; }

/* ---------- text pages ---------- */
body.page { overflow: auto; }
.page-wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; }
.page-wrap h1 { font-size: 1.8rem; }
.page-wrap h2 { margin-top: 1.6em; }
.page-wrap table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0; }
.page-wrap td, .page-wrap th { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.page-nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; margin-bottom: 20px; }
