/* ===== Data Center Tycoon — Mobile First UI ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --green: #2ecc40;
  --green-dark: #27a335;
  --yellow: #ffd700;
  --orange: #ff8c1a;
  --blue: #2e9fff;
  --dark: #1b2430;
  --panel: #f4f6f9;
  --card: #ffffff;
  --text: #22303f;
  --text-dim: #6b7a8c;
  --red: #e74c3c;
  --purple: #9b59b6;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #3da93d;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}

#game-root { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* SVG-Icons skalieren mit der Schriftgröße des Elternelements (ersetzen Emojis 1:1) */
.ic-svg { width: 1em; height: 1em; vertical-align: -0.14em; flex-shrink: 0; }
.side-btn .ic-svg { width: 1.15em; height: 1.15em; vertical-align: middle; }
.c-art .ic-svg { width: 64px; height: 64px; }
.li-ico .ic-svg, .r-ico .ic-svg, .bp-ico .ic-svg, .dc-ico .ic-svg { vertical-align: middle; }

/* ===== HUD ===== */
/* HUD-Spalte links rückt unter die oberste Sternenleiste */
#hud-top {
  position: absolute; top: calc(34px + env(safe-area-inset-top)); left: 8px;
  display: flex; gap: 5px; flex-wrap: wrap;
  /* Vier Pillen müssen nebeneinander passen; rechts bleibt Platz für die
     Seiten-Schaltflächen (46 px + Rand). */
  max-width: calc(100vw - 72px);
  z-index: 10;
}
.hud-pill {
  display: flex; align-items: center; gap: 5px;
  background: rgba(15, 22, 32, 0.88);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 4px 12px 4px 8px;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.hud-pill.small { font-size: 12px; padding: 3px 10px 3px 7px; }
/* Ressourcen-Pillen (Strom, Kühlung, SSD): kompakter als die Geld-Pille,
   damit alle vier auch auf schmalen Handys in einer Zeile bleiben. */
.hud-pill.res { font-size: 13px; padding: 3px 9px 3px 6px; gap: 3px; }
.hud-pill.res .hud-ico3d { width: 22px; height: 22px; }
/* Schmale Handys: sonst rutscht die vierte Pille in eine zweite Zeile und
   schiebt sich vor das Spielfeld. */
@media (max-width: 430px) {
  #hud-top { gap: 4px; }
  #pill-money { font-size: 14px; padding: 4px 9px 4px 6px; }
  #pill-money .hud-ico3d { width: 22px; height: 22px; }
  .hud-pill.res { font-size: 11.5px; padding: 3px 7px 3px 5px; }
  .hud-pill.res .hud-ico3d { width: 18px; height: 18px; }
}
.hud-pill.income { background: rgba(39, 163, 53, 0.92); font-size: 13px; }
.hud-ico { font-size: 14px; }
/* 3D-gerenderte HUD-Icons (Blender) — etwas größer für die plastische Wirkung */
.hud-ico3d { width: 26px; height: 26px; object-fit: contain; display: block; margin: -4px 0; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.side-ico3d { width: 30px; height: 30px; object-fit: contain; display: block; margin: -2px auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
#hud-clock {
  position: absolute; top: calc(72px + env(safe-area-inset-top)); left: 8px;
  display: flex; gap: 6px; z-index: 10;
}
#hud-income {
  position: absolute; top: calc(106px + env(safe-area-inset-top)); left: 8px; z-index: 10;
}

#reward-ad-btn {
  position: relative;
  z-index: 11;
  display: flex; align-items: center; gap: 9px;
  min-width: 154px;
  padding: 8px 13px 8px 9px;
  border: 2px solid rgba(255,255,255,.42);
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(180deg, #41dc66, #159439);
  box-shadow: 0 5px 14px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.25);
  cursor: pointer;
}
#reward-ad-btn:active:not(:disabled) { transform: scale(.96); }
#reward-ad-btn:disabled { filter: grayscale(.7); opacity: .66; cursor: default; }
/* Investor-Angebot: großer Charakter + Sprechblase, gleiche Sprache wie die
   Berater-Leiste im Tutorial (nur goldene statt blauer Kontur). */
#investor-offer {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 12;
  display: flex; align-items: flex-end;
  max-width: min(560px, 96vw);
  animation: advisor-in 0.35s ease-out;
}
#investor-portrait {
  width: 134px; height: 160px; flex-shrink: 0;
  object-fit: contain; object-position: bottom;
  margin: 0 2px -6px -6px;                   /* steht auf der Blasen-Unterkante */
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
  animation: mascot-idle 3s ease-in-out infinite;
  pointer-events: none;
}
#investor-bubble {
  position: relative; flex: 1; min-width: 232px;
  background: rgba(20,27,39,0.96); color: #fff;
  border: 2px solid #d9ad43; border-radius: 18px;
  padding: 12px 15px; text-align: center;
  box-shadow: 0 12px 30px #0008;
}
/* Sprechblasen-Zipfel zum Investor hin (zwei Dreiecke = Rand + Füllung) */
#investor-bubble::before, #investor-bubble::after {
  content: ''; position: absolute; width: 0; height: 0;
  border-top: 10px solid transparent; border-bottom: 10px solid transparent;
}
#investor-bubble::before { left: -12px; bottom: 30px; border-right: 12px solid #d9ad43; }
#investor-bubble::after  { left: -8px;  bottom: 32px; border-top-width: 8px; border-bottom-width: 8px;
                           border-right: 9px solid rgba(20,27,39,0.96); }
#investor-bubble > b { display: block; font-size: 14.5px; color: #ffd98a; }
#investor-bubble > span { display: block; font-size: 12px; opacity: .82; margin: 4px 0 10px; }
.investor-actions { display: flex; gap: 8px; justify-content: center; }
/* Menü-Schaltfläche, solange der Investor wartet */
#btn-investor {
  border-color: #d9ad43;
  background: linear-gradient(180deg, #463920, #221b10);
  animation: pulse 1.6s ease-in-out infinite;
}
#btn-investor .badge { background: #d9ad43; color: #201704; }
.investor-ico { width: 34px; height: 34px; margin: -4px auto; }
@media (max-width: 380px) {
  #investor-portrait { width: 98px; height: 118px; margin-left: -4px; }
  #investor-bubble { min-width: 0; padding: 10px 12px; }
}
#reward-ad-decline{border:0;border-radius:12px;padding:8px 12px;background:#536071;color:#fff;font-weight:800}
.reward-ad-play {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  padding-left: 2px;
  color: #1c7e35; background: #fff;
  font-size: 14px;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.reward-ad-copy { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.reward-ad-copy b { font-size: 13px; letter-spacing: .5px; }
.reward-ad-copy small { margin-top: 3px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.88); }

/* ===== Ausbau-Sternenleiste (ganz oben, kompakt, mittig) ===== */
#star-bar {
  position: absolute; top: calc(6px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  width: 150px;
  z-index: 12;
}
#star-bar .sb-track {
  height: 6px; border-radius: 6px;
  background: rgba(15, 22, 32, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
#star-bar .sb-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #ffd33d, #ff8c1a);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.sb-star {
  position: absolute; top: 3px;
  width: 15px; height: 15px;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.sb-star .ic-svg { display: block; width: 100%; height: 100%; filter: grayscale(1) brightness(0.45); transition: filter 0.3s; }
.sb-star.lit .ic-svg { filter: none; }
.sb-star.lit { animation: star-pop 0.5s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes star-pop { 0% { transform: translate(-50%,-50%) scale(0.4); } 100% { transform: translate(-50%,-50%) scale(1); } }

/* Bauplan-Vorschau (nächste vorgegebene Räume) */
.plan-next { font-size: 20px; line-height: 1; opacity: 0.9; }
.plan-next .ic-svg { width: 20px; height: 20px; vertical-align: middle; }

/* ===== Side buttons ===== */
#side-buttons {
  position: absolute; right: 8px; top: calc(8px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 7px; z-index: 10;
  /* Fällt nie aus dem Bild: scrollt notfalls, statt Buttons abzuschneiden */
  max-height: calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow-y: auto; overflow-x: visible;
  scrollbar-width: none; touch-action: pan-y;
  padding-bottom: 2px;
}
#side-buttons::-webkit-scrollbar { display: none; }

/* Niedrige Höhe (Querformat/Handy): Buttons in 2 Spalten, zweite Spalte nach links */
@media (max-height: 560px) {
  #side-buttons {
    display: grid; grid-auto-flow: column;
    grid-template-rows: repeat(5, auto);
    direction: rtl; gap: 6px;
    overflow: visible; max-height: none;
  }
  #side-buttons > * { direction: ltr; }
  .side-btn { width: 40px; height: 40px; font-size: 18px; }
}
.side-btn {
  position: relative;
  width: 46px; height: 46px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  background: linear-gradient(180deg, #2c3a4d, #1b2430);
  color: #fff; font-size: 21px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
  transition: transform 0.1s;
}
.side-btn:active { transform: scale(0.92); }
.badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  background: var(--red); color: #fff;
  border-radius: 9px; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ===== Strom-Warnung ===== */
#power-warning {
  position: absolute; top: calc(80px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ff9d4d, #e8780a);
  border: 2px solid #fff; border-radius: 12px;
  color: #fff; font-weight: 800; font-size: 12px;
  padding: 8px 14px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
  z-index: 15; max-width: 92vw;
  animation: pulse 1.2s infinite;
}

/* ===== Angedocktes Panel (Raum bleibt sichtbar) ===== */
#modal-backdrop.dock-right {
  background: transparent;
  justify-content: flex-end;
  padding: 0;
  pointer-events: none;
}
#modal-backdrop.dock-right #modal {
  pointer-events: auto;
  height: 100%;
  max-height: 100vh;
  width: min(400px, 80vw);
  border-radius: 18px 0 0 18px;
  box-shadow: -8px 0 30px rgba(0,0,0,0.45);
}

/* ===== Event banner ===== */
#event-banner {
  position: absolute; top: calc(120px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(160, 30, 20, 0.95);
  border: 2px solid #ff6b5b; border-radius: 14px;
  padding: 8px 12px; color: #fff;
  z-index: 20; max-width: 92vw;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: shake 0.6s;
}
@keyframes shake { 0%,100%{transform:translateX(-50%)} 25%{transform:translateX(calc(-50% - 6px))} 75%{transform:translateX(calc(-50% + 6px))} }
#event-ico { font-size: 28px; }
.event-text { display: flex; flex-direction: column; font-size: 13px; }
.event-text b { font-size: 15px; }
#event-fix {
  border: none; border-radius: 10px;
  background: var(--yellow); color: #5b3b00;
  font-weight: 900; font-size: 13px;
  padding: 8px 14px; cursor: pointer;
}

/* ===== Prolog ===== */
#prologue {
  position: absolute; inset: 0; z-index: 200;
  background: rgba(8, 14, 22, 0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fade-in 0.3s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.prologue-card {
  width: min(560px, 96vw);
  display: flex; flex-direction: column; align-items: center;
}
#prologue-mascot {
  width: 160px; height: 180px; object-fit: contain;
  margin-bottom: -18px; z-index: 1;
  filter: drop-shadow(0 8px 20px rgba(255, 180, 60, 0.45));
  animation: mascot-idle 3.2s ease-in-out infinite;
}
#prologue-mascot.pop {
  animation: mascot-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
             mascot-idle 3.2s ease-in-out 0.5s infinite;
}
@keyframes mascot-pop { 0% { transform: scale(0.6) translateY(20px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
/* dauerhaftes sanftes Schweben + Wiegen — wirkt lebendig statt statisch */
@keyframes mascot-idle {
  0%, 100% { transform: translateY(0) rotate(-1.6deg); }
  50% { transform: translateY(-7px) rotate(1.6deg); }
}
.speech {
  background: #f4f6f9;
  border-radius: 18px;
  padding: 26px 20px 16px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border: 3px solid #37b6ff;
}
#prologue-text {
  font-size: 16px; line-height: 1.5; color: var(--text);
  text-align: center; min-height: 76px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#prologue-text > span { display: block; }
#prologue-text b { color: var(--green-dark); }
#prologue-dots { display: flex; gap: 7px; justify-content: center; margin: 12px 0; }
#prologue-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: #cfd8e3; transition: all 0.2s; }
#prologue-dots .dot.on { background: var(--blue); transform: scale(1.3); }
.prologue-actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
#prologue-skip {
  border: none; background: none; color: var(--text-dim);
  font-size: 13px; cursor: pointer; padding: 8px; text-decoration: underline;
}
#prologue-next {
  border: none; border-radius: 12px;
  background: linear-gradient(180deg, #3ddc52, var(--green-dark));
  box-shadow: 0 3px 0 #1d7a28;
  color: #fff; font-weight: 800; font-size: 15px;
  padding: 12px 22px; cursor: pointer;
}
#prologue-next:active { transform: translateY(2px); box-shadow: none; }

/* ===== Berater-Leiste (Tutorial) ===== */
#advisor {
  position: absolute; z-index: 120;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  background: rgba(15, 22, 32, 0.94);
  border: 2px solid #37b6ff; border-radius: 16px;
  padding: 8px 10px 8px 8px;
  max-width: min(560px, 94vw);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  animation: advisor-in 0.35s ease-out;
}
@keyframes advisor-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.advisor-mascot {
  width: 52px; height: 58px; object-fit: contain; flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(255,180,60,0.5));
  animation: mascot-idle 3s ease-in-out infinite;
}
.advisor-mascot.bob { animation: bob 0.6s ease-in-out 2, mascot-idle 3s ease-in-out 1.2s infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.advisor-text { color: #fff; font-size: 13.5px; line-height: 1.4; flex: 1; }
.advisor-text b { color: #6ee7ff; }
#advisor-skip {
  border: none; background: rgba(255,255,255,0.12); color: #fff;
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  font-size: 15px; flex-shrink: 0; align-self: flex-start;
}

/* Pulsierender Highlight auf Buttons (Tutorial) */
.tut-highlight {
  position: relative;
  animation: tut-pulse 1.1s infinite !important;
  z-index: 130;
}
@keyframes tut-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7), 0 3px 8px rgba(0,0,0,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0), 0 3px 8px rgba(0,0,0,0.4); }
}

/* ===== Toasts ===== */
#toasts {
  position: absolute; bottom: calc(95px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 6px;
  z-index: 50; pointer-events: none;
  width: max-content; max-width: 90vw;
}
.toast {
  background: rgba(15,22,32,0.92); color: #fff;
  border-radius: 12px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; text-align: center;
  border: 1px solid rgba(255,255,255,0.2);
  animation: toast-in 0.25s ease-out;
}
.toast.gold { background: rgba(146, 100, 0, 0.95); border-color: var(--yellow); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== Modal ===== */
#modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 10px;
}
#modal {
  width: min(960px, 96vw);
  max-height: min(86vh, 720px);
  background: var(--panel);
  border-radius: 18px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
#modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, #2c3a4d, #1b2430);
  color: #fff; font-weight: 800; font-size: 17px;
}
#modal-close {
  width: 34px; height: 34px;
  border: none; border-radius: 10px;
  background: rgba(255,255,255,0.15); color: #fff;
  font-size: 16px; font-weight: 800; cursor: pointer;
}
#modal-body { overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }

/* ===== Cards (energy menu, rooms) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
}
.card.locked { opacity: 0.85; }
.card h3 { font-size: 14px; color: var(--text); text-transform: uppercase; letter-spacing: 0.3px; padding-right: 34px; }
.card .c-ico {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  background: var(--panel); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.card .c-art {
  height: 64px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  background: linear-gradient(180deg, #e8f4e8, #d4ecd4);
  margin: 4px 0;
}
.card .c-stat { font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between; }
.card .c-stat b { color: var(--text); }
.card .c-stat .val-power { color: #c98a00; font-weight: 800; }
.level-bar { display: flex; gap: 3px; margin-top: 4px; }
.level-bar .seg { flex: 1; height: 7px; border-radius: 3px; background: #cfd8e3; }
.level-bar .seg.on { background: var(--yellow); }

.btn {
  border: none; border-radius: 10px;
  padding: 10px 12px;
  font-weight: 800; font-size: 14px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #3ddc52, var(--green-dark));
  box-shadow: 0 2px 0 #1d7a28;
  margin-top: 6px;
}
.btn:disabled { background: #aab6c2; box-shadow: 0 2px 0 #8995a1; cursor: not-allowed; }
.btn.orange { background: linear-gradient(180deg, #ffa64d, #e8780a); box-shadow: 0 2px 0 #b35e08; }
.btn.purple { background: linear-gradient(180deg, #b06fd8, #8e44ad); box-shadow: 0 2px 0 #6c3483; }
.btn.blue { background: linear-gradient(180deg, #4dabff, #1f7fd6); box-shadow: 0 2px 0 #1763a6; }
.btn.gray { background: #aab6c2; box-shadow: 0 2px 0 #8995a1; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }

/* ===== Summary bar (bottom of energy modal) ===== */
.summary-bar {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px; margin-top: 12px;
}
.summary-cell {
  background: var(--dark); color: #fff;
  border-radius: 12px; padding: 8px 10px;
  text-align: center;
}
.summary-cell .s-label { font-size: 10px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }
.summary-cell .s-value { font-size: 17px; font-weight: 800; }

/* ===== Lists (missions, achievements, research) ===== */
.list-item {
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.list-item .li-ico { font-size: 26px; min-width: 34px; text-align: center; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 700; font-size: 14px; color: var(--text); }
.list-item .li-desc { font-size: 12px; color: var(--text-dim); }
.list-item .li-reward { font-size: 12px; font-weight: 800; color: var(--green-dark); white-space: nowrap; }
.list-item.done { opacity: 0.6; }
.progress {
  height: 8px; border-radius: 4px;
  background: #dde4ec; overflow: hidden; margin-top: 5px;
}
.progress .fill { height: 100%; background: linear-gradient(90deg, var(--green), #7be88a); border-radius: 4px; transition: width 0.3s; }

/* ===== Research tree ===== */
.research-tier { margin-bottom: 14px; }
.research-tier h4 { font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin: 0 2px 6px; }
.research-node {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 6px;
  border-left: 4px solid var(--blue);
}
.research-node.owned { border-left-color: var(--green); background: #eafbea; }
.research-node.locked { border-left-color: #b3bdc9; opacity: 0.65; }

/* ===== Room panel ===== */
.room-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.room-head .r-ico { font-size: 34px; }
.room-head .r-name { font-weight: 800; font-size: 17px; color: var(--text); }
.room-head .r-lvl { font-size: 12px; color: var(--text-dim); }
.stat-row {
  display: flex; justify-content: space-between;
  font-size: 13px; padding: 5px 2px;
  border-bottom: 1px dashed #dbe2ea; color: var(--text-dim);
}
.stat-row b { color: var(--text); }
.upg-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 10px;
  padding: 8px 10px; margin-top: 6px;
}
.upg-row .u-ico { font-size: 20px; min-width: 26px; text-align: center; }
.upg-row .u-ico3d { width: 28px; height: 28px; object-fit: contain; display: block; margin: -3px auto; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }
.toast-ico3d { width: 18px; height: 18px; object-fit: contain; vertical-align: -4px; margin-right: 2px; }
.upg-row .u-name { flex: 1; font-size: 13px; font-weight: 700; color: var(--text); }
.upg-row .u-lvl { font-size: 11px; color: var(--text-dim); }
.upg-row .btn { margin: 0; padding: 7px 10px; font-size: 12px; white-space: nowrap; }

/* ===== Prestige / Offline panels ===== */
.big-panel { text-align: center; padding: 8px 4px; }
.big-panel .bp-ico { font-size: 52px; }
.big-panel h2 { color: var(--text); margin: 6px 0; font-size: 20px; }
.big-panel p { color: var(--text-dim); font-size: 13px; margin: 4px 0 10px; }
.big-panel .bp-value { font-size: 26px; font-weight: 900; color: var(--green-dark); margin: 8px 0; }

/* ===== Modal-Abschnitte (Settings u.a.) ===== */
.section-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.6px;
  color: var(--text-dim); text-transform: uppercase;
  margin: 16px 2px 6px;
}
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; margin-top: 0; }
/* Zerstörerische Aktion: bewusst abgesetzt und optisch leiser als die grünen
   Aktions-Buttons — vorher stand "Delete save" gleichberechtigt neben "Save now". */
.danger-zone {
  margin-top: 18px; padding: 10px 12px 12px;
  border: 1px solid #f0c2bc; border-radius: 12px;
  background: #fdf3f2;
}
.danger-zone .dz-text {
  font-size: 12px; color: #a2554c; margin: 0 0 8px; line-height: 1.35;
}
.btn.danger-ghost {
  width: 100%; margin-top: 0;
  background: #fff; color: var(--red);
  border: 1.5px solid #eeaba3; box-shadow: none;
  font-size: 13px; padding: 8px 12px;
}
.btn.danger-ghost:active:not(:disabled) { background: #fdeceb; transform: translateY(1px); }

/* ===== World map ===== */
.dc-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px;
  padding: 12px; margin-bottom: 10px;
  border: 2px solid transparent;
}
.dc-card.active-dc { border-color: var(--green); background: #f0fdf0; }
.dc-card .dc-ico { font-size: 36px; }
.dc-card .dc-main { flex: 1; }
.dc-card .dc-name { font-weight: 800; color: var(--text); font-size: 15px; }
.dc-card .dc-desc { font-size: 12px; color: var(--text-dim); }

/* ---------- Reversible Blender world-map prototype ---------- */
#modal-backdrop.world-map-mode { padding: 0; background: rgba(3, 12, 22, .76); }
#modal-backdrop.world-map-mode #modal {
  width: min(100vw, 1280px); height: min(100vh, 720px); max-width: none; max-height: none;
  border-radius: 16px; overflow: hidden; background: #0b2437; border: 2px solid #46667c;
}
#modal-backdrop.world-map-mode #modal-header {
  position: absolute; z-index: 8; left: 50%; top: 0; transform: translateX(-50%);
  width: min(360px, 44vw); height: 48px; justify-content: center;
  border: 1px solid #496a80; border-top: 0; border-radius: 0 0 16px 16px;
  background: rgba(9, 28, 43, .96); color: #fff; letter-spacing: 1.4px;
}
#modal-backdrop.world-map-mode #modal-close {
  position: fixed; top: 10px; right: 12px; width: 42px; height: 42px;
  border-radius: 12px; color: #fff; background: rgba(8, 24, 38, .88); z-index: 12;
}
#modal-backdrop.world-map-mode #modal-body { padding: 0; overflow: hidden; height: 100%; }
.dc-world-map { position: relative; width: 100%; height: 100%; overflow: hidden; background: #07314c; }
.dc-world-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dc-world-routes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dc-world-routes path { fill: none; stroke: rgba(255,255,255,.9); stroke-width: 3; stroke-dasharray: 9 9; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.dc-world-node {
  position: absolute; z-index: 4; transform: translate(-50%, -50%); padding: 0; border: 0;
  background: transparent; color: #fff; display: flex; flex-direction: column; align-items: center;
  min-width: 150px; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0,0,0,.55));
}
.dc-world-node:not(:disabled) { cursor: pointer; }
.dc-world-pin {
  display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50% 50% 50% 12%;
  transform: rotate(45deg); margin-bottom: -5px; color: #fff; font-size: 20px; font-weight: 900;
  background: #56616a; border: 4px solid #b7c0c6;
}
.dc-world-pin em { transform: rotate(-45deg); font-style: normal; line-height: 1; }
.dc-world-label {
  display: flex; flex-direction: column; gap: 2px; min-width: 140px; max-width: 165px;
  padding: 9px 12px 8px; border-radius: 11px; background: rgba(7, 22, 34, .94);
  border: 2px solid #667786; font-size: 12px; line-height: 1.15;
}
.dc-world-label b { font-size: 13px; }
.dc-world-label small { color: #b7c6d0; font-size: 9px; font-weight: 800; letter-spacing: .5px; }
.dc-world-node.active .dc-world-pin { background: #168d43; border-color: #7bf39f; }
.dc-world-node.active .dc-world-label { border-color: #35d46e; }
.dc-world-node.available .dc-world-pin { background: #1688bd; border-color: #8de4ff; animation: worldPulse 1.8s ease-in-out infinite; }
.dc-world-node.available .dc-world-label { border-color: #43c8ff; }
.dc-world-node.next .dc-world-pin { background: #d89a00; border-color: #ffe16a; }
.dc-world-node.next .dc-world-label { border-color: #eebd36; }
.dc-world-node.locked { filter: grayscale(.55) drop-shadow(0 3px 4px rgba(0,0,0,.55)); opacity: .88; }
.dc-world-legend {
  position: absolute; z-index: 5; left: 18px; bottom: 16px; display: flex; gap: 14px;
  padding: 8px 12px; border: 1px solid #57758a; border-radius: 10px;
  background: rgba(7,22,34,.88); color: #d9e5ec; font-size: 10px; font-weight: 700;
}
.dc-world-legend span { display: flex; align-items: center; gap: 5px; }
.dc-world-legend i { width: 9px; height: 9px; border-radius: 50%; background: #77828a; }
.dc-world-legend i.active { background: #35d46e; }
.dc-world-legend i.available { background: #43c8ff; }
@keyframes worldPulse { 50% { transform: rotate(45deg) scale(1.08); filter: brightness(1.2); } }

@media (max-height: 520px), (max-width: 760px) {
  #modal-backdrop.world-map-mode #modal { border-radius: 0; border-width: 0; }
  #modal-backdrop.world-map-mode #modal-header { height: 38px; font-size: 14px; }
  #modal-backdrop.world-map-mode #modal-close { width: 36px; height: 36px; top: 4px; right: 5px; }
  .dc-world-node { min-width: 112px; }
  .dc-world-pin { width: 34px; height: 34px; font-size: 15px; border-width: 3px; }
  .dc-world-label { min-width: 108px; max-width: 128px; padding: 6px 7px; }
  .dc-world-label b { font-size: 10px; }
  .dc-world-label small { font-size: 7px; }
  .dc-world-legend { left: 7px; bottom: 7px; gap: 7px; padding: 5px 7px; font-size: 7px; }
}

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab {
  flex: 1; border: none; border-radius: 10px;
  padding: 9px 6px; font-weight: 800; font-size: 13px;
  background: #dde4ec; color: var(--text-dim); cursor: pointer;
}
.tab.on { background: var(--dark); color: #fff; }

/* ---------- Stern-Meilenstein-Feier (Konfetti + Stern-Burst) ---------- */
#star-celebration {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; overflow: hidden;
}
#star-celebration i {
  position: absolute; top: -20px; display: block;
  animation-name: sc-fall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes sc-fall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(102vh) rotate(var(--rot)); opacity: 0.9; }
}
#star-celebration .sc-burst {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  text-align: center; animation: sc-pop 0.5s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes sc-pop {
  0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0; }
  60%  { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
#star-celebration .sc-star {
  font-size: 88px; line-height: 1; filter: drop-shadow(0 0 18px rgba(255,215,0,0.9));
  animation: sc-spin 1.2s ease-out both;
}
@keyframes sc-spin {
  0% { transform: rotate(-25deg) scale(0.6); } 100% { transform: rotate(0deg) scale(1); }
}
#star-celebration .sc-label {
  margin-top: 6px; font-size: 30px; font-weight: 900; color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5), 0 0 20px rgba(255,215,0,0.7); letter-spacing: 1px;
}
@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .side-btn { width: 42px; height: 42px; font-size: 19px; }
  .hud-pill { font-size: 13px; }
  /* Sternenleiste auf dem Handy etwas größer (eigene Zeile oben, verdeckt nichts) */
  #star-bar { width: 210px; top: calc(10px + env(safe-area-inset-top)); }
  #star-bar .sb-track { height: 8px; }
  .sb-star { width: 20px; height: 20px; top: 4px; }  /* top = Trackhöhe/2 → mittig auf der Leiste */
}
