/* The Isle live map -- dark, quiet, and out of the way of the map itself.
   One accent colour, three diet colours, everything else is grey. */

:root {
  --bg:        #0a0d11;
  --bg-raised: #11161c;
  --bg-card:   rgba(20, 26, 33, 0.86);
  --line:      rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.045);
  --text:      #e6ebf1;
  --text-dim:  #8b98a8;
  --text-mute: #5d6875;
  --accent:    #f5a623;
  --accent-dim: rgba(245, 166, 35, 0.16);

  --carnivore: #ff6b4a;
  --herbivore: #55d98a;
  --omnivore:  #f5c542;
  --unknown:   #93a3b5;
  --self:      #46c8f5;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --sidebar: 292px;
  --topbar: 58px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The icon sprite must take no space and no layout; the strict CSP rules out
   doing this with a style attribute. */
.sprite { position: absolute; width: 0; height: 0; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

h2, h3 { margin: 0 0 10px; font-size: 11px; font-weight: 600;
         letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }
h3 { margin-bottom: 12px; }
.muted { color: var(--text-mute); font-weight: 400; letter-spacing: 0; text-transform: none; }
.hidden { display: none !important; }
/* .modal and .drawer set display, which would otherwise beat the hidden
   attribute's UA rule and leave an invisible overlay eating clicks. */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  grid-template-areas: "top top" "side stage";
  /* Viewport units, not height:100% -- the page also has to hold up embedded
     in a container that sizes itself to its content, where a percentage
     height resolves to zero and the map row collapses to nothing. */
  height: 100vh;
  height: 100dvh;
  min-height: 480px;
}

.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, #121820, #0d1218);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: radial-gradient(circle at 30% 25%, #ffcc70, var(--accent) 55%, #8a5407);
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.35), 0 6px 18px rgba(245, 166, 35, 0.22);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; letter-spacing: 0.02em; }
.brand-sub { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-mute); }

.status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute); box-shadow: 0 0 0 0 rgba(85, 217, 138, 0.5);
}
.status.is-live .pulse { background: var(--herbivore); animation: pulse 2.4s ease-out infinite; }
.status.is-stale .pulse { background: var(--accent); }
.status.is-down .pulse { background: var(--carnivore); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(85, 217, 138, 0.45); }
  70%  { box-shadow: 0 0 0 9px rgba(85, 217, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(85, 217, 138, 0); }
}

.counts { display: flex; gap: 14px; }
.count { display: flex; align-items: baseline; gap: 5px; }
.count b { font: 600 15px/1 var(--mono); }
.count span { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }

.spacer { flex: 1; }

.search { position: relative; display: flex; align-items: center; }
.search svg {
  position: absolute; left: 9px; width: 15px; height: 15px;
  fill: none; stroke: var(--text-mute); stroke-width: 2; stroke-linecap: round;
}
.search input[type=search] {
  width: 190px; padding: 7px 10px 7px 32px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); font: inherit; font-size: 13px;
  transition: border-color 0.15s, width 0.2s;
}
.search input[type=search]:focus { outline: none; border-color: rgba(245, 166, 35, 0.5); width: 220px; }
.search input::placeholder { color: var(--text-mute); }

.who { display: flex; align-items: center; gap: 8px; position: relative; flex-wrap: wrap; }
a.btn { text-decoration: none; }
.badge {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--text-dim);
}
.badge.is-admin { background: var(--accent-dim); border-color: rgba(245, 166, 35, 0.4); color: var(--accent); }
.badge.is-player { background: rgba(70, 200, 245, 0.12); border-color: rgba(70, 200, 245, 0.35); color: var(--self); }

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  grid-area: side;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; overflow: hidden;
  background: #0c1116; border-right: 1px solid var(--line);
}

.panel {
  background: var(--bg-card); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 14px;
}
.panel-grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
  color: var(--text-mute); font: inherit; font-size: 12px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover { color: var(--text); }
.chip.is-on { color: var(--text); background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.16); }
.chip:not(.is-on) .dot { opacity: 0.3; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.dot-carnivore { background: var(--carnivore); }
.dot-herbivore { background: var(--herbivore); }
.dot-omnivore  { background: var(--omnivore); }
.dot-unknown   { background: var(--unknown); }

.switch { display: flex; align-items: center; gap: 9px; padding: 5px 0;
          font-size: 13px; color: var(--text-dim); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span {
  position: relative; flex: none; width: 32px; height: 18px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.09); transition: background 0.18s;
}
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-mute); transition: transform 0.18s, background 0.18s;
}
.switch input:checked + span { background: var(--accent-dim); }
.switch input:checked + span::after { transform: translateX(14px); background: var(--accent); }
.switch:hover { color: var(--text); }

.players { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.players li {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px;
  border-radius: var(--r-md); cursor: pointer; transition: background 0.12s;
}
.players li:hover { background: rgba(255, 255, 255, 0.05); }
.players li.is-selected { background: rgba(245, 166, 35, 0.12); }
.players .icon { width: 22px; height: 22px; flex: none; }
.players .icon svg { width: 100%; height: 100%; fill: currentColor; }
.players .diet-carnivore { color: var(--carnivore); }
.players .diet-herbivore { color: var(--herbivore); }
.players .diet-omnivore  { color: var(--omnivore); }
.players .diet-unknown   { color: var(--unknown); }
.players .who-name { flex: 1; min-width: 0; }
.players .who-name b { display: block; font-size: 13px; font-weight: 500;
                        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .who-name span { font-size: 11px; color: var(--text-mute); }
.players .growth { font: 500 11px/1 var(--mono); color: var(--text-dim); }

.empty { margin: 6px 2px 0; font-size: 12px; color: var(--text-mute); }

#detail dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 12px; }
#detail dt { color: var(--text-mute); }
#detail dd { margin: 0; font-family: var(--mono); font-size: 11px; }
#detail .bar { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); overflow: hidden; }
#detail .bar i { display: block; height: 100%; background: var(--herbivore); }

/* ------------------------------------------------------------------ stage */

.stage { grid-area: stage; position: relative; overflow: hidden; background: #05080b; }

.viewport {
  position: absolute; inset: 0; cursor: grab;
  touch-action: none;
  background:
    radial-gradient(circle at 50% 40%, rgba(245, 166, 35, 0.035), transparent 60%),
    #05080b;
}
.viewport.is-dragging { cursor: grabbing; }

.world {
  position: absolute; top: 0; left: 0;
  width: 1000px; height: 1000px;         /* square; JS scales it to fit */
  transform-origin: 0 0;
  /* No `will-change: transform` on purpose: it pins a GPU raster at the 1000px
     layout size, so zooming just upscales that cached bitmap and the 2500px
     basemap looks blurry. Without it, Chromium re-rasters the image from the
     full-resolution source at the current zoom -> sharp when zoomed in. */
}
/* Basemap/overlays keep their own promoted layer for smooth panning, but let
   the compositor pick the raster scale from the live transform (adaptive),
   which samples the 2500px source instead of a fixed 1000px cache. */
.basemap, .overlay { image-rendering: auto; }

.basemap, .overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 2px; user-select: none; -webkit-user-drag: none;
}
.basemap { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 30px 90px rgba(0, 0, 0, 0.6); }
.overlay { opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.overlay.is-on { opacity: 0.85; }

.grid, .trails, .zones { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.grid { opacity: 0; transition: opacity 0.25s; }
.grid.is-on { opacity: 1; }
.grid line { stroke: rgba(245, 166, 35, 0.16); stroke-width: 0.08; }
.trails path { fill: none; stroke-width: 0.14; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }
/* Quest zones (admin only): a filled ring for the area plus a centre pip.
   Stroke width is in viewBox units so it scales with the map, matching the
   zone's real-world size. Dashed = quest currently inactive. */
/* The whole disc is hoverable so the quest name (SVG <title>) shows anywhere
   over it, not just on the hairline ring. Panning still works: pointerdown
   bubbles from the circle up to #viewport's drag handler. */
.zones circle.z-area { fill: rgba(70, 200, 245, 0.10); stroke: #46c8f5; stroke-width: 0.16; pointer-events: all; cursor: help; }
.zones circle.z-area:hover { stroke-width: 0.28; fill: rgba(70, 200, 245, 0.18); }
.zones circle.z-area.z-off { stroke-dasharray: 0.8 0.6; opacity: 0.5; }
.zones circle.z-area.z-preview { fill: rgba(245, 166, 35, 0.12); stroke: #f5a623; stroke-dasharray: 0.7 0.5; }
.zones circle.z-pip { fill: #46c8f5; pointer-events: auto; cursor: help; }
.zones circle.z-pip.z-preview { fill: #f5a623; }

/* The container spans the whole map; if it caught pointer events it would sit
   on top of the zone rings and swallow their hover. Make it transparent to
   hits and let the individual markers opt back in (.marker-body below). */
.markers { position: absolute; inset: 0; pointer-events: none; }

/* Markers sit in map space so they pan and zoom with it, but each one
   counter-scales its own contents, so an icon stays the same size on screen
   whatever the zoom. */
.marker {
  position: absolute; width: 0; height: 0;
  transition: left 1.6s linear, top 1.6s linear;
}
.marker-inner {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -50%) scale(var(--counter, 1));
  transform-origin: 50% 50%;
  display: flex; flex-direction: column; align-items: center;
}
.marker-body {
  position: relative; width: 30px; height: 30px;
  display: grid; place-items: center; cursor: pointer;
  pointer-events: auto;   /* re-enable hits; the .markers container is none */
}
.marker-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(10, 13, 17, 0.78);
  border: 1.5px solid var(--c);
  box-shadow: 0 0 12px -2px var(--c), inset 0 0 8px -4px var(--c);
  transition: transform 0.15s;
}
.marker-body:hover .marker-ring { transform: scale(1.12); }
.marker svg.sil { position: relative; width: 19px; height: 19px; fill: var(--c); }
.marker .heading {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-bottom: 9px solid var(--c);
  transform-origin: 50% 0;
  transform: translate(-50%, 0) rotate(var(--yaw, 0deg)) translateY(-24px);
  opacity: 0.9;
}
.marker.is-self .marker-ring { border-color: var(--self); box-shadow: 0 0 0 3px rgba(70, 200, 245, 0.2), 0 0 16px -2px var(--self); }
.marker.is-spawnselect { opacity: 0.45; }
.marker.is-spawnselect .marker-ring { border-style: dashed; }
.marker.is-selected .marker-ring { border-width: 2.5px; transform: scale(1.2); }
.marker.is-dimmed { opacity: 0.18; }
.marker-bot .marker-ring { border-style: dashed; }
.marker-bot.is-hunting .marker-ring { border-style: solid; box-shadow: 0 0 16px -1px var(--c); }
.marker-label {
  margin-top: 5px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: rgba(6, 9, 12, 0.82); border: 1px solid var(--line);
  font-size: 11px; color: var(--text); pointer-events: none;
}
.marker-label .sp { color: var(--text-mute); }
.markers.no-labels .marker-label { display: none; }
.marker-tier-4 .marker-body { width: 36px; height: 36px; }
.marker-tier-4 svg.sil { width: 23px; height: 23px; }
.marker-tier-1 .marker-body { width: 25px; height: 25px; }
.marker-tier-1 svg.sil { width: 16px; height: 16px; }

/* ------------------------------------------------------------- map tools */

.map-tools { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.tool-group {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.tool {
  width: 34px; height: 32px; border: 0; background: none; cursor: pointer;
  color: var(--text-dim); font: 500 15px/1 var(--font);
  transition: background 0.12s, color 0.12s;
}
.tool + .tool { border-top: 1px solid var(--line-soft); }
.tool:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.tool.wide { width: auto; padding: 0 12px; font-size: 12px; text-align: left; }
.tool.is-on { color: var(--accent); background: var(--accent-dim); }

.readout {
  position: absolute; left: 14px; bottom: 14px; display: flex; gap: 14px;
  padding: 6px 12px; border-radius: var(--r-md);
  background: rgba(6, 9, 12, 0.8); border: 1px solid var(--line);
  font: 11px/1.4 var(--mono); color: var(--text-dim); letter-spacing: 0.04em;
  backdrop-filter: blur(8px); z-index: 20; pointer-events: none;
}

.banner {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 999px; z-index: 25;
  background: rgba(245, 166, 35, 0.14); border: 1px solid rgba(245, 166, 35, 0.4);
  color: var(--accent); font-size: 12.5px; backdrop-filter: blur(8px);
}
.banner.is-error { background: rgba(255, 107, 74, 0.14); border-color: rgba(255, 107, 74, 0.4); color: var(--carnivore); }

/* ---------------------------------------------------------------- buttons */

.btn {
  padding: 7px 13px; border-radius: var(--r-sm); cursor: pointer;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
  color: var(--text); font: 500 12.5px/1 var(--font);
  transition: background 0.14s, border-color 0.14s, transform 0.08s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.18); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1204; font-weight: 600; }
.btn-primary:hover { background: #ffb63d; border-color: #ffb63d; }
.btn-ghost { background: none; }
.btn-danger { color: var(--carnivore); }

input[type=text], input[type=password], input[type=number], input[type=search], select, .rules input {
  padding: 7px 10px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: 13px;
}
input:focus, select:focus { outline: none; border-color: rgba(245, 166, 35, 0.5); }
select { appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
                    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px; background-repeat: no-repeat; }
option { background: var(--bg-raised); }

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(6px);
}
.modal-card {
  position: relative; width: min(400px, calc(100vw - 32px));
  padding: 26px; border-radius: var(--r-lg);
  background: var(--bg-raised); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.modal-card h2 { font-size: 15px; letter-spacing: 0.02em; text-transform: none; color: var(--text); margin-bottom: 16px; }
.modal-close {
  position: absolute; right: 12px; top: 10px; width: 28px; height: 28px;
  border: 0; background: none; color: var(--text-mute); font-size: 20px; cursor: pointer; border-radius: var(--r-sm);
}
.modal-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.tabs { display: flex; gap: 4px; padding: 3px; margin-bottom: 16px;
        background: rgba(255, 255, 255, 0.04); border-radius: var(--r-sm); }
.tab { flex: 1; padding: 6px; border: 0; border-radius: 4px; cursor: pointer;
       background: none; color: var(--text-mute); font: 500 12.5px var(--font); }
.tab.is-on { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.tab-body { display: flex; flex-direction: column; gap: 12px; }
.tab-body input { text-align: center; letter-spacing: 0.28em; font-size: 17px; padding: 12px; text-transform: uppercase; }
#form-admin input { letter-spacing: normal; text-align: left; font-size: 14px; text-transform: none; }
.hint { margin: 0; font-size: 12px; line-height: 1.55; color: var(--text-mute); }
.hint code { padding: 1px 5px; border-radius: 4px; background: rgba(245, 166, 35, 0.14); color: var(--accent); font-family: var(--mono); font-size: 11.5px; }
.form-error { margin: 0; min-height: 16px; font-size: 12px; color: var(--carnivore); }

/* ---------------------------------------------------------------- drawer */

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(460px, 100vw);
  display: flex; flex-direction: column;
  background: #0b1015; border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  animation: slide-in 0.22s ease-out;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head, .drawer-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; }
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--line); gap: 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13px; color: var(--text-dim); }
.field span { flex: 1; }
.field input, .field select { width: 150px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-bottom: 12px; }
.grid2 .field input { width: 110px; }
.popover { position: absolute; top: 100%; right: 0; margin-top: 6px; z-index: 40;
  display: flex; flex-direction: column; gap: 4px; padding: 8px;
  background: rgba(20,26,34,.98); border: 1px solid #2a333d; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); min-width: 220px; }
.popover .btn { text-align: left; }
/* action triggers are driven from the "Aktionen" menu, never shown in the header */
.act-trigger { display: none !important; }
/* garage / actions menu */
.pop-sep { height: 1px; background: #2a333d; margin: 6px 0 2px; }
.pop-action { justify-content: center; text-align: center; font-weight: 600; }
.pop-back { color: var(--text-mute); font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
.pop-back:hover { color: var(--text); }
.pop-head { margin: 8px 2px 2px; padding-top: 8px; border-top: 1px solid #2a333d;
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-mute); }
.pop-empty { padding: 4px 6px 6px; font-size: 13px; color: var(--text-mute); }
.pop-dino { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pop-dino-name { font-weight: 500; color: var(--text); }
.pop-dino-meta { font-size: 12px; color: var(--text-mute); white-space: nowrap; }
.pop-dino:hover .pop-dino-meta { color: var(--text-dim); }
.row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.row input { flex: 1; min-width: 90px; }

.rules { display: flex; flex-direction: column; gap: 8px; }
.rule {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.02); overflow: hidden;
}
.rule.is-off { opacity: 0.5; }
.rule-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.rule-head input[type=text] { flex: 1; background: none; border: 0; padding: 2px; font-size: 13px; }
.rule-head input[type=text]:focus { outline: 1px solid var(--line); border-radius: 4px; }
.rule-act { padding: 2px 8px; border-radius: 999px; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; border: 1px solid; }
.rule-act.show { color: var(--herbivore); border-color: rgba(85, 217, 138, 0.4); background: rgba(85, 217, 138, 0.1); }
.rule-act.hide { color: var(--carnivore); border-color: rgba(255, 107, 74, 0.4); background: rgba(255, 107, 74, 0.1); }
.rule-body { padding: 0 10px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-body h4 { margin: 0 0 6px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }
.rule-col { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.rule-diets { display: flex; flex-wrap: wrap; gap: 4px; }
.mini {
  padding: 3px 7px; border-radius: 5px; cursor: pointer; font-size: 11px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--text-mute);
}
.mini.is-on { color: var(--text); border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.09); }
.rule-dist { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.rule-dist input { width: 72px; }
.rule-dist label { font-size: 11.5px; color: var(--text-mute); display: flex; align-items: center; gap: 5px; }
.rule-tools { display: flex; gap: 2px; }
.icon-btn { width: 24px; height: 24px; border: 0; border-radius: 5px; background: none; color: var(--text-mute); cursor: pointer; font-size: 13px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }

.tokens { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tokens li { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-sm);
             background: rgba(255, 255, 255, 0.03); font-size: 12px; }
.tokens .t-steam { font-family: var(--mono); font-size: 11px; }
.tokens .t-label { flex: 1; color: var(--text-mute); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 100; padding: 10px 18px; border-radius: 999px;
  background: var(--bg-raised); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 13px;
}
.toast.is-error { border-color: rgba(255, 107, 74, 0.45); color: var(--carnivore); }

/* --------------------------------------------------------------- small */

@media (max-width: 900px) {
  /* minmax(0,…) rather than 1fr: a bare 1fr floors at the topbar's min-content
     width, which on a phone is wider than the screen and scrolls the whole
     page sideways. */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "stage"; }
  .sidebar { display: none; }
  .counts, .search { display: none; }
  .topbar { gap: 10px; padding: 0 10px; overflow: hidden; }
  .map-tools { right: 8px; top: 8px; }
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.16); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------- dock */

.dock {
  position: absolute; right: 14px; bottom: 14px; z-index: 22;
  width: min(380px, calc(100% - 28px));
  display: flex; flex-direction: column;
  max-height: 46%;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.dock.is-collapsed { max-height: none; }
.dock.is-collapsed .dock-body, .dock.is-collapsed .dock-compose, .dock.is-collapsed .dock-note { display: none; }
.dock-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 0; }
.tabs-mini { margin: 0; padding: 2px; }
.tabs-mini .tab { padding: 5px 10px; }
.pill { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px; border-radius: 999px;
        background: var(--accent); color: #1a1204; font: 700 10px/16px var(--font); }
.dock-body { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-height: 80px; }
.dock-body .empty { margin: 4px 0; }
.msg { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; font-size: 12.5px; line-height: 1.4; }
.msg time { grid-row: span 2; font: 10px/1.4 var(--mono); color: var(--text-mute); padding-top: 2px; }
.msg .who { font-weight: 600; }
.msg .who .ch { margin-left: 5px; padding: 0 5px; border-radius: 4px; font-size: 9.5px; letter-spacing: 0.08em;
                text-transform: uppercase; color: var(--text-mute); background: rgba(255,255,255,0.06); }
.msg.ch-spatial .who .ch { color: var(--herbivore); }
.msg.ch-admin .who .ch { color: var(--accent); }
.msg.is-self .who { color: var(--self); }
.msg .body { color: var(--text); word-break: break-word; }
.msg.is-dm .who .arrow { color: var(--text-mute); font-weight: 400; margin: 0 4px; }
.msg.is-announce { padding: 4px 8px; border-radius: var(--r-sm); background: var(--accent-dim); }
.msg.is-undelivered .body::after { content: " · nur hier"; color: var(--text-mute); font-size: 11px; }
.chat-divider { display: flex; align-items: center; gap: 8px; margin: 4px 0; font: 10px/1.4 var(--mono);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.chat-divider::before, .chat-divider::after { content: ""; flex: 1; border-top: 1px solid var(--accent-dim); }
.dock-compose { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line-soft); }
.dock-compose select { width: 120px; flex: none; }
.dock-compose input { flex: 1; min-width: 0; }
.dock-note { margin: 0; padding: 0 10px 8px; font-size: 11px; color: var(--text-mute); }
.field .chips { margin: 0; justify-content: flex-end; }
@media (max-width: 900px) { .dock { max-height: 40%; } }

/* -------------------------------------------------------------- shop/points */

/* Points badge: sits in the map's top-left corner (tools live top-right,
   the Lat/Long readout bottom-left), and doubles as the Shop opener. */
.points-badge {
  position: absolute; left: 14px; top: 14px; z-index: 20;
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; cursor: pointer;
  background: rgba(6, 9, 12, 0.82); border: 1px solid var(--line);
  border-radius: 999px; color: var(--text); font: inherit;
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, background 0.15s;
}
.points-badge:hover { border-color: rgba(245, 166, 35, 0.5); background: rgba(6, 9, 12, 0.92); }
.points-coin { font-size: 15px; line-height: 1; }
.points-value { font-weight: 700; font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.points-label { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); }

.modal-shop-card { width: min(440px, calc(100vw - 32px)); }
.shop-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 12px; }
.shop-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
}
.shop-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.shop-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.shop-desc { font-size: 11.5px; line-height: 1.45; color: var(--text-mute); }
.shop-buy { flex: none; min-width: 68px; text-align: center; font-variant-numeric: tabular-nums; }
.shop-buy:disabled { opacity: 0.4; cursor: not-allowed; }
.shop-buy:disabled:hover { background: var(--accent); border-color: var(--accent); }
.shop-foot { margin-top: 2px; }

/* --------------------------------------------------------------- confirm */
.modal-confirm-card { width: min(380px, calc(100vw - 32px)); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btn.is-danger { background: var(--carnivore); border-color: var(--carnivore); color: #fff; font-weight: 600; }
.btn.is-danger:hover { background: #e35b52; border-color: #e35b52; }

/* --------------------------------------------------------------- HUD control */
#modal-hud .switch { margin: 4px 0 14px; }
.hud-move-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.hud-move-row .btn { flex: none; }
.hud-move-row .hint { flex: 1; }
.hud-op-field input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 6px; }

/* ---------------------------------------------------------------- quests */
.quest-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 10px; }
.quest-group { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-mute); margin: 6px 2px 1px; }
.quest-group:first-child { margin-top: 0; }
.quest-item { display: flex; gap: 11px; padding: 11px 12px; border-radius: var(--r-sm);
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); }
.quest-item.q-explore { border-left-color: #4aa8e3; }
.quest-item.q-growth  { border-left-color: var(--herbivore); }
.quest-item.q-survive { border-left-color: var(--accent); }
.quest-item.q-kill_players, .quest-item.q-kill_species { border-left-color: var(--carnivore); }
.quest-item.is-done { border-left-color: var(--herbivore); background: rgba(85,217,138,0.06); opacity: 0.85; }
.quest-icbox { width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  font-size: 17px; border-radius: 8px; background: rgba(255,255,255,0.05); }
.quest-body { flex: 1; min-width: 0; }
.quest-head { display: flex; align-items: baseline; gap: 8px; }
.quest-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.quest-reward { margin-left: auto; flex: none; font-size: 12px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; }
.quest-sub { font-size: 11.5px; color: var(--text-mute); margin: 3px 0 7px; }
.quest-prog { display: flex; align-items: center; gap: 8px; }
.quest-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.09); overflow: hidden; }
.quest-bar i { display: block; height: 100%; width: 0; background: var(--herbivore); border-radius: 3px; transition: width 0.4s; }
.quest-pct { font-size: 10.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; flex: none; }
.quest-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.06); color: var(--text-dim); }
.quest-badge.done { background: var(--accent-dim); color: var(--herbivore); }
.quest-foot { margin-top: 4px; }

.q-create { display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line-soft); }
.q-admin-row { font-size: 12.5px; }
.q-admin-actions { display: flex; gap: 6px; margin-top: 6px; }
.q-admin-actions .btn { padding: 4px 10px; font-size: 11.5px; }
