.modal:has(.dispatch-ready),.modal:has(.first-run){max-width:430px}
.dispatch-ready,.first-run{text-align:center;color:#23475b}
.dispatch-kicker,.intro-progress{font-size:10px;letter-spacing:1.5px;font-weight:850;color:#487467;margin:4px 0 9px}
.dispatch-ready h2,.first-run h2{font-size:27px;line-height:1.15;color:#1d475e;text-shadow:none!important;margin:6px 0}
.dispatch-level-name{font-size:13px;color:#506c79;margin:7px 0}
.dispatch-scene{position:relative;perspective:750px;height:190px;margin:4px auto 0;max-width:300px;overflow:visible;isolation:isolate}
.dispatch-cube{position:absolute;left:50%;top:46%;width:94px;height:94px;transform-style:preserve-3d;transform:translate(-50%,-50%) rotateX(-19deg) rotateY(-30deg);animation:crate-arrive 1.15s cubic-bezier(.2,.8,.25,1) both}
.crate-face{position:absolute;inset:0;box-sizing:border-box;border:2px solid #b87630;border-radius:7px;background:linear-gradient(90deg,transparent 42%,#ffe6ac 42%,#ffe6ac 58%,transparent 58%),linear-gradient(#ffd17c,#e49b43);backface-visibility:hidden;box-shadow:inset 0 2px #fff0b8;display:grid;place-items:center}
.crate-front{transform:translateZ(47px)}.crate-back{transform:rotateY(180deg) translateZ(47px)}.crate-left{transform:rotateY(-90deg) translateZ(47px);filter:brightness(.82)}.crate-right{transform:rotateY(90deg) translateZ(47px);filter:brightness(.89)}.crate-top{transform:rotateX(90deg) translateZ(47px);background-color:#ffe7a9;filter:brightness(1.12)}.crate-bottom{transform:rotateX(-90deg) translateZ(47px)}
.crate-front b{display:grid;place-items:center;width:49px;height:48px;border-radius:15px;border:2px solid #fff5d0;background:#fff3ce;color:#9a631f;font-size:30px;font-style:normal;box-shadow:0 4px #b48338}
.dispatch-shadow{position:absolute;left:50%;top:148px;width:125px;height:24px;transform:translateX(-50%);background:#345a6640;filter:blur(7px);border-radius:50%;animation:crate-shadow 1.15s ease-out both}
.dispatch-halo{position:absolute;width:225px;height:160px;left:50%;top:20px;transform:translateX(-50%);background:radial-gradient(ellipse,#ffedaa88,#bceadd33 50%,transparent 72%);border-radius:50%}
.dispatch-spark{position:absolute;color:#e8b34c;animation:dispatch-spark 1.2s ease-out both;pointer-events:none}.spark-one{left:15%;top:35px;font-size:25px}.spark-two{right:12%;top:85px;font-size:35px;animation-delay:.12s}.spark-three{right:25%;top:15px;font-size:19px;animation-delay:.2s}
.dispatch-packs{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:15px 0}
.dispatch-pack{border:1px solid #d5dcca;background:linear-gradient(#fffef8,#eef3e4);border-radius:18px;padding:13px 9px;box-shadow:inset 0 2px #fff,0 5px #b3c9b3;text-align:center}
.dispatch-pack>span{font-size:27px}.dispatch-pack strong{display:block;font-size:17px;margin:6px 0;color:#335568}.dispatch-pack button{width:100%;min-height:44px;font-size:13px;padding:7px}
.first-run .dispatch-scene{height:170px;margin:0 auto}.first-run .dispatch-shadow{top:145px}
.first-run h2{font-size:25px;margin:7px 0 13px}.first-run .intro-body{font-size:14px;line-height:1.65;color:#3c5967;margin:10px 0 14px;text-shadow:none!important}
.intro-tip{background:#e8f4e9;border:1px solid #c9dfcf;border-radius:16px;padding:12px;font-size:12px;line-height:1.5;color:#375e4b;margin-bottom:15px}
.intro-actions{display:flex;gap:10px}.intro-actions button{min-height:48px;flex:1;font-size:14px}.intro-skip{min-height:44px;color:#4c6876;display:block;margin:8px auto 0;font-size:12px}
.intro-dots{display:flex;justify-content:center;gap:7px;margin:10px 0}.intro-dots i{display:block;width:7px;height:7px;background:#c4d7cf;border-radius:50%}.intro-dots i.active{width:21px;background:#2f947c;border-radius:5px}
@keyframes crate-arrive{0%{transform:translate(-50%,-95%) rotateX(-35deg) rotateY(-110deg) scale(.6)}70%{transform:translate(-50%,-46%) rotateX(-17deg) rotateY(-26deg) scale(1.05)}100%{transform:translate(-50%,-50%) rotateX(-19deg) rotateY(-30deg)}}
@keyframes supply-arrive{from{opacity:0;transform:translateY(25px) rotateX(-40deg) scale(.8)}to{opacity:1;transform:translateY(0) rotateX(0deg) scale(1)}}
@keyframes crate-shadow{from{opacity:0;scale:.5}to{opacity:1;scale:1}}
@keyframes dispatch-spark{from{opacity:0;transform:scale(.1) rotate(-60deg)}55%{opacity:1;transform:scale(1.2) rotate(15deg)}to{opacity:.7;transform:scale(1) rotate(0)}}
[data-motion=false] .dispatch-cube,[data-motion=false] .dispatch-item,[data-motion=false] .dispatch-shadow,[data-motion=false] .dispatch-spark{animation:none}

@media(prefers-reduced-motion:reduce){.dispatch-cube,.dispatch-item,.dispatch-shadow,.dispatch-spark{animation:none!important}}

/* Ten-level chapters share their labels across map, preparation and results. */
.dispatch-world-card{margin:12px 0;border:1px solid #b9d6d0;border-radius:20px;overflow:hidden;background:linear-gradient(135deg,#e4f8f1,#fff1ce);box-shadow:0 4px 0 #bad3ca;color:#173e51}
.dispatch-world-card>div:first-child{display:flex;gap:12px;align-items:center;padding:12px 16px;text-align:left}
.dispatch-world-card>div:first-child>span{font-size:32px;filter:drop-shadow(0 3px 1px #17435520)}
.dispatch-world-card p{display:grid;gap:3px;margin:0!important}
.dispatch-world-card small{font:800 10px/1.3 system-ui;letter-spacing:1.4px;color:#3b6b69}
.dispatch-world-card strong{font:800 18px/1.2 system-ui;color:#163f52}
.dispatch-world-card em,.dispatch-item em{font:600 11px/1.3 system-ui;color:#456578}
.dispatch-world-card.new-world{border:2px solid #edc66b;box-shadow:0 5px 0 #bb965b}
#dispatch-world-preview{display:block;width:100%;height:150px;object-fit:cover;object-position:50% 47%;border-top:1px solid #e4c779}
.dispatch-tool-purpose{margin:10px 0;padding:10px 12px;background:#e6f2ef;border-radius:13px;font:600 12px/1.45 system-ui!important;color:#244b58!important;text-shadow:none!important;-webkit-text-fill-color:currentColor!important;-webkit-text-stroke:0!important}
.world-unlocked{display:flex;align-items:center;gap:14px;padding:16px;margin:16px 0;border:2px solid #e9c36a;border-radius:18px;background:linear-gradient(135deg,#fff6d2,#def5ed);box-shadow:0 4px 0 #baa069;text-align:left;color:#183e51}
.world-unlocked>span{font-size:38px}.world-unlocked small{display:block;font:800 10px/1.4 system-ui;letter-spacing:1px;color:#3c6c65}.world-unlocked strong{display:block;font:800 20px/1.25 system-ui;color:#173e51}.world-unlocked p{margin:3px 0 0!important;font:600 12px/1.4 system-ui!important;color:#48616c!important}
.hub-world-gate{position:absolute;left:calc(51% - 18px);width:42%;max-width:230px;z-index:3;display:grid;grid-template-columns:32px 1fr;gap:2px 7px;padding:9px 10px;pointer-events:none;border-radius:15px;border:2px solid #f5dc9b;background:linear-gradient(135deg,#fff4d9,#d9eee5);box-shadow:0 5px 0 #8e7757,0 9px 12px #12384b40;transform:translateX(-100%);color:#173e51}
.hub-world-gate>span{grid-row:span 2;font-size:25px;align-self:center}.hub-world-gate strong{font:800 11px/1.3 system-ui}.hub-world-gate small{font:600 10px/1.3 system-ui;color:#49676c}

/* Let the content shrink before the action row, including on devices with a home indicator. */
#modal-backdrop:has(.fit-dialog) {
  align-items:center;
  padding:calc(var(--safe-top, 0px) + 8px) max(8px,var(--safe-right, 0px))
          calc(var(--safe-bottom, 0px) + 8px) max(8px,var(--safe-left, 0px));
}
#modal:has(.fit-dialog) {
  display:flex;
  flex-direction:column;
  max-width:460px;
  max-height:100%;
  padding:clamp(12px,3.4vw,20px);
  overflow:hidden;
}
#modal-content:has(> .fit-dialog), .fit-dialog {
  min-height:0;
  display:flex;
  flex-direction:column;
}
.fit-body { min-height:0; overflow:auto; overscroll-behavior:contain; }
.fit-actions { flex:none; }
.dispatch-summary { display:grid; gap:10px; padding:3px 3px 6px; }
.dispatch-summary .dispatch-kicker { margin:0; }
.dispatch-summary h2 { margin:4px 0; font-size:clamp(21px,5.5vw,27px); }
.dispatch-level-name { margin:0; }
.dispatch-summary .dispatch-world-card {
  display:grid;
  grid-template-columns:minmax(0,1fr) 24%;
  align-items:stretch;
  margin:0 0 3px;
}
.dispatch-world-card>div:first-child { gap:8px; padding:9px 10px; }
.dispatch-world-card>div:first-child>span { font-size:24px; }
.dispatch-world-card strong { font-size:16px; overflow-wrap:anywhere; }
.dispatch-world-art { position:relative; overflow:hidden; }
.dispatch-world-art .dispatch-scene {
  width:170px; height:180px; margin:0; position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%) scale(.42);
}
.dispatch-world-art #dispatch-world-preview {
  position:absolute; inset:0; width:100%; height:100%; border:0;
}
.dispatch-inventory {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0 0 2px;
}
.dispatch-item {
  display:grid; grid-template-columns:auto minmax(0,auto); justify-content:center;
  gap:0 6px; align-items:center; padding:7px 4px;
  border:1px solid #bfd8c9; border-radius:14px;
  background:linear-gradient(145deg,#fffef9,#e1f3e9); box-shadow:0 3px #8ebcaa;
}
.dispatch-item>span { grid-row:span 2; font-size:21px; }
.dispatch-item strong { color:#244c5c; font-size:19px; line-height:1.1; overflow-wrap:anywhere; }
.dispatch-item small { color:#456959; font-size:12px; }
.dispatch-summary .dispatch-tool-purpose { margin:0; padding:7px 10px; }
.dispatch-balances { display:flex; flex-wrap:wrap; justify-content:center; gap:8px; }
.dispatch-balances span {
  padding:3px 10px; border:1px solid #d4dccb; border-radius:20px;
  background:#f3f6eb; font-size:14px; font-weight:750; color:#49624b;
}
.dispatch-actions { padding-top:8px; }
#dispatch-continue { width:100%; min-height:48px; margin:0; line-height:1.2; }
.dispatch-links { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; margin-top:5px; }
.dispatch-links .text-button { min-height:44px; padding:4px; text-align:center; justify-content:center; font-size:13px; color:#375c70; }
@media (orientation:landscape) and (min-width:480px) and (max-height:540px) {
  #modal:has(.fit-dialog) { max-width:680px; padding:8px 12px; }
  .dispatch-summary { grid-template-columns:1fr 1fr; align-items:center; gap:5px 12px; }
  .dispatch-heading { grid-column:1; grid-row:1; }
  .dispatch-summary .dispatch-world-card { grid-column:1; grid-row:2 / 4; }
  .dispatch-inventory { grid-column:2; grid-row:1; }
  .dispatch-tool-purpose { grid-column:2; grid-row:2; }
  .dispatch-balances { grid-column:2; grid-row:3; }
  .dispatch-actions { padding-top:4px; display:grid; grid-template-columns:1fr 1.2fr; align-items:center; gap:10px; }
  .dispatch-links { margin:0; }
}
