:root {
  --bg: #06111f;
  --panel: rgba(8, 22, 39, 0.96);
  --panel-soft: rgba(13, 35, 61, 0.9);
  --line: rgba(130, 190, 255, 0.18);
  --text: #eaf5ff;
  --muted: #91a9bf;
  --blue: #2f8cff;
  --blue-strong: #086dff;
  --green: #2ddc96;
  --red: #ff5f73;
  --yellow: #ffd166;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(4, 12, 23, 0.88);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(82, 164, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.16);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #06111f;
  color: #fff;
  text-align: center;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 13, 25, 0.98);
  z-index: 30;
}

.brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  background: linear-gradient(145deg, #0d6efd, #00c2ff);
  box-shadow: 0 0 25px rgba(47, 140, 255, 0.45);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-ok {
  color: var(--green);
  border-color: rgba(45, 220, 150, 0.42);
}

.status-error {
  color: var(--red);
  border-color: rgba(255, 95, 115, 0.42);
}

.status-muted {
  color: var(--muted);
}

.icon-button,
.small-button,
.primary-button,
.secondary-button,
.hud-scan-button,
.hud-build-button {
  border-radius: 10px;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.icon-button:active,
.small-button:active,
.primary-button:active,
.secondary-button:active,
.hud-scan-button:active,
.hud-build-button:active {
  transform: translateY(1px);
}

.icon-button {
  display: none;
  width: 42px;
  height: 38px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.small-button {
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-size: 13px;
}

.small-button.active,
.secondary-button.active {
  border-color: rgba(45, 220, 150, 0.54);
  color: #c9ffe9;
  background: rgba(45, 220, 150, 0.12);
}

.small-button.danger {
  color: #ffd5db;
  border-color: rgba(255, 95, 115, 0.35);
}

.small-button.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.danger-info-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 95, 115, 0.28);
  background: rgba(255, 95, 115, 0.08);
}

.danger-info-box strong {
  color: #ffd5db;
}

.danger-info-box p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.primary-button {
  padding: 11px 13px;
  background: linear-gradient(145deg, #0d6efd, #00a6ff);
  color: white;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(13, 110, 253, 0.24);
}

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

.wide {
  width: 100%;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 0;
}

.side-panel {
  position: relative;
  z-index: 18;
  overflow-y: auto;
  padding: 12px;
  background: linear-gradient(180deg, rgba(5, 15, 28, 0.98), rgba(5, 15, 28, 0.92));
  border-right: 1px solid var(--line);
}

.panel-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-card.compact-card {
  padding-bottom: 12px;
}

.panel-card h1,
.panel-card h2 {
  margin: 0 0 11px;
  font-size: 16px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-stack,
.select-label {
  display: grid;
  gap: 10px;
}

.form-stack label,
.select-label {
  color: var(--muted);
  font-size: 13px;
}

.form-stack label span,
.select-label span {
  display: block;
  margin-bottom: 6px;
}

.player-box {
  display: grid;
  gap: 12px;
}

.muted-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 10px 0 0;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-grid div,
.info-list div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.metric-grid span,
.info-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metric-grid strong,
.info-list strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.info-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.hint,
.small-output {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.small-output {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.map-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
}

.map-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  filter: drop-shadow(0 0 10px rgba(0, 140, 255, 0.5));
}

.map-crosshair::before,
.map-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.58);
}

.map-crosshair::before {
  width: 54px;
  height: 2px;
  left: -13px;
  top: 15px;
}

.map-crosshair::after {
  width: 2px;
  height: 54px;
  left: 15px;
  top: -13px;
}

.map-status-card {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 9;
  display: grid;
  gap: 5px;
  min-width: 230px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(6, 17, 31, 0.72);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.map-status-card div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
}

.map-status-card span {
  color: var(--muted);
}

.map-status-card strong {
  font-size: 12px;
  text-align: right;
}

.map-status-card .bad,
#hudDistanceInfo.bad {
  color: var(--red);
}

.bottom-hud {
  position: absolute;
  left: 14px;
  right: auto;
  bottom: 24px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(calc(100vw - 28px), 820px);
  pointer-events: none;
}

.bottom-hud > * {
  pointer-events: auto;
}

.hud-scan-button {
  min-width: 112px;
  height: 52px;
  padding: 0 20px;
  border-radius: 18px;
  background: linear-gradient(145deg, #0d6efd, #00c2ff);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.02em;
  box-shadow: 0 16px 38px rgba(13, 110, 253, 0.42);
}

.resource-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: min(52vw, 620px);
  overflow-x: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(6, 17, 31, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
}

.hud-resource-select {
  min-width: 170px;
  width: min(34vw, 260px);
  height: 52px;
  border-radius: 18px;
  background: rgba(6, 17, 31, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.resource-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(130, 190, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  white-space: nowrap;
  font-weight: 700;
}

.resource-chip.active {
  background: rgba(47, 140, 255, 0.24);
  border-color: rgba(95, 185, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(47, 140, 255, 0.14), 0 0 28px rgba(47, 140, 255, 0.28);
}

.resource-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 9px;
  background: radial-gradient(circle at 35% 25%, rgba(120, 230, 255, 0.95), rgba(0, 87, 255, 0.5));
  color: white;
  font-size: 15px;
  line-height: 1;
}

.chip-placeholder {
  color: var(--muted);
  padding: 0 8px;
  white-space: nowrap;
}

.hud-plant-select {
  width: min(30vw, 260px);
  height: 52px;
  border-radius: 18px;
  background: rgba(6, 17, 31, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hud-build-button {
  min-width: 104px;
  height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(45, 220, 150, 0.16);
  border: 1px solid rgba(45, 220, 150, 0.4);
  color: #d5fff0;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.bottom-note {
  position: absolute;
  left: 14px;
  bottom: 82px;
  z-index: 10;
  max-width: min(70vw, 760px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(6, 17, 31, 0.68);
  color: var(--muted);
  font-size: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.table-wrap {
  max-height: 270px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(130, 190, 255, 0.12);
  text-align: left;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(8, 22, 39, 0.98);
  color: var(--muted);
}

td strong {
  color: var(--text);
}

.history-box {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.history-item {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
}

.history-item strong {
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 80;
  transform: translateX(-50%);
  max-width: min(92vw, 620px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(5, 15, 28, 0.95);
  color: var(--text);
  box-shadow: var(--shadow);
}

.marker-player {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(45, 220, 150, 0.18), 0 0 34px rgba(45, 220, 150, 0.36), 0 10px 30px rgba(0, 0, 0, 0.35);
}

.maplibregl-popup-content {
  background: rgba(6, 17, 31, 0.96);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.maplibregl-popup-tip {
  border-top-color: rgba(6, 17, 31, 0.96) !important;
  border-bottom-color: rgba(6, 17, 31, 0.96) !important;
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib a {
  color: rgba(234, 245, 255, 0.82) !important;
  background: rgba(6, 17, 31, 0.66) !important;
}

.maplibregl-ctrl-group {
  background: rgba(6, 17, 31, 0.92) !important;
  border: 1px solid rgba(130, 190, 255, 0.18) !important;
}

.maplibregl-ctrl button {
  filter: invert(1) brightness(1.4);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .resource-strip {
    max-width: min(46vw, 520px);
  }
}

@media (max-width: 980px) {
  body {
    overflow: hidden;
  }

  .icon-button {
    display: grid;
    place-items: center;
  }

  .topbar .small-button {
    display: none;
  }

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

  .side-panel {
    position: fixed;
    left: 0;
    top: 58px;
    bottom: 0;
    width: min(92vw, 400px);
    transform: translateX(-104%);
    transition: transform 0.18s ease;
    border-right: 1px solid var(--line);
  }

  .side-panel.open {
    transform: translateX(0);
  }

  .map-area {
    height: calc(100dvh - 58px);
  }

  .map-status-card {
    left: 10px;
    right: 10px;
    top: 10px;
    min-width: 0;
  }

  .bottom-hud {
    left: 10px;
    right: 10px;
    bottom: 12px;
  }

  .resource-strip {
    max-width: none;
    flex: 1 1 auto;
  }

  .hud-plant-select {
    display: none;
  }

  .bottom-note {
    left: 10px;
    right: 10px;
    bottom: 75px;
    max-width: none;
  }
}

@media (max-width: 620px) {
  .brand span,
  .status-pill {
    display: none;
  }

  .topbar {
    height: 54px;
  }

  .side-panel {
    top: 54px;
  }

  .map-area {
    height: calc(100dvh - 54px);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .button-grid,
  .metric-grid,
  .metric-grid.compact {
    grid-template-columns: 1fr;
  }

  .hud-scan-button {
    min-width: 92px;
    height: 50px;
    padding: 0 15px;
    font-size: 16px;
  }

  .hud-build-button {
    min-width: 84px;
    height: 50px;
    padding: 0 12px;
  }

  .resource-chip span:last-child {
    display: none;
  }

  .resource-chip {
    padding: 0 9px;
  }

  .resource-icon {
    width: 28px;
    height: 28px;
  }

  .map-status-card div {
    font-size: 11px;
  }

  .map-status-card strong {
    font-size: 11px;
  }
}

/* Schritt 7 Fix 5: mobile-first HUD, Dropdown-Rohstoffwahl, Close-Zoom-Wolke */
.player-hud-card {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 13;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto auto auto minmax(150px, 260px);
  align-items: center;
  gap: 8px;
  max-width: min(92vw, 620px);
  padding: 8px 10px;
  border: 1px solid rgba(24, 69, 112, 0.24);
  border-radius: 16px;
  background: rgba(247, 251, 255, 0.86);
  color: #08213b;
  box-shadow: 0 14px 36px rgba(0, 25, 60, 0.22);
  backdrop-filter: blur(16px);
}

.player-hud-metric {
  min-width: 72px;
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(7, 28, 52, 0.06);
}

.player-hud-metric span,
.progress-label span {
  display: block;
  color: rgba(8, 33, 59, 0.68);
  font-size: 10px;
  line-height: 1.1;
}

.player-hud-metric strong,
.progress-label strong {
  display: block;
  color: #08213b;
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

.player-hud-progress {
  min-width: 0;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 33, 59, 0.14);
}

.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b82ff, #21c7ff);
  box-shadow: 0 0 18px rgba(27, 130, 255, 0.45);
  transition: width 0.22s ease;
}

.map-status-card {
  background: rgba(247, 251, 255, 0.82);
  color: #092744;
  border-color: rgba(24, 69, 112, 0.22);
  box-shadow: 0 14px 36px rgba(0, 25, 60, 0.18);
}

.map-status-card span,
.map-status-card strong {
  color: #092744;
}

.map-status-card span {
  opacity: 0.68;
}

.bottom-hud {
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
}

.hud-scan-button,
.hud-build-button,
.resource-strip,
.hud-resource-select,
.hud-plant-select {
  box-shadow: 0 12px 32px rgba(0, 36, 76, 0.28);
}

.resource-strip,
.hud-resource-select,
.hud-plant-select {
  background: rgba(247, 251, 255, 0.88);
  color: #08213b;
  border-color: rgba(24, 69, 112, 0.22);
}

.hud-resource-select,
.hud-plant-select {
  color: #08213b;
}

.resource-chip {
  color: #08213b;
  background: rgba(8, 33, 59, 0.06);
  border-color: rgba(24, 69, 112, 0.16);
}

.resource-chip.active {
  color: #05213d;
  background: rgba(32, 142, 255, 0.18);
  border-color: rgba(24, 129, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(32, 142, 255, 0.12), 0 8px 24px rgba(32, 142, 255, 0.22);
}

.bottom-note {
  background: rgba(247, 251, 255, 0.84);
  color: rgba(8, 33, 59, 0.72);
  border-color: rgba(24, 69, 112, 0.2);
}

.map-crosshair {
  border-color: rgba(0, 86, 190, 0.72);
  filter: drop-shadow(0 0 8px rgba(0, 115, 255, 0.42));
}

.map-crosshair::before,
.map-crosshair::after {
  background: rgba(0, 86, 190, 0.82);
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib a {
  color: rgba(8, 33, 59, 0.78) !important;
  background: rgba(247, 251, 255, 0.72) !important;
}

.maplibregl-ctrl-group {
  background: rgba(247, 251, 255, 0.92) !important;
  border: 1px solid rgba(24, 69, 112, 0.20) !important;
}

.maplibregl-ctrl button {
  filter: none;
}

@media (max-width: 980px) {
  .player-hud-card {
    left: 10px;
    right: 10px;
    top: 10px;
    transform: none;
    grid-template-columns: 1fr 58px 76px minmax(110px, 1.25fr);
    max-width: none;
  }

  .map-status-card {
    left: 10px;
    right: 10px;
    top: 76px;
    min-width: 0;
    padding: 7px 9px;
    border-radius: 13px;
    gap: 3px;
  }

  .bottom-hud {
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    width: auto;
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 76px;
    gap: 6px;
    align-items: end;
  }

  .hud-scan-button,
  .hud-build-button {
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 0 8px;
    border-radius: 16px;
    font-size: 15px;
  }

  .resource-strip {
    min-width: 0;
    max-width: none;
    height: 54px;
    padding: 6px;
    border-radius: 16px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .hud-resource-select {
    width: 100%;
    min-width: 0;
    height: 54px;
    border-radius: 16px;
    padding-left: 10px;
    padding-right: 24px;
  }

  .resource-chip {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 9px;
    border-radius: 13px;
  }

  .hud-plant-select {
    display: none;
  }

  .bottom-note {
    display: none;
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 620px) {
  .player-hud-card {
    top: 8px;
    left: 8px;
    right: 8px;
    grid-template-columns: 1fr 50px 68px 1.1fr;
    gap: 5px;
    padding: 7px;
    border-radius: 14px;
  }

  .player-hud-metric {
    min-width: 0;
    padding: 5px 6px;
  }

  .player-hud-metric strong,
  .progress-label strong {
    font-size: 12px;
  }

  .player-hud-metric span,
  .progress-label span {
    font-size: 9px;
  }

  .map-status-card {
    top: 67px;
    padding: 6px 8px;
  }

  .map-status-card div:nth-child(2) {
    display: none;
  }

  .bottom-hud {
    grid-template-columns: 72px minmax(0, 1fr) 70px;
    gap: 5px;
  }

  .hud-scan-button,
  .hud-build-button,
  .resource-strip,
  .hud-resource-select {
    height: 52px;
  }

  .hud-scan-button,
  .hud-build-button {
    font-size: 14px;
    border-radius: 15px;
  }

  .resource-chip {
    min-height: 38px;
    padding: 0 8px;
  }

  .resource-icon {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 380px) {
  .bottom-hud {
    grid-template-columns: 66px minmax(0, 1fr) 64px;
  }

  .hud-scan-button,
  .hud-build-button {
    font-size: 13px;
  }

  .player-hud-card {
    grid-template-columns: 1fr 46px 60px 1fr;
  }
}

/* Schritt 7 Fix 5: Mobile-HUD als Dropdown, Scan-Knopf sichtbar, Credits/GP als ganze Zahlen */
.player-hud-card {
  grid-template-columns: auto auto auto minmax(130px, 240px);
  gap: 7px;
}

.hud-resource-select,
.hud-plant-select {
  height: 52px;
  border-radius: 18px;
  background: rgba(247, 251, 255, 0.92);
  color: #08213b;
  border-color: rgba(24, 69, 112, 0.24);
  box-shadow: 0 12px 32px rgba(0, 36, 76, 0.24);
  backdrop-filter: blur(14px);
  font-weight: 800;
}

.hud-resource-select {
  width: min(32vw, 300px);
}

.hud-plant-select {
  width: min(30vw, 260px);
}

.bottom-hud {
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: auto;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  align-items: end;
}

.bottom-note {
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.hud-scan-button,
.hud-build-button {
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .map-area {
    height: calc(100dvh - 58px);
  }

  .bottom-hud {
    left: calc(10px + env(safe-area-inset-left, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    max-width: none;
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) 78px;
    gap: 7px;
  }

  .hud-resource-select,
  .hud-scan-button,
  .hud-build-button {
    width: 100%;
    min-width: 0;
    height: 54px;
    border-radius: 16px;
  }

  .hud-resource-select {
    font-size: 15px;
    padding-left: 10px;
    padding-right: 30px;
  }

  .hud-plant-select {
    display: none;
  }

  .player-hud-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr) 54px minmax(110px, 1.2fr);
  }

  .toast {
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 620px) {
  .map-area {
    height: calc(100dvh - 54px);
  }

  .player-hud-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) 48px minmax(92px, 1fr);
    gap: 4px;
    padding: 6px;
  }

  .player-hud-metric {
    padding: 4px 5px;
  }

  .player-hud-metric strong,
  .progress-label strong {
    font-size: 11px;
  }

  .player-hud-metric span,
  .progress-label span {
    font-size: 8px;
  }

  .bottom-hud {
    grid-template-columns: 74px minmax(0, 1fr) 70px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
  }

  .hud-scan-button,
  .hud-build-button,
  .hud-resource-select {
    height: 52px;
  }

  .hud-resource-select {
    font-size: 14px;
  }

  .hud-scan-button,
  .hud-build-button {
    font-size: 14px;
  }
}

@media (max-width: 380px) {
  .bottom-hud {
    grid-template-columns: 68px minmax(0, 1fr) 64px;
  }

  .hud-resource-select {
    font-size: 13px;
  }

  .player-hud-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) 42px minmax(82px, 1fr);
  }
}

/* Schritt 7 Fix 7: gescannter Baupunkt bleibt fixiert, Icons im HUD */
.hud-select-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 52px;
  border: 1px solid rgba(24, 69, 112, 0.24);
  border-radius: 18px;
  background: rgba(247, 251, 255, 0.92);
  color: #08213b;
  box-shadow: 0 12px 32px rgba(0, 36, 76, 0.24);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.hud-select-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin-left: 8px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(4, 13, 25, 0.08);
  filter: drop-shadow(0 0 10px rgba(0, 95, 255, 0.28));
}

.hud-select-box select,
.hud-resource-select,
.hud-plant-select {
  height: 100%;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #08213b;
  box-shadow: none;
  font-weight: 800;
  padding-left: 0;
  padding-right: 28px;
}

.hud-resource-box {
  min-width: 190px;
  width: min(34vw, 320px);
}

.hud-plant-box {
  min-width: 180px;
  width: min(30vw, 280px);
}

.bottom-hud {
  grid-template-columns: auto auto auto auto;
}

@media (max-width: 980px) {
  .bottom-hud {
    grid-template-columns: 74px minmax(0, 1fr) 58px 70px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  }

  .hud-select-box,
  .hud-scan-button,
  .hud-build-button {
    height: 52px;
    border-radius: 16px;
  }

  .hud-resource-box {
    width: auto;
    min-width: 0;
  }

  .hud-plant-box {
    display: flex;
    width: 58px;
    min-width: 58px;
  }

  .hud-plant-box .hud-select-icon {
    width: 38px;
    height: 38px;
    margin-left: 9px;
  }

  .hud-plant-box select {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
  }

  .hud-resource-box .hud-select-icon {
    width: 34px;
    height: 34px;
    margin-left: 7px;
  }
}

@media (max-width: 420px) {
  .bottom-hud {
    grid-template-columns: 68px minmax(0, 1fr) 52px 62px;
    gap: 5px;
    left: calc(7px + env(safe-area-inset-left, 0px));
    right: calc(7px + env(safe-area-inset-right, 0px));
  }

  .hud-scan-button,
  .hud-build-button {
    font-size: 13px;
    padding: 0 5px;
  }

  .hud-plant-box {
    width: 52px;
    min-width: 52px;
  }

  .hud-resource-select {
    font-size: 13px;
  }
}

@media (max-width: 980px) {
  .hud-plant-box .hud-plant-select {
    display: block !important;
  }
}

/* Schritt 8 Fix 1: Rohstoff bestimmt Anlage automatisch, gebaute Anlagen bleiben sichtbar */
.auto-plant-info {
  margin-top: 8px;
  padding: 10px 11px;
  border: 1px solid rgba(24, 69, 112, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.hud-plant-box,
.hud-plant-select {
  display: none !important;
}

.bottom-hud {
  grid-template-columns: auto minmax(190px, 320px) auto;
}

.hud-build-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(8, 33, 59, 0.42);
  background: rgba(247, 251, 255, 0.72);
  border: 1px solid rgba(24, 69, 112, 0.18);
}

.hud-build-button.build-waiting {
  color: rgba(8, 33, 59, 0.58);
  background: rgba(247, 251, 255, 0.82);
  border-color: rgba(24, 69, 112, 0.25);
}

.hud-build-button.build-ready {
  color: #ffffff;
  background: linear-gradient(145deg, #13b975, #2ddc96);
  border-color: rgba(45, 220, 150, 0.82);
  box-shadow: 0 14px 36px rgba(20, 185, 116, 0.38), 0 0 0 3px rgba(45, 220, 150, 0.18);
}

.hud-build-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 95, 255, 0.26));
}

.hud-build-button.build-ready .hud-build-icon {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.28));
}

.marker-plant {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 9px;
  padding: 2px;
  display: grid;
  place-items: center;
  background: rgba(6, 17, 31, 0.80);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.84), 0 0 0 3px rgba(47, 140, 255, 0.18), 0 8px 16px rgba(0, 25, 60, 0.26);
  cursor: pointer;
}

.marker-plant img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  pointer-events: none;
}

.marker-plant-fallback {
  color: #fff;
  font-weight: 900;
  background: linear-gradient(145deg, #0d6efd, #00c2ff);
}

@media (max-width: 980px) {
  .bottom-hud {
    grid-template-columns: 74px minmax(0, 1fr) 76px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  }

  .hud-resource-box {
    min-width: 0;
    width: auto;
  }
}

@media (max-width: 420px) {
  .bottom-hud {
    grid-template-columns: 68px minmax(0, 1fr) 70px;
  }

  .hud-build-icon {
    width: 21px;
    height: 21px;
  }
}

.plant-image-overlay-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  overflow: hidden;
}

.plant-footprint-image-marker {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 7;
  border: 1px solid rgba(0, 126, 83, 0.85);
  padding: 0;
  margin: 0;
  background-color: rgba(7, 18, 31, 0.08);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-radius: 2px;
  overflow: hidden;
  display: block;
  cursor: pointer;
  pointer-events: auto;
  opacity: 1;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24), 0 0 0 1px rgba(0, 109, 255, 0.10);
  appearance: none;
  -webkit-appearance: none;
}

.plant-footprint-image-marker.has-image {
  background-color: rgba(7, 18, 31, 0.02);
}

.plant-footprint-image-inner {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  opacity: 1;
  pointer-events: none;
  user-select: none;
}

.plant-footprint-image-marker.image-missing::after {
  content: attr(data-image-code);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1px;
  font-size: 7px;
  line-height: 1;
  color: rgba(0, 60, 38, 0.9);
  background: rgba(38, 220, 145, 0.16);
  overflow: hidden;
  text-align: center;
}

/* Schritt 8 Fix 11: Canvas-Overlay für Anlagenbilder. */
.plant-image-canvas-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Schritt 11 / V0.1-Fertigstellungsblock: Overlays, Lager, Markt, Upgrades */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(5, 12, 23, 0.48);
  backdrop-filter: blur(10px);
}

.game-overlay.hidden {
  display: none !important;
}

.overlay-panel {
  width: min(720px, 100%);
  max-height: min(86dvh, 860px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(24, 69, 112, 0.20);
  border-radius: 22px;
  background: rgba(247, 251, 255, 0.96);
  color: #06111f;
  box-shadow: 0 26px 80px rgba(0, 27, 70, 0.32);
  overflow: hidden;
}

.overlay-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 0;
}

.overlay-header h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.overlay-scroller {
  overflow: auto;
  padding: 0 18px 18px;
}

.overlay-actions,
.overlay-toolbar {
  padding: 0 18px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.plant-detail-head,
.storage-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-icon,
.storage-card-head img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(8, 33, 59, 0.05);
  padding: 5px;
}

.plant-detail-head span,
.storage-card-head span {
  display: block;
  color: #60718a;
  font-size: 12px;
  margin-top: 2px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-metric,
.upgrade-box,
.storage-card,
.market-offer-card,
.empty-state {
  border: 1px solid rgba(24, 69, 112, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.detail-metric span,
.market-offer-card small {
  display: block;
  color: #60718a;
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-metric strong {
  font-size: 15px;
}

.upgrade-box {
  margin-top: 12px;
  line-height: 1.45;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.storage-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-mini {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: rgba(8, 33, 59, 0.10);
  overflow: hidden;
}

.progress-mini i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #237bff, #21d49b);
}

.storage-numbers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #41536a;
  font-size: 13px;
}

.market-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  padding: 0 18px;
}

.market-form label {
  display: grid;
  gap: 6px;
  color: #60718a;
  font-size: 12px;
}

.market-form select,
.market-form input {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(24, 69, 112, 0.18);
  background: #ffffff;
  color: #06111f;
  padding: 0 10px;
}

.market-action-grid {
  padding: 0 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.market-scroll h3 {
  margin: 14px 0 8px;
}

.market-list {
  display: grid;
  gap: 10px;
}

.market-offer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offer-main {
  display: grid;
  gap: 3px;
}

.offer-main span {
  color: #41536a;
  font-size: 13px;
}

@media (max-width: 720px) {
  .game-overlay {
    align-items: end;
    padding: 10px;
  }

  .overlay-panel {
    width: 100%;
    max-height: 82dvh;
    border-radius: 20px 20px 16px 16px;
  }

  .detail-grid,
  .storage-grid,
  .market-form,
  .market-action-grid {
    grid-template-columns: 1fr;
  }

  .market-offer-card {
    align-items: stretch;
    flex-direction: column;
  }
}


.scan-quality-pill {
  position: absolute;
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(104px + env(safe-area-inset-bottom));
  z-index: 24;
  max-width: 560px;
  margin: 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(4, 20, 34, 0.84);
  color: #e9fbff;
  border: 1px solid rgba(101, 215, 255, 0.42);
  box-shadow: 0 10px 32px rgba(0,0,0,0.28);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.scan-quality-pill strong {
  color: #7de7ff;
}

.scan-quality-pill.hidden {
  display: none;
}

@media (max-width: 720px) {
  .scan-quality-pill {
    bottom: calc(116px + env(safe-area-inset-bottom));
    left: calc(10px + env(safe-area-inset-left));
    right: calc(10px + env(safe-area-inset-right));
    font-size: 0.78rem;
    padding: 8px 10px;
  }
}

/* Schritt 11 Fix 2: Overlay-Ausgang, stärkere Buttons, bessere Markt-/Lagerbedienung. */
.overlay-close-button {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(24, 69, 112, 0.24);
  border-radius: 14px;
  background: rgba(8, 33, 59, 0.08);
  color: #06111f;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 27, 70, 0.10);
}

.overlay-close-button:hover,
.overlay-close-button:focus-visible {
  background: rgba(255, 95, 115, 0.14);
  border-color: rgba(255, 95, 115, 0.44);
  color: #b3132a;
  outline: none;
}

.game-overlay {
  touch-action: manipulation;
}

.overlay-panel {
  position: relative;
}

.storage-card .secondary-button,
.storage-card [data-storage-upgrade] {
  min-height: 46px;
  color: #ffffff;
  background: linear-gradient(145deg, #0878ff, #21a8ff);
  border: 1px solid rgba(8, 120, 255, 0.72);
  font-weight: 900;
  box-shadow: 0 12px 28px rgba(8, 120, 255, 0.24);
}

.storage-card [data-storage-upgrade]:disabled {
  color: rgba(8, 33, 59, 0.52);
  background: rgba(8, 33, 59, 0.08);
  border-color: rgba(24, 69, 112, 0.16);
  box-shadow: none;
}

.market-action-grid .primary-button,
.market-action-grid .secondary-button,
.market-offer-card .small-button,
.overlay-actions .primary-button {
  min-height: 44px;
  font-weight: 900;
}

.market-action-grid .secondary-button {
  color: #08213b;
  background: rgba(8, 120, 255, 0.10);
  border-color: rgba(8, 120, 255, 0.34);
}

.market-action-grid .secondary-button:hover,
.market-action-grid .secondary-button:focus-visible {
  background: rgba(8, 120, 255, 0.18);
  outline: none;
}

.market-inline-message {
  margin: 0 18px 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(24, 69, 112, 0.18);
  background: rgba(8, 33, 59, 0.06);
  color: #30445b;
  font-size: 13px;
  line-height: 1.35;
}

.market-inline-message.error {
  border-color: rgba(255, 95, 115, 0.36);
  background: rgba(255, 95, 115, 0.10);
  color: #9b1b2e;
}

.market-inline-message.ok {
  border-color: rgba(20, 185, 116, 0.36);
  background: rgba(20, 185, 116, 0.10);
  color: #06734d;
}

.storage-card-head img,
.detail-icon {
  background: rgba(8, 120, 255, 0.07);
  border: 1px solid rgba(8, 120, 255, 0.12);
}

@media (max-width: 720px) {
  .overlay-close-button {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 26px;
  }

  .overlay-header {
    padding-top: 14px;
  }

  .storage-card .secondary-button,
  .market-action-grid .primary-button,
  .market-action-grid .secondary-button {
    min-height: 48px;
  }
}

/* V0.2 Schritt 12: oberes Seiten-Dropdown, Web-Registrierung, Lager-/Produktionsstatistiken */
.page-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 164px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--muted);
  font-size: 12px;
}

.page-switch select {
  min-height: 32px;
  padding: 5px 26px 5px 9px;
  border-radius: 10px;
  background: rgba(4, 12, 23, 0.96);
  color: var(--text);
  font-weight: 800;
}

.auth-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.auth-mode-row .small-button.active {
  background: rgba(47, 140, 255, 0.24);
  color: #ffffff;
  border-color: rgba(82, 164, 255, 0.65);
}

.app-page-overlay {
  top: 58px;
  z-index: 42;
  display: grid;
  place-items: stretch center;
  overflow: auto;
  padding: 14px;
  background: linear-gradient(180deg, #eef6ff 0%, #dbeaff 100%);
  backdrop-filter: none;
}

.app-page-overlay.hidden {
  display: none !important;
}

.app-page-overlay .overlay-panel {
  width: min(1180px, 100%);
  max-height: none;
  min-height: calc(100dvh - 86px);
  margin: 0 auto;
  background: rgba(248, 252, 255, 0.98);
}

.app-page-overlay .overlay-close-button {
  width: auto;
  padding: 0 12px;
  font-size: 22px;
}

.app-page-overlay .overlay-close-button::after {
  content: " Karte";
  font-size: 13px;
  font-weight: 800;
  margin-left: 3px;
}

.storage-rate-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}

.storage-rate-row span {
  display: grid;
  gap: 2px;
  padding: 7px;
  border-radius: 11px;
  background: rgba(8, 120, 255, 0.07);
  color: #41536a;
  font-size: 11px;
}

.storage-rate-row strong {
  color: #08213b;
  font-size: 12px;
}

.storage-rate-row .rate-positive strong {
  color: #06734d;
}

.storage-rate-row .rate-negative strong {
  color: #b3132a;
}

.production-page-content {
  display: grid;
  gap: 14px;
}

.production-summary-grid,
.production-rates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.production-rate-card,
.production-summary-card {
  border: 1px solid rgba(24, 69, 112, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.production-rate-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.production-rate-card img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(8, 120, 255, 0.07);
  padding: 4px;
}

.production-rate-card strong,
.production-summary-card strong {
  display: block;
  color: #08213b;
}

.production-rate-card span,
.production-summary-card span {
  color: #60718a;
  font-size: 12px;
}

.production-rate-lines {
  display: grid;
  gap: 5px;
  color: #41536a;
  font-size: 13px;
}

.production-rate-lines b {
  color: #08213b;
}

.page-mode-note {
  color: #60718a;
  font-size: 13px;
}

@media (max-width: 980px) {
  .page-switch {
    min-width: 136px;
  }

  .page-switch span,
  .status-pill {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .app-page-overlay {
    top: 58px;
    padding: 10px;
  }

  .app-page-overlay .overlay-panel {
    min-height: calc(100dvh - 78px);
  }

  .production-summary-grid,
  .production-rates-grid,
  .storage-rate-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .brand span {
    display: none;
  }

  .page-switch {
    min-width: 120px;
    padding-left: 5px;
  }

  .page-switch select {
    font-size: 13px;
  }

  #targetPlayerBtn {
    display: none;
  }
}

/* Schritt 12 Fix 1: Markt, Lagerstatus, Auto-Stromkauf */
.market-resource-info {
  margin: 0.65rem 0 0.75rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 14px;
  background: rgba(8, 19, 34, 0.72);
  color: rgba(226, 242, 255, 0.95);
  font-size: 0.88rem;
  line-height: 1.45;
}

.market-resource-info b {
  color: #ffffff;
}

.market-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.offer-volume {
  display: block;
  color: rgba(212, 232, 255, 0.94);
}

.storage-full-time {
  margin-top: 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(226, 242, 255, 0.92);
  font-size: 0.84rem;
}

.storage-full-time.filling {
  border: 1px solid rgba(56, 189, 248, 0.22);
}

.storage-full-time.full {
  border: 1px solid rgba(248, 113, 113, 0.38);
  background: rgba(127, 29, 29, 0.22);
}

.storage-full-time.idle {
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.storage-card .secondary-button[data-storage-upgrade] {
  background: linear-gradient(180deg, #0ea5e9, #0369a1);
  border-color: rgba(125, 211, 252, 0.75);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.18);
}

.storage-card .secondary-button[data-storage-upgrade]:disabled {
  background: rgba(71, 85, 105, 0.85);
  border-color: rgba(148, 163, 184, 0.35);
  color: rgba(226, 232, 240, 0.78);
  box-shadow: none;
}

.power-settings-card {
  margin: 0.75rem 0 0.9rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  background: linear-gradient(180deg, rgba(12, 30, 52, 0.95), rgba(8, 18, 32, 0.92));
}

.power-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.power-settings-head h3 {
  margin: 0.15rem 0 0;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  white-space: nowrap;
}

.switch-row input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: #38bdf8;
}

.power-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.power-settings-grid label {
  display: grid;
  gap: 0.35rem;
  color: rgba(226, 242, 255, 0.9);
  font-size: 0.82rem;
}

.power-settings-grid input,
.market-form input[type="number"] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  padding: 0.65rem 0.75rem;
}

@media (max-width: 760px) {
  .market-action-grid,
  .power-settings-grid {
    grid-template-columns: 1fr;
  }
}

/* Schritt 12 Fix 3: echtes Dropdown-Seitenlayout, Markt-Karten, Konto-Seite */
body:not([data-active-page="account"]) .layout {
  grid-template-columns: minmax(0, 1fr);
}

body:not([data-active-page="account"]) .side-panel {
  display: none !important;
}

body[data-active-page="account"] .layout {
  grid-template-columns: minmax(0, 1fr);
  background: linear-gradient(180deg, #eaf5ff 0%, #d8eaff 100%);
  overflow: auto;
}

body[data-active-page="account"] .map-area {
  display: none !important;
}

body[data-active-page="account"] .side-panel {
  display: block !important;
  position: relative;
  transform: none !important;
  width: min(620px, calc(100vw - 24px));
  max-width: 620px;
  margin: 18px auto;
  padding: 0;
  overflow: visible;
  border-right: 0;
  background: transparent;
}

body[data-active-page="account"] .side-panel .panel-card:not(.auth-card) {
  display: none !important;
}

body[data-active-page="account"] .side-panel .auth-card {
  margin: 0;
  background: rgba(8, 22, 39, 0.97);
}

body[data-active-page="storage"] .map-area,
body[data-active-page="market"] .map-area,
body[data-active-page="production"] .map-area {
  display: none !important;
}

body[data-active-page="storage"] .app-page-overlay,
body[data-active-page="market"] .app-page-overlay,
body[data-active-page="production"] .app-page-overlay {
  position: fixed;
  inset: 58px 0 0;
}

.market-resource-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.65rem;
  margin: 0.8rem 0 0.85rem;
}

.market-resource-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  gap: 0.15rem 0.55rem;
  align-items: center;
  padding: 0.65rem;
  border-radius: 15px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  background: rgba(255, 255, 255, 0.78);
  color: #0b2542;
  text-align: left;
  box-shadow: 0 8px 20px rgba(2, 8, 23, 0.06);
}

.market-resource-card.active {
  border-color: rgba(14, 165, 233, 0.9);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18), 0 10px 24px rgba(2, 8, 23, 0.08);
}

.market-resource-card img {
  grid-row: 1 / span 3;
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  padding: 4px;
  background: rgba(14, 165, 233, 0.10);
}

.market-resource-card-name {
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.market-resource-card-stock,
.market-resource-card-counts {
  color: #55708b;
  font-size: 0.76rem;
  line-height: 1.2;
}

.market-resource-info-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
}

.market-resource-info-main img,
.market-offer-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  padding: 4px;
  background: rgba(14, 165, 233, 0.12);
  flex: 0 0 auto;
}

.market-offer-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.market-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.market-action-grid #marketCreateSellBtn::after {
  content: " (kein Systemverkauf)";
  font-weight: 600;
  opacity: 0.72;
}

@media (max-width: 620px) {
  body[data-active-page="storage"] .app-page-overlay,
  body[data-active-page="market"] .app-page-overlay,
  body[data-active-page="production"] .app-page-overlay {
    inset: 54px 0 0;
  }

  .market-resource-cards {
    grid-template-columns: 1fr;
  }

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

  .market-offer-card .small-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .market-action-grid {
    grid-template-columns: 1fr;
  }
}

/* Schritt 12 Fix 3: Dropdown-Seitenmodus, Markt/Lager/Power-Korrekturen */
body[data-active-page="map"] .layout,
body[data-active-page="storage"] .layout,
body[data-active-page="market"] .layout,
body[data-active-page="production"] .layout,
body[data-active-page="account"] .layout {
  grid-template-columns: 1fr;
}

#togglePanelBtn {
  display: none !important;
}

.side-panel {
  display: none;
}

body[data-active-page="account"] .side-panel {
  display: block;
  max-width: 520px;
  width: min(94vw, 520px);
  margin: 18px auto;
  border-right: 0;
  background: transparent;
  padding: 12px;
}

body[data-active-page="account"] .side-panel .panel-card:not(.auth-card) {
  display: none;
}

body[data-active-page="account"] .map-area,
body[data-active-page="storage"] .map-area,
body[data-active-page="market"] .map-area,
body[data-active-page="production"] .map-area {
  display: none;
}

body[data-active-page="map"] .map-area {
  display: block;
}

body[data-active-page="storage"] #storageOverlay,
body[data-active-page="market"] #marketOverlay,
body[data-active-page="production"] #productionPage {
  background: linear-gradient(180deg, rgba(6, 17, 31, 0.98), rgba(8, 23, 41, 0.98));
}

.market-resource-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px;
  margin: 10px 0 12px;
}

.market-resource-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 64px;
  padding: 8px;
  border: 1px solid rgba(112, 167, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.market-resource-card.active,
.market-resource-card.selected {
  border-color: rgba(62, 176, 255, 0.88);
  background: rgba(47, 140, 255, 0.20);
  box-shadow: 0 0 0 2px rgba(62, 176, 255, 0.14);
}

.market-resource-card img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
}

.market-resource-card-name {
  display: block;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-resource-card-stock,
.market-resource-card-counts {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.market-resource-info-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.market-resource-info-main img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.storage-card .secondary-button[data-storage-upgrade] {
  background: linear-gradient(180deg, #2f8cff, #1563d8);
  color: #fff;
  border-color: rgba(160, 205, 255, 0.65);
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(20, 102, 220, 0.22);
}

.storage-card .secondary-button[data-storage-upgrade]:disabled {
  background: rgba(120, 137, 158, 0.32);
  color: rgba(255, 255, 255, 0.72);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

@media (max-width: 760px) {
  .topbar-actions {
    gap: 6px;
  }

  .page-switch {
    min-width: 126px;
  }

  .page-switch span {
    display: none;
  }

  .market-resource-cards {
    grid-template-columns: 1fr 1fr;
  }
}

/* Step 12 Fix 4: Markt nur mit Systemverkauf + Spieler-Verkaufsangeboten */
.market-action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.market-action-grid #marketCreateSellBtn::after {
  content: "";
}

.market-system-offer-card {
  border-color: rgba(34, 197, 94, 0.28);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.92), rgba(255, 255, 255, 0.86));
}

.market-system-offer-card .small-button:not(:disabled) {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #ffffff;
  border-color: rgba(21, 128, 61, 0.45);
}

.market-system-offer-card .small-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Schritt 12 Fix 5: Markt klar getrennt in Systemankauf + Spieler-Verkaufsangebote */
.market-selected-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.market-selected-panel {
  border: 1px solid rgba(118, 178, 255, 0.22);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

.market-selected-panel h3 {
  margin: 0 0 5px;
  font-size: 0.98rem;
}

.market-help-text {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--muted);
}

.compact-market-list {
  min-height: auto;
}

.market-system-panel {
  border-color: rgba(52, 211, 153, 0.34);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.10), rgba(255, 255, 255, 0.045));
}

.market-system-offer-card {
  border-color: rgba(52, 211, 153, 0.30);
  background: rgba(3, 37, 28, 0.34);
}

.market-system-offer-card .market-system-buy-button,
.market-system-buy-button {
  background: linear-gradient(180deg, #22c55e, #15803d) !important;
  color: #ffffff !important;
  border-color: rgba(187, 247, 208, 0.78) !important;
  font-weight: 900;
}

.market-system-offer-card .market-system-buy-button:disabled {
  background: rgba(120, 137, 158, 0.32) !important;
  color: rgba(255, 255, 255, 0.70) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

.market-resource-info {
  border-left: 4px solid rgba(62, 176, 255, 0.80);
}

.market-resource-card {
  min-height: 78px;
}

.market-resource-card-system {
  color: #bbf7d0;
}

.market-action-grid {
  grid-template-columns: 1fr 0.7fr;
}

@media (max-width: 760px) {
  .market-selected-layout {
    grid-template-columns: 1fr;
  }

  .market-action-grid {
    grid-template-columns: 1fr;
  }
}

/* Schritt 12 Fix 6: Markt per Dropdown, nur ausgewählter Rohstoff, Teilmenge an System */
.market-overlay-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 82px);
  overflow: hidden;
}

.market-overlay-panel .overlay-header {
  flex: 0 0 auto;
}

.market-resource-select-form {
  grid-template-columns: 1fr !important;
  flex: 0 0 auto;
}

.market-resource-select-label select {
  min-height: 46px;
  font-weight: 900;
}

.market-selected-resource-card-wrap {
  grid-template-columns: 1fr !important;
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.market-resource-card-selected {
  cursor: default;
  min-height: 82px;
  grid-template-columns: 48px minmax(0, 1fr) !important;
}

.market-resource-card-selected img {
  width: 48px;
  height: 48px;
}

.market-inline-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.market-inline-field span {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 800;
}

.market-inline-field input {
  min-height: 42px;
  border-radius: 13px;
  border: 1px solid rgba(130, 178, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 12px;
  font-weight: 850;
}

.market-offer-total-info {
  border-radius: 13px;
  border: 1px solid rgba(62, 176, 255, 0.22);
  background: rgba(47, 140, 255, 0.10);
  padding: 9px 10px;
  color: #dbeafe;
  font-size: 0.84rem;
  font-weight: 800;
  margin: 8px 0 10px;
}

.market-system-summary-card {
  grid-template-columns: 46px minmax(0, 1fr) !important;
}

.market-scroll {
  overflow-y: auto;
  min-height: 160px;
  padding-right: 4px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.market-selected-layout {
  flex: 0 0 auto;
}

.market-resource-info,
.market-inline-message,
.market-selected-resource-card-wrap {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  .market-overlay-panel {
    max-height: calc(100dvh - 62px);
  }

  .market-selected-layout {
    grid-template-columns: 1fr !important;
  }

  .market-scroll {
    min-height: 220px;
  }
}

/* Schritt 12 Fix 7: Markt-Lesbarkeit und bereinigte Rohstoffkarte */
.market-overlay-panel,
body[data-active-page="market"] #marketOverlay .overlay-panel {
  color: #eef6ff;
}

.market-resource-info {
  background: linear-gradient(180deg, rgba(11, 27, 48, 0.96), rgba(7, 18, 34, 0.94)) !important;
  color: #eef6ff !important;
  border-color: rgba(92, 171, 255, 0.46) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.market-resource-info b,
.market-resource-info strong,
.market-system-offer-line b {
  color: #ffffff !important;
}

.market-resource-info-main {
  margin-bottom: 0.45rem;
}

.market-resource-card,
.market-resource-card.active,
.market-resource-card.selected,
.market-resource-card-selected {
  background: linear-gradient(135deg, rgba(11, 31, 56, 0.98), rgba(13, 48, 86, 0.94)) !important;
  color: #f8fbff !important;
  border-color: rgba(92, 171, 255, 0.58) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24) !important;
}

.market-resource-card-name {
  color: #ffffff !important;
}

.market-resource-card-stock,
.market-resource-card-counts,
.market-resource-card-system {
  color: #cfe7ff !important;
}

.market-resource-card-selected {
  min-height: 74px;
}

.market-selected-panel {
  background: rgba(8, 23, 41, 0.78) !important;
  color: #eef6ff;
  border-color: rgba(92, 171, 255, 0.32) !important;
}

.market-selected-panel h3,
.market-offer-card strong {
  color: #ffffff;
}

.market-help-text,
.market-offer-card small,
.offer-main span {
  color: #cfe0f3 !important;
}

.market-offer-card,
.empty-state {
  background: rgba(11, 27, 48, 0.88) !important;
  color: #eef6ff !important;
  border-color: rgba(92, 171, 255, 0.24) !important;
}

.market-system-offer-card,
.market-system-summary-card {
  background: linear-gradient(135deg, rgba(5, 46, 31, 0.94), rgba(8, 32, 27, 0.92)) !important;
  border-color: rgba(74, 222, 128, 0.42) !important;
}

.market-form label,
.market-inline-field span,
.market-resource-select-label,
.market-offer-total-info {
  color: #dbeafe !important;
}

.market-form select,
.market-form input,
.market-inline-field input,
.market-resource-select-label select {
  background: rgba(3, 10, 24, 0.88) !important;
  color: #f8fbff !important;
  border-color: rgba(130, 178, 255, 0.42) !important;
}

.market-form select option,
.market-resource-select-label select option {
  background: #081827;
  color: #f8fbff;
}

.market-inline-message {
  background: rgba(8, 23, 41, 0.92) !important;
  color: #e0f2fe !important;
  border-color: rgba(92, 171, 255, 0.32) !important;
}

.market-inline-message.ok {
  background: rgba(5, 46, 31, 0.92) !important;
  color: #dcfce7 !important;
  border-color: rgba(74, 222, 128, 0.38) !important;
}

.market-inline-message.error {
  background: rgba(69, 10, 10, 0.92) !important;
  color: #fee2e2 !important;
  border-color: rgba(248, 113, 113, 0.46) !important;
}

/* Gravoryx V0.2 Schritt 3: Aufgaben-Frontend */
.tutorial-task-card {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(92, 171, 255, 0.32);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(9, 27, 49, 0.96), rgba(18, 42, 77, 0.9));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
  color: #eef6ff;
}

.tutorial-task-head {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}

.tutorial-task-head strong {
  color: #ffffff;
  font-size: 1rem;
}

.tutorial-task-card p {
  margin: 0 0 0.75rem;
  color: #cfe0f3;
  line-height: 1.45;
}

.task-progress-line,
.task-progress-block {
  display: grid;
  gap: 0.45rem;
}

.task-progress-line {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 0.6rem;
}

.task-progress-line span,
.task-reward-line {
  color: #dbeafe;
  font-size: 0.86rem;
}

.tutorial-task-actions {
  margin-top: 0.85rem;
}

.tasks-page-panel {
  width: min(1180px, calc(100vw - 1.5rem));
  max-height: min(880px, calc(100vh - 1.5rem));
  color: #eef6ff;
}

.tasks-toolbar {
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tasks-toolbar .secondary-button.active {
  border-color: rgba(92, 171, 255, 0.72);
  background: rgba(37, 99, 235, 0.32);
  color: #ffffff;
}

.task-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.task-summary-card {
  padding: 0.85rem;
  border: 1px solid rgba(92, 171, 255, 0.28);
  border-radius: 18px;
  background: rgba(8, 23, 41, 0.86);
}

.task-summary-card span {
  display: block;
  color: #bdd7f2;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.task-summary-card strong {
  color: #ffffff;
  font-size: 1.2rem;
}

.task-next-tutorial {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid rgba(74, 222, 128, 0.34);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(5, 46, 31, 0.94), rgba(8, 32, 47, 0.92));
}

.task-next-head,
.task-card-head,
.task-footer-line,
.task-progress-values {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.task-next-head h3,
.task-category-section h3 {
  margin: 0.1rem 0 0.35rem;
  color: #ffffff;
}

.task-next-head p {
  margin: 0;
  color: #d8ecff;
  line-height: 1.45;
}

.tasks-page-content {
  padding-right: 0.25rem;
}

.task-category-section {
  margin-bottom: 1.2rem;
}

.task-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.task-card {
  padding: 1rem;
  border: 1px solid rgba(92, 171, 255, 0.24);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(8, 23, 41, 0.94), rgba(11, 31, 56, 0.9));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18);
}

.task-card.is-completed {
  border-color: rgba(74, 222, 128, 0.5);
  background: linear-gradient(145deg, rgba(5, 46, 31, 0.94), rgba(11, 31, 56, 0.9));
}

.task-card.is-claimed {
  opacity: 0.82;
}

.task-card.is-locked {
  opacity: 0.62;
}

.task-card-head strong {
  display: block;
  color: #ffffff;
  font-size: 1rem;
}

.task-category-label {
  display: block;
  color: #93c5fd;
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
}

.task-card p {
  margin: 0.7rem 0 0.85rem;
  color: #cfe0f3;
  line-height: 1.45;
}

.task-status-badge {
  flex: 0 0 auto;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.36);
  background: rgba(15, 23, 42, 0.72);
  color: #e5eefb;
  font-size: 0.74rem;
  white-space: nowrap;
}

.task-status-badge.is-completed {
  border-color: rgba(74, 222, 128, 0.52);
  background: rgba(22, 101, 52, 0.5);
  color: #dcfce7;
}

.task-status-badge.is-active {
  border-color: rgba(96, 165, 250, 0.52);
  background: rgba(37, 99, 235, 0.32);
  color: #dbeafe;
}

.task-status-badge.is-claimed {
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(88, 28, 135, 0.38);
  color: #f3e8ff;
}

.task-status-badge.is-locked {
  border-color: rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.68);
  color: #cbd5e1;
}

.task-progress-values span,
.task-progress-values strong,
.task-footer-line span {
  color: #dbeafe;
  font-size: 0.85rem;
}

.task-footer-line {
  align-items: center;
  margin-top: 0.85rem;
}

.task-claim-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

body[data-active-page="tasks"] .map-status-card,
body[data-active-page="tasks"] .bottom-hud,
body[data-active-page="tasks"] .bottom-note,
body[data-active-page="tasks"] .scan-quality-pill {
  display: none;
}

@media (max-width: 900px) {
  .task-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card-grid {
    grid-template-columns: 1fr;
  }

  .task-next-head,
  .task-card-head,
  .task-footer-line,
  .task-progress-values {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-claim-button {
    width: 100%;
  }
}

/* V0.2 Schritt 3b: Aufgabenansicht als Reihen-Felder */
.task-series-grid {
  align-items: stretch;
}

.task-series-card {
  border-color: rgba(125, 211, 252, 0.34);
}

.task-series-card.is-completed {
  border-color: rgba(74, 222, 128, 0.46);
  box-shadow: 0 18px 42px rgba(22, 163, 74, 0.10);
}

.task-series-card.is-claimed {
  border-color: rgba(148, 163, 184, 0.28);
}

.task-series-subtitle {
  display: block;
  margin-top: 0.28rem;
  color: #bfdbfe;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.task-series-history {
  margin-top: 0.95rem;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding-top: 0.75rem;
}

.task-series-history-head {
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-series-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.45rem 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.task-series-history-row:first-of-type {
  border-top: 0;
}

.task-series-history-title {
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 700;
}

.task-series-history-status {
  border: 1px solid rgba(74, 222, 128, 0.36);
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
  background: rgba(22, 101, 52, 0.24);
  color: #bbf7d0;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .task-series-history-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }
}


/* V0.2: Credits- und Gravoryxys-Anzeige mit Icons im Spielerstatus und Karten-HUD */
.metric-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.currency-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.currency-value span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.currency-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 0 7px rgba(255, 212, 96, 0.34));
}

.player-hud-card {
  grid-template-columns: auto auto auto auto minmax(130px, 240px);
  max-width: min(94vw, 760px);
}

.player-hud-metric strong .currency-value {
  justify-content: flex-start;
}

.player-hud-metric .currency-icon {
  width: 17px;
  height: 17px;
}

@media (max-width: 980px) {
  .player-hud-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    row-gap: 6px;
  }

  .player-hud-progress {
    grid-column: 1 / -1;
  }

  .map-status-card {
    top: 104px;
  }
}

@media (max-width: 620px) {
  .metric-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-hud-card {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .player-hud-metric {
    min-width: 0;
  }

  .player-hud-metric strong .currency-value {
    gap: 3px;
  }

  .player-hud-metric .currency-icon {
    width: 14px;
    height: 14px;
  }

  .map-status-card {
    top: 98px;
  }
}

@media (max-width: 380px) {
  .player-hud-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-hud-progress {
    grid-column: 1 / -1;
  }

  .map-status-card {
    top: 142px;
  }
}

/* V0.2 Schritt 9 Fix: kompakte Belohnungsübersicht ohne störende Historienliste */
.tasks-page-panel {
  min-height: 0;
}

.tasks-page-panel .overlay-header,
.tasks-page-panel .tasks-toolbar,
.tasks-page-panel .task-summary-grid,
.tasks-page-panel .task-next-tutorial,
.tasks-page-panel .task-reward-history-card {
  flex: 0 0 auto;
}

.tasks-page-content {
  flex: 1 1 auto;
  min-height: 240px;
  overflow: auto;
  padding-right: 0.25rem;
}

.task-reward-history-card {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(168, 85, 247, 0.26);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(46, 16, 101, 0.72), rgba(8, 23, 41, 0.82));
  color: #eef6ff;
}

.task-reward-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.task-reward-overview-head h3 {
  margin: 0.1rem 0 0;
  color: #ffffff;
  font-size: 1rem;
}

.task-reward-overview-head > strong {
  color: #ffffff;
  font-size: 0.92rem;
  white-space: nowrap;
}

.task-reward-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.task-reward-overview-grid div {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(196, 181, 253, 0.16);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.38);
}

.task-reward-overview-grid span {
  display: block;
  color: #d8ecff;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.task-reward-overview-grid strong {
  display: block;
  color: #ffffff;
  font-size: 0.94rem;
}

@media (max-width: 760px) {
  .tasks-page-content {
    min-height: 280px;
  }

  .task-reward-overview-head {
    flex-direction: column;
    gap: 0.4rem;
  }

  .task-reward-overview-grid {
    grid-template-columns: 1fr;
  }
}

.tasks-toolbar .task-claim-all-button {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.9), rgba(21, 128, 61, 0.85));
  color: #ffffff;
  font-weight: 800;
}

.tasks-toolbar .task-claim-all-button:hover:not(:disabled) {
  border-color: rgba(134, 239, 172, 0.82);
  transform: translateY(-1px);
}

.tasks-toolbar .task-claim-all-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* V0.2 Schritt 11: Ranglisten */
.leaderboard-page-panel {
  width: min(1180px, calc(100vw - 1.5rem));
  max-height: min(880px, calc(100vh - 1.5rem));
  color: #eef6ff;
  min-height: 0;
}

.leaderboard-toolbar {
  flex-wrap: wrap;
  gap: 0.55rem;
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.leaderboard-tabs .secondary-button.active {
  border-color: rgba(92, 171, 255, 0.72);
  background: rgba(37, 99, 235, 0.32);
  color: #ffffff;
}

.leaderboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
}

.leaderboard-summary-card {
  padding: 0.85rem;
  border: 1px solid rgba(92, 171, 255, 0.28);
  border-radius: 18px;
  background: rgba(8, 23, 41, 0.86);
}

.leaderboard-summary-card span {
  display: block;
  color: #bdd7f2;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.leaderboard-summary-card strong {
  color: #ffffff;
  font-size: 1.05rem;
}

.leaderboard-page-content {
  flex: 1 1 auto;
  min-height: 300px;
  overflow: auto;
  padding-right: 0.25rem;
}

.leaderboard-board-card {
  padding: 1rem;
  border: 1px solid rgba(92, 171, 255, 0.24);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(8, 23, 41, 0.96), rgba(11, 31, 56, 0.92));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
}

.leaderboard-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.leaderboard-board-head h3 {
  margin: 0.1rem 0 0.35rem;
  color: #ffffff;
}

.leaderboard-board-head p {
  margin: 0;
  color: #cfe0f3;
  line-height: 1.45;
}

.leaderboard-board-head > strong {
  flex: 0 0 auto;
  color: #ffffff;
  font-size: 0.92rem;
}

.leaderboard-table {
  display: grid;
  gap: 0.45rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) minmax(120px, 0.7fr) minmax(120px, 0.7fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.58);
}

.leaderboard-row-head {
  background: rgba(37, 99, 235, 0.18);
  color: #bdd7f2;
  font-size: 0.8rem;
  font-weight: 800;
}

.leaderboard-row.is-current-user {
  border-color: rgba(74, 222, 128, 0.54);
  background: linear-gradient(135deg, rgba(5, 46, 31, 0.82), rgba(15, 23, 42, 0.62));
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08);
}

.leaderboard-position,
.leaderboard-value {
  color: #ffffff;
  font-weight: 900;
}

.leaderboard-player {
  color: #eef6ff;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-player em {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.22);
  color: #dcfce7;
  font-style: normal;
  font-size: 0.72rem;
}

.leaderboard-subvalue {
  color: #cfe0f3;
  font-weight: 700;
}

.leaderboard-own-rank {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid rgba(74, 222, 128, 0.28);
  border-radius: 18px;
  background: rgba(5, 46, 31, 0.42);
}

.leaderboard-own-rank > span {
  display: block;
  margin-bottom: 0.55rem;
  color: #bbf7d0;
  font-size: 0.82rem;
  font-weight: 800;
}

body[data-active-page="leaderboards"] .map-status-card,
body[data-active-page="leaderboards"] .bottom-hud,
body[data-active-page="leaderboards"] .bottom-note,
body[data-active-page="leaderboards"] .scan-quality-pill {
  display: none;
}

@media (max-width: 900px) {
  .leaderboard-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard-row {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 0.45rem 0.75rem;
  }

  .leaderboard-row span:nth-child(3),
  .leaderboard-row span:nth-child(4) {
    grid-column: 2;
  }

  .leaderboard-row-head span:nth-child(3),
  .leaderboard-row-head span:nth-child(4) {
    display: none;
  }

  .leaderboard-board-head {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .leaderboard-summary-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-page-content {
    min-height: 300px;
  }
}

/* V0.2 Schritt 13: leichtere Seiten und mobiles Scrollen für Produktion */
.production-page-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 82px);
  min-height: 0 !important;
  overflow: hidden;
  color: #eef6ff;
}

.production-page-panel .overlay-header,
.production-page-panel .overlay-toolbar,
.production-page-panel .power-settings-card {
  flex: 0 0 auto;
}

.production-page-content {
  flex: 1 1 auto;
  min-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

@media (max-width: 760px) {
  body[data-active-page="production"] #productionPage {
    overflow: hidden !important;
  }

  .production-page-panel {
    width: min(100vw, 100%);
    max-height: calc(100dvh - 54px);
    min-height: calc(100dvh - 54px) !important;
    border-radius: 0;
  }

  .production-page-panel .overlay-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .production-page-panel .power-settings-card {
    max-height: 42dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .production-page-content {
    min-height: 220px;
  }
}

/* V0.3 Fix: Produktlager in der normalen Lageransicht */
.storage-card.product-storage-card {
  border-color: rgba(34, 211, 238, 0.24);
}

.storage-card-placeholder {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.16);
  color: #dbeafe;
  font-weight: 800;
}

/* V0.3 Quicklinks: markiertes Lager nach Sprung aus Produktion */
.storage-card.quick-target {
  outline: 3px solid rgba(34, 211, 238, 0.9);
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.16), 0 18px 44px rgba(8, 145, 178, 0.26);
}

/* V0.4 Schritt 2: zentrale Kraftwerke im Energiemenü */
.power-plant-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.power-plant-section-head h3,
.power-plant-section-head p {
  margin: 0;
}

.power-plant-section-head p {
  max-width: 720px;
  color: rgba(238, 246, 255, 0.72);
  font-size: 0.88rem;
  line-height: 1.45;
}

.power-plant-list {
  margin-top: 0.8rem;
}

.power-plant-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.power-plant-summary span {
  display: block;
  padding: 0.72rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(238, 246, 255, 0.74);
  font-size: 0.82rem;
}

.power-plant-summary strong {
  display: block;
  margin-top: 0.2rem;
  color: #ffffff;
  font-size: 1rem;
}

.power-plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.8rem;
}

.power-plant-card {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.power-plant-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.power-plant-head h4,
.power-plant-head p {
  margin: 0;
}

.power-plant-head h4 {
  color: #ffffff;
  font-size: 1rem;
}

.power-plant-head p {
  margin-top: 0.18rem;
  color: rgba(238, 246, 255, 0.68);
  font-size: 0.8rem;
  line-height: 1.35;
}

.power-plant-visual {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(114, 0, 236, 0.18);
  color: #ffffff;
  font-size: 1.45rem;
}

.power-plant-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.power-plant-rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.power-plant-rate-grid div {
  min-width: 0;
  padding: 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.18);
}

.power-plant-rate-grid span {
  display: block;
  margin-bottom: 0.18rem;
  color: rgba(238, 246, 255, 0.58);
  font-size: 0.74rem;
}

.power-plant-rate-grid strong {
  display: block;
  color: #ffffff;
  font-size: 0.9rem;
  line-height: 1.25;
  word-break: break-word;
}

.power-plant-blockers {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 0.8rem;
}

.power-plant-actions {
  display: flex;
  justify-content: flex-end;
}

.power-plant-actions button {
  width: 100%;
}

@media (max-width: 760px) {
  .power-plant-section-head {
    display: block;
  }

  .power-plant-section-head p {
    margin-top: 0.35rem;
  }

  .power-plant-summary,
  .power-plant-rate-grid {
    grid-template-columns: 1fr;
  }

  .power-plant-head {
    grid-template-columns: auto 1fr;
  }

  .power-plant-head > div:last-child {
    grid-column: 1 / -1;
  }
}

/* V0.4 Korrektur: Kraftwerke als eigene Seite, Produktion bleibt reine Produktionsseite */
.power-page-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 82px);
  min-height: 0 !important;
  overflow: hidden;
  color: #eef6ff;
}

.power-page-content {
  flex: 1 1 auto;
  display: grid;
  gap: 1rem;
  min-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.power-stats-card {
  margin: 0.75rem 0 0;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: linear-gradient(180deg, rgba(8, 23, 42, 0.96), rgba(7, 16, 30, 0.92));
}

.power-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.power-stat-card {
  min-width: 0;
  padding: 0.78rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.055);
}

.power-stat-card span,
.power-stat-card small {
  display: block;
  color: rgba(238, 246, 255, 0.68);
  font-size: 0.76rem;
  line-height: 1.35;
}

.power-stat-card strong {
  display: block;
  margin: 0.22rem 0;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.25;
  word-break: break-word;
}

.power-plant-section-head.no-border {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

@media (max-width: 920px) {
  .power-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body[data-active-page="power"] #powerPage {
    overflow: hidden !important;
  }

  .power-page-panel {
    width: min(100vw, 100%);
    max-height: calc(100dvh - 54px);
    min-height: calc(100dvh - 54px) !important;
    border-radius: 0;
  }

  .power-page-panel .overlay-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .power-stats-grid {
    grid-template-columns: 1fr;
  }
}


/* V0.4 Anlagenmarkt */
.plant-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}

.plant-sale-field {
  display: grid;
  gap: 0.25rem;
  min-width: min(220px, 100%);
  color: var(--muted, #9fb2c7);
  font-size: 0.78rem;
}

.plant-sale-field input {
  width: 100%;
  border: 1px solid rgba(126, 231, 255, 0.24);
  border-radius: 12px;
  background: rgba(3, 10, 20, 0.78);
  color: #eef8ff;
  padding: 0.75rem 0.8rem;
  outline: none;
}

.plant-sale-info-box {
  margin-top: 0.85rem;
  border: 1px solid rgba(126, 231, 255, 0.16);
  background: rgba(126, 231, 255, 0.07);
  border-radius: 16px;
  padding: 0.9rem;
}

.plant-sale-info-box.active {
  border-color: rgba(59, 220, 151, 0.32);
  background: rgba(59, 220, 151, 0.08);
}

.plant-sale-info-box p {
  margin: 0.35rem 0 0;
  color: #cfe1f2;
}

.plant-market-page-panel {
  width: min(1240px, calc(100vw - 24px));
  max-height: min(92vh, 920px);
}

.plant-market-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.plant-market-toolbar label {
  display: grid;
  gap: 0.25rem;
  min-width: 180px;
  color: var(--muted, #9fb2c7);
  font-size: 0.78rem;
}

.plant-market-toolbar select {
  border: 1px solid rgba(126, 231, 255, 0.24);
  border-radius: 12px;
  background: rgba(3, 10, 20, 0.78);
  color: #eef8ff;
  padding: 0.72rem 0.8rem;
  outline: none;
}

.plant-market-page-content {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}

.plant-market-section {
  border: 1px solid rgba(126, 231, 255, 0.13);
  border-radius: 18px;
  background: rgba(4, 14, 28, 0.72);
  padding: 1rem;
}

.plant-market-section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.9rem;
}

.plant-market-section-head h3,
.plant-market-section-head p {
  margin: 0;
}

.plant-market-section-head p {
  max-width: 560px;
  color: var(--muted, #9fb2c7);
  font-size: 0.88rem;
  line-height: 1.45;
}

.plant-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 0.85rem;
}

.plant-market-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.plant-market-card {
  border: 1px solid rgba(126, 231, 255, 0.16);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(8, 24, 45, 0.94), rgba(3, 11, 22, 0.94));
  padding: 0.95rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.plant-market-card.disabled {
  opacity: 0.72;
}

.plant-market-card header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
}

.plant-market-card h4,
.plant-market-card p {
  margin: 0;
}

.plant-market-card h4 {
  color: #f4fbff;
  font-size: 1.02rem;
}

.plant-market-card header p,
.plant-market-position {
  color: var(--muted, #9fb2c7);
  font-size: 0.82rem;
  line-height: 1.35;
}

.plant-market-image {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(126, 231, 255, 0.08);
  border: 1px solid rgba(126, 231, 255, 0.16);
  overflow: hidden;
}

.plant-market-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plant-market-price {
  margin: 0.85rem 0;
  padding: 0.72rem 0.85rem;
  border-radius: 14px;
  background: rgba(59, 220, 151, 0.1);
  color: #eafff7;
  font-size: 1.2rem;
  font-weight: 800;
  border: 1px solid rgba(59, 220, 151, 0.18);
}

.plant-market-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.plant-market-metrics .detail-metric {
  min-height: auto;
}

.plant-market-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

body[data-active-page="plant-market"] .app-page-overlay {
  pointer-events: auto;
}

@media (max-width: 760px) {
  .plant-market-toolbar,
  .plant-market-section-head,
  .plant-overlay-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .plant-market-toolbar label,
  .plant-sale-field {
    min-width: 0;
  }

  .plant-market-card header {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .plant-market-card header .v03-status-pill {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* V0.4 Booster */
.boost-page-panel {
  max-width: min(1120px, calc(100vw - 1.5rem));
}

.boost-page-content {
  display: grid;
  gap: 1rem;
}

.boost-summary-card,
.boost-card {
  border: 1px solid rgba(126, 231, 255, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(8, 24, 45, 0.94), rgba(3, 11, 22, 0.94));
  padding: 1rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.boost-summary-card h3,
.boost-card h3,
.boost-card p {
  margin: 0;
}

.boost-summary-grid,
.boost-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
  margin-top: 0.85rem;
}

.boost-summary-item,
.boost-metric-grid > div {
  border: 1px solid rgba(126, 231, 255, 0.12);
  border-radius: 16px;
  background: rgba(126, 231, 255, 0.06);
  padding: 0.78rem 0.85rem;
}

.boost-summary-item span,
.boost-metric-grid span {
  display: block;
  color: var(--muted, #9fb2c7);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.boost-summary-item strong,
.boost-metric-grid strong {
  color: #f4fbff;
  font-size: 1.08rem;
}

.boost-summary-item small,
.boost-expires {
  display: block;
  color: var(--muted, #9fb2c7);
  font-size: 0.78rem;
  margin-top: 0.28rem;
}

.boost-card {
  display: grid;
  gap: 0.85rem;
}

.boost-card.active {
  border-color: rgba(59, 220, 151, 0.36);
  box-shadow: 0 20px 50px rgba(59, 220, 151, 0.08);
}

.boost-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.boost-card p {
  color: var(--muted, #9fb2c7);
  line-height: 1.45;
}

.boost-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

body[data-active-page="boosts"] .app-page-overlay {
  pointer-events: auto;
}

@media (max-width: 760px) {
  .boost-card-head,
  .boost-metric-grid {
    grid-template-columns: 1fr;
  }

  .boost-card-head {
    display: grid;
  }
}

.storage-rate-boost-line {
  grid-column: 1 / -1;
  margin-top: .35rem;
  font-size: .78rem;
  color: var(--text-muted);
}

.power-plant-rate-grid small {
  display: block;
  margin-top: .25rem;
  font-size: .72rem;
  line-height: 1.3;
  color: var(--text-muted);
}
