/* ==========================================================================
   Grundlagen – minimalistisch, hell, eine Akzentfarbe
   ========================================================================== */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2230;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --line: #e6e8ec;
  --line-strong: #d5d9e0;
  --accent: #4f46e5;
  --accent-dark: #3f37c9;
  --accent-soft: #eef0ff;
  --good: #15803d;
  --good-soft: #e9f7ee;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --gold: #d4a017;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-width: 0;
  overflow: hidden;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 8px; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn-text { color: var(--warn); }
.nowrap { white-space: nowrap; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-dark); color: #fff; }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover:not(:disabled) { background: var(--accent-soft); }
button.danger { color: var(--bad); }
button.danger:hover:not(:disabled) { border-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
button.small { padding: 3px 9px; font-size: 12.5px; border-radius: 6px; }
button.big { padding: 10px 18px; font-size: 15px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
.kbd { font-size: 11px; opacity: .75; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; padding: 0 4px; margin-left: 6px; font-weight: 500; }

select, input[type="number"], input[type="text"], input[type="search"] {
  font: inherit; border: 1px solid var(--line-strong); border-radius: 7px; padding: 5px 8px; background: #fff; color: var(--text);
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ==========================================================================
   Layout
   ========================================================================== */
#app { display: grid; grid-template-rows: 64px 1fr auto; height: 100vh; }

#topbar {
  display: flex; align-items: center; gap: 24px; padding: 0 20px;
  background: var(--card); border-bottom: 1px solid var(--line); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; min-width: 150px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #8b84ff); position: relative; }
.logo::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 6px; height: 9px; background: #fff; border-radius: 2px 2px 0 0; opacity: .9; }
.kpis { display: flex; gap: 28px; flex: 1; align-items: center; }
.kpi { display: flex; flex-direction: column; }
.kpi label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kpi > span { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
#hdr-alert { font-size: 12.5px; font-weight: 600; }
.actions { display: flex; gap: 8px; align-items: center; }

#main { display: grid; grid-template-columns: 1fr 410px; min-height: 0; }
#center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); background: var(--bg); }
#tabs button {
  border: 0; background: transparent; border-radius: 8px 8px 0 0; padding: 9px 14px; color: var(--muted); font-weight: 550;
  border-bottom: 2px solid transparent;
}
#tabs button:hover { color: var(--text); background: rgba(79, 70, 229, .05); }
#tabs button.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; text-align: center; }
.count:empty { display: none; }
#view { flex: 1; overflow: auto; padding: 16px; min-height: 0; }

#panel { background: var(--card); border-left: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; padding: 18px 18px 30px; min-height: 0; }

#log { background: var(--card); border-top: 1px solid var(--line); }
.log-head { width: 100%; display: flex; justify-content: space-between; border: 0; border-radius: 0; padding: 6px 20px; font-weight: 600; font-size: 12.5px; color: var(--muted); background: var(--card); }
.log-head:hover { color: var(--accent); }
#log-list { height: 104px; overflow-y: auto; padding: 0 20px 8px; font-size: 13px; }
#log.collapsed #log-list { display: none; }
.log-entry { display: flex; gap: 10px; padding: 2px 0; border-bottom: 1px dashed #f0f1f4; }
.log-entry time { color: var(--faint); min-width: 62px; font-variant-numeric: tabular-nums; }
.log-entry.good span { color: var(--good); }
.log-entry.bad span { color: var(--bad); }
.log-entry.warn span { color: var(--warn); }
.log-entry.milestone span { color: var(--accent); font-weight: 600; }

/* ==========================================================================
   Karten, Kacheln, Tabellen
   ========================================================================== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack > * + * { margin-top: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.tile .val { font-size: 20px; font-weight: 680; font-variant-numeric: tabular-nums; margin-top: 2px; letter-spacing: -.01em; }
.tile .sub { font-size: 12px; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 6px 8px; border-bottom: 1px solid #f1f2f5; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.r, table.data th.r { text-align: right; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td, table.data tr.selected td { background: var(--accent-soft); }
.p-switch { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; }
.p-switch select { flex: 1; min-width: 0; }
.mobile-only { display: none !important; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--accent); }
th.sorted { color: var(--accent); }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.kv > span:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.kv .total { border-top: 1px solid var(--line); padding-top: 4px; font-weight: 700 !important; color: var(--text) !important; }

.bar { height: 6px; background: #edeff3; border-radius: 4px; overflow: hidden; min-width: 50px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .3s; }
.bar.tall { height: 10px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.pill.new { background: #d4a017; color: #fff; }
.offer.is-new { border-color: #e8c35a; box-shadow: 0 0 0 2px rgba(212, 160, 23, .25), var(--shadow); }

.ec { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px; padding: 0 5px; border-radius: 4px; font-weight: 750; font-size: 12px; color: #fff; }
.ec.dark { color: #3a3200; }
.ec.big { min-width: 40px; height: 30px; font-size: 16px; border-radius: 6px; }
.ec-scale { display: flex; gap: 2px; }
.ec-scale .ec { min-width: 22px; height: 16px; font-size: 10px; }

.help {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%;
  background: #e8eaf0; color: var(--muted); font-size: 10px; font-weight: 700; cursor: help; vertical-align: middle; flex: none;
}
.help:hover { background: var(--accent); color: #fff; }

.note { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #3730a3; }
.note.warn { background: var(--warn-soft); color: #8a4a06; }
.note.bad { background: var(--bad-soft); color: #9b1c1c; }
.note.good { background: var(--good-soft); color: #14532d; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ==========================================================================
   Stadtkarte
   ========================================================================== */
#map-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
#map-svg { width: 100%; height: auto; max-height: calc(100vh - 300px); display: block; margin: 0 auto; user-select: none; }
.plot { cursor: pointer; }
.plot .hover-ring { fill: none; stroke: transparent; stroke-width: 2; }
.plot:hover .hover-ring { stroke: rgba(79, 70, 229, .55); }
.district-label {
  font-size: 13px; font-weight: 750; fill: rgba(29, 34, 48, .55); pointer-events: none; text-transform: uppercase; letter-spacing: .08em;
  paint-order: stroke; stroke: rgba(255, 255, 255, .85); stroke-width: 4px; stroke-linejoin: round;
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid rgba(0,0,0,.08); }

#tooltip {
  position: fixed; z-index: 1000; pointer-events: none; background: #1d2230; color: #fff; font-size: 12.5px; padding: 8px 10px;
  border-radius: 8px; max-width: 300px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .1s; line-height: 1.4;
}
#tooltip.show { opacity: 1; }
#tooltip b { font-weight: 650; }
#tooltip .tt-muted { color: #b7bdc9; }

/* ==========================================================================
   Detail-Panel
   ========================================================================== */
.p-head { margin-bottom: 12px; }
.p-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.p-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.p-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px; }
.p-kpi { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.p-kpi label { font-size: 11.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.p-kpi div { font-weight: 650; font-variant-numeric: tabular-nums; }
.p-sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.p-sec > h4 { margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.part-row { display: grid; grid-template-columns: 1fr 74px auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #f1f2f5; }
.part-row:last-child { border-bottom: 0; }
.part-row .name { font-weight: 600; font-size: 13px; }
.part-row .std { font-size: 12px; color: var(--muted); }
.part-row .btns { display: flex; gap: 4px; }
.unit-row td { font-size: 12.5px; }
.tenant { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.inline-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }

/* ==========================================================================
   Baustellen, Netzwerk, Markt
   ========================================================================== */
.proj { display: grid; grid-template-columns: 34px 1fr 230px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.proj:last-child { border-bottom: 0; }
.prio { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.prio button { padding: 0 6px; line-height: 1.2; font-size: 11px; }
.prio span { font-weight: 700; color: var(--muted); font-size: 12px; }
.trade-bars { display: grid; gap: 4px; }
.trade-bar { display: grid; grid-template-columns: 92px 1fr 56px; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

.inv-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.inv-form input[type="number"] { width: 120px; }
.roulette-ball { display: inline-flex; width: 42px; height: 42px; border-radius: 50%; color: #fff; font-weight: 750; font-size: 16px; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 0 0 3px rgba(255,255,255,.35); }
.table-scroll { overflow-x: auto; }
.cap-row { display: grid; grid-template-columns: 150px 1fr 190px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }

.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.offer { display: flex; flex-direction: column; gap: 8px; }
.offer .title { font-weight: 650; }
.offer .price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.offer .kv { font-size: 12.5px; }
.offer .foot { margin-top: auto; display: flex; gap: 6px; }

/* ==========================================================================
   Dialoge
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .42); display: flex; align-items: center; justify-content: center; z-index: 850;
  animation: fade .15s ease-out;
}
.modal {
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow-lg); width: 560px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px); display: flex; flex-direction: column; animation: pop .18s ease-out;
}
.modal.wide { width: 900px; }
.modal.xwide { width: 1040px; }
.modal-head { padding: 18px 22px 8px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head .x { border: 0; font-size: 20px; line-height: 1; padding: 2px 6px; color: var(--muted); }
.modal-body { padding: 6px 22px 16px; overflow-y: auto; }
.modal-foot { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

.options { display: grid; gap: 8px; }
.option {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; cursor: pointer; text-align: left; display: block; width: 100%;
  background: #fff;
}
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.option .o-title { font-weight: 650; display: flex; justify-content: space-between; gap: 10px; }
.option .o-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 5px 12px; border-right: 1px solid var(--line-strong); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.field { margin-bottom: 12px; }
.field > label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field > label span { font-weight: 650; font-variant-numeric: tabular-nums; }
.bank { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.bank.ok { background: var(--good-soft); color: #14532d; }
.bank.no { background: var(--bad-soft); color: #7f1d1d; }
.bank ul { margin: 6px 0 0; padding-left: 18px; }
.cmp { display: grid; grid-template-columns: 1fr auto auto auto; gap: 4px 10px; font-size: 13px; align-items: center; }
.cmp .h { color: var(--muted); font-size: 12px; }
.cmp .arrow { color: var(--faint); }

.lexicon { display: grid; grid-template-columns: 220px 1fr; gap: 18px; min-height: 380px; }
.lex-list { border-right: 1px solid var(--line); padding-right: 10px; max-height: 460px; overflow-y: auto; }
.lex-list button { display: block; width: 100%; text-align: left; border: 0; padding: 5px 8px; border-radius: 6px; }
.lex-list button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.lex-text h3 { margin-bottom: 8px; }
.lex-text p { font-size: 14.5px; line-height: 1.6; }

/* Start- und Game-over-Bildschirm */
.start-screen {
  position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 10%, #eceafe, transparent), radial-gradient(900px 500px at 90% 90%, #e7f4ec, transparent), var(--bg);
}
.start-box { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 40px 44px; width: 520px; text-align: center; }
.start-box h1 { font-size: 40px; letter-spacing: -.03em; margin: 10px 0 6px; }
.start-box .logo { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto; }
.start-box .logo::after { left: 14px; right: 14px; bottom: 12px; height: 18px; }
.start-box .tag { color: var(--muted); font-size: 15px; margin-bottom: 26px; }
.start-box .btns { display: grid; gap: 10px; }
.start-box .disc { margin-top: 22px; font-size: 12px; color: var(--faint); }

/* Toasts */
#toasts { position: fixed; right: 430px; bottom: 150px; z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: #1d2230; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 420px; animation: pop .2s ease-out; }
.toast.good { background: #14532d; }
.toast.bad { background: #8f1d1d; }
.toast.milestone { background: var(--accent); }

/* Tutorial */
.tut-highlight {
  position: fixed; z-index: 700; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 4px var(--accent), 0 0 0 9999px rgba(17, 24, 39, .38);
  transition: all .25s ease;
}
.tut-bubble {
  position: fixed; z-index: 710; width: 340px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 16px 18px;
  border-top: 4px solid var(--accent);
}
.tut-bubble h3 { margin-bottom: 6px; }
.tut-bubble p { font-size: 13.5px; }
.tut-bubble .tut-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.tut-bubble .step { color: var(--faint); font-size: 12px; }

/* ==========================================================================
   Kleine Desktops / Tablets
   ========================================================================== */
button, select, input { touch-action: manipulation; }
@media (max-width: 1279px) {
  #main { grid-template-columns: 1fr 360px; }
  .kpis { gap: 18px; }
}

/* ==========================================================================
   Smartphone (unter 960 px): eine Spalte, Detail-Panel als Blatt von unten
   ========================================================================== */
@media (max-width: 959px) {
  body { min-width: 0; font-size: 14px; }
  #app { grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; }
  #topbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  .brand { order: 1; flex: 1; min-width: 0; font-size: 16px; }
  .logo { width: 22px; height: 22px; }
  .actions { order: 2; gap: 4px; }
  .actions button.ghost { padding: 6px 8px; }
  #btn-next.big { padding: 8px 12px; font-size: 14px; }
  #btn-next .kbd { display: none; }
  .kpis { order: 3; flex: none; width: 100%; display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 2px 10px; }
  .kpi label { font-size: 10.5px; }
  .kpi > span { font-size: 13.5px; }
  #hdr-alert-wrap { grid-column: 1 / -1; }
  #hdr-alert-wrap:empty, #hdr-alert:empty { display: none; }

  #main { grid-template-columns: 1fr; }
  #tabs { overflow-x: auto; flex-wrap: nowrap; padding: 6px 8px 0; scrollbar-width: none; }
  #tabs::-webkit-scrollbar { display: none; }
  #tabs button { white-space: nowrap; padding: 8px 10px; }
  #view { padding: 10px; }

  #panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 400; border-left: 0; padding: 12px 14px 90px;
    transform: translateY(105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  body.panel-open #panel { transform: none; }
  .mobile-only { display: inline-flex !important; }

  #map-wrap { padding: 8px; overflow-x: auto; }
  #map-svg { max-height: none; min-width: 680px; }
  .legend { font-size: 11.5px; gap: 6px 12px; }

  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px; }
  .tile .val { font-size: 17px; }
  .card { padding: 12px; }
  .offer-grid { grid-template-columns: 1fr; }
  .proj { grid-template-columns: 30px 1fr; }
  .proj .trade-bars { grid-column: 2; }
  .cap-row { grid-template-columns: 110px 1fr; gap: 4px 10px; }
  .cap-row small { grid-column: 1 / -1; }
  .inv-form { flex-wrap: wrap; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 5px 6px; }

  .modal-backdrop { align-items: stretch; }
  .modal, .modal.wide, .modal.xwide { width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .modal-head { padding: 14px 14px 6px; }
  .modal-body { padding: 6px 14px 14px; flex: 1; }
  .modal-foot { padding: 10px 14px 14px; flex-wrap: wrap; }
  .lexicon { grid-template-columns: 1fr; min-height: 0; }
  .lex-list { max-height: 170px; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }

  #log-list { height: 84px; padding: 0 12px 6px; }
  .log-head { padding: 6px 12px; }
  #toasts { left: 12px; right: 12px; bottom: 64px; align-items: stretch; }
  .toast { max-width: none; }
  .start-box { width: calc(100vw - 32px); padding: 28px 20px; }
  .start-box h1 { font-size: 32px; }
  .tut-bubble { width: calc(100vw - 32px); }
}

/* Touch-Geräte ohne Maus: keine schwebenden Tooltips („?“ öffnet das Lexikon per Tippen) */
@media (hover: none) {
  #tooltip { display: none; }
}

/* Keine Umbrüche in Tabs und Kopfzeile; Tabs scrollen bei Platzmangel */
#tabs { overflow-x: auto; scrollbar-width: thin; }
#tabs button { white-space: nowrap; flex: none; }
.kpi label, .kpi > span { white-space: nowrap; }
@media (max-width: 1279px) and (min-width: 960px) {
  .kpis { gap: 14px; }
  .brand { min-width: 0; }
  #btn-next .kbd { display: none; }
}

@media (max-width: 959px) {
  #game-name { display: none; }
  .brand { flex: 0 0 auto; }
  .actions { margin-left: auto; }
  #btn-next .long { display: none; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi label { white-space: normal; line-height: 1.2; }
  .kpi label .help { display: none; }
  .kpi > span { font-size: 13px; white-space: normal; line-height: 1.2; }
  html, body { overflow-x: hidden; }
}
.start-box .disc a { color: var(--muted); }
