:root {
  --text: #f0f0f0;
  --muted: #a8a8a8;
  --gold: #fcd34d;
  --green: #55ff55;
  --red: #ff5555;
  --aqua: #55ffff;
  --panel: rgba(20, 20, 20, .78);
  --font: "VT323", monospace;
  --pixel: "Press Start 2P", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 20px; color: var(--text);
  background: #3b2a1c url("/static/dirt.png") repeat; background-size: 64px;
  image-rendering: pixelated;
}
.hidden { display: none !important; }

/* ---------- Logo ---------- */
.logo { font-family: var(--pixel); font-size: 34px; color: #d6d6d6; letter-spacing: 2px;
  text-shadow: 4px 4px 0 #3f3f3f; text-align: center; line-height: 1.3; }
.logo span { display: block; color: var(--gold); font-size: .7em; text-shadow: 3px 3px 0 #6b4f00; }
.logo.small { font-size: 14px; text-align: left; }
.logo.small span { display: inline; margin-left: 6px; font-size: 1em; }
.splash { font-family: var(--pixel); color: #ffff55; font-size: 10px; text-align: right; transform: rotate(-12deg);
  margin: -6px 0 14px; text-shadow: 2px 2px 0 #3f3f00; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: rotate(-12deg) scale(1.08); } }

/* ---------- Panels & Buttons ---------- */
.panel { background: var(--panel); border: 3px solid #000; box-shadow: inset 2px 2px 0 #555, inset -2px -2px 0 #1a1a1a; }
.mc-btn {
  font-family: var(--font); font-size: 20px; color: #e0e0e0; text-shadow: 2px 2px 0 #3f3f3f; cursor: pointer;
  padding: 4px 14px; border: 2px solid #000; text-decoration: none; display: inline-block; text-align: center;
  background: #6f6f6f url("/static/stone.png") repeat; background-size: 48px;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.35), inset -2px -3px 0 rgba(0,0,0,.45);
}
.mc-btn:hover { outline: 2px solid #fff; outline-offset: -2px; color: #ffffa0; }
.mc-btn:active { box-shadow: inset -2px -2px 0 rgba(255,255,255,.3), inset 2px 3px 0 rgba(0,0,0,.5); }
.mc-btn:disabled { opacity: .5; cursor: not-allowed; outline: none; }
.mc-btn.green { background-color: #2f7d32; background-blend-mode: multiply; }
.mc-btn.red { background-color: #9b2a2a; background-blend-mode: multiply; }
.mc-btn.tiny { font-size: 16px; padding: 1px 8px; }
.mc-btn.wide { width: 100%; }
.mc-btn.active { color: #ffff55; outline: 2px solid #fff; outline-offset: -2px; }
input, select {
  font-family: var(--font); font-size: 20px; color: #fff; background: #000; border: 2px solid #a0a0a0;
  padding: 4px 8px; outline: none; min-width: 0;
}
input:focus, select:focus { border-color: #fff; }
h3 { font-family: var(--pixel); font-size: 11px; color: var(--gold); margin: 14px 0 8px; text-shadow: 2px 2px 0 #4a3a00; }
.row { display: flex; gap: 6px; margin-top: 8px; } .row input { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.hint { color: var(--muted); font-size: 17px; }

/* ---------- Login ---------- */
.login-page { display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 420px; padding: 28px 24px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.error { color: var(--red); text-shadow: 1px 1px 0 #400; }

/* ---------- Layout ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px;
  background: rgba(0,0,0,.7); border-bottom: 3px solid #000; flex-wrap: wrap; }
.status { display: flex; align-items: center; gap: 8px; }
.sep { color: #555; }
.lamp { width: 14px; height: 14px; display: inline-block; background: #555; border: 2px solid #000; }
.lamp.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.lamp.off { background: var(--red); }
.user { display: flex; align-items: center; gap: 8px; }
.role { font-family: var(--pixel); font-size: 9px; padding: 3px 6px; border: 2px solid #000; }
.role-admin { background: #7a1f1f; } .role-player { background: #1f5a2a; } .role-viewer { background: #2a3f6a; }
.layout { display: grid; grid-template-columns: 1fr 400px; gap: 10px; padding: 10px; height: calc(100vh - 58px); }
.map-wrap { position: relative; overflow: hidden; }
#map { position: absolute; inset: 0; background: #0b0b0b url("/static/fog.png") repeat; background-size: 128px; }
.side { display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; }
.tabs .mc-btn { padding: 4px 4px; font-size: 18px; }
.tab-body { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }

/* ---------- Karte ---------- */
.map-tools { position: absolute; top: 8px; left: 56px; right: 8px; z-index: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-row { display: flex; gap: 4px; }
.check { background: rgba(0,0,0,.7); padding: 2px 8px; border: 2px solid #000; display: flex; gap: 6px; align-items: center; }
.coords, .fog-info { position: absolute; z-index: 500; background: rgba(0,0,0,.75); padding: 2px 10px; border: 2px solid #000; }
.coords { bottom: 8px; left: 8px; }
.fog-info { bottom: 8px; right: 8px; color: var(--muted); font-size: 17px; }
.leaflet-container { font-family: var(--font); background: transparent; }
.leaflet-tile { image-rendering: pixelated; }
.leaflet-bar a { background: #6f6f6f url("/static/stone.png"); color: #fff; border-bottom: 2px solid #000 !important;
  font-family: var(--pixel); text-shadow: 2px 2px 0 #333; }
.pmarker { position: relative; }
.pmarker img { width: 26px; height: 26px; border: 2px solid #000; image-rendering: pixelated; display: block; background: #333; }
.pmarker .arrow { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; pointer-events: none; }
.pmarker .arrow::before { content: ""; position: absolute; left: 50%; top: -2px; margin-left: -6px;
  border: 6px solid transparent; border-bottom: 9px solid #ffff55; filter: drop-shadow(0 0 1px #000); }
.pmarker .tag { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); white-space: nowrap;
  background: rgba(0,0,0,.6); padding: 0 5px; font-size: 18px; color: #fff; text-shadow: 1px 1px 0 #000; }
.pmarker.tracked .tag { color: #ffff55; }

/* ---------- Listen ---------- */
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 6px; border-bottom: 2px solid rgba(0,0,0,.4); cursor: default; }
.plist li.clickable { cursor: pointer; } .plist li.clickable:hover { background: rgba(255,255,255,.07); }
.plist img { width: 32px; height: 32px; image-rendering: pixelated; border: 2px solid #000; background: #333; }
.plist .name { flex: 1; }
.plist .sub { color: var(--muted); font-size: 16px; display: block; }
.dot { width: 10px; height: 10px; background: #555; border: 2px solid #000; }
.dot.on { background: var(--green); }
.hearts { color: #ff5555; letter-spacing: -2px; font-size: 16px; }
.events { list-style: none; margin: 0; padding: 0; font-size: 19px; }
.events li { padding: 2px 0; word-break: break-word; }
.events time { color: #777; margin-right: 6px; }
.ev-join { color: #ffff55; } .ev-leave { color: #ffff55; opacity: .75; } .ev-death { color: #ff7777; }
.ev-advancement { color: #55ff55; } .ev-webchat .who { color: var(--aqua); } .ev-admin { color: #ffaa00; } .ev-say { color: #ff55ff; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stats div { background: rgba(0,0,0,.45); padding: 6px 8px; border: 2px solid #000; }
.stats b { display: block; font-family: var(--pixel); font-size: 12px; color: var(--gold); margin-top: 4px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.subtabs { display: flex; gap: 4px; margin: 6px 0; }
.console, .cmd-out { background: #000; border: 2px solid #333; padding: 6px; font-size: 15px; height: 340px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; margin: 0; }
.cmd-out { height: auto; max-height: 120px; color: var(--aqua); }
.cmd-out:empty { display: none; }
table.users { width: 100%; border-collapse: collapse; }
table.users td { padding: 4px; border-bottom: 2px solid rgba(0,0,0,.4); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal .panel { padding: 20px; width: 100%; max-width: 380px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 3000; background: #000;
  border: 3px solid #fff; padding: 8px 16px; font-size: 20px; }
.toast.err { border-color: var(--red); color: var(--red); }

/* ---------- Rollen ---------- */
body[data-level="1"] .player-only, body[data-level="1"] .admin-only, body[data-level="2"] .admin-only { display: none !important; }

/* ---------- Handy ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 62vh; }
  .side { height: auto; min-height: 50vh; }
  .hide-mobile { display: none; }
  .map-tools { left: 50px; }
  .logo.small { font-size: 11px; }
}
