:root {
  --bg: #07111f;
  --panel: rgba(11, 24, 42, 0.92);
  --panel-strong: #0d1b2f;
  --panel-soft: #12243c;
  --line: rgba(148, 182, 225, 0.16);
  --text: #eff7ff;
  --muted: #8ea6c2;
  --cyan: #56d9ff;
  --blue: #4f7cff;
  --green: #49e29d;
  --yellow: #ffd35a;
  --orange: #ff9f4a;
  --red: #ff5d73;
  --purple: #b78cff;
  --floor-height: 72px;
  --roof-height: 46px;
  --radius: 22px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(79, 124, 255, 0.18), transparent 28%),
    radial-gradient(circle at 85% 0%, rgba(86, 217, 255, 0.12), transparent 24%),
    linear-gradient(145deg, #07111f 0%, #0a1727 50%, #08121f 100%);
}

button {
  font: inherit;
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid rgba(86, 217, 255, 0.65);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.3;
}

.ambient-one {
  width: 420px;
  height: 420px;
  left: -220px;
  top: 28%;
  background: #3457ff;
}

.ambient-two {
  width: 360px;
  height: 360px;
  right: -180px;
  bottom: 5%;
  background: #27d5ba;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1680px, calc(100% - 28px));
  margin: 14px auto 28px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(16, 35, 59, 0.96), rgba(9, 21, 37, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(500px, 1.7fr) auto;
  gap: 24px;
  align-items: center;
  padding: 18px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(86, 217, 255, 0.35);
  border-radius: 18px;
  color: var(--cyan);
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(145deg, rgba(86, 217, 255, 0.14), rgba(79, 124, 255, 0.14));
  box-shadow: inset 0 0 24px rgba(86, 217, 255, 0.1), 0 12px 30px rgba(0, 0, 0, 0.2);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.headline-stats {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) repeat(3, minmax(90px, 0.75fr));
  gap: 10px;
}

.stat-card {
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid rgba(148, 182, 225, 0.12);
  border-radius: 15px;
  background: rgba(5, 15, 28, 0.55);
}

.stat-card strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.fp-bar {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.fp-bar span {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
  transition: width 250ms ease;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button {
  border: 0;
  cursor: pointer;
}

.icon-button,
.secondary-button,
.danger-button,
.primary-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 800;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.icon-button:hover,
.secondary-button:hover,
.danger-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.icon-button:active,
.secondary-button:active,
.danger-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.icon-button {
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.055);
}

.danger-button {
  border: 1px solid rgba(255, 93, 115, 0.22);
  color: #ffafbb;
  background: rgba(255, 93, 115, 0.08);
}

.primary-button {
  color: #05131d;
  background: linear-gradient(135deg, var(--cyan), #8ce9ff);
  box-shadow: 0 10px 26px rgba(86, 217, 255, 0.16);
}

.primary-button.large {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none !important;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(660px, 1.55fr) minmax(380px, 0.75fr);
  gap: 14px;
  margin-top: 14px;
}

.building-panel,
.control-panel,
.shop-panel,
.mission-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.rush-badge,
.state-pill,
.shop-hint {
  padding: 7px 10px;
  border: 1px solid rgba(73, 226, 157, 0.24);
  border-radius: 999px;
  color: var(--green);
  background: rgba(73, 226, 157, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.rush-badge.rush {
  border-color: rgba(255, 159, 74, 0.32);
  color: var(--orange);
  background: rgba(255, 159, 74, 0.1);
  animation: pulseBadge 1.6s infinite;
}

@keyframes pulseBadge {
  50% { box-shadow: 0 0 0 7px rgba(255, 159, 74, 0); }
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 74, 0.22); }
}

.building-stage {
  position: relative;
  min-height: calc(var(--floor-height) * 9 + var(--roof-height));
  overflow: hidden;
  border: 1px solid rgba(148, 182, 225, 0.18);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(82, 116, 150, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(82, 116, 150, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, #0a1727, #0c2036);
  background-size: 28px 28px, 28px 28px, auto;
}

.building-roof {
  height: var(--roof-height);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
  z-index: 8;
  border-bottom: 1px solid rgba(148, 182, 225, 0.2);
  color: #abc1d8;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  background: linear-gradient(180deg, #172c45, #0d1b2d);
}

.roof-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.floors {
  position: relative;
  z-index: 1;
  padding-right: 222px;
}

.floor-row {
  position: relative;
  height: var(--floor-height);
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid rgba(148, 182, 225, 0.12);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.018), transparent 65%);
}

.floor-row:last-child {
  border-bottom: 0;
}

.floor-row.active-arrival {
  animation: floorFlash 900ms ease;
}

@keyframes floorFlash {
  0%, 100% { background-color: transparent; }
  35% { background-color: rgba(86, 217, 255, 0.16); }
}

.floor-number {
  display: grid;
  place-items: center;
  height: 100%;
  border-right: 1px solid rgba(148, 182, 225, 0.12);
  color: #d7e9f9;
  font-size: 20px;
  font-weight: 950;
  background: rgba(3, 11, 21, 0.35);
}

.floor-number small {
  display: block;
  margin-top: -13px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.waiting-zone {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
}

.call-lamp {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid #566d84;
  border-radius: 50%;
  background: #0b1928;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.8);
  transition: 180ms ease;
}

.call-lamp.on {
  border-color: var(--yellow);
  background: var(--yellow);
  box-shadow: 0 0 15px rgba(255, 211, 90, 0.75);
}

.waiting-people {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 5px;
  overflow: hidden;
}

.person {
  position: relative;
  width: 31px;
  height: 50px;
  flex: 0 0 auto;
  animation: personEnter 220ms ease both;
}

@keyframes personEnter {
  from { opacity: 0; transform: translateY(9px) scale(0.86); }
}

.person-head {
  position: absolute;
  left: 8px;
  top: 0;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: #07111f;
  font-size: 8px;
  font-weight: 950;
  background: #e8b88f;
  z-index: 2;
}

.person-body {
  position: absolute;
  left: 5px;
  bottom: 5px;
  width: 22px;
  height: 31px;
  border-radius: 9px 9px 5px 5px;
  background: var(--person-color, var(--blue));
  box-shadow: inset -5px 0 rgba(0, 0, 0, 0.14);
}

.person-body::before,
.person-body::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 7px;
  height: 12px;
  border-radius: 3px;
  background: #263b52;
}

.person-body::before { left: 2px; }
.person-body::after { right: 2px; }

.person-bubble {
  position: absolute;
  left: 23px;
  top: -1px;
  z-index: 5;
  min-width: 24px;
  padding: 2px 4px;
  border-radius: 7px 7px 7px 1px;
  color: #07111f;
  font-size: 9px;
  font-weight: 950;
  text-align: center;
  background: white;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.person-patience {
  position: absolute;
  left: 3px;
  bottom: -3px;
  width: 26px;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
}

.person-patience span {
  display: block;
  height: 100%;
  background: var(--green);
}

.person.uneasy .person-patience span { background: var(--yellow); }
.person.angry .person-patience span { background: var(--red); }
.person.angry { animation: angryShake 450ms infinite; }

@keyframes angryShake {
  25% { transform: translateX(-1px); }
  75% { transform: translateX(1px); }
}

.more-people {
  align-self: center;
  padding: 5px 7px;
  border-radius: 9px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 211, 90, 0.09);
}

.empty-floor {
  color: rgba(142, 166, 194, 0.46);
  font-size: 11px;
}

.shaft-area {
  position: absolute;
  z-index: 3;
  top: var(--roof-height);
  right: 0;
  width: 222px;
  height: calc(var(--floor-height) * 9);
  border-left: 1px solid rgba(148, 182, 225, 0.2);
  background: rgba(4, 12, 22, 0.48);
}

.shaft-labels {
  position: absolute;
  z-index: 20;
  top: 7px;
  left: 8px;
  right: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  pointer-events: none;
}

.elevator-select {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border: 1px solid rgba(148, 182, 225, 0.16);
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  background: rgba(4, 14, 26, 0.84);
  pointer-events: auto;
}

.elevator-select.selected {
  border-color: rgba(86, 217, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(86, 217, 255, 0.1);
}

.elevator-select strong,
.elevator-select small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.elevator-select strong { font-size: 10px; }
.elevator-select small { margin-top: 1px; color: var(--muted); font-size: 8px; }

.elevator-letter {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  color: #05131d;
  font-size: 10px;
  font-weight: 950;
  background: var(--cyan);
}

.shafts {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 8px;
}

.shaft {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-left: 1px solid rgba(148, 182, 225, 0.1);
  border-right: 1px solid rgba(148, 182, 225, 0.1);
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(255, 255, 255, 0.02) 12px 13px),
    linear-gradient(90deg, #07111b, #101c29 45%, #07111b);
}

.cable {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #2d3b49, #778797, #2d3b49);
}

.elevator-cabin {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 4px;
  height: 62px;
  z-index: 4;
  cursor: pointer;
  border: 2px solid #7b91a6;
  border-radius: 8px 8px 5px 5px;
  background: #263a4d;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.44), inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  transition: box-shadow 180ms ease, border-color 180ms ease;
  will-change: transform;
}

.elevator-cabin.selected {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(86, 217, 255, 0.15), 0 10px 22px rgba(0, 0, 0, 0.5);
}

.cabin-display {
  position: absolute;
  top: -21px;
  left: 50%;
  min-width: 38px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transform: translateX(-50%);
  border: 1px solid #26384b;
  border-radius: 5px 5px 1px 1px;
  color: #ffb657;
  font-family: "Courier New", monospace;
  font-size: 10px;
  background: #02070b;
  box-shadow: inset 0 0 8px rgba(255, 159, 74, 0.08);
}

.cabin-display b {
  color: var(--cyan);
}

.cabin-inner {
  position: absolute;
  inset: 4px 4px 10px;
  overflow: hidden;
  border-radius: 3px;
  background: linear-gradient(180deg, #d2e2e8, #7c909e);
}

.door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 3;
  border: 1px solid rgba(28, 46, 61, 0.6);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.2), transparent 20% 80%, rgba(0, 0, 0, 0.14)),
    linear-gradient(180deg, #9badb8, #667a88);
  transition: transform 300ms ease;
}

.door-left { left: 0; transform-origin: left; }
.door-right { right: 0; transform-origin: right; }
.elevator-cabin.doors-open .door-left { transform: translateX(-92%); }
.elevator-cabin.doors-open .door-right { transform: translateX(92%); }

.passenger-dots {
  position: absolute;
  z-index: 2;
  left: 4px;
  right: 4px;
  bottom: 3px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-height: 28px;
}

.passenger-dot {
  position: relative;
  width: 11px;
  height: 22px;
  border-radius: 5px 5px 2px 2px;
  background: var(--dot-color, var(--purple));
}

.passenger-dot::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ecc19b;
}

.cabin-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 11px;
  display: grid;
  place-items: center;
  color: #d5e4ee;
  font-size: 7px;
  font-weight: 900;
  background: #152637;
}

.floating-messages {
  position: absolute;
  z-index: 30;
  inset: 0;
  pointer-events: none;
}

.float-message {
  position: absolute;
  right: 236px;
  padding: 6px 9px;
  border-radius: 9px;
  color: var(--green);
  font-size: 11px;
  font-weight: 950;
  background: rgba(4, 13, 23, 0.92);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: floatAway 1.4s ease forwards;
}

.float-message.negative { color: var(--red); }

@keyframes floatAway {
  0% { opacity: 0; transform: translateY(12px) scale(0.9); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-38px) scale(1.04); }
}

.building-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
}

.legend-dot.calm { background: var(--green); }
.legend-dot.uneasy { background: var(--yellow); }
.legend-dot.angry { background: var(--red); }
.legend-dot.onboard { background: var(--purple); }

.control-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.elevator-readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.elevator-readout > div {
  padding: 10px;
  border: 1px solid rgba(148, 182, 225, 0.1);
  border-radius: 12px;
  background: rgba(4, 14, 25, 0.45);
}

.elevator-readout span,
.elevator-readout strong {
  display: block;
}

.elevator-readout span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.elevator-readout strong {
  margin-top: 2px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.instruction {
  margin: 12px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.floor-console {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.floor-button {
  position: relative;
  min-height: 48px;
  border: 1px solid rgba(148, 182, 225, 0.15);
  border-radius: 12px;
  color: #dfefff;
  font-size: 15px;
  font-weight: 950;
  background: linear-gradient(145deg, #13263c, #0b1828);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
  transition: 150ms ease;
}

.floor-button:hover {
  border-color: rgba(86, 217, 255, 0.45);
  transform: translateY(-1px);
}

.floor-button.queued {
  border-color: rgba(86, 217, 255, 0.64);
  color: var(--cyan);
  background: rgba(86, 217, 255, 0.11);
  box-shadow: inset 0 0 16px rgba(86, 217, 255, 0.08);
}

.floor-button.mandatory::after {
  content: "PFLICHT";
  position: absolute;
  right: 4px;
  bottom: 3px;
  color: var(--orange);
  font-size: 6px;
  letter-spacing: 0.06em;
}

.floor-button.has-call::before {
  content: "";
  position: absolute;
  top: 5px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 211, 90, 0.8);
}

.queue-box {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(148, 182, 225, 0.1);
  border-radius: 13px;
  background: rgba(4, 14, 25, 0.42);
}

.queue-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.text-button {
  padding: 0;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
  background: none;
}

.queue-list {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.queue-stop {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(86, 217, 255, 0.24);
  border-radius: 9px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
  background: rgba(86, 217, 255, 0.08);
}

.queue-stop.mandatory {
  border-color: rgba(255, 159, 74, 0.32);
  color: var(--orange);
  background: rgba(255, 159, 74, 0.08);
}

.queue-arrow {
  color: #526b85;
  font-size: 10px;
}

.empty-queue {
  color: rgba(142, 166, 194, 0.55);
  font-size: 11px;
}

.quick-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 8px;
  margin-top: 12px;
}

.upgrade-list {
  display: grid;
  gap: 8px;
}

.upgrade-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(148, 182, 225, 0.11);
  border-radius: 14px;
  background: rgba(4, 14, 25, 0.4);
}

.upgrade-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  background: rgba(183, 140, 255, 0.1);
}

.upgrade-info strong,
.upgrade-info span {
  display: block;
}

.upgrade-info strong {
  font-size: 12px;
}

.upgrade-info span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.upgrade-button {
  min-width: 72px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid rgba(183, 140, 255, 0.3);
  border-radius: 11px;
  color: #d9c4ff;
  font-size: 10px;
  font-weight: 900;
  background: rgba(183, 140, 255, 0.09);
}

.upgrade-button:hover:not(:disabled) {
  border-color: rgba(183, 140, 255, 0.62);
  background: rgba(183, 140, 255, 0.16);
}

.shop-hint {
  border-color: rgba(183, 140, 255, 0.2);
  color: var(--purple);
  background: rgba(183, 140, 255, 0.07);
}

.mission-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.mission-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 240ms ease;
}

.mission-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.overlay {
  position: fixed;
  z-index: 999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 7, 13, 0.74);
  backdrop-filter: blur(14px);
  transition: opacity 200ms ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid rgba(148, 182, 225, 0.18);
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(160deg, #12263e, #081522);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.58);
}

.overlay-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 22px;
  color: var(--cyan);
  font-size: 30px;
  background: rgba(86, 217, 255, 0.1);
}

.overlay-card h2 {
  margin-bottom: 8px;
  font-size: 30px;
}

.overlay-card > p:not(.eyebrow) {
  margin-bottom: 20px;
  color: var(--muted);
}

.final-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 20px 0;
}

.final-stats div {
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.16);
}

.final-stats span,
.final-stats strong {
  display: block;
}

.final-stats span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.final-stats strong {
  margin-top: 3px;
  font-size: 21px;
}

.toast {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 24px;
  max-width: min(460px, calc(100% - 28px));
  padding: 11px 15px;
  transform: translate(-50%, 20px);
  border: 1px solid rgba(86, 217, 255, 0.3);
  border-radius: 13px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  background: rgba(5, 17, 29, 0.94);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: 220ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: rgba(255, 93, 115, 0.4);
  color: #ffb4bf;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .headline-stats {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .control-column {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }

  .mission-panel {
    grid-column: 2;
  }
}

@media (max-width: 820px) {
  :root {
    --floor-height: 64px;
  }

  .game-shell {
    width: min(100% - 14px, 1680px);
    margin-top: 7px;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .top-actions,
  .headline-stats {
    grid-column: 1;
    grid-row: auto;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button:not(.icon-button) {
    flex: 1;
  }

  .headline-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .fp-stat {
    grid-column: 1 / -1;
  }

  .control-column {
    display: flex;
  }

  .floors {
    padding-right: 164px;
  }

  .shaft-area {
    width: 164px;
  }

  .float-message {
    right: 175px;
  }

  .shaft-labels {
    display: none;
  }

  .floor-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .floor-number {
    font-size: 16px;
  }

  .person {
    width: 25px;
    transform: scale(0.86);
    transform-origin: bottom left;
    margin-right: -3px;
  }

  .floor-console {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 540px) {
  :root {
    --floor-height: 58px;
    --roof-height: 40px;
  }

  .panel,
  .building-stage {
    border-radius: 16px;
  }

  .topbar,
  .building-panel,
  .control-panel,
  .shop-panel,
  .mission-panel {
    padding: 13px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 26px;
  }

  .subtitle {
    display: none;
  }

  .headline-stats {
    gap: 7px;
  }

  .stat-card {
    min-height: 56px;
    padding: 8px 10px;
  }

  .stat-card strong {
    font-size: 18px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .building-stage {
    min-height: calc(var(--floor-height) * 9 + var(--roof-height));
  }

  .building-roof {
    font-size: 7px;
  }

  .floors {
    padding-right: 116px;
  }

  .shaft-area {
    width: 116px;
  }

  .shafts {
    gap: 4px;
    padding: 0 4px;
  }

  .elevator-cabin {
    left: 3px;
    right: 3px;
    height: 50px;
  }

  .cabin-display {
    top: -17px;
    min-width: 28px;
    height: 15px;
    font-size: 8px;
  }

  .passenger-dot {
    width: 7px;
    height: 16px;
  }

  .passenger-dot::before {
    left: 1px;
    width: 5px;
    height: 5px;
  }

  .floor-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .floor-number {
    font-size: 13px;
  }

  .floor-number small {
    display: none;
  }

  .waiting-zone {
    gap: 4px;
    padding: 0 5px;
  }

  .call-lamp {
    width: 8px;
    height: 8px;
    border-width: 1px;
  }

  .person {
    width: 20px;
    margin-right: -6px;
    transform: scale(0.72);
  }

  .person-bubble {
    display: none;
  }

  .empty-floor {
    display: none;
  }

  .float-message {
    right: 122px;
    font-size: 9px;
  }

  .building-legend {
    gap: 9px;
    font-size: 9px;
  }

  .elevator-readout {
    grid-template-columns: 1fr 1fr;
  }

  .elevator-readout > div:last-child {
    grid-column: 1 / -1;
  }

  .floor-console {
    gap: 6px;
  }

  .floor-button {
    min-height: 42px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .upgrade-card {
    grid-template-columns: 38px 1fr auto;
    gap: 7px;
    padding: 8px;
  }

  .upgrade-icon {
    width: 38px;
    height: 38px;
  }
}

/* =========================================================
   V6 – dynamische Leitstelle, fünf Aufzüge und Wartungssystem
   ========================================================= */

:root {
  --floor-count: 9;
  --elevator-count: 2;
  --shaft-area-width: 222px;
  --person-scale: 1;
}

.hidden {
  display: none !important;
}

.building-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.level-badge {
  padding: 7px 10px;
  border: 1px solid rgba(86, 217, 255, 0.24);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(86, 217, 255, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.workspace-panel {
  min-width: 0;
  overflow: hidden;
  padding: 0;
}

.workspace-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 10, 19, 0.32);
}

.workspace-tab {
  position: relative;
  min-height: 48px;
  padding: 0 14px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  background: transparent;
}

.workspace-tab:last-child {
  border-right: 0;
}

.workspace-tab.active {
  color: var(--text);
  background: rgba(86, 217, 255, 0.07);
  box-shadow: inset 0 -3px var(--cyan);
}

.tab-notice {
  position: absolute;
  top: 7px;
  right: 12px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #08121f;
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  background: var(--yellow);
  box-shadow: 0 0 12px rgba(255, 211, 90, 0.65);
}

.workspace-tab-panel {
  padding: 16px;
  max-height: calc(100vh - 255px);
  overflow-y: auto;
  scrollbar-color: rgba(86, 217, 255, 0.35) transparent;
}

.workspace-tab-panel[hidden] {
  display: none !important;
}

.workspace-heading {
  margin-bottom: 10px;
}

.persistent-mission {
  padding: 15px 17px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

.mission-panel .panel-heading strong {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 17px;
}

.upgrade-intro {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.building-stage {
  min-height: calc(var(--floor-height) * var(--floor-count) + var(--roof-height));
}

.floors {
  padding-right: var(--shaft-area-width);
}

.shaft-area {
  width: var(--shaft-area-width);
  height: calc(var(--floor-height) * var(--floor-count));
  transition: width 220ms ease;
}

.shaft-labels,
.shafts {
  grid-template-columns: repeat(var(--elevator-count), minmax(0, 1fr));
}

.shaft-labels {
  gap: 5px;
}

.elevator-select {
  justify-content: center;
  min-width: 0;
  padding: 5px 4px;
}

.elevator-select > span:last-child {
  min-width: 0;
}

.elevator-select strong {
  font-size: 9px;
}

.elevator-select small {
  font-size: 8px;
}

.elevator-letter {
  width: 21px;
  height: 21px;
}

.shafts {
  gap: 5px;
  padding: 0 6px;
}

.elevator-cabin {
  left: 4px;
  right: 4px;
  min-width: 29px;
}

.elevator-cabin.broken {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 93, 115, 0.15), 0 10px 24px rgba(0, 0, 0, 0.55);
  animation: cabinFaultPulse 1s infinite;
}

.elevator-cabin.repairing,
.elevator-cabin.maintenance {
  border-color: var(--yellow);
  filter: saturate(0.72);
}

@keyframes cabinFaultPulse {
  50% { box-shadow: 0 0 0 6px rgba(255, 93, 115, 0), 0 10px 24px rgba(0, 0, 0, 0.55); }
}

.cabin-fault {
  position: absolute;
  z-index: 12;
  inset: 5px;
  display: none;
  place-items: center;
  border-radius: 4px;
  font-size: 21px;
  background: rgba(4, 10, 17, 0.72);
  backdrop-filter: blur(2px);
}

.cabin-fault.visible {
  display: grid;
}

.passenger-overflow {
  align-self: center;
  padding: 2px 3px;
  border-radius: 5px;
  color: #07111f;
  font-size: 8px;
  background: var(--yellow);
}

.float-message {
  right: calc(var(--shaft-area-width) + 14px);
}

.person {
  width: 40px;
  height: 55px;
  margin-right: 1px;
  scale: var(--person-scale);
  transform-origin: center bottom;
  animation: personEnterStable 220ms ease both;
}

@keyframes personEnterStable {
  from { opacity: 0; translate: 0 8px; }
}

.person-head {
  left: 12px;
  top: 9px;
}

.person-body {
  left: 9px;
  bottom: 5px;
}

.person-bubble {
  left: 50%;
  top: -2px;
  min-width: 25px;
  padding: 2px 5px;
  transform: translateX(-50%);
  border-radius: 7px 7px 3px 3px;
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

.person-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(45deg);
  background: white;
}

.person-patience {
  left: 4px;
  bottom: -2px;
  width: 32px;
  height: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(2, 8, 14, 0.78);
}

.person-patience span {
  width: 100%;
  transform-origin: left center;
  transition: transform 100ms linear, background 180ms ease;
}

.person.angry {
  animation: angryShakeStable 410ms infinite;
}

@keyframes angryShakeStable {
  25% { translate: -1px 0; }
  75% { translate: 1px 0; }
}

.incident-alert {
  position: absolute;
  z-index: 60;
  top: calc(var(--roof-height) + 10px);
  left: 50%;
  width: min(520px, calc(100% - 26px));
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 93, 115, 0.58);
  border-radius: 14px;
  color: #ffdbe1;
  background: rgba(76, 11, 24, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 28px rgba(255, 93, 115, 0.18);
  animation: incidentDrop 250ms ease both;
}

.incident-alert.breakdown {
  border-color: rgba(255, 159, 74, 0.62);
  color: #ffe5c8;
  background: rgba(69, 34, 8, 0.95);
}

.incident-alert.endless {
  border-color: rgba(183, 140, 255, 0.62);
  color: #eadcff;
  background: rgba(43, 21, 73, 0.95);
}

.incident-alert strong,
.incident-alert span {
  display: block;
}

.incident-alert strong {
  font-size: 13px;
  letter-spacing: 0.06em;
}

.incident-alert div span {
  margin-top: 2px;
  font-size: 11px;
}

.incident-icon {
  font-size: 23px;
}

@keyframes incidentDrop {
  from { opacity: 0; transform: translate(-50%, -14px); }
}

.floor-row.escape-alert {
  z-index: 4;
  animation: escapeFloorFlash 1.15s ease;
}

@keyframes escapeFloorFlash {
  0%, 100% { background-color: transparent; }
  18%, 55% { background-color: rgba(255, 93, 115, 0.27); }
  36%, 72% { background-color: rgba(255, 93, 115, 0.08); }
}

.stair-runner {
  position: absolute;
  z-index: 25;
  top: 50%;
  left: 105px;
  transform: translateY(-50%);
  font-size: 24px;
  pointer-events: none;
  animation: runToStairs 1.55s ease-in forwards;
}

@keyframes runToStairs {
  0% { opacity: 0; translate: 80px 0; }
  12% { opacity: 1; }
  100% { opacity: 0; translate: -95px 0; }
}

.incident-shake {
  animation: buildingIncidentShake 580ms ease;
}

@keyframes buildingIncidentShake {
  20% { translate: -3px 0; }
  40% { translate: 3px 0; }
  60% { translate: -2px 0; }
  80% { translate: 2px 0; }
}

.danger-flash {
  animation: dangerStatFlash 1s ease;
}

@keyframes dangerStatFlash {
  0%, 100% { background: rgba(5, 15, 28, 0.55); }
  30%, 65% { background: rgba(255, 93, 115, 0.28); box-shadow: 0 0 24px rgba(255, 93, 115, 0.28); }
}

.control-elevator-picker {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.control-elevator-picker > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-elevator-buttons {
  display: grid;
  grid-template-columns: repeat(var(--elevator-count), minmax(0, 1fr));
  gap: 6px;
}

.control-elevator-button {
  min-width: 0;
  min-height: 43px;
  padding: 6px 5px;
  border: 1px solid rgba(148, 182, 225, 0.15);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(4, 14, 25, 0.5);
}

.control-elevator-button strong,
.control-elevator-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-elevator-button strong {
  color: var(--text);
  font-size: 14px;
}

.control-elevator-button span {
  margin-top: 1px;
  font-size: 9px;
}

.control-elevator-button.selected {
  border-color: rgba(86, 217, 255, 0.62);
  color: var(--cyan);
  background: rgba(86, 217, 255, 0.1);
  box-shadow: inset 0 0 18px rgba(86, 217, 255, 0.07);
}

.elevator-readout {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.elevator-readout > div {
  min-width: 0;
}

.elevator-readout strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.state-pill.warning,
.maintenance-status.warning {
  border-color: rgba(255, 211, 90, 0.34);
  color: var(--yellow);
  background: rgba(255, 211, 90, 0.09);
}

.state-pill.danger,
.maintenance-status.danger {
  border-color: rgba(255, 93, 115, 0.4);
  color: var(--red);
  background: rgba(255, 93, 115, 0.1);
}

.maintenance-box {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid rgba(148, 182, 225, 0.12);
  border-radius: 14px;
  background: rgba(4, 14, 25, 0.46);
}

.maintenance-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.maintenance-heading strong,
.maintenance-kicker {
  display: block;
}

.maintenance-heading strong {
  margin-top: 2px;
  font-size: 13px;
}

.maintenance-kicker {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.maintenance-status {
  padding: 5px 8px;
  border: 1px solid rgba(73, 226, 157, 0.24);
  border-radius: 999px;
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  background: rgba(73, 226, 157, 0.08);
}

.condition-track {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.condition-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
  transition: width 160ms linear;
}

.condition-track span.warning {
  background: linear-gradient(90deg, var(--orange), var(--yellow));
}

.condition-track span.critical {
  background: var(--red);
  animation: conditionPulse 800ms infinite;
}

.condition-track span.service-progress {
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

@keyframes conditionPulse {
  50% { opacity: 0.55; }
}

.maintenance-box p {
  margin: 7px 0 9px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.maintenance-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.maintenance-actions button {
  min-width: 0;
  min-height: 38px;
  padding: 0 7px;
  font-size: 9px;
}

.upgrade-progress-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}

.upgrade-progress-summary > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(148, 182, 225, 0.1);
  border-radius: 12px;
  background: rgba(4, 14, 25, 0.48);
}

.upgrade-progress-summary span,
.upgrade-progress-summary strong,
.upgrade-progress-summary small {
  display: block;
}

.upgrade-progress-summary span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.upgrade-progress-summary strong {
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-progress-summary small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.25;
}

.upgrade-list {
  max-height: calc(100vh - 440px);
  min-height: 300px;
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-color: rgba(183, 140, 255, 0.35) transparent;
}

.upgrade-card {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.upgrade-card.featured-upgrade {
  border-color: rgba(86, 217, 255, 0.3);
  background: rgba(86, 217, 255, 0.07);
}

.upgrade-card.level-progress-card {
  border-color: rgba(255, 211, 90, 0.2);
}

.upgrade-card.level-progress-card.unlocked {
  border-color: rgba(73, 226, 157, 0.36);
  background: rgba(73, 226, 157, 0.06);
}

.upgrade-card.cap-reached,
.upgrade-card.locked-upgrade {
  opacity: 0.72;
}

.upgrade-info span {
  font-size: 10px;
}

.inline-progress {
  height: 5px;
  margin-top: 6px !important;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.inline-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.overlay {
  padding: 18px;
}

.help-card {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
}

.overlay-close {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  font-size: 24px;
  background: rgba(255, 255, 255, 0.05);
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 18px 0;
  text-align: left;
}

.help-grid article {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.14);
}

.help-grid article > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #06131d;
  font-weight: 950;
  background: var(--cyan);
}

.help-grid strong {
  font-size: 12px;
}

.help-grid p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.help-pause-note,
.endless-note {
  font-size: 10px;
}

.level-unlock-card,
.win-card {
  position: relative;
  width: min(560px, 100%);
}

.level-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 16px 0;
}

.level-details span {
  padding: 9px 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 10px;
  background: rgba(0, 0, 0, 0.14);
}

.text-link-button {
  margin-top: 11px;
  padding: 6px;
  color: var(--cyan);
  background: transparent;
  font-size: 11px;
  font-weight: 850;
}

.win-card {
  border-color: rgba(255, 211, 90, 0.35);
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.58), 0 0 60px rgba(255, 211, 90, 0.1);
}

.win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.win-actions .large {
  width: 100%;
}

.fp-bar span.critical {
  background: var(--red);
  animation: conditionPulse 750ms infinite;
}

@media (max-width: 1180px) {
  .workspace-tab-panel {
    max-height: none;
  }

  .upgrade-list {
    max-height: 620px;
  }
}

@media (max-width: 820px) {
  .floors {
    padding-right: var(--shaft-area-width);
  }

  .shaft-area {
    width: var(--shaft-area-width);
  }

  .float-message {
    right: calc(var(--shaft-area-width) + 9px);
  }

  .control-column {
    display: flex;
  }

  .mission-panel {
    order: 0;
  }

  .workspace-panel {
    order: 1;
  }

  .elevator-readout {
    grid-template-columns: repeat(2, 1fr);
  }

  .help-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .top-actions {
    flex-wrap: wrap;
  }

  .top-actions .save-button,
  .top-actions .secondary-button,
  .top-actions .danger-button {
    flex: 1 1 30%;
  }

  .upgrade-progress-summary {
    grid-template-columns: 1fr 1fr;
  }

  .upgrade-progress-summary > div:last-child {
    grid-column: 1 / -1;
  }

  .maintenance-actions {
    grid-template-columns: 1fr;
  }

  .level-details,
  .win-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .shaft-labels {
    display: none;
  }

  .floors {
    padding-right: var(--shaft-area-width);
  }

  .shaft-area {
    width: var(--shaft-area-width);
  }

  .shafts {
    gap: 2px;
    padding: 0 2px;
  }

  .elevator-cabin {
    left: 1px;
    right: 1px;
  }

  .person {
    width: 34px;
    margin-right: -2px;
  }

  .person-bubble {
    display: block;
    min-width: 21px;
    padding: 1px 4px;
    font-size: 8px;
  }

  .person-patience {
    left: 3px;
    width: 27px;
  }

  .control-elevator-button span {
    display: none;
  }

  .control-elevator-button {
    min-height: 38px;
  }

  .elevator-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .upgrade-card {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .upgrade-card .upgrade-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .upgrade-icon {
    width: 36px;
    height: 36px;
  }

  .workspace-tab-panel {
    padding: 12px;
  }
}


/* V7: kompakter Technikraum, Prioritätsstopps und geplante Wartung */
.floor-row,
.floor-button {
  user-select: none;
}

.floor-row.priority-floor {
  background: linear-gradient(90deg, rgba(255, 211, 90, 0.13), rgba(255, 211, 90, 0.025) 68%);
  box-shadow: inset 4px 0 0 var(--yellow), inset 0 0 24px rgba(255, 211, 90, 0.045);
}

.floor-row.priority-floor .floor-number {
  color: var(--yellow);
  text-shadow: 0 0 12px rgba(255, 211, 90, 0.42);
}

.floor-button.priority {
  border-color: rgba(255, 211, 90, 0.9);
  color: var(--yellow);
  background: linear-gradient(145deg, rgba(255, 211, 90, 0.17), rgba(255, 159, 74, 0.08));
  box-shadow: inset 0 0 18px rgba(255, 211, 90, 0.1), 0 0 0 2px rgba(255, 211, 90, 0.08);
}

.queue-stop.priority {
  min-width: 38px;
  border-color: rgba(255, 211, 90, 0.72);
  color: var(--yellow);
  background: rgba(255, 211, 90, 0.12);
  box-shadow: 0 0 12px rgba(255, 211, 90, 0.12);
}

/* Nur noch eine Scrollfläche: der gesamte Tab. Die Upgrade-Liste selbst scrollt nicht mehr. */
#upgradeTab.workspace-tab-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

#upgradeTab .upgrade-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  max-height: none;
  min-height: 0;
  padding-right: 0;
  overflow: visible;
}

#upgradeTab .upgrade-card {
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-areas:
    "icon info"
    "button button";
  align-content: start;
  gap: 7px 9px;
  min-height: 104px;
  padding: 9px;
}

#upgradeTab .upgrade-icon {
  grid-area: icon;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 17px;
}

#upgradeTab .upgrade-info {
  grid-area: info;
  min-width: 0;
}

#upgradeTab .upgrade-info strong {
  font-size: 11px;
  line-height: 1.25;
}

#upgradeTab .upgrade-info span {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.34;
}

#upgradeTab .upgrade-button {
  grid-area: button;
  width: 100%;
  min-width: 0;
  min-height: 31px;
  padding: 0 7px;
  font-size: 9px;
}

#upgradeTab .upgrade-card.featured-upgrade,
#upgradeTab .upgrade-card.locked-upgrade,
#upgradeTab .upgrade-card.level-progress-card {
  grid-column: 1 / -1;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "icon info button";
  min-height: 66px;
  align-items: center;
}

#upgradeTab .upgrade-card.featured-upgrade .upgrade-button,
#upgradeTab .upgrade-card.locked-upgrade .upgrade-button,
#upgradeTab .upgrade-card.level-progress-card .upgrade-button {
  width: auto;
  min-width: 88px;
}

@media (max-width: 1360px) {
  #upgradeTab .upgrade-list {
    grid-template-columns: 1fr;
  }

  #upgradeTab .upgrade-card,
  #upgradeTab .upgrade-card.featured-upgrade,
  #upgradeTab .upgrade-card.locked-upgrade,
  #upgradeTab .upgrade-card.level-progress-card {
    grid-column: auto;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas: "icon info button";
    min-height: 62px;
    align-items: center;
  }

  #upgradeTab .upgrade-card .upgrade-button {
    width: auto;
    min-width: 74px;
  }
}

@media (max-width: 620px) {
  #upgradeTab .upgrade-card,
  #upgradeTab .upgrade-card.featured-upgrade,
  #upgradeTab .upgrade-card.locked-upgrade,
  #upgradeTab .upgrade-card.level-progress-card {
    grid-template-columns: 36px minmax(0, 1fr);
    grid-template-areas:
      "icon info"
      "button button";
    min-height: 0;
  }

  #upgradeTab .upgrade-card .upgrade-button,
  #upgradeTab .upgrade-card.featured-upgrade .upgrade-button,
  #upgradeTab .upgrade-card.locked-upgrade .upgrade-button,
  #upgradeTab .upgrade-card.level-progress-card .upgrade-button {
    width: 100%;
  }
}

.upgrade-category-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 10px;
  padding: 4px;
  border: 1px solid rgba(148, 182, 225, 0.1);
  border-radius: 12px;
  background: rgba(3, 12, 22, 0.42);
}

.upgrade-category-button {
  min-width: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  background: transparent;
}

.upgrade-category-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.upgrade-category-button.active {
  border-color: rgba(86, 217, 255, 0.28);
  color: var(--cyan);
  background: rgba(86, 217, 255, 0.09);
  box-shadow: inset 0 -2px rgba(86, 217, 255, 0.45);
}

@media (max-width: 420px) {
  .upgrade-category-button {
    padding: 0 4px;
    font-size: 8px;
  }
}

#upgradeTab .upgrade-card[hidden] {
  display: none !important;
}

/* =========================================================
   V8 – gleichmäßige Upgrade-Karten und volle Warteschlangenbreite
   ========================================================= */

/* Die Figurenzeile nimmt jetzt wirklich den gesamten Platz zwischen
   Ruflampe und erstem Fahrstuhlschacht ein. */
.waiting-people {
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  justify-content: flex-start;
}

.more-people {
  min-width: 39px;
  flex: 0 0 auto;
  text-align: center;
  white-space: nowrap;
}

/* Im Aufzug-Upgradebereich besitzen alle Karten denselben Aufbau:
   Beschreibung oben, gleich hoher Kaufbutton unten. Das gilt auch für
   den gesperrten bzw. später kaufbaren zusätzlichen Fahrstuhl. */
#upgradeTab .upgrade-card[data-upgrade-group="elevator"],
#upgradeTab .upgrade-card.featured-upgrade[data-upgrade-group="elevator"],
#upgradeTab .upgrade-card.locked-upgrade[data-upgrade-group="elevator"] {
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: minmax(50px, 1fr) 34px;
  grid-template-areas:
    "icon info"
    "button button";
  align-content: stretch;
  align-items: start;
  gap: 7px 9px;
  min-height: 112px;
  padding: 9px;
}

#upgradeTab .upgrade-card.featured-upgrade[data-upgrade-group="elevator"],
#upgradeTab .upgrade-card.locked-upgrade[data-upgrade-group="elevator"] {
  grid-column: 1 / -1;
}

#upgradeTab .upgrade-card[data-upgrade-group="elevator"] .upgrade-icon {
  grid-area: icon;
}

#upgradeTab .upgrade-card[data-upgrade-group="elevator"] .upgrade-info {
  grid-area: info;
  align-self: start;
}

#upgradeTab .upgrade-card[data-upgrade-group="elevator"] .upgrade-button,
#upgradeTab .upgrade-card.featured-upgrade[data-upgrade-group="elevator"] .upgrade-button,
#upgradeTab .upgrade-card.locked-upgrade[data-upgrade-group="elevator"] .upgrade-button {
  grid-area: button;
  width: 100%;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 8px;
  align-self: end;
  line-height: 1;
}

/* Auch in den anderen Kategorien bleiben die Kaufbuttons exakt gleich hoch. */
#upgradeTab .upgrade-button {
  height: 34px;
  min-height: 34px;
}

@media (max-width: 1360px) {
  #upgradeTab .upgrade-card[data-upgrade-group="elevator"],
  #upgradeTab .upgrade-card.featured-upgrade[data-upgrade-group="elevator"],
  #upgradeTab .upgrade-card.locked-upgrade[data-upgrade-group="elevator"] {
    grid-column: auto;
    min-height: 104px;
  }
}

@media (max-width: 540px) {
  .waiting-people {
    gap: 3px;
  }

  .more-people {
    min-width: 31px;
    padding: 4px 5px;
    font-size: 10px;
  }

  #upgradeTab .upgrade-card[data-upgrade-group="elevator"],
  #upgradeTab .upgrade-card.featured-upgrade[data-upgrade-group="elevator"],
  #upgradeTab .upgrade-card.locked-upgrade[data-upgrade-group="elevator"] {
    min-height: 108px;
  }
}

/* =========================================================
   V9 – Hauptmenü und neuer Game-over-Ablauf
   ========================================================= */

.game-shell {
  transition: filter 260ms ease, opacity 260ms ease, transform 260ms ease;
}

body.main-menu-open {
  overflow: hidden;
}

body.main-menu-open .game-shell {
  pointer-events: none;
  opacity: 0.16;
  filter: blur(7px) saturate(0.72);
  transform: scale(0.992);
}

.main-menu-screen {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  place-items: center;
  min-width: 320px;
  padding: 28px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 20%, rgba(79, 124, 255, 0.26), transparent 30%),
    radial-gradient(circle at 82% 15%, rgba(86, 217, 255, 0.18), transparent 28%),
    radial-gradient(circle at 72% 88%, rgba(73, 226, 157, 0.12), transparent 30%),
    linear-gradient(145deg, rgba(4, 12, 23, 0.98), rgba(8, 23, 39, 0.98));
  isolation: isolate;
}

.main-menu-screen.hidden {
  display: none !important;
}

.menu-skyline {
  position: absolute;
  z-index: -1;
  inset: auto 0 0;
  height: 46%;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 2.2vw;
  padding: 0 4vw;
  overflow: hidden;
  opacity: 0.22;
  pointer-events: none;
}

.menu-skyline span {
  position: relative;
  width: clamp(70px, 11vw, 180px);
  border: 1px solid rgba(86, 217, 255, 0.25);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 17px, rgba(86, 217, 255, 0.12) 18px 20px),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(86, 217, 255, 0.1) 25px 27px),
    linear-gradient(180deg, rgba(18, 52, 82, 0.6), rgba(5, 17, 30, 0.92));
  box-shadow: 0 0 50px rgba(86, 217, 255, 0.05);
}

.menu-skyline span:nth-child(1) { height: 45%; }
.menu-skyline span:nth-child(2) { height: 72%; }
.menu-skyline span:nth-child(3) { height: 58%; }
.menu-skyline span:nth-child(4) { height: 92%; }
.menu-skyline span:nth-child(5) { height: 64%; }
.menu-skyline span:nth-child(6) { height: 48%; }

.main-menu-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(390px, 1.12fr);
  gap: 30px;
  align-items: center;
}

.menu-hero {
  padding: 20px 8px;
}

.menu-brand-mark {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid rgba(86, 217, 255, 0.42);
  border-radius: 28px;
  color: var(--cyan);
  font-size: 50px;
  font-weight: 950;
  background: linear-gradient(145deg, rgba(86, 217, 255, 0.18), rgba(79, 124, 255, 0.16));
  box-shadow: inset 0 0 38px rgba(86, 217, 255, 0.1), 0 24px 70px rgba(0, 0, 0, 0.34);
}

.menu-hero h1 {
  margin: 0 0 15px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.menu-hero > p:not(.eyebrow) {
  max-width: 520px;
  margin: 0;
  color: #a8bdd3;
  font-size: 16px;
  line-height: 1.65;
}

.menu-feature-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.menu-feature-row span {
  padding: 8px 10px;
  border: 1px solid rgba(148, 182, 225, 0.13);
  border-radius: 999px;
  color: #b9cee2;
  font-size: 11px;
  font-weight: 800;
  background: rgba(7, 22, 37, 0.6);
}

.main-menu-card {
  padding: 26px;
  border: 1px solid rgba(148, 182, 225, 0.18);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(18, 39, 64, 0.96), rgba(7, 19, 33, 0.96));
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(22px);
}

.menu-card-kicker {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.18em;
}

.main-menu-card h2 {
  margin: 0 0 18px;
  font-size: 25px;
}

.main-menu-actions {
  display: grid;
  gap: 9px;
}

.menu-action {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 13px;
  border: 1px solid rgba(148, 182, 225, 0.14);
  border-radius: 15px;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: rgba(3, 13, 24, 0.48);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.menu-action:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(86, 217, 255, 0.38);
  background: rgba(86, 217, 255, 0.075);
}

.menu-action:active:not(:disabled) {
  transform: translateY(1px);
}

.menu-action:disabled {
  opacity: 0.42;
}

.primary-menu-action {
  border-color: rgba(86, 217, 255, 0.35);
  background: linear-gradient(135deg, rgba(86, 217, 255, 0.16), rgba(79, 124, 255, 0.12));
  box-shadow: inset 0 0 24px rgba(86, 217, 255, 0.05);
}

.menu-action-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--cyan);
  font-size: 18px;
  font-weight: 950;
  background: rgba(86, 217, 255, 0.1);
}

.menu-action strong,
.menu-action small {
  display: block;
}

.menu-action strong {
  font-size: 14px;
}

.menu-action small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.external-link-mark {
  color: var(--cyan);
  font-size: 18px;
}

.menu-save-hint {
  min-height: 36px;
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 182, 225, 0.1);
  border-radius: 11px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.14);
}

.menu-footer {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: rgba(142, 166, 194, 0.68);
  font-size: 10px;
  text-align: center;
}

.menu-footer strong {
  color: rgba(239, 247, 255, 0.78);
}

/* Das Hauptmenü liegt unter den Dialogen, damit die Spielanleitung
   auch direkt aus dem Menü geöffnet werden kann. */
.overlay {
  z-index: 1200;
}

.game-over-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.game-over-actions .large {
  width: 100%;
}

.secondary-button.large {
  min-height: 50px;
  font-size: 15px;
}

@media (max-width: 820px) {
  .main-menu-screen {
    align-items: start;
    padding: 22px 16px;
  }

  .main-menu-shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .menu-hero {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    column-gap: 15px;
    padding: 4px 2px;
  }

  .menu-brand-mark {
    grid-row: 1 / 4;
    width: 70px;
    height: 70px;
    margin: 0;
    border-radius: 21px;
    font-size: 38px;
  }

  .menu-hero .eyebrow {
    margin-top: 4px;
  }

  .menu-hero h1 {
    font-size: clamp(36px, 10vw, 54px);
  }

  .menu-hero > p:not(.eyebrow),
  .menu-feature-row {
    grid-column: 1 / -1;
  }

  .menu-hero > p:not(.eyebrow) {
    margin-top: 14px;
    font-size: 14px;
  }

  .menu-feature-row {
    margin-top: 14px;
  }
}

@media (max-width: 540px) {
  .main-menu-screen {
    padding: 14px 10px;
  }

  .main-menu-card {
    padding: 17px;
    border-radius: 20px;
  }

  .menu-action {
    min-height: 64px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 9px 10px;
  }

  .menu-action-icon {
    width: 38px;
    height: 38px;
  }

  .menu-feature-row span {
    font-size: 9px;
  }

  .game-over-actions {
    grid-template-columns: 1fr;
  }
}
