/* Bridge: 6 heroes — layout from prototype style.css; beat mine.css 2-slot overrides.
   Prototype mine mode uses 1–2 heroes at ~147px; with six we keep the same slot grid
   (25%×30%, tops 2/34/66) and canvas ratio, on a taller battlefield so they fit. */

/* ~½ vertical gaps between panels: chrome up / footer down → battlefield rises */
#hud {
  height: 54px;
  padding: 5px 12px 4px;
  gap: 6px;
}
#finds-dock {
  padding: 2px 9px 3px;
  gap: 4px;
}
#orders {
  padding: 4px 10px 0;
}
#orders .milestone {
  padding: 3px 8px 4px;
  margin-bottom: 4px;
  gap: 6px;
}
#orders .milestone img {
  width: 36px;
  height: 28px;
}
#orders .segments i {
  height: 8px;
}
#orders .order-panel {
  padding: 5px 9px;
}
#orders .order-title {
  margin-bottom: 2px;
}
#orders .order-columns {
  gap: 4px;
}
#orders .order-submit {
  margin-top: 3px;
}
#target-info {
  padding-top: 2px;
}
#target-info .mine-progress {
  margin: 0 16px 2px;
  gap: 2px;
  font-size: 12px;
}
#target-info .mine-progress > div {
  height: 6px;
}
#target-info .target-name {
  font-size: 20px;
  line-height: 1.1;
}
#target-info .target-kind {
  margin-top: 0;
  min-height: 0;
  font-size: 12px;
}
#target-info .health {
  margin-top: 2px;
  height: 18px;
}
#target-info .battle-stats {
  margin-top: 1px;
  font-size: 12px;
}
#battlefield {
  min-height: 240px;
  max-height: 520px;
  margin-top: -16px;
  flex: 1 1 auto;
}
/* Keep block horizontally centered; only lift it (align-items), don't shift X. */
#battlefield #target {
  justify-content: center;
  align-items: flex-start;
  padding-top: 4%;
}
#battlefield .target-button {
  margin-inline: auto;
}
#mine-footer {
  padding: 0 12px 2px;
  margin-top: -2px;
}
#mine-footer .tap-hint,
#mine-footer .start-note {
  margin-bottom: 3px;
  min-height: 12px;
  font-size: 11px;
}
#mine-footer .mine-actions {
  gap: 5px;
}
#mine-footer .develop-button,
#mine-footer .inventory-toggle {
  padding: 7px 5px;
  font-size: 16px;
}
#mine-footer > .primary-button {
  margin-top: 0;
  min-height: 38px;
  padding: 8px 12px;
}
#bottom-nav {
  min-height: 48px;
  padding: 4px 12px calc(4px + var(--safe));
  gap: 6px;
}
#bottom-nav button {
  padding: 6px 4px;
  font-size: 14px;
}
#team .team-slot,
#team .team-slot.has-hero {
  position: absolute;
  width: 28%;
  height: 32%;
  top: 2%;
  left: -2.5%;
  right: auto;
  padding: 0;
  background: none;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: visible;
}
#team .team-slot:nth-child(2n),
#team .team-slot.has-hero:nth-child(2n) {
  left: auto;
  right: -2.5%;
}
#team .team-slot:nth-child(3),
#team .team-slot:nth-child(4),
#team .team-slot.has-hero:nth-child(3),
#team .team-slot.has-hero:nth-child(4) {
  top: 34%;
}
#team .team-slot:nth-child(5),
#team .team-slot:nth-child(6),
#team .team-slot.has-hero:nth-child(5),
#team .team-slot.has-hero:nth-child(6) {
  top: 66%;
}
#team .team-slot.has-hero {
  top: 2%;
}
/* Larger heroes — closer to prototype canvas scale, still capped to the slot. */
#team .team-slot canvas,
#team .team-slot.has-hero canvas {
  width: 138%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 3px #0008);
}
#team .team-slot .slot-level {
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  line-height: 1.1;
  padding: 1px 5px;
  white-space: nowrap;
  z-index: 2;
  pointer-events: none;
}
#team .team-slot[data-slot="0"],
#team .team-slot[data-slot="2"],
#team .team-slot[data-slot="4"] {
  left: -1.5%;
  right: auto;
}
#team .team-slot[data-slot="1"],
#team .team-slot[data-slot="3"],
#team .team-slot[data-slot="5"] {
  left: auto;
  right: -1.5%;
}

/* Button press feel (prototype relies on tactile shadows; reinforce active state) */
button:active:not(:disabled) {
  transform: translateY(2px);
  filter: brightness(1.08);
}
.primary-button:active:not(:disabled),
.primary-button.gold:active:not(:disabled) {
  box-shadow: 0 1px #0b4d4f, inset 0 2px #0003;
}
.primary-button.gold:active:not(:disabled) {
  box-shadow: 0 1px #916020, inset 0 2px #0002;
}
.order-submit:active:not(:disabled) {
  box-shadow: 0 1px #095550;
}
.develop-button:active:not(:disabled) {
  box-shadow: 0 1px #664418;
}
.inventory-toggle:active:not(:disabled) {
  box-shadow: inset 0 2px #8ef9df44, 0 1px #064a51;
}
#bottom-nav button:active:not(:disabled) {
  transform: translateY(1px);
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0d2a30;
  color: #ffe27a;
  transition: opacity .25s;
}
#loader p { color: #9cc9b8; font-size: 13px; margin: 0; }
#loader i {
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid #477394;
  border-top-color: #ffe36e;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
#loader.done { opacity: 0; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Keep dialog/modal usable with our shell() markup when needed */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #06151acc;
  backdrop-filter: blur(4px);
}
#overlay[hidden] { display: none !important; }
#overlay .modal {
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  color: var(--ink, #f9ebd1);
  background: linear-gradient(145deg, #254c4e, #122e38);
  border: 2px solid #a3ad8a;
  border-radius: 20px;
  box-shadow: 0 15px 100px #000a;
  padding: 22px 20px 20px;
}
#overlay .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
#overlay .modal-head h2 { font-size: 23px; margin: 0; }
#overlay .modal-close,
#overlay .close.modal-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #0f2c35;
  border: 1px solid #76908466;
  color: #d4dcc6;
  border-radius: 8px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
#overlay .modal-close img,
#overlay .close img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
#overlay .modal-eyebrow {
  color: #e6c26b; text-transform: uppercase; letter-spacing: 2px; font-size: 11px; margin-bottom: 8px;
}

/* Inventory sheet */
#overlay.inventory-mode {
  align-items: flex-end;
  padding: 0;
  background: linear-gradient(transparent 22%, #06151acc 52%);
  backdrop-filter: none;
}
#overlay .modal.inventory-sheet {
  width: min(440px, 100%);
  max-height: min(78dvh, 640px);
  margin: 0 auto;
  border-radius: 20px 20px 0 0;
  padding: 14px 14px calc(12px + var(--safe, 0px));
  overflow: auto;
  overscroll-behavior: contain;
}
#overlay .inventory-sheet .modal-head {
  margin-bottom: 10px;
  align-items: flex-start;
}
#overlay .inventory-sheet .inv-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
  flex: 1;
}
#overlay .inventory-sheet .eyebrow {
  flex-basis: 100%;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #e6c26b;
  margin: 0;
}
#overlay .inventory-sheet h2 {
  font-size: 22px;
  margin: 0;
}
#overlay .inventory-sheet .inv-capacity {
  font-size: 13px;
  color: #ffe09a;
  background: #0f2c35;
  border: 1px solid #6f9c9066;
  border-radius: 999px;
  padding: 3px 10px;
}
#overlay .board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  touch-action: none;
  user-select: none;
}
#overlay .cell {
  aspect-ratio: 1;
  position: relative;
  min-width: 0;
  padding: 3px;
  border-radius: 8px;
  background: #0c252de8;
  border: 1px solid #59757266;
  box-shadow: inset 0 2px 4px #0008;
  cursor: grab;
  touch-action: none;
  -webkit-user-drag: none;
}
#overlay .cell:empty { cursor: default; }
#overlay .cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
#overlay .cell b, #overlay .cell .level-tag {
  position: absolute;
  right: 2px;
  bottom: 2px;
  background: #1c2b35;
  color: #fff5d7;
  font: bold 11px Arial;
  padding: 1px 4px;
  border-radius: 4px;
  pointer-events: none;
}
#overlay .cell.needed {
  background: linear-gradient(#2a5a45, #163a32);
  border-color: #8fd89a88;
}
#overlay .cell.selected { border-color: #ffce68; box-shadow: 0 0 0 1px #ffce6888; }
#overlay .cell.drag-source { opacity: 0.4; }
#overlay .cell.drop-target {
  outline: 2px solid #ffe398;
  outline-offset: 1px;
  box-shadow: 0 0 14px #efc67588;
}
#overlay .board-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  min-height: 40px;
}
#overlay .board-footer .board-tip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
  color: #c5d8cd;
}
#overlay .board-footer .board-tip b {
  display: block;
  font-size: 12px;
  color: #f4ebcf;
}
#overlay .board-footer .board-tip small {
  display: block;
  font-size: 11px;
  color: #9eb8ae;
}
#overlay .board-footer .trash {
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #a36b6b88;
  background: linear-gradient(#5a3434, #3a2222);
  color: #ffe0d8;
  font-size: 13px;
  font-weight: 800;
}
.inventory-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -58%) scale(1.12);
  border-radius: 8px;
  padding: 3px;
  background: #2a4a45e8;
  border: 2px solid #ffe09a;
  box-shadow: 0 8px 20px #001b28aa;
}
.inventory-drag-ghost img { width: 100%; height: 100%; object-fit: contain; }
.inventory-drag-ghost b {
  position: absolute;
  right: 2px;
  bottom: 2px;
  background: #1c2b35;
  color: #fff5d7;
  font: bold 11px Arial;
  padding: 1px 4px;
  border-radius: 4px;
}
#overlay .primary-button, #overlay .secondary-button, #overlay .buy-level, #overlay .teal, #overlay .gold, #overlay .wide {
  display: block; width: 100%; margin-top: 12px;
  background: linear-gradient(#39baa3, #1b8279); border: 1px solid #91dfb4;
  border-radius: 10px; color: #fff9de; padding: 12px 16px; font-weight: 900;
}
#overlay .gold, #overlay .buy-level.ready {
  background: linear-gradient(#ffe18c, #dfa33e); border-color: #fff0ba; color: #563713;
}
/* offer/choice layouts live in proto-modals.css */
#overlay .team-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
#overlay .team-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; background: #12313b; border: 1px solid #6f9c90; border-radius: 10px; color: #fff0cd;
}
#overlay .team-card img, #overlay .hero-large { width: 100%; max-height: 120px; object-fit: contain; }
#overlay .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#overlay .settings-grid button, #overlay .settings-grid a {
  min-height: 48px; background: #173c43; border: 1px solid #6f9c90; border-radius: 9px; color: #d9e4c9;
}
.beam {
  position: absolute; height: 3px; transform-origin: left center; border-radius: 2px;
  box-shadow: 0 0 8px currentColor; pointer-events: none; z-index: 12;
}

/* Break/loot particles (coords are relative to #game) */
#flights {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}
#flights .particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  background: #ecc77a;
  pointer-events: none;
}
#flights .flight {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 80;
}
#flights .flight img { width: 100%; height: 100%; }
#flights .gain {
  position: absolute;
  font-weight: bold;
  font-size: 16px;
  color: #ffe39b;
  text-shadow: 0 2px 3px #032528;
  white-space: nowrap;
  pointer-events: none;
  z-index: 6;
  transform: translateX(-50%);
}
