:root {
  --bg: #1b1d1f;
  --panel: #2b2d30;
  --panel2: #35383c;
  --line: #4a4e53;
  --text: #e8e4dc;
  --muted: #9a958c;
  --accent: #ff9f1c;
  --ok: #6cc04a;
  --warn: #f2c94c;
  --bad: #e5533d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; color: var(--text);
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif; user-select: none; }
canvas { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 3px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 16px; align-items: center; white-space: nowrap; overflow: hidden;
  padding: 6px 14px; background: rgba(20,21,23,.85); border-bottom: 2px solid #000; font-size: 13px; }
#topbar .logo { color: var(--accent); font-weight: 800; letter-spacing: 2px; text-decoration: none; }
#coords { margin-left: auto; color: var(--muted); }
.bar { display: inline-block; width: 120px; height: 8px; background: #111; border: 1px solid var(--line); vertical-align: middle; }
.bar > i { display: block; height: 100%; background: var(--accent); }

#hotbar { position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px;
  padding: 5px; background: rgba(30,31,33,.92); border: 2px solid #000; }
.slot { position: relative; width: 50px; height: 50px; background: var(--panel2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot.active { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.slot.empty .ico { opacity: .3; }
.slot .key { position: absolute; top: 1px; left: 3px; font-size: 10px; color: var(--muted); }
.slot .cnt { position: absolute; bottom: 1px; right: 3px; font-size: 11px; font-weight: 700; text-shadow: 0 0 3px #000; }

.ico { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  background: var(--c); color: #111; font-size: 11px; font-weight: 800; border: 1px solid rgba(0,0,0,.6);
  vertical-align: middle; flex: none; }
.ico.s { width: 20px; height: 20px; font-size: 9px; }
.ico-ore { border-radius: 50%; }
.ico-gear { border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(0,0,0,.25); }
.ico-part { border-radius: 2px 12px; }
.ico-flask { border-radius: 4px 4px 12px 12px; color: #fff; }
.ico[style*="#262626"] { color: #ddd; }

#help { position: fixed; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
#help b { color: var(--text); }

#hover { position: fixed; right: 12px; top: 44px; min-width: 200px; padding: 8px 10px; background: rgba(30,31,33,.92);
  border: 2px solid #000; font-size: 13px; }
#hover .t { color: var(--accent); font-weight: 700; }

#toasts { position: fixed; top: 44px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.toast { background: rgba(30,31,33,.95); border-left: 3px solid var(--accent); padding: 6px 12px; animation: fade 4s forwards; }
@keyframes fade { 0%,80% { opacity: 1 } 100% { opacity: 0 } }

.panel { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: var(--panel);
  border: 2px solid #000; box-shadow: 0 10px 40px rgba(0,0,0,.6); max-height: 80vh; overflow: auto; }
#invPanel { width: min(860px, 96vw); }
#entPanel { width: min(420px, 96vw); left: auto; right: 16px; transform: translateY(-50%); }
#resPanel { width: min(520px, 96vw); }
.phead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #222326;
  font-weight: 700; color: var(--accent); position: sticky; top: 0; }
.phead .x { padding: 0 8px; }
.panel > :not(.phead) { margin: 10px 12px; }
.panel h3 { margin: 6px 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, 50px); gap: 4px; }
.grid .slot { cursor: default; }
.grid .slot.place { cursor: pointer; }

.rec { display: flex; align-items: center; gap: 6px; padding: 4px; border-bottom: 1px solid #25272a; }
.rec .nm { width: 130px; }
.rec .ing { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.rec .ing span.miss { color: var(--bad); }
.qitem { display: flex; align-items: center; gap: 8px; margin: 3px 0; }

.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.row .lbl { width: 110px; color: var(--muted); }
.st-ok { color: var(--ok); } .st-warn { color: var(--warn); } .st-bad { color: var(--bad); }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
select { font: inherit; background: var(--panel2); color: var(--text); border: 1px solid var(--line); padding: 4px; }

.tech { padding: 8px; border: 1px solid var(--line); margin-bottom: 8px; background: var(--panel2); }
.tech.cur { border-color: var(--accent); }
.tech.done { opacity: .6; }
.tech .head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }

#login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #3a2a14, #0d0d0d 70%); }
#loginForm { background: var(--panel); border: 2px solid #000; padding: 28px 32px; width: 320px; display: flex; flex-direction: column; gap: 10px; }
#loginForm h1 { margin: 0; color: var(--accent); letter-spacing: 4px; }
#loginForm input { font: inherit; padding: 8px; background: #1a1b1d; color: var(--text); border: 1px solid var(--line); }
#loginForm button { background: var(--accent); color: #1a1a1a; font-weight: 700; padding: 8px; }

/* ---------- Erweiterungen ---------- */
#powerInfo { font-size: 12px; }
#minimap { position: fixed; right: 12px; bottom: 34px; width: 180px; height: 180px; border: 2px solid #000;
  background: #000; image-rendering: pixelated; opacity: .92; }
#minimap.big { width: min(560px, 70vh); height: min(560px, 70vh); right: 50%; bottom: 50%; transform: translate(50%, 50%); }
#hover { top: 44px; }
#chat { position: fixed; left: 12px; bottom: 96px; width: 380px; pointer-events: none; }
#chatLog > div { background: rgba(20,21,23,.75); padding: 3px 8px; margin-top: 2px; font-size: 13px; animation: fadeChat 12s forwards; }
#chatLog > div b { color: var(--accent); }
#chat.open #chatLog > div { animation: none; opacity: 1; }
@keyframes fadeChat { 0%,85% { opacity: 1 } 100% { opacity: 0 } }
#chatInput { pointer-events: auto; width: 100%; margin-top: 4px; font: inherit; padding: 6px 8px; background: rgba(20,21,23,.95);
  color: var(--text); border: 1px solid var(--accent); }
.rec.locked { opacity: .45; }
.rec .lock { font-size: 11px; color: var(--muted); }
.tech.locked { opacity: .5; }
.tech .req { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tech .unl { display: flex; gap: 4px; margin-top: 4px; }
#statsPanel { width: min(820px, 96vw); }
table.stats { width: 100%; border-collapse: collapse; }
table.stats td { padding: 3px 6px; border-bottom: 1px solid #25272a; }
table.stats td.n { text-align: right; font-variant-numeric: tabular-nums; }
.qitem { cursor: pointer; }
.qitem:hover { color: var(--bad); }
#hotbar .slot { width: 46px; height: 46px; }

/* ---------- Login, Teams, Admin, Kampf ---------- */
#topbar button { padding: 2px 8px; font-size: 12px; }
#teamsBtn { margin-left: 4px; }
.teamtag { display: inline-block; padding: 0 7px; border-radius: 2px; color: #111; font-weight: 700; font-size: 12px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
#loginForm .tabs { margin-bottom: 4px; }
#loginStatus.err { color: var(--bad); }
#adminPanel { width: min(900px, 96vw); }
#teamsPanel { width: min(760px, 96vw); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 5px 6px; border-bottom: 1px solid #25272a; vertical-align: middle; }
table.tbl td .btns { margin: 0; gap: 4px; }
table.tbl button { padding: 2px 7px; font-size: 12px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #555; margin-right: 6px; }
.dot.on { background: var(--ok); }
button.on-state { background: var(--ok); color: #111; border-color: var(--ok); }
button.danger { border-color: var(--bad); color: var(--bad); }
.winner { background: linear-gradient(90deg, #5a4210, #2b2d30); border: 1px solid var(--accent); padding: 10px; font-weight: 700; }
.setrow { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.setrow .lbl { width: 190px; color: var(--muted); }
.itemgrid { display: grid; grid-template-columns: repeat(auto-fill, 54px); gap: 4px; }
.itemgrid .slot { cursor: pointer; }
.itemgrid .slot:hover { border-color: var(--accent); }
.toast.big { font-size: 18px; padding: 10px 18px; border-left-width: 5px; }
#hpInfo .bar > i { background: var(--ok); }

#logiPanel { width: min(640px, 96vw); }
#reqList select { max-width: 200px; }
#reqList input { font: inherit; background: #1a1b1d; color: var(--text); border: 1px solid var(--line); padding: 3px 5px; }
#hotbar { flex-wrap: wrap; justify-content: center; max-width: min(1000px, 92vw); }
#hotbar.compact .slot { width: 38px; height: 38px; }
#hotbar.compact .ico { width: 24px; height: 24px; font-size: 10px; }
#hotbar { max-width: min(760px, 70vw); }
#trainPanel { width: min(560px, 96vw); left: auto; right: 16px; transform: translateY(-50%); }
#trainBody select { max-width: 170px; }

/* Symbolbilder statt Kürzel */
.ico.img { background: none; border: 0; border-radius: 0; transform: none; box-shadow: none; }
.ico.img img { width: 100%; height: 100%; display: block; image-rendering: auto; pointer-events: none; }
.slot .ico.img { width: 36px; height: 36px; }
#hotbar.compact .slot .ico.img { width: 30px; height: 30px; }
.grid .slot .ico.img, .itemgrid .slot .ico.img { width: 36px; height: 36px; }
#hotbar .hsep { width: 2px; align-self: stretch; margin: 2px 3px; background: #555; border-radius: 1px; }
#hotbar { max-width: min(980px, 70vw); }
#hotbar.compact .slot { width: 36px; height: 36px; }
#hotbar.compact .slot .ico.img { width: 28px; height: 28px; }
#hotbar.compact .slot .key { font-size: 9px; }
#hotbar { width: max-content; }

/* Meldungen */
#alertBar { position: fixed; left: 12px; top: 44px; display: flex; flex-direction: column; gap: 4px; }
#alertBar .ab { display: flex; align-items: center; gap: 6px; background: rgba(30,31,33,.92); border: 2px solid #000;
  border-left: 4px solid var(--bad); padding: 3px 8px 3px 6px; cursor: pointer; font-size: 13px; animation: abpulse 2s infinite; }
#alertBar .ab.warn { border-left-color: var(--warn); animation: none; }
#alertBar .ab b { min-width: 18px; text-align: right; }
@keyframes abpulse { 0%,100% { box-shadow: 0 0 0 rgba(229,83,61,0) } 50% { box-shadow: 0 0 10px rgba(229,83,61,.7) } }
#alertCount { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--bad); color: #fff; font-weight: 700; }
#alertCount:empty { display: none; }
#alertPanel { width: min(620px, 96vw); }
.al { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-bottom: 1px solid #25272a; cursor: pointer; }
.al:hover { background: #33363a; }
.al .tx { flex: 1; }
.al .dist { color: var(--muted); font-size: 12px; white-space: nowrap; }
.toast.alert { border-left-color: var(--bad); }

/* Blaupausen */
#bpPanel { width: min(620px, 96vw); }
#bpBody button.on { background: var(--accent); color: #111; }
.bprow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.08); }
.bprow button { margin-left: 3px; }
.bpitems { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; font-size: 12px; }
.bpitems span { display: inline-flex; align-items: center; gap: 2px; }
#bpText { background: #111; color: #ddd; border: 1px solid #444; font-family: monospace; font-size: 11px; }

#topbar > span, #topbar > button { flex-shrink: 0; }
#topbar #online { flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Schaltungsnetz */
.sigchip { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; font-size: 12px; }
.sigchip i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }

/* Erfolge */
#achPanel { width: min(680px, 96vw); }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.ach { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; opacity: .45; font-size: 12px; position: relative; }
.ach.got { opacity: 1; border-color: #c9a640; background: rgba(201,166,64,.08); }
.ach .ai { font-size: 22px; }
.ach .ok { position: absolute; top: 3px; right: 6px; color: #7fe07f; }

/* Tutorial-Box */
#tutBox { position: fixed; left: 12px; top: 92px; width: 300px; background: rgba(20,21,23,.94); border: 1px solid #c9a640; border-radius: 8px; padding: 10px 12px; z-index: 5; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
#tutBox .th { display: flex; align-items: center; gap: 6px; color: #c9a640; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
#tutBox .th span { flex: 1; }
#tutBox .th button { padding: 0 6px; font-size: 12px; }
#tutBox p { margin: 4px 0 8px; color: #d0cbc2; }
#tutBox .bar { height: 7px; background: #2a2c2f; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
#tutBox .bar i { display: block; height: 100%; background: #c9a640; }
#setPanel { width: min(480px, 96vw); }
.teamtag { color: #6ad0ff; font-weight: 700; }
#chatInput.team { border-color: #6ad0ff; }
.keylist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.keylist kbd { background: #2a2c2f; border: 1px solid #444; border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* ---------- Gemeinschaft ---------- */
#comPanel { width: min(860px, 96vw); }
#comBody .lbtbl td, #comBody .lbtbl th { padding: 4px 6px; text-align: left; }
#comBody .lbtbl tr.me { background: rgba(255,159,28,.12); }
#comBody .lbtbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.plink { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }
.avatar { font-size: 22px; line-height: 1; }
.avpick { display: flex; flex-wrap: wrap; gap: 4px; }
.avpick button { font-size: 20px; padding: 2px 6px; }
.avpick button.on-state { outline: 2px solid var(--accent); }
.badge { display: inline-block; padding: 2px 6px; margin: 2px; border-radius: 10px; background: #2a2c2f; font-size: 12px; }
.bpcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bpcard { border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #1c1d20; }
.bpcard canvas { width: 100%; height: 120px; background: #2b3a22; border-radius: 4px; display: block; margin-bottom: 6px; }
.bpcard .tags span { font-size: 11px; background: #2a2c2f; padding: 1px 5px; border-radius: 8px; margin-right: 3px; }
.offer { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.offer .arrow { color: var(--muted); }
#login .ghostbtn { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 400; margin-top: 6px; }
#specBar { position: fixed; top: 44px; left: 50%; transform: translateX(-50%); background: rgba(20,21,23,.92); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 94vw; }
#specBar button { padding: 2px 8px; }
body.spectator #hotbar, body.spectator #tutBox, body.spectator #help, body.spectator #alertBar,
body.spectator #alertBtn, body.spectator #talerBtn, body.spectator #achBtn, body.spectator #bpBtn, body.spectator #logiBtn, body.spectator #adminBtn, body.spectator #chatInput { display: none !important; }

.panel { z-index: 10; }

/* ---------- Produktionsdiagramm ---------- */
.chartwrap { position: relative; }
#prodChart { width: 100%; height: 280px; display: block; border-radius: 6px; }
.charttip { position: absolute; background: rgba(15,16,18,.95); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; pointer-events: none; min-width: 150px; }
.charttip i, .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0; font-size: 13px; }
.legend .lg { white-space: nowrap; }
.chartctl button { padding: 3px 9px; }

/* ---------- Touch-Steuerung ---------- */
#touchUI { position: fixed; inset: auto 0 0 0; pointer-events: none; z-index: 6; }
#joy { position: fixed; left: 18px; bottom: 90px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.08);
  border: 2px solid rgba(255,255,255,.25); pointer-events: auto; touch-action: none; }
#joyKnob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,159,28,.75); }
#touchBtns { position: fixed; right: 10px; bottom: 90px; display: grid; grid-template-columns: repeat(3, 52px); gap: 8px; pointer-events: auto; }
#touchBtns button { width: 52px; height: 52px; font-size: 22px; border-radius: 12px; background: rgba(30,31,34,.85); border: 1px solid var(--line); touch-action: none; }
#touchBtns button.on-state { background: rgba(229,83,61,.85); }
body.touch #help { display: none; }
body.touch #hover { display: none !important; }
body.touch #minimap { width: 110px; height: 110px; top: 50px; bottom: auto; }
body.touch #hotbar { bottom: 6px; transform: translateX(-50%) scale(.9); }
body.touch .panel { max-height: 86vh; }
@media (max-width: 900px) {
  #topbar { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; }
  #topbar::-webkit-scrollbar { display: none; }
  #tutBox { width: 240px; top: 56px; }
  .panel { width: 96vw !important; }
  #entPanel { right: 2vw; }
}
body.touch #minimap.big { top: auto; right: 50%; bottom: 50%; width: min(560px, 90vw, 86vh); height: min(560px, 90vw, 86vh); }

.worldtag { background: #2b4a2b; border: 1px solid #3d6b3d; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.curworld { background: rgba(108,192,74,.08); }
#login select { width: 100%; padding: 8px; margin: 4px 0; background: #1a1b1d; color: var(--text); border: 1px solid var(--line); }
/* Touch: kompakte Anordnung für kleine (Quer-)Bildschirme */
body.touch #joy { left: 10px; bottom: 10px; width: 110px; height: 110px; }
body.touch #joyKnob { left: 32px; top: 32px; width: 46px; height: 46px; }
body.touch #touchBtns { right: 8px; bottom: 8px; grid-template-columns: repeat(4, 44px); gap: 6px; }
body.touch #touchBtns button { width: 44px; height: 44px; font-size: 19px; }
body.touch #minimap { width: 92px; height: 92px; top: 44px; right: 8px; }
body.touch #hotbar { bottom: 4px; transform: translateX(-50%) scale(.72); transform-origin: bottom center; max-width: 70vw; }
body.touch #tutBox { width: 220px; top: 44px; font-size: 12px; padding: 6px 8px; }
body.touch #chat { bottom: 130px; }

/* ---------- Laden ---------- */
#shopPanel { width: min(820px, 96vw); }
#talerBtn { color: #f2c94c; font-weight: 700; }
.talerhead { justify-content: space-between; }
.talerbig { font-size: 22px; font-weight: 800; color: #f2c94c; }
.talerbig small { font-size: 12px; color: var(--muted); font-weight: 400; }
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 46vh; overflow: auto; }
.shopitem { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; padding: 4px 6px; }
.shopitem .ico { grid-row: span 2; }
.shopitem .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shopitem .pr { font-size: 12px; color: #f2c94c; }
.shopitem > span:last-child:not(.pr) { font-size: 11px; grid-column: 2; }
.shopitem.locked { opacity: .45; }
.talerico { font-size: 16px; background: none !important; display: inline-flex; align-items: center; justify-content: center; }
#entPanel { overflow-x: hidden; }
#entPanel select { max-width: 190px; }
#entPanel .row { flex-wrap: wrap; }

/* ---------- Ereignisse ---------- */
#evBar { position: fixed; top: 42px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: rgba(60,12,12,.9); border: 1px solid #a33; border-radius: 6px; padding: 5px 12px; font-size: 13px; animation: evpulse 1.2s ease-in-out infinite alternate; }
@keyframes evpulse { from { box-shadow: 0 0 0 rgba(255,60,40,.0); } to { box-shadow: 0 0 18px rgba(255,60,40,.55); } }
body.spectator #evBar { top: 86px; }

.replaywrap { background: #111; border-radius: 6px; padding: 6px; text-align: center; }
#replayCv { width: min(100%, 520px); image-rendering: pixelated; aspect-ratio: 1; }

/* ---------- Chronik ---------- */
#storyPanel { width: min(640px, 96vw); }
.storycard { background: linear-gradient(160deg, #2c2a24, #1f2023); border: 1px solid #5a4a2a; border-radius: 8px; padding: 12px 14px; }
.storycard h2 { margin: 2px 0 8px; color: var(--accent); font-size: 22px; }
.storycard blockquote { margin: 0 0 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: rgba(0,0,0,.25); font-style: italic; line-height: 1.5; }
.storycard cite { display: block; margin-top: 6px; font-style: normal; color: var(--muted); font-size: 12px; }
.storyrow { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px solid #25272a; }
.storyrow.locked { opacity: .5; }
.storyrow.cur b { color: var(--accent); }
.storyrow details { width: 100%; font-size: 12px; }
body.spectator #storyBtn { display: none !important; }

#hallBar { position: fixed; top: 44px; left: 12px; z-index: 6; background: rgba(60,45,25,.92); border: 1px solid #8a6f4a; border-radius: 6px; padding: 5px 10px; display: flex; gap: 8px; align-items: center; }
body #hallBar ~ #tutBox { top: 92px; }
.chip { display: inline-flex; align-items: center; gap: 3px; background: #2a2c2f; border-radius: 10px; padding: 1px 6px; margin: 1px; font-size: 12px; }
.chip button { padding: 0 4px; font-size: 10px; }
.clantag { display: inline-block; padding: 0 6px; border-radius: 3px; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 1px rgba(0,0,0,.5); }

/* ---------- Szenarien ---------- */
#scnBar { position: fixed; bottom: 200px; right: 12px; z-index: 6; background: rgba(20,21,24,.9); border: 1px solid #c98500; border-radius: 6px; padding: 6px 12px; font-size: 13px; min-width: 220px; }
#scnBar .bar { width: 100%; margin-top: 4px; }
#scnBar .tm { font: 600 18px/1.2 ui-monospace, monospace; color: #ffd166; }
.scncard { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }
.scncard h4 { margin: 0 0 4px; }
.planwrap { display: grid; grid-template-columns: 200px 1fr; gap: 10px; }
.planlist { display: flex; flex-direction: column; gap: 4px; max-height: 480px; overflow-y: auto; }
.planlist button { text-align: left; }
#planCv { width: 100%; max-width: 480px; aspect-ratio: 1; image-rendering: pixelated; cursor: crosshair; border-radius: 4px; }
@media (max-width: 700px) { .planwrap { grid-template-columns: 1fr; } }
#planPanel { width: min(760px, 96vw); max-height: 90vh; overflow-y: auto; }
/* v4.0: Post, Turnier, Bewertung, Weltwunder, Notizen */
#comBtn { position: relative; }
#comBtn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -6px; right: -6px; background: #e5533d; color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 1px 5px; line-height: 14px; }
.mail { border: 1px solid var(--line); border-radius: 6px; margin: 4px 0; background: rgba(255,255,255,.02); }
.mail.unread { border-color: var(--accent); }
.mail.unread .mhead b { color: var(--accent); }
.mail .mhead { display: flex; gap: 8px; align-items: center; padding: 6px 8px; cursor: pointer; flex-wrap: wrap; }
.mail .mbody { padding: 4px 10px 8px; border-top: 1px solid var(--line); white-space: normal; }
.grade { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 10px; font-size: 26px; font-weight: 800; color: #fff; }
.stars { color: #e0a526; font-size: 18px; letter-spacing: 1px; }
.stars.big button { font-size: 26px; background: none; border: none; color: #555; cursor: pointer; padding: 0 3px; }
.stars.big button.on, .stars.big button:hover { color: #e0a526; }
.wsteps { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; font-size: 13px; }
.wsteps .cur { color: #d4af37; font-weight: 700; }
.notebox { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }
/* v4.4: Kartenebenen, Planer, Fernwärme */
#mmLayers { position: fixed; right: 12px; bottom: 220px; display: flex; gap: 3px; z-index: 6; }
#mmLayers button { width: 30px; height: 26px; padding: 0; font-size: 14px; opacity: .55; background: rgba(20,21,23,.85); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
#mmLayers button.on { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
#minimap.big + #mmLayers { right: 50%; bottom: calc(50% + min(280px, 35vh) + 8px); transform: translateX(50%); }
body.touch #mmLayers { display: none; }
#prodPlanPanel { width: min(880px, 96vw); max-height: 88vh; overflow-y: auto; }
.ptree { font-size: 13px; }
.ptree details { margin-left: 16px; border-left: 1px dashed var(--line); padding-left: 6px; }
.ptree summary { cursor: pointer; padding: 2px 0; list-style: none; }
.ptree summary::-webkit-details-marker { display: none; }
.ptree .leaf { margin-left: 16px; padding: 2px 6px; border-left: 1px dashed var(--line); }
.ptree .mach { color: var(--muted); }
.hnet { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; margin: 6px 0; }
.perfbar { display: inline-block; height: 9px; background: var(--accent); border-radius: 2px; vertical-align: middle; }
.titletag { display: inline-block; padding: 0 6px; border-radius: 8px; background: rgba(255,209,102,.18); color: #ffd166; font-size: 11px; font-weight: 600; }
#photoBar { display: none; position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 60; background: rgba(14,16,22,.82); border: 1px solid #444; border-radius: 10px; padding: 7px 12px; gap: 12px; align-items: center; font-size: 13px; color: #ddd; }
#photoBar label { display: inline-flex; align-items: center; gap: 5px; }
#photoBar input[type=range] { width: 130px; }
body.photo #photoBar { display: flex; }
body.photo > *:not(#game):not(#photoBar):not(#toasts):not(script) { display: none !important; }
#autoCam.on-state { background: #2d6a4f; color: #fff; }
/* Menüleiste: Infos links (dürfen gekürzt werden), Knöpfe rechts (immer sichtbar, bei wenig Platz nur Symbole) */
#topbar { gap: 12px; }
#topbar > span { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#topbar > #coords { flex-shrink: 0; }
#topBtns { display: flex; gap: 4px; align-items: center; margin-left: 4px; flex-shrink: 0; }
#topBtns button { padding: 2px 7px; font-size: 12px; }
#teamsBtn { margin-left: 0; }
@media (max-width: 1300px) { #topBtns > button .bl { display: none; } }
@media (max-width: 1100px) { #storyInfo { display: none; } #topbar { gap: 8px; } }
#cityPanel { width: min(820px, 96vw); max-height: 86vh; overflow-y: auto; }

/* Dropdown-Menüs in der Menüleiste */
.dd { position: relative; flex-shrink: 0; }
.ddBtn { padding: 2px 9px !important; }
.ddBtn .car { font-size: 10px; opacity: .7; }
.dd.open > .ddBtn { border-color: var(--accent); background: #2a2b2e; }
.ddMenu { display: none; position: fixed; z-index: 400; min-width: 240px; background: rgba(24,25,28,.98); border: 1px solid #444; border-radius: 8px;
  padding: 5px; box-shadow: 0 10px 28px rgba(0,0,0,.55); }
.dd.open > .ddMenu { display: block; }
.ddMenu button { display: flex !important; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; border: 0; border-radius: 5px;
  padding: 7px 10px !important; font-size: 13px !important; color: var(--text); white-space: nowrap; }
.ddMenu button:hover { background: rgba(255,159,28,.16); }
.ddMenu button.hidden { display: none !important; }
.ddMenu kbd { margin-left: auto; padding-left: 16px; font: 11px/1.4 monospace; color: var(--muted); background: none; border: 0; }
.ddMenu hr { border: 0; border-top: 1px solid #3a3b3e; margin: 4px 6px; }
.ddMenu .chk { margin-left: auto; color: var(--muted); font-size: 12px; }
.ddMenu .chk.on { color: #3fd16a; }
.ddBtn[data-badge]:not([data-badge=""])::after { content: attr(data-badge); position: absolute; top: -6px; right: -6px; background: #e5533d; color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 1px 5px; line-height: 14px; }
.ddBtn { position: relative; }
#comBtn[data-badge]:not([data-badge=""])::after { position: static; margin-left: 8px; }
body.spectator #ddFabrik, body.spectator #ddStadt { display: none !important; }
/* Schnellleiste mit Gruppen-Reitern (kompakt) */
#hotbar { flex-direction: column; align-items: center; gap: 4px; width: auto; max-width: min(640px, 94vw); padding: 4px 6px; border-radius: 8px; }
#hotbar .htabs { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; justify-content: center; max-width: 100%; }
#hotbar .htab { width: 30px; height: 26px; padding: 0 !important; display: flex; align-items: center; justify-content: center; background: #1f2023; border: 1px solid #3a3b3e; border-radius: 5px; }
#hotbar .htab .ico.img { width: 20px; height: 20px; }
#hotbar .htab .ico { transform: scale(.8); }
#hotbar .htab.on { border-color: var(--accent); background: rgba(255,159,28,.18); }
#hotbar .htab.has:not(.on) { border-color: #6a5a3a; }
#hotbar .hcat { font-size: 11px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
#hotbar .hitems { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
#hotbar .slot { width: 42px; height: 42px; }
#hotbar .slot .ico.img { width: 32px; height: 32px; }
#hotbar.compact .slot { width: 38px; height: 38px; }
#hotbar.compact .slot .ico.img { width: 28px; height: 28px; }
body.ddopen #hover { display: none !important; }
#topbar { z-index: 40; }
#rgLogin a { color: var(--accent); }
#rgLogin p { margin: 10px 0 6px; }

/* Demo ohne Konto */
.demobtn { width: 100%; margin-top: 8px; background: #1f3a2a; border: 1px solid #2e7a49; color: #e7f5ea; font-weight: 600; padding: 9px; border-radius: 6px; cursor: pointer; }
.demobtn:hover { background: #24472f; }
#demoBar { position: fixed; left: 12px; bottom: 12px; z-index: 35; background: rgba(20,40,28,.92); border: 1px solid #2e7a49; border-radius: 18px; padding: 4px 14px; font-size: 13px; color: #e7f5ea; white-space: nowrap; }
#demoBar.low { background: rgba(70,20,20,.94); border-color: #e5533d; animation: demoBlink 1s infinite alternate; }
#demoBar a { color: var(--accent); margin-left: 8px; }
@keyframes demoBlink { to { box-shadow: 0 0 14px rgba(229,83,61,.7); } }
body.photo #demoBar { display: none; }
.rgsso { width: 100%; padding: 10px; background: #5865f2; border: 1px solid #6d78f5; color: #fff; font-weight: 700; border-radius: 6px; cursor: pointer; margin-bottom: 4px; }
.rgsso:hover { background: #6d78f5; }

/* Streamer-Modus */
#streamerTag { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); z-index: 60; background: rgba(229,83,61,.85); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 10px; pointer-events: none; }
body.streamer input[type=password], body.streamer #adminBody input[readonly], body.streamer .secret, body.streamer #adminBody code.key, body.streamer .mbody, body.streamer #mlText { filter: blur(7px); transition: filter .15s; }
body.streamer input[type=password]:hover, body.streamer #adminBody input[readonly]:hover, body.streamer .secret:hover, body.streamer .mbody:hover, body.streamer input:focus, body.streamer textarea:focus { filter: none; }
body.streamer-big #chatLog, body.streamer-big #toasts, body.streamer-big #hud { font-size: 125%; }
.pollbox { background: #1a1b1d; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 6px 0; }
