/* =========================================================
   Humanitarian Logistics – UA Theme (B: dezenter, stabil)
   CLEAN styles.css (konsolidiert)
   ========================================================= */

/* ---------- Tokens (final) ---------- */
:root{
  --ua-blue:#0057B7;
  --ua-yellow:#FFD700;

  --bg1:#1E2A44;
  --bg2:#24365C;

  /* FINAL: Kontrast-Boost direkt hier */
  --card:rgba(255,255,255,.08);
  --panel:rgba(255,255,255,.07);
  --stroke:rgba(255,255,255,.18);

  --text:rgba(238,242,255,.92);
  --muted:rgba(238,242,255,.72);

  --shadow:0 18px 60px rgba(0,0,0,.30);
  --shadowCard:0 12px 34px rgba(0,0,0,.22);
  --r:18px;

  --ok:#4CAF50;
  --warn:#F59E0B;
  --bad:#EF4444;
}

/* ---------- Base ---------- */
*{box-sizing:border-box}
html,body{height:100%}
html,body{overflow-x:hidden}
img{max-width:100%;height:auto;display:block}

body{
  margin:0;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(0,87,183,.16), transparent 55%),
    radial-gradient(900px 700px at 75% 20%, rgba(255,215,0,.10), transparent 60%),
    linear-gradient(160deg,var(--bg2),var(--bg1));
}

a{color:inherit}
.hidden{display:none !important}
.muted{color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:10px}

/* Fluid Typo (dezent) */
h1{font-size:clamp(22px,3vw,34px)}
h2{font-size:clamp(18px,2.2vw,24px);margin:0 0 10px}
h3{font-size:clamp(15px,1.8vw,18px);margin:0 0 10px}
p{margin:0 0 10px}

/* ---------- App shell ---------- */
.app{max-width:1560px;margin:0 auto;padding:18px 18px 28px}


.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:10px 6px 18px;
  border-bottom:2px solid rgba(255,215,0,.35);
  margin-bottom:16px;
}

.brand{display:flex;gap:12px;align-items:center}
.logo{
  width:44px;height:44px;border-radius:14px;
  background:rgba(255,255,255,.08);
  border:1px solid var(--stroke);
  display:grid;place-items:center;
  box-shadow:var(--shadowCard);
}

.brandText{display:flex;flex-direction:column}
.brandSub{font-size:12px;color:var(--muted)}
.topActions{display:flex;gap:10px;align-items:center}
.screen{width:100%}

/* ---------- Layouts ---------- */
.screenGrid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap:16px;
}
.vehicleLayout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:16px;
}
/* PACK: bessere Aufteilung – Mitte deutlich größer */
.packGrid{
  display:grid;
  grid-template-columns: minmax(260px, 1fr) minmax(640px, 2.4fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: stretch;
}


/* ---------- Cards / panels ---------- */
.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding:16px;
  backdrop-filter: blur(10px);
  position:relative;
}
.card.small{padding:12px}

.panel{
  background:var(--panel);
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--r);
  padding:12px;
  box-shadow:var(--shadowCard);
  backdrop-filter: blur(10px);
}

.panelHeader{
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,255,255,.08);
  margin-bottom:10px;
}

/* subtle UA accent line on top of cards */
.card::before{
  content:"";
  position:absolute;
  left:14px; right:14px; top:10px;
  height:2px;
  border-radius:999px;
  background:linear-gradient(90deg, rgba(0,87,183,.40), rgba(255,215,0,.28));
  opacity:.55;
  pointer-events:none;
}

/* ---------- Buttons ---------- */
.btn{
  appearance:none;border:none;
  border-radius:14px;
  padding:10px 12px;
background: linear-gradient(90deg, #0057B7, #FFD700);
  border:2px solid rgba(255,255,255,.16);
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  transition:transform .08s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{
  background:rgba(255,255,255,.13);
  box-shadow:0 0 0 2px rgba(255,255,255,.06) inset;
}
.btn:active{transform:translateY(1px)}
.btn:disabled{opacity:.45;cursor:not-allowed}

.btn.primary{
  background:rgba(0,87,183,.26);
  border-color:rgba(0,87,183,.52);
}
.btn.primary:hover{
  background:rgba(0,87,183,.32);
  box-shadow:0 0 0 2px rgba(255,215,0,.16) inset;
}

.btn.ghost{
  background:transparent;
  border-color:rgba(255,255,255,.18);
}
.btn.ghost:hover{
  border-color:rgba(255,215,0,.28);
}

/* Focus (Keyboard) */
.btn:focus{outline:none}
.btn:focus-visible{
  box-shadow:0 0 0 2px rgba(255,215,0,.18), 0 12px 34px rgba(0,0,0,.24);
}

/* ---------- Mission cards (BANNER final) ---------- */
#missionList{gap:14px}

.missionBtn{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
  padding:14px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
  position:relative; /* für Schloss */
  box-shadow:0 10px 30px rgba(0,0,0,.18);
}
.missionBtn:hover{
  background:rgba(255,255,255,.10);
  border-color:rgba(255,215,0,.30);
  box-shadow:0 0 0 2px rgba(255,215,0,.10) inset, 0 10px 30px rgba(0,0,0,.22);
}
.missionBtn:focus{outline:none}
.missionBtn:focus-visible{
  box-shadow:0 0 0 2px rgba(255,215,0,.14) inset, 0 10px 30px rgba(0,0,0,.22);
}

.missionImg{
  width:100%;
  height:170px;
  border-radius:12px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,.18);
  filter:saturate(1.05) contrast(1.02);
  box-shadow:0 10px 26px rgba(0,0,0,.22);
}

.missionText{display:flex;flex-direction:column;gap:8px;min-width:0}
.missionTitle{
  font-weight:900;
  font-size:16px;
  line-height:1.2;
  letter-spacing:.2px;
  color:rgba(238,242,255,.96);
  text-shadow:0 0 14px rgba(0,87,183,.12);
}
.missionSub{
  font-size:12.5px;
  line-height:1.35;
  color:rgba(238,242,255,.78);
}

/* Locked missions */
.missionBtn.locked,
.missionBtn:disabled{
  opacity:.55;
  filter:grayscale(.55);
  cursor:not-allowed;
}
.missionBtn.locked::after,
.missionBtn:disabled::after{
  content:"🔒";
  position:absolute;
  right:14px;
  top:14px;
  font-size:18px;
  opacity:.9;
}

/* ---------- History list (beibehalten, aber einmal) ---------- */
#historyList > *{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
}
#historyList > *:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,215,0,.22);
}

/* ---------- Vehicle side panel ---------- */
.missionSide{position:sticky;top:14px;align-self:start;display:flex;flex-direction:column;gap:10px}
.sideMissionBody{display:flex;flex-direction:column;gap:10px}
.sideMissionBody .sideBlock{
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.14);
  border-radius:14px;
  padding:10px;
}

/* ---------- Vehicle cards ---------- */
.vehicleCards{display:flex;flex-direction:column;gap:12px}
.vehicleCard{
  display:grid;
  grid-template-columns: 90px 1fr;
  gap:12px;
  align-items:center;
  padding:12px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.16);
  color:var(--text);
  cursor:pointer;
}
.vehicleCard:hover{
  background:rgba(0,0,0,.22);
  border-color:rgba(255,215,0,.28);
  box-shadow:0 0 0 2px rgba(255,215,0,.10) inset;
}
.vehicleCard:focus{outline:none}
.vehicleCard:focus-visible{
  box-shadow:0 0 0 2px rgba(255,215,0,.14) inset, 0 10px 30px rgba(0,0,0,.22);
}
.vehicleImg{
  width:90px;height:64px;object-fit:cover;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.18);
}
.vehicleMeta b{font-weight:900}

/* ---------- Context row / chips ---------- */
.contextRow{
  display:flex;justify-content:space-between;align-items:center;
  gap:12px;margin-bottom:12px;flex-wrap:wrap;
  padding:10px 12px;
  border-radius: var(--r);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadowCard);
}
.chips{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 10px;border-radius:999px;
  background:rgba(0,0,0,.20);
  border:1px solid rgba(255,255,255,.12);
  font-weight:800;font-size:12px;color:rgba(238,242,255,.90);
}
.chip.soft{opacity:.9}
.packActions{display:flex;gap:10px;flex-wrap:wrap}

/* ---------- Requirements ---------- */
.reqRow{margin-bottom:12px}
.reqBox{
  background:rgba(0,0,0,.18);
  border:1px solid rgba(255,215,0,.20);
  border-radius:16px;
  padding:10px 12px;
  display:flex;gap:12px;flex-wrap:wrap;align-items:center;
}
.reqPill{
  display:inline-flex;gap:8px;align-items:center;
  padding:6px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
  font-weight:900;font-size:12px;
}
.reqPill small{font-weight:800;color:rgba(238,242,255,.65)}

/* ---------- Select (Kategorie) ---------- */
.goodsToolbar{margin-bottom:10px}
.selectLabel{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted)}
.selectLabel > span{
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  font-size:11px;
  color:rgba(238,242,255,.78);
}
.selectWrap{
  position:relative;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(15,23,54,.55);
  box-shadow:0 10px 30px rgba(0,0,0,.18);
  overflow:hidden;
}
.selectWrap::after{
  content:"▾";
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  pointer-events:none;
  color:rgba(238,242,255,.80);
  font-size:14px;
}
.select{
  -webkit-appearance:none;
  -moz-appearance:none;
  appearance:none;
  width:100%;
  min-height:44px;
  padding:10px 42px 10px 12px;
  border:0;
  background:transparent;
  color:var(--text);
  font-weight:800;
  font-size:14px;
  letter-spacing:.2px;
}
.select:focus{outline:none}
.selectWrap:focus-within{
  border-color:rgba(255,215,0,.40);
  box-shadow:0 0 0 2px rgba(255,215,0,.12), 0 10px 30px rgba(0,0,0,.22);
}
select option{background:#0f1736;color:rgba(238,242,255,.92)}

/* ---------- Items list + Scrollbar (Chrome + Firefox) ---------- */
.itemsScroll{
  max-height:64vh;
  overflow:auto;
  padding-right:6px;

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.55) rgba(0,0,0,.15);
}
.itemsScroll::-webkit-scrollbar{width:10px}
.itemsScroll::-webkit-scrollbar-track{background:rgba(0,0,0,.15)}
.itemsScroll::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,.55);
  border:2px solid rgba(0,0,0,.20);
  border-radius:999px;
}
.itemsScroll::-webkit-scrollbar-thumb:hover{background:rgba(255,215,0,.18)}

.itemRich{
  display:grid;
  grid-template-columns: 34px 1fr;
  gap:10px;
  padding:10px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.12);
  cursor:grab;
}
.itemRich:hover{border-color:rgba(255,215,0,.20);background:rgba(0,0,0,.16)}
.itemRich:active{cursor:grabbing}
.itemRich .emo{font-size:18px;opacity:.95}
.nameRow{display:flex;justify-content:space-between;gap:10px;align-items:center;min-width:0}
.tag{
  font-size:11px;font-weight:900;
  padding:4px 8px;border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
}
.meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.pill{
  font-size:11px;font-weight:800;
  padding:4px 8px;border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.14);
}
.benefits{margin-top:8px;display:flex;gap:6px;flex-wrap:wrap}

.catHeader{
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(8px);
  background: rgba(10,12,30,.72);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  padding: 8px 10px;
  margin: 10px 0 6px;
  font-weight: 900;
  font-size: 12px;
}

/* ---------- Truck canvas / cargo ---------- */
.truckWrap{padding:10px;border-radius:18px;background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.10)}
.truckCanvas{
  position:relative;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0px, rgba(255,255,255,.06) 1px, transparent 1px, transparent 48px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0px, rgba(255,255,255,.06) 1px, transparent 1px, transparent 48px);
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
}

.cargo{
  position:absolute;
  border-radius:14px;
  border:1px solid rgba(0,87,183,.35);
  background:rgba(0,87,183,.14);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  box-shadow:var(--shadowCard);
}
.cargo:hover{
  border-color:rgba(255,215,0,.50);
  box-shadow:0 0 0 2px rgba(255,215,0,.12) inset, var(--shadowCard);
}
.cargo .icon{padding:6px;font-size:18px}
.cargo .cargoLabel{
  font-size:10px;
  padding:6px;
  color:rgba(238,242,255,.86);
  background:rgba(0,0,0,.18);
  border-top:1px solid rgba(255,255,255,.10);
  display:flex;
  flex-direction:column;
  gap:4px;
}
.cargo .cargoName{font-weight:900;line-height:1.15}
.cargo .cargoSub{
  font-size:9px;
  line-height:1.15;
  opacity:.95;
  display:flex;
  flex-wrap:wrap;
  gap:4px 6px;
}
.cargo .cargoSub .pill{
  font-size:9px;
  padding:3px 6px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.06);
}

.cargo.ghost{pointer-events:none;opacity:.55}
.cargo.ghost.ok{outline:2px solid rgba(76,175,80,.70)}
.cargo.ghost.bad{outline:2px solid rgba(239,68,68,.70)}

/* ---------- Status meters ---------- */
.statusPanel{display:flex;flex-direction:column;gap:12px}
.meterBlock{display:flex;flex-direction:column;gap:10px}
.meterRow{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--muted)}
.meterValue{color:rgba(238,242,255,.92);font-weight:900}
.meterBar{width:100%;height:10px;border-radius:999px;overflow:hidden;appearance:none}
.meterBar::-webkit-progress-bar{background:rgba(255,255,255,.10)}
.meterBar::-webkit-progress-value{background:linear-gradient(90deg, rgba(0,87,183,.70), rgba(255,215,0,.45))}
.meterBar::-moz-progress-bar{background:linear-gradient(90deg, rgba(0,87,183,.70), rgba(255,215,0,.45))}
.meterBar.over1::-webkit-progress-value{background:rgba(245,158,11,.95)}
.meterBar.over2::-webkit-progress-value{background:rgba(239,68,68,.95)}
.meterBar.over3::-webkit-progress-value{background:rgba(220,38,38,.98)}
.meterBar.over1::-moz-progress-bar{background:rgba(245,158,11,.95)}
.meterBar.over2::-moz-progress-bar{background:rgba(239,68,68,.95)}
.meterBar.over3::-moz-progress-bar{background:rgba(220,38,38,.98)}

#weightText.over1{color:rgba(245,158,11,.95)}
#weightText.over2{color:rgba(239,68,68,.95)}
#weightText.over3{color:rgba(220,38,38,.98)}

.statusBox{
  margin-top:12px;
  padding:10px 12px;
  border-radius:16px;
  background:rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.10);
  font-size:12px;
  white-space:pre-line;
}

/* ---------- Dialogs (<dialog>) base ---------- */
.dialog{
  border:none;
  border-radius:22px;
  background:rgba(10,12,30,.94);
  color:var(--text);
  box-shadow: var(--shadow);
  max-width: 920px;
  width: calc(100vw - 40px);
}
.dialog::backdrop{background:rgba(0,0,0,.55)}
.dialog-inner{padding:16px}
.dialogHead{border-bottom:1px solid rgba(255,255,255,.10);padding-bottom:10px;margin-bottom:12px}
.dialogActions{display:flex;justify-content:flex-end;gap:10px;margin-top:12px}
.dialogGrid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:12px;
}
.kv{display:flex;justify-content:space-between;gap:10px;font-size:12px}
.breakdown{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.token{
  background:rgba(0,0,0,.22);
  border:1px solid rgba(255,255,255,.10);
  padding:10px;border-radius:16px;
  overflow:auto;
}

/* Travel */
.travelGrid{display:grid;grid-template-columns: 1fr 1fr;gap:12px}
.travelMap{background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.10);border-radius:16px;padding:10px}
.travelMap svg{width:100%;height:auto}
.travelEvents{background:rgba(0,0,0,.18);border:1px solid rgba(255,255,255,.10);border-radius:16px;padding:10px;max-height:55vh;overflow:auto}
.truckMarker{transition:transform 1.2s ease}

/* Arrival */
.arrivalHero{display:flex;gap:14px;align-items:center}
.arrivalArt{font-size:42px}
.arrivalText{color:rgba(238,242,255,.86)}

/* ---------- Img fallback helper ---------- */
.imgWrap{ position:relative; overflow:hidden; border-radius:12px; }
.imgWrap img{ width:100%; height:100%; object-fit:cover; display:block; }
.imgFallback{
  position:absolute; inset:0; display:grid; place-items:center;
  font-size:28px; background:rgba(255,255,255,.08);
  opacity:0; pointer-events:none;
}
.imgWrap.fallbackOn .imgFallback{ opacity:1; }
.imgWrap.fallbackOn img{ opacity:0; }


/* ---------- QUEST OVERLAY (FINAL) ---------- */
.questOverlay{
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: grid;
  place-items: start center;        /* oben starten, horizontal mittig */
  padding: 120px 24px 24px;

  background: rgba(0,0,0,.60);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility 0s linear .35s;
}

.questOverlay.isOpen{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .35s ease;
}

.questOverlay .questCard{
  opacity: 0;
  transform: translateY(14px) scale(.99);
  transition: transform .45s ease, opacity .45s ease;
}

.questOverlay.isOpen .questCard{
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce){
  .questOverlay,
  .questOverlay .questCard{
    transition: none !important;
  }
}

/* Card */
.questCard{
  width: min(780px, calc(100vw - 48px));
  min-height: min(68vh, 560px);
  max-height: min(88vh, 820px);
  overflow: auto;
  border-radius: 24px;
  position: relative;

  display:flex;
  flex-direction:column;
  justify-content:flex-end;

  padding: 42px 0 120px;
}

.questCard::before{
  content:"";
  position:absolute;
  inset:0;
  background-image: var(--quest-bg, none);
  background-size: cover;
  background-position: 85% 65%;
  opacity: .70;
  filter: saturate(1.05) contrast(1.10);
  pointer-events:none;
}

.questCard::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(
    to bottom,
    rgba(10,12,30,.22),
    rgba(10,12,30,.55)
  );
  pointer-events:none;
}

.questHeader, .questBody{
  position: relative;
  z-index: 2;

  max-width: 700px;     /* etwas breiter */
  margin: 0 auto;

  background: rgba(8,10,24,.58);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}

.questHeader{
  padding: 14px 16px;
  display:flex;
  justify-content: space-between;
  gap: 14px;
}

#questTitle{
  font-weight: 900;     /* Titel fett */
}

#questOkBtn{
  margin-top: 2px;
  white-space: nowrap;
}

.questBody{
  margin-top: 12px;
  padding: 16px 16px 18px;
}

/* optional: Header/Body auch breiter machen */
.questHeader, .questBody{
  position: relative;
  z-index: 2;

  max-width: 760px;                   /* war 620px */
  margin: 0 auto;

  background: rgba(8,10,24,.58);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  backdrop-filter: blur(8px);
}

/* ---------- RESULTS (FINAL – nur einmal) ---------- */
#resultDialog::backdrop{ background: rgba(0,0,0,.55); }

#resultDialog .dialog-inner{
  width: min(1180px, 94vw);
  max-height: min(90vh, 860px);
  padding: 22px 22px 18px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;

  background: rgba(12, 16, 40, .82);
  border: 1px solid rgba(255, 215, 0, .18);
  backdrop-filter: blur(10px);
}

#resultDialog .dialog-inner::before{
  background:
    radial-gradient(900px 480px at 15% 10%, rgba(0, 120, 255, .12), transparent 60%),
    radial-gradient(900px 520px at 85% 0%, rgba(255, 215, 0, .10), transparent 62%),
    linear-gradient(135deg, rgba(10, 14, 38, .45), rgba(18, 22, 55, .35));
}

#resultDialog .dialog-inner > *{ position: relative; z-index: 1; }

#resultDialog .dialogGrid{
  display: block !important;
  padding: 0 !important;
}

.dialogGrid.resultsGrid .resultsWrapper{
  width: min(980px, calc(100vw - 64px));
  margin: 0 auto;
  display:flex;
  flex-direction:column;
  gap:16px;
}

.resHero{ padding:0; }
.resStory{
  display:flex;
  gap:14px;
  align-items:flex-start;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
}
.resStoryIcon{
  width:42px;height:42px;
  border-radius:14px;
  display:grid;place-items:center;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.12);
  font-size:18px;
  flex: 0 0 auto;
}
.resStoryText{min-width:0}
.resStoryLead{font-weight:950;font-size:15px;margin-bottom:6px}
.resStoryDetail{line-height:1.5}
.resStoryAfter{margin-top:10px;line-height:1.5}

.resKpis{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:10px 0 2px;
}
.resKpis .pill{
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  line-height:1;
  white-space:nowrap;
}

.resTri{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.resTri .resCol.bad{ grid-column: 1 / -1; }

.resCol{
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
}
.resCol h3{margin:0 0 10px; font-size:14px}
.resCol.ok{border-color: rgba(76,175,80,.22)}
.resCol.warn{border-color: rgba(245,158,11,.22)}
.resCol.bad{border-color: rgba(239,68,68,.22)}

.cleanList{
  list-style:none;
  padding:0;
  margin: 10px 0 0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.cleanList li{
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  font-size: 12.5px;
  line-height: 1.45;
}

.supplyBox { display:flex; flex-direction:column; gap:10px; margin-top:6px; }
.supplyLine { display:grid; grid-template-columns: 1.2fr 1.3fr auto; gap:10px; align-items:center; padding:10px; border-radius:12px; background: rgba(255,255,255,0.04); }
.supplyLeft { display:flex; gap:10px; align-items:baseline; }
.supplyIcon { font-size:16px; }
.supplyName { font-weight:850; }
.supplyBar { height:8px; border-radius:999px; background: rgba(255,255,255,0.08); overflow:hidden; }
.supplyBar > span { display:block; height:100%; background: rgba(255,255,255,0.5); border-radius:999px; }

.resDetails{
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
  padding: 12px 14px;
}
.resDetails summary{ cursor:pointer; font-weight:900; }

.resMeta{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.resRow{
  display:grid;
  grid-template-columns: 1.2fr 1.5fr auto;
  gap: 10px;
  align-items:center;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
}

.resLearn{
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
}
.resMot{margin-top:6px}
.resActions{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}

/* ---------- Donation Section / Dialog (beibehalten) ---------- */
.donationSection {
  margin: 60px 0;
  display: flex;
  justify-content: center;
}
.donationCard {
  max-width: 720px;
  width: 100%;
  padding: 40px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(0, 87, 183, 0.18), rgba(255, 215, 0, 0.12));
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35), inset 0 0 30px rgba(255,255,255,0.05);
  text-align: center;
}
.donationTitle { margin-top: 0; font-size: 28px; font-weight: 700; }
.donationIntro { opacity: 0.9; margin-bottom: 25px; }
.donationDetails { line-height: 1.6; margin-bottom: 30px; font-size: 16px; }
.donationButton {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  background: linear-gradient(90deg, #0057B7, #FFD700);
  color: #111;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.donationButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}

.donationDialog .donationBox{
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(0,87,183,.18), rgba(255,215,0,.12));
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: inset 0 0 24px rgba(255,255,255,.05);
  text-align: center;
}
.donationDialog .donationDetails{ line-height: 1.65; margin-bottom: 16px; }
.donationDialog .iban{ font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.donationDialog .donationButton{
  display:inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  background: linear-gradient(90deg, #0057B7, #FFD700);
  color: #111;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.donationDialog .donationButton:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
}

#donationDialog{ transform-origin: center; }
#donationDialog[open]{ animation: donateIn 220ms ease-out both; }
#donationDialog::backdrop{ background: rgba(0,0,0,.0); }
#donationDialog[open]::backdrop{ animation: donateBackdrop 220ms ease-out both; }

@keyframes donateIn{
  from{ opacity:0; transform: translateY(10px) scale(.985); }
  to  { opacity:1; transform: translateY(0)   scale(1); }
}
@keyframes donateBackdrop{
  from{ background: rgba(0,0,0,.0); }
  to  { background: rgba(0,0,0,.55); }
}

.donationDialog .donImpact{
  margin: 14px auto 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.14);
  border: 1px solid rgba(255,255,255,.10);
  text-align: left;
  max-width: 62ch;
}
.donationDialog .donImpactTitle{ font-weight: 900; margin-bottom: 8px; }
.donationDialog .donImpactList{ margin: 0; padding-left: 18px; color: rgba(238,242,255,.82); }
.donationDialog .donImpactList li{ margin: 6px 0; line-height: 1.35; }

/* ---------- Header Logos (beibehalten) ---------- */
.header-logos{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 30px;
  padding: 25px 40px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.logo-center{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.header-logos::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 2px;
  background: linear-gradient(90deg, #0057B7, #FFD700);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Legal footer ---------- */
.legalFooter{
  margin-top: 60px;
  padding: 20px 0 10px;
  text-align: center;
  font-size: .9rem;
  opacity: .8;
}
.legalFooter a{
  text-decoration: none;
  color: inherit;
  margin: 0 6px;
  transition: opacity .2s ease;
}
.legalFooter a:hover{
  opacity: 1;
  text-decoration: underline;
}
.sep{ opacity: .5; }

/* =========================================================
   RESPONSIVE PATCH (final breakpoints)
   ========================================================= */
@media (max-width: 1280px){
  .app{max-width:1120px}
}

@media (max-width: 1024px){
  .screenGrid{grid-template-columns:1fr}
  .vehicleLayout{grid-template-columns:1fr}
  .packGrid{grid-template-columns:1fr}
  .missionSide{position:static;top:auto}

  /* Pack-Canvas skaliert statt overflow */
  #truckCanvas,
  .truckCanvas{
    margin:0 auto;
    transform:scale(.88);
    transform-origin:top center;
  }
}

@media (max-width: 820px){
  .topbar{flex-direction:column;align-items:flex-start;gap:12px}
  .topActions{width:100%;justify-content:flex-start;flex-wrap:wrap}

  .dialogGrid{grid-template-columns:1fr}
  .travelGrid{grid-template-columns:1fr}

  /* Results: 1 Spalte */
  .resTri{grid-template-columns:1fr !important}
  .resTri .resCol.bad{grid-column:auto}
  .resMeta{grid-template-columns:1fr 1fr}
}

@media (max-width: 600px){
  .app{padding:14px 14px 22px}
  .logo{width:40px;height:40px;border-radius:12px}

  .missionImg{height:140px}

  #resultDialog .dialog-inner{
    width:96vw;
    padding:18px 16px;
    border-radius:18px;
    max-height:92vh;
  }
  .resMeta{grid-template-columns:1fr !important}
  .resRow{grid-template-columns:1fr}
  .resActions{flex-direction:column;align-items:stretch}

  /* Pack-Canvas noch etwas kleiner */
  #truckCanvas,
  .truckCanvas{
    transform:scale(.78);
  }
}
/* =========================================================
   RESULT DIALOG – FIX: größer + scrollbar statt abgeschnitten
   ganz ans ENDE von styles.css
   ========================================================= */

#resultDialog{
  /* Dialog selbst */
  width: min(1320px, calc(100vw - 32px)) !important;
  max-width: none !important;
  margin: auto;
}

#resultDialog .dialog-inner{
  /* WICHTIG: nicht verstecken, sondern scrollen lassen */
  overflow: auto !important;

  /* größerer Viewport-Anteil */
  max-height: calc(100vh - 64px) !important;

  /* optional: etwas mehr Luft */
  padding: 22px 22px 18px !important;
}

/* Wrapper darf nicht künstlich verengen */
.dialogGrid.resultsGrid .resultsWrapper{
  width: min(1120px, calc(100vw - 56px)) !important;
  margin: 0 auto !important;
}

/* Wenn es trotzdem knapp wird: Tri-Block in 1 Spalte */
@media (max-width: 980px){
  .resTri{ grid-template-columns: 1fr !important; }
  .resTri .resCol.bad{ grid-column: auto !important; }
}

/* Mobile: fast fullscreen */
@media (max-width: 600px){
  #resultDialog{
    width: calc(100vw - 16px) !important;
  }
  #resultDialog .dialog-inner{
    max-height: calc(100vh - 16px) !important;
    padding: 16px 14px !important;
    border-radius: 18px !important;
  }
}

/* optional: Scrollbar Styling im Result-Dialog (Chrome + Firefox) */
#resultDialog .dialog-inner{
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.55) rgba(0,0,0,.15);
}
#resultDialog .dialog-inner::-webkit-scrollbar{width:10px}
#resultDialog .dialog-inner::-webkit-scrollbar-track{background:rgba(0,0,0,.15)}
#resultDialog .dialog-inner::-webkit-scrollbar-thumb{
  background:rgba(0,0,0,.55);
  border:2px solid rgba(0,0,0,.20);
  border-radius:999px;
}
#resultDialog .dialog-inner::-webkit-scrollbar-thumb:hover{
  background:rgba(255,215,0,.18);
}
/* =========================
   RESULT (clean)
   ========================= */

.resultsWrapper.cleanRes{
  position: relative;
  padding: 18px;
  border-radius: 18px;
  overflow: hidden;
}

/* Missionsbild als Hintergrund */
.resultsWrapper.cleanRes::before{
  content:"";
  position:absolute; inset:0;
  background-image: var(--res-bg, none);
  background-size: cover;
  background-position: center;
  opacity: .50;              /* nur einmal! */
  filter: saturate(1.1);
  pointer-events:none;
}


.resultsWrapper.cleanRes::after{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(900px 520px at 20% 0%, rgba(0,120,255,.10), transparent 60%),
    radial-gradient(900px 520px at 85% 0%, rgba(255,215,0,.08), transparent 62%),
    linear-gradient(135deg, rgba(10,14,38,.40), rgba(18,22,55,.30));
  pointer-events:none;
}


.cleanRes > *{ position:relative; z-index:1; }

.resTopRow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
}

.resStatus{
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .2px;
}

.resMiniPills{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.resMainRow{
  display:grid;
  grid-template-columns: 1.05fr .95fr; /* links Info, rechts Güter */
  gap: 14px;
  margin-top: 14px;
}

.resCard{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(8,10,24,.50);
  border-radius: 16px;
  padding: 12px 12px;
}

.resGoodsTitle{
  font-weight: 850;
  margin-bottom: 8px;
}

.resDetailsClean{
  margin-top: 14px;
}

.resDetailsClean summary{
  cursor:pointer;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(8,10,24,.45);
  font-weight: 750;
}

.resDetailsBody{
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

@media (max-width: 980px){
  .resMainRow{ grid-template-columns: 1fr; }
}


/* =========================================================
   VEHICLE SCREEN – Truck images larger (restored)
   Appended after Quest fade update
   ========================================================= */
#vehicleScreen .vehicleLayout{
  grid-template-columns: 320px 1fr;
  gap: 22px;
}

#vehicleScreen .vehicleCards{ gap: 14px; }

#vehicleScreen button.vehicleCard{
  grid-template-columns: 180px 1fr;
  gap: 14px;
  padding: 14px;
}

#vehicleScreen .vehicleImg{
  width: 180px;
  height: 120px;
  border-radius: 16px;
}

/* Wenn vehicleImg als imgWrap-Container genutzt wird */
#vehicleScreen .vehicleImg.imgWrap{
  width: 180px;
  height: 120px;
}
#vehicleScreen .vehicleImg.imgWrap img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive: auf kleineren Screens wieder kompakter */
@media (max-width: 820px){
  #vehicleScreen button.vehicleCard{ grid-template-columns: 140px 1fr; }
  #vehicleScreen .vehicleImg,
  #vehicleScreen .vehicleImg.imgWrap{ width: 140px; height: 95px; }
}



/* =========================================================
   PACK SCREEN: Header-Logos ausblenden (nur dort)
   ========================================================= */
body[data-screen="pack"] .header-logos{ display:none !important; }

/* =========================================================
   QUEST OVERLAY – final: Header+Body als EIN Bottom-Sheet
   (OK Button bleibt sichtbar)
   ========================================================= */
.questHeader{
  display:flex !important;

  width: min(860px, 92%) !important;
  margin: 0 auto 0 auto !important;
  padding: 14px 18px 10px !important;

  background: rgba(12,16,40,0.42) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-bottom: 0 !important;

  border-radius: 18px 18px 0 0 !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 22px 60px rgba(0,0,0,0.35) !important;

  align-items:flex-start !important;
  justify-content:space-between !important;
  gap: 12px !important;
}

.questBody{
  width: min(860px, 92%) !important;
  margin: 0 auto 18px auto !important;

  background: rgba(12,16,40,0.42) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-top: 0 !important;

  border-radius: 0 0 18px 18px !important;
  backdrop-filter: blur(10px) !important;

  padding: 12px 18px 18px !important;
}

#questOkBtn{
  position: absolute !important;
  right: 22px !important;
  bottom: 26px !important;
  z-index: 6 !important;
}
.questTitle{
  font-weight: 900;      /* stärker als bisher */
  font-size: 22px;       /* optional etwas größer */
  letter-spacing: 0.3px; /* wirkt hochwertiger */
}
/* Result-Dialog: alte Kopfzeile (Titel + Lead) ausblenden */
#resultDialog .dialogHead{ display:none !important; }

/* PACK: Hauptbutton "Transport abschicken" */
#finishBtn{
  background: rgba(255, 215, 0, .22) !important;     /* gelblich */
  border-color: rgba(255, 215, 0, .55) !important;
  color: rgba(238,242,255,.95) !important;
}

#finishBtn:hover{
  background: rgba(255, 215, 0, .28) !important;
  box-shadow: 0 0 0 2px rgba(255, 215, 0, .16) inset !important;
}

#finishBtn:focus-visible{
  box-shadow: 0 0 0 2px rgba(255, 215, 0, .22), 0 12px 34px rgba(0,0,0,.24) !important;
}
#packScreen #finishBtn{
  background: rgba(255, 215, 0, .22);
  border-color: rgba(255, 215, 0, .55);
}
/* PACK: nutze mehr Bildschirmbreite */
body[data-screen="pack"] .app{
  max-width: 1600px; /* war 1200px global */
}
/* PACK: Panels sollen innerhalb des Viewports arbeiten */
#packScreen .packGrid > .panel{ min-height: 0; } /* wichtig für Grid+Overflow */

#packScreen .goodsPanel,
#packScreen .cargoPanel,
#packScreen .statusPanel{
  height: calc(100vh - 240px); /* ggf. 220–280 anpassen je nach Header-Höhe */
  overflow: hidden;
}

/* Güterliste: soll bis unten mitscrollen */
#packScreen .itemsScroll{
  max-height: none;     /* war 64vh */
  height: calc(100% - 90px); /* Header + Toolbar grob */
  overflow: auto;
}

/* Truck: eigener Scrollbereich */
#packScreen #truckWrap{
  overflow: auto;
}

/* ===== PACK LAYOUT FIX: Panels flexen + innen scrollen ===== */

#packScreen .goodsPanel,
#packScreen .cargoPanel,
#packScreen .statusPanel{
  display:flex;
  flex-direction:column;
  min-height: 0;       /* wichtig in Grid */
}

/* Güterliste soll IM Panel den Rest füllen und scrollen */
#packScreen .goodsPanel .itemsScroll{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  max-height: none !important;  /* überschreibt 64vh */
}

/* TruckWrap soll IM Panel den Rest füllen und scrollen */
#packScreen .cargoPanel #truckWrap{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Status rechts: Inhalte nicht abschneiden */
#packScreen .statusPanel{
  overflow: hidden;
}
/* ===== PACK: nutze Ultrawide besser ===== */
body[data-screen="pack"] .app{
  max-width: 1920px; /* mehr als 1600, wenn Monitor breit */
}

/* ===== PACK: Spalten neu gewichten (Mitte bekommt den meisten Platz) ===== */
#packScreen .packGrid{
  grid-template-columns: minmax(320px, 420px) minmax(760px, 1fr) minmax(260px, 340px);
  gap: 14px;
}
/* ===== Truck Grid: Raster skaliert mit Zellgröße ===== */
#truckCanvas{
  --cell: 48px; /* fallback */
  background-size: var(--cell) var(--cell) !important;
}

/* Falls du das Raster über linear-gradients machst: */
#truckCanvas{
  background-image:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
}
/* Truck-Bereich: Canvas darf volle Breite nutzen */
#truckWrap{
  display:flex;
  align-items:flex-start;
  justify-content:flex-start;
}

/* falls irgendwo max-width/center aktiv ist: */
#truckWrap #truckCanvas{
  max-width:none !important;
}
/* ===== Truck Stage: sieht wie Ladefläche aus ===== */
#truckWrap{
  position: relative;
  padding: 14px;
  border-radius: 18px;
  background:
    radial-gradient(1200px 500px at 30% 10%, rgba(255,255,255,.08), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.10));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

/* Reling/Rahmen */
#truckWrap::before{
  content:"";
  position:absolute; inset: 10px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,.10);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.35),
    0 10px 30px rgba(0,0,0,.25);
  pointer-events:none;
}

/* Ladeboden-Textur unter dem Grid */
#truckCanvas{
  border-radius: 12px;
  background:
    /* Bodenlamellen (subtil) */
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,.035) 0px,
      rgba(255,255,255,.035) 6px,
      rgba(0,0,0,.00) 6px,
      rgba(0,0,0,.00) 18px
    ),
    /* Vignette / Tiefe */
    radial-gradient(800px 400px at 50% 15%, rgba(255,255,255,.06), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.32));
}

/* Gridlinien: sehr viel feiner (nur Orientierung) */
#truckCanvas{
  background-image:
    repeating-linear-gradient(to right, rgba(255,255,255,.05) 0 1px, transparent 1px var(--cell)),
    repeating-linear-gradient(to bottom, rgba(255,255,255,.05) 0 1px, transparent 1px var(--cell)),
    /* darunter bleibt dein "Boden" */
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0px, rgba(255,255,255,.035) 6px, rgba(0,0,0,.00) 6px, rgba(0,0,0,.00) 18px),
    radial-gradient(800px 400px at 50% 15%, rgba(255,255,255,.06), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.32));
  background-size: var(--cell) var(--cell), var(--cell) var(--cell), auto, auto, auto;
}
//Alternativ
/* Visuelle No-Go-Zone (z.B. Fahrerhaus/Radkästen) */
#truckWrap .nogozone{
  position:absolute;
  right: 16px;
  top: 16px;
  width: 28%;
  height: 22%;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(0,0,0,.15));
  border: 1px dashed rgba(255,255,255,.22);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
  opacity: .85;
  pointer-events:none;
}
#truckWrap .nogozone::after{
  content:"Fahrerhaus / Radkästen";
  position:absolute;
  left: 10px; top: 8px;
  font-size: 11px;
  color: rgba(238,242,255,.75);
}
#truckWrap::after{
  content:"";
  position:absolute;
  inset: 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 22%, transparent 78%, rgba(0,0,0,.25));
  pointer-events:none;
  mix-blend-mode: overlay;
  opacity: .6;
}
