:root {
  --bg: #07080d;
  --bg-2: #0d1018;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.1);
  --stroke-2: rgba(255, 255, 255, 0.16);
  --text: #f4f6fb;
  --muted: #8f97ab;
  --accent: #ffd60a;
  --accent-2: #ff9f0a;
  --accent-ink: #1a1405;
  --danger: #ff3b5c;
  --ok: #30d158;
  --warn: #ff9f0a;
  --border-red: #ff1f3d;
  --me: #ffd60a;
  --glass: rgba(14, 17, 26, 0.72);
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body { overflow: hidden; }

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.02em; }
h2 { font-size: 30px; }
h3 { font-size: 22px; margin-bottom: 8px; }
p { margin: 0; }

.small { font-size: 13px; }
.muted { color: var(--muted); line-height: 1.45; }
.error { color: var(--danger); text-align: center; font-weight: 600; font-size: 14px; }
.fine { color: var(--muted); font-size: 12px; text-align: center; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic.sm { width: 14px; height: 14px; }

/* ---------- schermen ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: none;
  background:
    radial-gradient(900px 500px at 110% -10%, rgba(120, 80, 255, 0.18), transparent 60%),
    radial-gradient(700px 500px at -20% 110%, rgba(0, 200, 160, 0.14), transparent 60%),
    var(--bg);
}
.screen.active { display: flex; animation: screen-in 0.28s ease-out; }
.screen.center {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
}
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen.scroll.active { display: block; }
.screen.full.active { display: block; }
.screen.full { background: var(--bg-2); }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
.stack.wide { max-width: none; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- kaarten / panelen ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 18px;
}
.glass-card {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* ---------- knoppen ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 16px; }
.btn.xl { min-height: 64px; font-size: 19px; border-radius: 18px; }
.btn.xl .ic { width: 22px; height: 22px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(255, 170, 10, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn.glass {
  background: var(--surface-2);
  border-color: var(--stroke);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn.ghost { background: transparent; color: var(--muted); min-height: 44px; }
.btn.light { background: #fff; color: #111; }
.btn.ghost-light { background: transparent; color: rgba(255, 255, 255, 0.8); }
.btn.danger-solid { background: rgba(255, 59, 92, 0.14); color: #ff6b85; border-color: rgba(255, 59, 92, 0.3); }
.btn.left { justify-content: flex-start; text-align: left; }
.btn.left span { display: flex; flex-direction: column; }
.btn.left small { color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.btn.grow { flex: 1.4; }

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  flex: none;
  transition: transform 0.12s ease;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.lg { width: 50px; height: 50px; border-radius: 16px; }
.icon-btn.glassy {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.icon-btn.top-left { position: absolute; top: calc(16px + var(--safe-top)); left: 16px; }

.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
}
.chip .ic { width: 16px; height: 16px; }
.chip.danger { color: #ff6b85; border-color: rgba(255, 59, 92, 0.3); background: rgba(255, 59, 92, 0.08); }

/* ---------- invoer ---------- */

.field {
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--stroke-2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field::placeholder { color: rgba(255, 255, 255, 0.28); }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 214, 10, 0.15); }
.code-field {
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.35em;
  padding-left: calc(18px + 0.35em);
  font-size: 36px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---------- beginscherm ---------- */

.home { overflow: hidden; }
.home-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.home::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side at 50% 45%, rgba(7, 8, 13, 0.82), rgba(7, 8, 13, 0.35) 70%, rgba(7, 8, 13, 0.1));
  pointer-events: none;
}
.home-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 44px;
}
.home-inner .stack { max-width: none; }
.brand { text-align: center; }
.brand-kicker {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-size: 14px;
  color: var(--muted);
  margin-left: 0.5em;
}
.brand-title {
  font-size: clamp(64px, 20vw, 92px);
  line-height: 0.88;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin: 10px 0 18px;
  background: linear-gradient(120deg, #ffe45c 0%, #ff9f0a 35%, #ff4fd8 70%, #7d6bff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 30px rgba(255, 120, 60, 0.25));
}
.brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-weight: 600;
  color: #c9cfdd;
}
.live-dot, .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.6);
  animation: ping 1.8s infinite;
}
@keyframes ping {
  70% { box-shadow: 0 0 0 8px rgba(48, 209, 88, 0); }
  100% { box-shadow: 0 0 0 0 rgba(48, 209, 88, 0); }
}

/* ---------- join flow ---------- */

.flow-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 22px 22px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
}
.flow-card .btn { margin-top: 6px; }
.step { display: flex; gap: 6px; }
.step span { height: 4px; flex: 1; border-radius: 4px; background: var(--surface-2); }
.step span.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- kaarten (Leaflet) ---------- */

.map { position: absolute; inset: 0; background: #dfe3e8; }
html[data-mapstyle="dark"] .map { background: #11141b; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.75) !important;
  border-radius: 8px 0 0 0;
  padding: 1px 6px;
}
html[data-mapstyle="dark"] .leaflet-control-attribution { background: rgba(0, 0, 0, 0.55) !important; color: #aaa; }
html[data-mapstyle="dark"] .leaflet-control-attribution a { color: #ddd; }
.leaflet-bar { border: 0 !important; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important; border-radius: 16px !important; overflow: hidden; }
.leaflet-bar a {
  width: 50px !important;
  height: 46px !important;
  line-height: 46px !important;
  font-size: 22px !important;
  background: var(--glass) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--stroke) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.leaflet-bar a:last-child { border-bottom: 0 !important; }
.leaflet-bottom.leaflet-left { margin-bottom: calc(var(--safe-bottom) + 6px); }

.vertex-icon {
  width: 22px !important;
  height: 22px !important;
  margin: -11px 0 0 -11px !important;
  border-radius: 50%;
  background: #fff;
  border: 5px solid var(--border-red);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
}
.mid-icon {
  width: 20px !important;
  height: 20px !important;
  margin: -10px 0 0 -10px !important;
  border-radius: 50%;
  background: rgba(255, 31, 61, 0.9);
  border: 2px solid #fff;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Kop van een lijn (de speler) */
.head-icon { position: relative; }
.head-dot {
  position: absolute;
  left: -9px;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 16px var(--c);
}
.head-icon.me .head-dot { width: 22px; height: 22px; left: -11px; top: -11px; animation: me-pulse 1.6s infinite; }
@keyframes me-pulse {
  0% { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 0 0 var(--c); }
  70% { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 0 14px transparent; }
  100% { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 0 0 transparent; }
}
.head-name {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 12, 18, 0.82);
  border-radius: 999px;
  padding: 3px 9px;
  pointer-events: none;
}
.head-icon.gps-lost .head-dot { opacity: 0.45; border-style: dashed; animation: lost-blink 1.2s infinite; }
.head-icon.gps-lost .head-name { background: rgba(255, 159, 10, 0.92); color: #1a1405; }
@keyframes lost-blink { 50% { opacity: 0.15; } }
.head-icon.dead .head-dot { background: #777; border-color: #ccc; box-shadow: none; animation: none; width: 12px; height: 12px; left: -6px; top: -6px; }
.head-icon.dead .head-name { opacity: 0.6; text-decoration: line-through; }

.player-pin {
  width: 16px !important;
  height: 16px !important;
  margin: -8px 0 0 -8px !important;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
}

/* ---------- zwevende panelen op kaarten ---------- */

.float-top, .float-bottom {
  position: absolute;
  z-index: 1000;
  left: 12px;
  right: 12px;
}
.float-top { top: calc(var(--safe-top) + 12px); }
.float-bottom { bottom: calc(var(--safe-bottom) + 12px); }
.editor-head, .mapview-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 14px 18px; }
.editor-head > div, .mapview-head > div { flex: 1; min-width: 0; }
.mapview-head { align-items: center; }
.editor-title { font-family: var(--display); font-size: 20px; font-weight: 700; margin-top: 2px; }
.editor-hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.4; }
.bar { display: flex; gap: 8px; padding: 8px; border-radius: 22px; }
.bar .btn { flex: 1; padding: 10px 12px; }
#screen-editor .leaflet-bottom.leaflet-left { margin-bottom: calc(var(--safe-bottom) + 84px); }
#screen-editor .leaflet-control-attribution { margin-bottom: calc(var(--safe-bottom) + 78px); }

/* ---------- lobby ---------- */

.lobby {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 16px calc(130px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.not-host .lobby { padding-bottom: calc(40px + var(--safe-bottom)); }
.lobby-top { display: flex; align-items: center; justify-content: space-between; min-height: 40px; }

.code-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 18px 22px;
  background:
    linear-gradient(135deg, rgba(255, 214, 10, 0.14), rgba(255, 79, 216, 0.08)),
    var(--surface);
  border-color: rgba(255, 214, 10, 0.25);
}
.code {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  margin-top: 6px;
  color: var(--accent);
  user-select: all;
}

.banner {
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.3);
  color: #ffd29a;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
}

.field-card { display: flex; align-items: center; gap: 16px; padding: 12px; cursor: pointer; transition: background 0.2s; }
.field-card:active { background: var(--surface-2); }
.minimap { position: relative; width: 96px; height: 96px; border-radius: 14px; overflow: hidden; flex: none; pointer-events: none; }
.field-info { flex: 1; min-width: 0; }
.field-size { font-family: var(--display); font-size: 20px; font-weight: 700; margin: 2px 0 4px; }
.chevron { color: var(--muted); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.gps-mine { font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.players li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 10px 10px 10px 12px;
  animation: screen-in 0.25s ease-out;
}
.players li.me { border-color: rgba(255, 255, 255, 0.22); background: var(--surface-2); }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  color: rgba(0, 0, 0, 0.72);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), 0 6px 18px -6px var(--c);
  background: var(--c);
}
.pmain { flex: 1; min-width: 0; }
.pname { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { display: flex; gap: 6px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #c9cfdd;
}
.badge .ic { width: 12px; height: 12px; }
.badge.host { background: rgba(255, 214, 10, 0.15); color: var(--accent); }
.badge.off { background: rgba(255, 59, 92, 0.12); color: #ff8098; }
.players li.offline .avatar, .players li.offline .pname { opacity: 0.45; }

.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.signal i { width: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.signal i:nth-child(1) { height: 5px; }
.signal i:nth-child(2) { height: 9px; }
.signal i:nth-child(3) { height: 14px; }
.signal.s1 i:nth-child(-n+1), .signal.s2 i:nth-child(-n+2), .signal.s3 i:nth-child(-n+3) { background: var(--ok); }
.signal.s1 i:nth-child(-n+1) { background: var(--warn); }
.gps-txt { font-size: 11px; color: var(--muted); font-weight: 600; }

.kick {
  appearance: none;
  border: 1px solid rgba(255, 59, 92, 0.25);
  background: rgba(255, 59, 92, 0.08);
  color: #ff6b85;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.tip {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  padding: 0 4px;
}
.wait-host {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 14px;
}
.not-host .host-only, .is-host .guest-only { display: none !important; }

.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 55%, rgba(7, 8, 13, 0));
  display: flex;
  justify-content: center;
  z-index: 10;
}
.sticky-cta .btn { width: 100%; max-width: 528px; }

/* ---------- spel ---------- */

.frame {
  position: absolute;
  inset: 0;
  z-index: 900;
  pointer-events: none;
  border-radius: 0;
  box-shadow: inset 0 0 0 7px var(--me), inset 0 0 40px 6px color-mix(in srgb, var(--me) 45%, transparent);
  transition: box-shadow 0.4s;
}
.hud {
  position: absolute;
  z-index: 1000;
  top: calc(var(--safe-top) + 16px);
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-card { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 18px; }
.hud-me { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.hud-me .swatch { width: 12px; height: 12px; border-radius: 50%; background: var(--me); box-shadow: 0 0 10px var(--me); }
.hud-me span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-status { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 3px; }
.hud-dots { display: flex; gap: 4px; margin-top: 7px; flex-wrap: wrap; }
.hud-dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--c); }
.hud-dots i.dead { opacity: 0.22; }
.gps-chip {
  position: absolute;
  z-index: 1000;
  left: 16px;
  top: calc(var(--hud-bottom, calc(var(--safe-top) + 94px)) + 10px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #d4d9e4;
}
.map-tools {
  position: absolute;
  z-index: 1000;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 30px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#screen-game .leaflet-bottom.leaflet-left { margin-bottom: calc(var(--safe-bottom) + 24px); margin-left: 6px; }

.dead-banner {
  position: absolute;
  z-index: 1000;
  top: calc(var(--hud-bottom, calc(var(--safe-top) + 94px)) + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(40, 40, 46, 0.92);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow);
}
#screen-game.is-dead .gps-chip { display: none; }
#screen-game.is-dead:not(.spectating) .map { filter: grayscale(0.9) brightness(0.9); }
#screen-game.is-dead .frame { box-shadow: inset 0 0 0 7px #6b6f78; }

.gps-lost {
  position: absolute;
  z-index: 1050;
  left: 16px;
  right: 80px;
  bottom: calc(var(--safe-bottom) + 30px);
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255, 159, 10, 0.95);
  color: #1a1405;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.gps-lost .ic { width: 24px; height: 24px; margin-top: 2px; animation: lost-blink 1.2s infinite; }
.gps-lost b { display: block; font-size: 15px; }
.gps-lost span { display: block; font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
#screen-game:has(.gps-lost:not([hidden])) .leaflet-bottom.leaflet-left { display: none; }

.warning {
  position: absolute;
  z-index: 1100;
  left: 16px;
  right: 16px;
  top: calc(var(--hud-bottom, calc(var(--safe-top) + 94px)) + 52px);
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255, 38, 76, 0.96), rgba(200, 0, 50, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 16px 40px rgba(255, 0, 60, 0.4);
  animation: shake 1s infinite;
  pointer-events: none;
}
@keyframes shake {
  0%, 100% { transform: none; }
  10%, 30% { transform: translateX(-3px); }
  20%, 40% { transform: translateX(3px); }
  50% { transform: scale(1.015); }
}
.warning-ring { position: relative; width: 64px; height: 64px; flex: none; }
.warning-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.warning-ring circle { fill: none; stroke-width: 4; }
.warning-ring .track { stroke: rgba(255, 255, 255, 0.25); }
.warning-ring .arc { stroke: #fff; stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke-dashoffset 0.25s linear; }
.warning-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
}
.warning-text { font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.15; text-transform: uppercase; }

.countdown {
  position: absolute;
  z-index: 1100;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle, rgba(7, 8, 13, 0.55), rgba(7, 8, 13, 0.85));
  pointer-events: none;
}
.countdown-num {
  font-family: var(--display);
  font-size: 160px;
  font-weight: 700;
  line-height: 1;
  color: var(--me);
  text-shadow: 0 0 60px var(--me);
  animation: pop 1s ease-out infinite;
}
@keyframes pop {
  0% { transform: scale(1.35); opacity: 0.3; }
  25% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.85; }
}
.countdown-sub { color: #fff; font-weight: 700; font-size: 17px; }

.dead-overlay {
  position: absolute;
  z-index: 1200;
  inset: 0;
  background: rgba(58, 60, 66, 0.9);
  backdrop-filter: grayscale(1) blur(2px);
  -webkit-backdrop-filter: grayscale(1) blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  animation: screen-in 0.4s ease-out;
}
.dead-icon { width: 64px; height: 64px; color: rgba(255, 255, 255, 0.85); stroke-width: 1.6; }
.dead-title { font-family: var(--display); font-size: 72px; font-weight: 700; color: #fff; letter-spacing: -0.04em; line-height: 1; }
.dead-reason { font-size: 17px; color: #d8dbe2; margin-bottom: 18px; }
.dead-overlay .stack { max-width: 300px; }

/* ---------- uitslag ---------- */

.result {
  position: relative;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(34px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.result-badge {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  color: var(--muted);
}
.result-badge .ic { width: 42px; height: 42px; stroke-width: 1.8; }
.result-badge.win {
  background: linear-gradient(135deg, #ffe45c, #ff9f0a);
  color: #2a1c00;
  border: 0;
  box-shadow: 0 0 0 8px rgba(255, 214, 10, 0.12), 0 20px 60px rgba(255, 170, 10, 0.5);
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-6px) rotate(-3deg); } }
.result-title { font-family: var(--display); font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.result-title.victory {
  font-size: clamp(56px, 17vw, 76px);
  background: linear-gradient(90deg, #ffe45c, #ff9f0a, #ff4fd8, #7d6bff, #00e5ff, #ffe45c);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 5s linear infinite;
}
@keyframes shine { to { background-position: 300% 0; } }
.result-sub { color: var(--muted); font-size: 16px; line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.stat { background: var(--surface); border: 1px solid var(--stroke); border-radius: 16px; padding: 12px 8px; }
.stat b { display: block; font-family: var(--display); font-size: 22px; }
.stat span { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.image-card { width: 100%; padding: 6px; overflow: hidden; }
.result-image { display: block; width: 100%; border-radius: 15px; }
.image-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 220px;
  color: var(--muted);
  font-weight: 600;
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-top-color: #111; }
@keyframes spin { to { transform: rotate(360deg); } }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  animation: fade 0.2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%;
  max-width: 440px;
  background: #141822;
  border: 1px solid var(--stroke);
  border-radius: 26px;
  padding: 10px 20px 20px;
  box-shadow: var(--shadow);
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); margin: 0 auto 16px; }
.sheet p { color: #c4cad8; margin: 0 0 18px; line-height: 1.45; }
.sheet .field { margin: 6px 0 16px; }
.fullmodal { padding: 0; background: var(--bg); backdrop-filter: none; }

.pocket {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  text-align: center;
  user-select: none;
}
.pocket-text { font-weight: 700; display: flex; flex-direction: column; gap: 6px; }

.toast {
  position: fixed;
  z-index: 6000;
  left: 50%;
  top: calc(var(--safe-top) + 14px);
  transform: translateX(-50%);
  background: rgba(250, 251, 255, 0.96);
  color: #111;
  font-weight: 700;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 16px;
  max-width: calc(100% - 32px);
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.25s ease-out;
}
@keyframes toast-in { from { transform: translate(-50%, -12px); opacity: 0; } }
.conn {
  position: fixed;
  z-index: 6000;
  bottom: calc(var(--safe-bottom) + 14px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--warn);
  color: #111;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

/* ---------- power-ups ---------- */

.pu-ic {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2b3142, #12151d);
  border: 3px solid #ff8a00;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(255, 138, 0, 0.45);
  color: #fff;
}
.pu-ic svg {
  width: 58%;
  height: 58%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pu-ic svg .fill, .pu-ic .fill { fill: currentColor; stroke: none; }
.pu-ic.sm { --size: 20px; border-width: 2px; box-shadow: none; }
.pu-ic.lg { --size: 56px; }
.pu-ic.xl { --size: 64px; }

/* Power-up op de kaart */
.pu-item { position: relative; }
.pu-item .pu-ic {
  position: absolute;
  left: -20px;
  top: -20px;
  animation: pu-bob 2.4s ease-in-out infinite;
}
.pu-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: -26px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #ff8a00;
  animation: pu-ping 2.4s ease-out infinite;
  pointer-events: none;
}
.pu-item.placing::before { display: none; }
@keyframes pu-bob { 50% { transform: translateY(-4px); } }
@keyframes pu-ping {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Inventaris onderin */
.pu-bar {
  position: absolute;
  z-index: 1040;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 26px);
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 24px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.pu-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  animation: pu-new 0.4s ease-out;
}
.pu-btn:active { transform: scale(0.92); }
@keyframes pu-new { from { transform: scale(0.3); opacity: 0; } }
.gps-lost { bottom: calc(var(--safe-bottom) + 104px); }

/* Lopende effecten in de HUD */
.hud-effects { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.fx-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e6e9f2;
}
.fx-chip .fx-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-chip .fx-time { font-variant-numeric: tabular-nums; color: #ffb340; }
.fx-chip.hit { color: #ffd29a; }

/* Keuzevenster */
.pu-sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.pu-sheet-head h3 { margin: 2px 0 0; }
.target-btn { gap: 12px; }
.avatar.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 15px; }
.wide-btn { width: 100%; margin-top: 8px; }

/* Plek kiezen op de kaart */
#screen-game.placing .hud,
#screen-game.placing .map-tools,
#screen-game.placing .gps-chip,
#screen-game.placing .gps-lost,
#screen-game.placing .dead-banner,
#screen-game.placing .warning { display: none !important; }
.placer-head { padding: 14px 18px; }
.wall-handle { position: relative; }
.wall-handle::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.wall-handle.move::after { left: -12px; top: -12px; width: 24px; height: 24px; border: 4px solid #111; }
.wall-handle.rotate::after { left: -11px; top: -11px; width: 22px; height: 22px; border: 4px solid #ff8a00; }

/* Gespiegeld (Mirrored) */
#game-map.mirrored { transform: scaleX(-1); }

/* Ghost en chonker op de kaart */
.head-icon.ghost .head-dot { opacity: 0.4; border-style: dashed; box-shadow: none; }
.head-icon.ghost .head-name::after { content: " · ghost"; }
.head-icon.chonk .head-dot { width: 30px; height: 30px; left: -15px; top: -15px; border-width: 4px; }
.head-icon.chonk .head-name { bottom: 20px; }
.head-icon.chonk .head-name::after { content: " · chonker"; }

/* Effecten op de kaart */
.nuke-fx { animation: nuke 2.6s ease-out forwards; transform-box: fill-box; transform-origin: center; }
@keyframes nuke {
  0% { opacity: 0; transform: scale(0.2); }
  15% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.25); }
}
.nolines-zone { animation: zone-pulse 2s ease-in-out infinite; }
@keyframes zone-pulse { 50% { stroke-opacity: 0.45; } }
.zone-label {
  background: rgba(0, 229, 255, 0.92);
  border: 0;
  color: #002a30;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 10px;
  box-shadow: none;
}
.zone-label::before { display: none; }

/* ---------- speelveld-tools ---------- */

.field-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  padding: 2px 0;
  margin-top: 2px;
  border: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
  background: transparent;
}
.field-name:focus { border-bottom-color: var(--accent); box-shadow: none; }
.field-area { text-transform: none; letter-spacing: 0; font-weight: 600; }
.field-area.warn { color: var(--warn); }
.tool-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tool-row::-webkit-scrollbar { display: none; }
.chip.glassy {
  flex: none;
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  padding: 9px 13px;
}
.sheet.tall { max-height: 80vh; display: flex; flex-direction: column; }
.results { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; margin-bottom: 4px; }
.result-item, .saved-item {
  appearance: none;
  text-align: left;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 14px;
  font: inherit;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.result-item b, .saved-item b { display: block; font-size: 15px; }
.result-item span, .saved-item span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.saved-row { display: flex; gap: 8px; align-items: center; }
#field-search .field { margin: 6px 0 12px; }

/* ---------- spelinstellingen ---------- */

.settings-btn small { display: block; }
.settings-modal { flex-direction: column; align-items: stretch; justify-content: flex-start; }
.settings-modal:not([hidden]) { display: flex; }
.settings-head {
  padding: calc(18px + var(--safe-top)) 20px 12px;
  border-bottom: 1px solid var(--stroke);
}
.settings-head h2 { margin: 2px 0 4px; }
.settings-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 16px 24px; }
.settings-foot {
  display: flex;
  gap: 8px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--stroke);
  background: var(--bg-2);
}
.settings-foot .btn { flex: 1; padding: 10px; }
.settings-foot .btn.grow { flex: 1.6; }
.set-section { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.set-title { font-family: var(--display); font-weight: 700; font-size: 18px; }
.set-hint { color: var(--muted); font-size: 13px; margin-top: -4px; }
.set-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 12px 14px;
}
.set-label { font-size: 14px; font-weight: 600; color: #d8dce6; }
.set-value { font-variant-numeric: tabular-nums; color: var(--accent); font-size: 15px; }
.set-row input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); height: 28px; }
.set-row input:disabled { opacity: 0.5; }
.set-master, .pu-card-head { display: flex; align-items: center; gap: 12px; }
.set-master {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 14px;
}
.set-master > div, .pu-card-text { flex: 1; min-width: 0; }
.set-master span, .pu-card-desc { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.35; }
.pu-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 138, 0, 0.35);
  background: rgba(255, 138, 0, 0.05);
  border-radius: 18px;
  padding: 12px;
}
.pu-card.off { border-color: var(--stroke); background: transparent; }
.pu-card.off .pu-ic { filter: grayscale(1); opacity: 0.5; }
.pu-card .set-row { background: rgba(0, 0, 0, 0.18); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s;
  cursor: pointer;
}
.switch .slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: 0.5; cursor: default; }
