:root {
  --bg: #090b11;
  --panel: rgba(21, 25, 36, .82);
  --panel-strong: #151924;
  --text: #f5f7fb;
  --muted: #929aab;
  --line: rgba(255,255,255,.09);
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #fb5471;
  --success: #4ade80;
  --warning: #f6c85f;
  --shadow: 0 22px 70px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(139,92,246,.20), transparent 34rem),
    radial-gradient(circle at 90% 30%, rgba(34,211,238,.12), transparent 36rem),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(9,11,17,.74);
}
.brand { display: inline-flex; gap: 12px; align-items: center; }
.brand strong { display: block; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; margin-top: 1px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  background: linear-gradient(145deg, #a78bfa, #6d28d9);
  box-shadow: 0 8px 24px rgba(124,58,237,.35), inset 0 1px 0 rgba(255,255,255,.35);
  font-weight: 900;
}
.version { color: var(--muted); font-size: .78rem; }

.page-shell { width: min(1400px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }

.hero {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 40px;
  min-height: 360px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: .94;
  letter-spacing: -.065em;
  margin: 10px 0 22px;
  max-width: 900px;
}
.hero p { color: var(--muted); max-width: 680px; font-size: 1.08rem; line-height: 1.7; }
.eyebrow { color: #b7c0d4; text-transform: uppercase; letter-spacing: .16em; font-size: .68rem; font-weight: 800; }

.radar-orb {
  width: min(310px, 78vw);
  aspect-ratio: 1;
  justify-self: center;
  border: 1px solid rgba(139,92,246,.32);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background:
    repeating-radial-gradient(circle, transparent 0 17%, rgba(255,255,255,.055) 17.4% 17.8%, transparent 18.2% 34%),
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    radial-gradient(circle, rgba(139,92,246,.18), rgba(16,19,27,.85) 68%);
  background-size: auto, 32px 32px, 32px 32px, auto;
  box-shadow: var(--shadow), 0 0 100px rgba(139,92,246,.1);
}
.radar-orb::before, .radar-orb::after {
  content: ""; position: absolute; inset: 50% auto auto 50%; background: rgba(255,255,255,.08);
}
.radar-orb::before { width: 1px; height: 100%; transform: translateY(-50%); }
.radar-orb::after { height: 1px; width: 100%; transform: translateX(-50%); }
.radar-line {
  position: absolute; inset: 50% 50% 0 50%;
  transform-origin: top left;
  width: 50%; height: 50%;
  background: linear-gradient(30deg, rgba(34,211,238,.25), transparent 65%);
  animation: sweep 4.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.radar-dot { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 18px currentColor; }
.dot-a { left: 25%; top: 53%; }
.dot-b { right: 22%; top: 31%; }
.dot-x { width: 34px; height: 34px; display: grid; place-items: center; left: 58%; top: 61%; background: var(--danger); font-weight: 900; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.glass-card {
  background: linear-gradient(180deg, rgba(27,32,45,.88), rgba(15,18,27,.9));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 26px;
}
.glass-card.compact { border-radius: 20px; padding: 20px; }
.card-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.card-heading h2, .glass-card h2, .glass-card h3 { margin: 0; }
.card-heading p, .glass-card p { color: var(--muted); margin: 5px 0 0; line-height: 1.5; }
.step {
  width: 45px; height: 45px; border-radius: 14px; display: grid; place-items: center;
  color: #d8ccff; background: rgba(139,92,246,.13); border: 1px solid rgba(139,92,246,.25);
  font-weight: 800;
}

.form-grid { display: grid; gap: 15px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 7px; color: #bec5d5; font-size: .82rem; font-weight: 700; }
input, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(4,6,11,.56);
  color: var(--text);
  border-radius: 13px;
  padding: 13px 14px;
  outline: none;
}
input:focus, select:focus { border-color: rgba(139,92,246,.72); box-shadow: 0 0 0 3px rgba(139,92,246,.12); }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-weight: 900; }

.btn {
  border: 0;
  color: white;
  border-radius: 14px;
  padding: 13px 17px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(145deg, #9b77fb, #6d3ce8); box-shadow: 0 10px 26px rgba(109,60,232,.28), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-secondary { background: linear-gradient(145deg, #25304a, #1a2032); border: 1px solid rgba(255,255,255,.09); }
.btn-danger { background: linear-gradient(145deg, #ff667f, #d62d50); box-shadow: 0 10px 26px rgba(214,45,80,.20), inset 0 1px 0 rgba(255,255,255,.2); }

.how-it-works { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.how-it-works h3 { font-size: .95rem; }
.how-it-works ol { color: var(--muted); line-height: 1.8; padding-left: 21px; }

.center-card { max-width: 620px; margin: 10vh auto; text-align: center; }

.game-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 18px; }
.game-code { font-size: clamp(2rem, 5vw, 3.8rem); letter-spacing: .14em; font-weight: 900; margin-top: 4px; }
.status-cluster { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border-radius: 999px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); color: #cdd3df; font-size: .76rem; font-weight: 800;
}
.pill.success { color: #b9fbcf; border-color: rgba(74,222,128,.22); background: rgba(74,222,128,.08); }
.pill.warning { color: #ffe4a2; border-color: rgba(246,200,95,.22); background: rgba(246,200,95,.08); }
.pill.danger { color: #ffc0cb; border-color: rgba(251,84,113,.22); background: rgba(251,84,113,.08); }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.map-card {
  min-height: 680px; height: calc(100vh - 180px); position: sticky; top: 92px;
  overflow: hidden; border-radius: 24px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
#map { width: 100%; height: 100%; background: #111722; }
.control-panel { display: grid; gap: 14px; }
.identity { display: flex; align-items: center; gap: 14px; }
.identity h2 { font-size: 1.2rem; margin-top: 4px; }
.identity p { margin-top: 2px; }
.role-badge {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-weight: 1000; font-size: 1.25rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.role-x { background: linear-gradient(145deg, #ff667f, #ca2748); }
.role-detective { background: linear-gradient(145deg, #35c9e6, #1877a5); }

.map-overlay {
  position: absolute; z-index: 500; background: rgba(9,12,18,.88); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.11); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3);
}
.map-overlay.top-left { left: 14px; top: 14px; }
.map-overlay.bottom-left { left: 14px; bottom: 14px; }
.map-overlay strong { display: block; font-size: 1.35rem; }
.map-overlay span { color: #aab2c3; font-size: .72rem; }
.tiny-label { text-transform: uppercase; letter-spacing: .11em; }

.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.count-badge { min-width: 29px; height: 29px; display: grid; place-items: center; background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 10px; font-weight: 800; }
.player-list { display: grid; gap: 8px; margin-top: 14px; }
.player-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 11px; border-radius: 13px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.055); }
.player-meta { display: flex; align-items: center; gap: 9px; min-width: 0; }
.player-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px rgba(34,211,238,.5); }
.player-dot.x { background: var(--danger); box-shadow: 0 0 10px rgba(251,84,113,.5); }
.player-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 750; font-size: .88rem; }
.player-role { color: var(--muted); font-size: .72rem; }

.code-button {
  width: 100%; margin-top: 14px; padding: 15px; border-radius: 14px; border: 1px dashed rgba(139,92,246,.45);
  background: rgba(139,92,246,.08); color: #dacfff; font-size: 1.12rem; font-weight: 900; letter-spacing: .18em; cursor: pointer;
}

.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 2000;
  background: #1b2030; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 14px;
  padding: 12px 15px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease;
  max-width: min(400px, calc(100vw - 36px));
}
.toast.show { opacity: 1; transform: translateY(0); }

.mx-div-icon, .det-div-icon, .ghost-div-icon, .self-div-icon { background: transparent; border: 0; }
.map-marker {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 8px; transform: rotate(-45deg);
  display: grid; place-items: center; border: 2px solid rgba(255,255,255,.88);
  box-shadow: 0 8px 22px rgba(0,0,0,.42);
}
.map-marker span { transform: rotate(45deg); font-size: .72rem; font-weight: 1000; }
.map-marker.mx { background: #e64162; }
.map-marker.det { background: #159ec4; }
.map-marker.self { background: #7d53e6; }
.map-marker.ghost { background: #60697a; opacity: .72; }

.leaflet-control-attribution { background: rgba(9,11,17,.75)!important; color: #aeb4c1!important; }
.leaflet-control-attribution a { color: #c9c0ff!important; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding-top: 16px; }
  .radar-orb { display: none; }
  .home-grid, .game-layout { grid-template-columns: 1fr; }
  .map-card { position: relative; top: auto; height: 58vh; min-height: 440px; }
}
@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1400px); padding-top: 24px; }
  .topbar { height: 64px; padding: 0 13px; }
  .hero { min-height: auto; margin-bottom: 28px; }
  .hero h1 { font-size: clamp(2.6rem, 14vw, 4.3rem); }
  .split { grid-template-columns: 1fr; }
  .glass-card { border-radius: 20px; padding: 19px; }
  .game-head { align-items: start; }
  .game-code { font-size: 2rem; }
  .map-card { border-radius: 19px; min-height: 410px; height: 54vh; }
}

/* 0.2.0 lobby + game-area controls */
.role-host {
  background: linear-gradient(145deg, #f0b85b, #b96f16);
  color: #201404;
}
.role-unassigned {
  background: linear-gradient(145deg, #566076, #303748);
  color: #f3f5fa;
}
.host-chip, .inline-host {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(246,200,95,.26);
  background: rgba(246,200,95,.09);
  color: #ffe1a0;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 4px 7px;
}
.inline-host { margin-left: 5px; vertical-align: 1px; padding: 2px 5px; }
.lobby-control .btn, .capture-card .btn, .share-button { width: 100%; margin-top: 15px; }
.lobby-player-row { align-items: center; }
.player-controls { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.role-select {
  width: auto;
  min-width: 105px;
  border-radius: 10px;
  padding: 8px 9px;
  font-size: .76rem;
  background: rgba(4,6,11,.64);
}
.remove-player {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(251,84,113,.18);
  background: rgba(251,84,113,.07);
  color: #ff9bad;
  font-size: 1.2rem;
  cursor: pointer;
}
.remove-player:hover { background: rgba(251,84,113,.14); }
.qr-wrap {
  margin: 15px auto 8px;
  width: min(190px, 72%);
  aspect-ratio: 1;
  border-radius: 18px;
  overflow: hidden;
  background: white;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08), 0 12px 28px rgba(0,0,0,.24);
}
.join-qr { display: block; width: 100%; height: 100%; }
.join-card h1 { margin: 8px 0 6px; }
.join-code { margin: 10px 0 18px; }
.join-form { margin-top: 22px; text-align: left; }

.area-toolbar {
  right: 14px;
  bottom: 14px;
  left: auto;
  max-width: min(440px, calc(100% - 28px));
}
.toolbar-buttons { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 6px; }
.mini-btn {
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.07);
  color: #e9edf5;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}
.mini-btn:hover, .mini-btn.active { background: rgba(139,92,246,.2); border-color: rgba(139,92,246,.38); }
.mini-btn.accent { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.24); color: #bcf7cf; }
.mini-btn.danger-soft { background: rgba(251,84,113,.08); border-color: rgba(251,84,113,.18); color: #ffb5c1; }
.mini-btn:disabled { opacity: .38; cursor: not-allowed; }
.area-toolbar small { display: block; color: #949db0; line-height: 1.35; max-width: 390px; }
.reveal-live { border-color: rgba(251,84,113,.55)!important; box-shadow: 0 12px 34px rgba(251,84,113,.18); }
.reveal-live strong { color: #ff8ca0; }

@media (max-width: 620px) {
  .lobby-player-row { align-items: flex-start; gap: 8px; }
  .player-controls { flex-direction: column; align-items: stretch; }
  .role-select { min-width: 96px; padding: 7px 8px; }
  .remove-player { width: 100%; height: 30px; }
  .area-toolbar { right: 9px; bottom: 9px; left: 9px; max-width: none; }
  .map-overlay.bottom-left { bottom: 148px; }
  .toolbar-buttons { gap: 5px; }
  .mini-btn { padding: 7px 8px; }
}

/* 0.3.0 live controls, timeline and abilities */
.host-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.host-actions .btn { width: 100%; margin-top: 0; }
.host-actions .btn:first-child:last-child { grid-column: 1 / -1; }

.ability-card { border-color: rgba(139,92,246,.22); }
.ability-card .btn { width: 100%; margin-top: 15px; }
.ability-card h3 { margin-top: 5px; }

.event-list { display: grid; gap: 8px; margin-top: 14px; max-height: 320px; overflow: auto; padding-right: 2px; }
.event-row {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  border-radius: 13px;
  background: rgba(255,255,255,.032);
  border: 1px solid rgba(255,255,255,.05);
}
.event-symbol {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(139,92,246,.11);
  color: #d7caff;
  font-weight: 900;
}
.event-copy { min-width: 0; }
.event-copy strong { display: block; font-size: .78rem; line-height: 1.35; font-weight: 700; }
.event-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .66rem; }
.event-empty { color: var(--muted); font-size: .8rem; padding: 8px 2px; }
.event-capture .event-symbol { background: rgba(74,222,128,.12); color: #bdf7cf; }
.event-game_aborted .event-symbol, .event-game_ended .event-symbol { background: rgba(251,84,113,.10); color: #ffb5c1; }
.event-cloak .event-symbol { background: rgba(251,84,113,.10); color: #ffb5c1; }
.event-scanner .event-symbol { background: rgba(34,211,238,.10); color: #baf5ff; }

.reveal-suppressed { border-color: rgba(139,92,246,.55)!important; box-shadow: 0 12px 34px rgba(139,92,246,.18); }
.reveal-suppressed strong { color: #c7b5ff; }

@media (max-width: 620px) {
  .host-actions { grid-template-columns: 1fr; }
  .event-list { max-height: 260px; }
}

/* 0.4.0 Traccar tracking + replay */
.tracking-chip {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: #b7c0d4;
  font-size: .6rem;
  font-weight: 900;
  vertical-align: 1px;
}
.tracking-chip.traccar {
  border-color: rgba(74,222,128,.22);
  background: rgba(74,222,128,.10);
  color: #bdf7cf;
}
.tracking-button {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: #bfc7d8;
  padding: 0 9px;
  font-size: .7rem;
  font-weight: 850;
  cursor: pointer;
}
.tracking-button:hover { background: rgba(255,255,255,.09); }
.tracking-button.active {
  border-color: rgba(74,222,128,.24);
  background: rgba(74,222,128,.09);
  color: #bdf7cf;
}

.replay-card { border-color: rgba(34,211,238,.15); }
.replay-card > .btn { width: 100%; margin-top: 14px; }
.replay-controls { margin-top: 15px; }
.replay-controls input[type="range"] { padding: 0; accent-color: var(--accent); }
.replay-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; }
#replay-time { color: #d7deec; font-variant-numeric: tabular-nums; font-size: .78rem; font-weight: 800; }
#replay-source { width: auto; padding: 0 8px; font-size: .58rem; letter-spacing: .08em; }

@media (max-width: 620px) {
  .tracking-button { width: 100%; }
  .replay-meta { align-items: stretch; flex-direction: column; }
}

/* 0.5.0 game modes, configurable rules, history and replay events */
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-link {
  color: #c8cfdd;
  font-size: .78rem;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.035);
}
.topbar-link:hover { background: rgba(255,255,255,.075); }
.field-help { color: var(--muted); font-size: .7rem; line-height: 1.4; font-weight: 500; }
.history-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
  padding: 14px 17px;
  border-radius: 16px;
  border: 1px solid rgba(139,92,246,.2);
  background: rgba(139,92,246,.07);
  color: #dcd5f6;
  font-size: .84rem;
}
.history-strip strong { color: white; }

.rules-card { border-color: rgba(246,200,95,.14); }
.rules-card > .btn { width: 100%; margin-top: 14px; }
.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.rules-grid label { font-size: .68rem; }
.rules-grid select { padding: 9px 10px; border-radius: 10px; font-size: .76rem; }
#rule-hint { font-size: .76rem; margin-top: 12px; }

.replay-event-summary {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(34,211,238,.06);
  border: 1px solid rgba(34,211,238,.12);
  color: #b9dfe7;
  font-size: .72rem;
  font-weight: 700;
}
.event-div-icon { background: transparent; border: 0; }
.replay-event-marker {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(18,22,31,.92);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 7px 18px rgba(0,0,0,.38);
  font-size: .78rem;
  font-weight: 1000;
  color: #e8eaf1;
}
.replay-event-marker.event-capture { border-color: rgba(74,222,128,.55); }
.replay-event-marker.event-reveal { border-color: rgba(251,84,113,.55); }
.replay-event-marker.event-reveal_suppressed { border-color: rgba(139,92,246,.65); }
.replay-event-marker.event-scanner { border-color: rgba(34,211,238,.55); }

.stats-card { border-color: rgba(74,222,128,.13); }
.stats-card > .btn { width: 100%; margin-top: 14px; }
.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 13px; }
.mini-stats > div {
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.055);
}
.mini-stats strong { display: block; font-size: .9rem; }
.mini-stats span { display: block; margin-top: 2px; color: var(--muted); font-size: .65rem; }

.history-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.history-head h1 { margin: 7px 0 6px; font-size: clamp(2.2rem, 6vw, 4rem); letter-spacing: -.045em; }
.history-head p { color: var(--muted); margin: 0; max-width: 700px; }
.history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.history-card-head { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.history-card h2 { margin: 5px 0 0; }
.history-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.history-stats > div {
  padding: 11px;
  border-radius: 13px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.055);
}
.history-stats strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.history-stats span { display: block; margin-top: 3px; color: var(--muted); font-size: .64rem; }
.history-distance { margin-top: 14px!important; font-size: .82rem; }
.history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.empty-history { text-align: center; max-width: 700px; margin: 8vh auto; }
.empty-history h2 { margin: 8px 0 7px; }
.empty-history .btn { display: inline-block; margin-top: 18px; }
.event-reveal .event-symbol { background: rgba(251,84,113,.10); color: #ffb5c1; }
.event-reveal_suppressed .event-symbol { background: rgba(139,92,246,.14); color: #d8ccff; }
.event-settings_changed .event-symbol { background: rgba(246,200,95,.10); color: #ffe1a0; }

@media (max-width: 960px) {
  .history-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar-link { display: none; }
  .history-strip, .history-head { align-items: stretch; flex-direction: column; }
  .rules-grid { grid-template-columns: 1fr; }
  .history-stats { grid-template-columns: 1fr 1fr; }
  .history-actions { grid-template-columns: 1fr; }
}

/* advanced abilities, presets and missions */
.ability-actions { display: grid; gap: 10px; margin-top: 14px; }
.ability-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06);
}
.ability-row strong { display: block; font-size: .9rem; }
.ability-row p { margin: 4px 0 0; font-size: .78rem; }
.ability-row button:disabled { opacity: .42; cursor: not-allowed; }
.preset-tools { display: grid; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.preset-tools input, .preset-tools select { width: 100%; }


.mission-editor { display: grid; gap: 8px; margin-top: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.mission-editor small { color: var(--muted); line-height: 1.4; }
.mission-list { display: grid; gap: 8px; margin-top: 12px; }
.mission-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 11px; border-radius: 13px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.055); }
.mission-row.complete { opacity: .68; }
.mission-row strong { display: block; font-size: .86rem; }
.mission-row small { display: block; color: var(--muted); margin-top: 3px; }
.mission-actions { display: flex; gap: 6px; align-items: center; }
.export-button { display: block; text-align: center; margin-top: 8px; }

/* 0.8 mission system */
.mission-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mission-editor-grid label { display: grid; gap: 5px; }
.mission-editor-grid label > span { color: var(--muted); font-size: .7rem; font-weight: 700; }
.mission-editor-grid input, .mission-editor-grid select { min-width: 0; }
.mission-flags { display: grid; gap: 7px; padding: 8px 0 2px; }
.mission-flags label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.mission-flags input { width: auto; accent-color: var(--accent); }
.mission-row.mission-mister_x { border-color: rgba(251,84,113,.18); }
.mission-row.mission-detectives { border-color: rgba(34,211,238,.14); }
@media (max-width: 520px) { .mission-editor-grid { grid-template-columns: 1fr; } }

.mission-score { margin: 10px 0 14px; color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .02em; }

/* 0.11+ Spielleiter-Dashboard */
.control-grid { display:grid; grid-template-columns:minmax(0,1fr) 390px; gap:18px; align-items:start; }
.control-map { min-height:620px; height:calc(100vh - 180px); }
#control-map { width:100%; height:100%; }
.button-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:14px; }
.inline-form { display:grid; grid-template-columns:90px 1fr; gap:8px; margin-top:10px; }
.admin-player-list { display:grid; gap:8px; margin-top:12px; }
.admin-player-row { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.025); }
.admin-player-row strong,.admin-player-row small { display:block; }
.admin-player-row small { color:var(--muted); margin-top:3px; }
textarea { width:100%; border:1px solid rgba(255,255,255,.1); background:rgba(4,6,11,.56); color:var(--text); border-radius:13px; padding:12px; resize:vertical; }
.toggle-row { display:flex; grid-template-columns:none; align-items:center; gap:9px; margin:10px 0; }
.toggle-row input { width:auto; }
@media (max-width: 980px) { .control-grid { grid-template-columns:1fr; } .control-map { height:55vh; min-height:420px; } }

/* 0.10 mobile outdoor UX */
.mobile-map-tools { top:14px; right:14px; display:flex; gap:6px; }
.map-card:fullscreen { width:100vw; height:100vh; border-radius:0; }
.map-card:fullscreen #map { height:100vh; }
.privacy-consent { display:flex; grid-template-columns:none; gap:9px; align-items:flex-start; font-weight:500; line-height:1.45; color:var(--muted); }
.privacy-consent input { width:auto; margin-top:3px; }
body.offline .topbar { border-bottom-color:rgba(251,84,113,.45); }
@media (max-width: 620px) {
  .mobile-map-tools { top:auto; bottom:14px; right:14px; left:auto; }
  .map-card { height:62vh; }
  .status-cluster { gap:5px; }
  .pill { min-height:28px; padding:0 8px; }
}
.advanced-settings { border:1px solid var(--line); border-radius:14px; padding:12px 14px; background:rgba(255,255,255,.02); }
.advanced-settings summary { cursor:pointer; font-weight:800; color:#cfd5e4; }
.advanced-settings-body { margin-top:14px; }
.mini-select { background:rgba(4,6,11,.7); color:var(--text); border:1px solid var(--line); border-radius:9px; padding:6px 8px; }
.muted-copy { color:var(--muted); font-size:.8rem; }
.admin-player-stack { display:grid; align-items:stretch; }
.admin-player-head { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.admin-player-actions { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding-top:8px; border-top:1px solid var(--line); }
.admin-player-actions .role-select { min-width:110px; }
.admin-player-actions .ticket-kind { min-width:105px; }
.danger-zone { display:grid; gap:8px; margin-top:14px; padding-top:14px; border-top:1px solid rgba(251,84,113,.25); }
