:root{
  --sidebarW: 360px;
  --headerH: 80px;   /* <-- zurück */
  --bg:#0b0b0c;
  --panel:#121216;
  --border:#ffffff22;
  --text:#f3f4f6;
  --muted:#a1a1aa;
}


*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.app{
  height:100vh;
  display:grid;
  grid-template-columns:1fr var(--sidebarW);
  grid-template-rows:var(--headerH) 1fr;
}

.header{
  grid-column: 1 / -1;
  position: relative;
  height: var(--headerH);     /* <-- statt 240px */
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  overflow: visible;          /* <-- damit Banner raus darf */
  display: block;
  padding: 10px 14px;
  z-index: 10;                /* sicher über Map */
}

/* Optional: weicher Übergang zur Map */
.header::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 48px;
  background: linear-gradient(
    to bottom,
    var(--panel) 0%,
    rgba(18,18,22,0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Banner mittig, am unteren Rand des Headers */
.brand{
  position: absolute;
  top: 0;
  left: calc((100% - var(--sidebarW)) / 2);
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}


.brandBanner{
  height: 120px;              /* ~40% kleiner */
  width: auto;
  max-width: 92vw;

  transform: translateY(12px); /* weniger Überlappung */
  object-fit: contain;

  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.85));
}



/* Controls fix rechts oben */
.topControls{
  position: absolute;
  top: 10px;
  right: 14px;

  display:flex;
  gap:6px;
  align-items:center;

  z-index: 3;
}

.topControls input,
.topControls button,
.topControls a.btn{
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.topControls button:hover,
.topControls a.btn:hover{
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.16);
}

.mapWrap{
  position: relative;
  overflow: hidden; /* Blur darf nicht rauslaufen */
}

/* Blurred Fill */
.mapWrap::before{
  content: "";
  position: absolute;
  inset: 0;
  background: var(--mapUrl) center / cover no-repeat;
  filter: blur(10px) brightness(0.65);
  transform: scale(1.1);
  z-index: 0;
}

/* Vignette */
.mapWrap::after{
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0,0,0,0) 45%,
    rgba(0,0,0,0.35) 70%,
    rgba(0,0,0,0.6) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* eigentliche Karte */
.mapBg{
  position: absolute;
  inset: 0;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2;
}

/* === Day/Night + Lampen Overlay (Canvas) === */
#lightCanvas{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2; /* über .mapBg (z-index 2, aber später im DOM = darüber), unter #hotspotsLayer (z-index 3) */
}

/* Hotspots/GM darüber */
#hotspotsLayer,
.gmOverlay{
  position: relative;
  z-index: 3;
  filter: brightness(var(--hsBrightness, 1));
  transition: filter 500ms ease;
}

/* === HOTSPOT BUTTON === */
.hotspot{
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;

  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
}

/* === HIT AREA (rein funktional, unsichtbar) === */
.hotspot .hit{
  width: var(--hs);
  height: var(--hs);
  overflow: visible;           /* <-- NEU */

  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* === HOTSPOT IMAGE === */
.hotspot img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scale(1.15);          /* <-- NEU: 1.10–1.25 nach Geschmack */
  transform-origin: 50% 65%;       /* <-- NEU: etwas tiefer = bodiger */
  background: transparent !important;
  pointer-events: none;
  user-select: none;

  filter: drop-shadow(0 6px 14px rgba(0,0,0,.6));
  transition: transform .12s, filter .12s;
}

/* === HOVER (NUR EFFEKT, KEIN HINTERGRUND) === */
.hotspot:hover img{
  transform: scale(1.20);          /* vorher 1.05, jetzt passend zu 1.15 */
  filter:
    drop-shadow(0 0 6px rgba(255,255,255,.25))
    drop-shadow(0 6px 14px rgba(0,0,0,.6));
}

/* === GM-SELECTION HIGHLIGHT === */
.hotspot.editorSelected img{
  filter:
    drop-shadow(0 0 10px rgba(245,158,11,.6))
    drop-shadow(0 6px 14px rgba(0,0,0,.6));
}



.sidebar{
  background:var(--panel);
  padding:12px;
  overflow-y:auto;
}

.section{
  margin-bottom:14px;
  padding: 0 10px;   /* <-- links / rechts Luft */
}

#sideImageWrap{
  display:none;
  text-align:center;
  margin-bottom:10px;
}

#sideImage{
  max-width:120px;
  max-height:120px;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.7));
}

.error{color:#ef4444}
.ok{color:#22c55e}

/* GM Overlay */
.divider{
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

.gmOverlay{
  position:absolute;
  inset:0;
  background: #00000088;
  backdrop-filter: blur(4px);
  z-index: 50;
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  padding: 14px;
}

.gmPanel{
  width: 380px;
  max-width: calc(100vw - 28px);
  border: 1px solid #60a5fa66;
  background: #0f0f13;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.7);
}

.gmHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom: 8px;
}

.gmRow{
  display:flex;
  gap: 8px;
  margin-top: 8px;
  align-items:flex-end;
}

.gmCol{ flex: 1; }

.gmPanel input, .gmPanel textarea, .gmPanel button{
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f0f13;
  color: var(--text);
}

.gmPanel button{
  cursor:pointer;
}

.hotspot.editorSelected img{
  filter:
    drop-shadow(0 0 8px rgba(245,158,11,.6))
    drop-shadow(0 6px 14px rgba(0,0,0,.6));
}

/* --- Character badge in header --- */
.charBadge{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border-radius:12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.charAvatar{
  width:32px;
  height:32px;
  border-radius:10px;
  object-fit:cover;
  border: 1px solid rgba(255,255,255,0.15);
}

.charMeta{ line-height:1.1; }
.charName{ font-weight:700; }
.charRole{ font-size:12px; opacity:0.85; }

/* --- Jobs table styling --- */
.jobsTable{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
  font-size: 14px;
}

.jobsTable thead th{
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 10px 12px;
  color: rgba(255,255,255,0.78);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  white-space: nowrap;
}

.jobsTable tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
  line-height: 1.25;
}

.jobsTable tbody tr:nth-child(2n){
  background: rgba(255,255,255,0.03);
}

.jobsTable tbody tr:hover{
  background: rgba(255,255,255,0.06);
}

.jobsTable .mono{
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
}

/* Spalten etwas stabilisieren (damit nicht alles "quetscht") */
.jobsTable th:nth-child(1),
.jobsTable td:nth-child(1){
  width: 55%;
}

.jobsTable th:nth-child(2),
.jobsTable td:nth-child(2){
  width: 20%;
  white-space: nowrap;
}

.jobsTable th:nth-child(3),
.jobsTable td:nth-child(3){
  width: 15%;
  white-space: nowrap;
}

/* Falls GM-Spalte existiert */
.jobsTable th:nth-child(4),
.jobsTable td:nth-child(4){
  width: 10%;
  text-align: right;
  white-space: nowrap;
}

.jobsTable button{
  padding: 6px 10px;
  border-radius: 10px;
}

.resourceRow{
  display:flex;
  justify-content:space-between;
  padding:6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.resourceRow .k{ opacity:0.9; }
.resourceRow .v{
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.logo{
  overflow: hidden; /* damit das Bild sauber in den Rundungen bleibt */
}

.logo img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.topControls a.btn{
  padding:6px 8px;
  border-radius:8px;
  border:1px solid var(--border);
  background:#0f0f13;
  color:var(--text);
  text-decoration:none;
  display:inline-block;
}

/* --- Collapsible sections (Ressourcen/Pools) --- */
.foldHeader{
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.foldHeader::after{
  content: "▾";
  opacity: 0.75;
  transform: rotate(0deg);
  transition: transform .2s ease, opacity .2s ease;
}

.foldHeader.isCollapsed::after{
  transform: rotate(-90deg);
  opacity: 0.6;
}

/* Animated collapse */
.foldBody{
  overflow: hidden;
  max-height: 800px; /* muss größer als der Inhalt sein */
  transition: max-height .25s ease, opacity .2s ease;
  opacity: 1;
}

.foldBody.isCollapsed{
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* =========================
   Minigame Modals (iframe)
   ========================= */
.mgModal{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;

  padding: 18px;                 /* vorher 18px */
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
}

.mgCard{
 height: 70vh;     /* statt 98vh */
  width: min(1400px, 50vw);  /* statt 99vw */
  max-height: 98vh;

  background: rgba(10,10,12,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.65);
  overflow: hidden;
  display: flex;
  flex-direction: column;

  min-height: 0;
}


.mgHead{
  flex: 0 0 auto;               /* Kopf bleibt fix */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.mgFrame{
  flex: 1 1 auto;               /* ✅ das ist der entscheidende Punkt */
  width: 100%;
  height: auto;                 /* nicht hart begrenzen */
  border: 0;
  display: block;
  background: transparent;
  min-height: 0;     /* ✅ wichtig */
  height: 100%;      /* ✅ damit iframe wirklich den Rest füllt */
}

/* =========================
   Mobile: Minigame Modal größer
   ========================= */
@media (max-width: 720px){
  .mgModal{
    padding: 8px;                 /* weniger Rand, mehr Platz */
  }

  .mgCard{
    width: 96vw;                  /* fast volle Breite */
    height: 92vh;                 /* fast volle Höhe */
    max-height: 92vh;
    border-radius: 12px;          /* etwas kleiner wirkt besser */
  }

  .mgHead{
    padding: 8px 10px;            /* Header kompakter */
  }
}



/* --- Event Log (letzte 10) --- */
.eventLog { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.eventRow { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.eventRow .muted { width: 56px; flex: 0 0 auto; opacity: 0.7; }

/* =========================
   Mobile Layout
   ========================= */
@media (max-width: 900px) {
  .app {
    display: flex;
    flex-direction: column;
  }
  :root{ --headerH: 120px; }
  /* Header-Inhalt bekommt oben Luft (für Buttons) */
  .header{
    padding-top: 56px;   /* ggf. 48–64 testen */
  }

  /* Banner wird tiefer gesetzt, damit er Buttons nicht überlappt */
  .brand{
    top: 56px;           /* exakt gleich wie padding-top */
    left: 50%;
    transform: translateX(-50%);
  }

  .brandBanner{
    height: 56px;        /* du wolltest eh kleiner */
    transform: translateY(0);
    max-width: 90vw;
   }
  .topControls{
    display:flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items:center;
    justify-content:flex-end;
  }

  .topControls > * {
    flex: 1 1 auto;
  }

  .mapWrap {
    order: 1;
    min-height: 40vh;
  }

  .sidebar {
    order: 2;
    width: 100%;
    max-width: none;
    padding: 10px;
  }

  .section{
    margin-bottom: 14px;
    padding: 0 14px; /* mehr Luft mobil */
  }

  button,
  .btn,
  input {
    min-height: 44px;
    font-size: 16px;
  }

  #actions button,
  #jobs button {
    width: 100%;
  }

  .eventLog {
    max-height: 200px;
    overflow-y: auto;
  }
}
