/* Heimdall expandable game panel. Preview only. Scoped to #heimdall. */

#heimdall .hd-expand-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 14px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
}
#heimdall .hd-expand-handle i {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .38);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}
#heimdall .hd-expand-btn {
  flex: 0 0 auto;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 198, 47, .55);
  background: rgba(255, 198, 47, .12);
  color: var(--gold, #FFC62F);
  font: 800 10px/1 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
#heimdall .hd-expand-btn .hd-expand-ico {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid currentColor;
}
#heimdall.stats-expanded .hd-expand-btn .hd-expand-ico {
  border-bottom: 0;
  border-top: 6px solid currentColor;
}
#heimdall .hd-stop-row { align-items: center; }
#heimdall .hd-stop-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

#heimdall .hd-sheet,
#heimdall.hd-desk .hd-dock {
  transition: height .38s cubic-bezier(.22, .8, .28, 1),
              top .38s cubic-bezier(.22, .8, .28, 1),
              max-height .38s cubic-bezier(.22, .8, .28, 1),
              border-radius .28s ease;
}

/* ---- Expanded: near-full sheet under the Heimdall header; score stays sticky ---- */
#heimdall.stats-expanded.hd-port.stats-open .hd-sheet,
#heimdall.stats-expanded.hd-land.stats-open .hd-sheet {
  left: var(--pad) !important;
  right: var(--pad) !important;
  top: calc(var(--hdr) + 4px) !important;
  bottom: var(--pad) !important;
  width: auto !important;
  height: auto !important;
  max-height: none !important;
  border-radius: 14px 14px 10px 10px;
}

#heimdall.stats-expanded.hd-desk .hd-stage {
  grid-template-rows: 0fr minmax(0, 1fr) !important;
  gap: 0 !important;
}
#heimdall.stats-expanded.hd-desk .hd-grid {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
#heimdall.stats-expanded.hd-desk .hd-dock {
  min-height: 0;
  border-radius: 14px 14px 10px 10px;
}

/* Readable type only in the expanded state. Normal panel stays compact. */
#heimdall.stats-expanded .hd-stitle { font-size: 20px; }
#heimdall.stats-expanded .hd-ssub { font-size: 14px; color: rgba(255,255,255,.82); }
#heimdall.stats-expanded .hd-jump button { font-size: 12px; padding: 6px 12px; }
#heimdall.stats-expanded .hd-v { font-size: 16px; line-height: 1.35; }
#heimdall.stats-expanded .hd-k,
#heimdall.stats-expanded .hd-even,
#heimdall.stats-expanded .hd-sh { font-size: 12px; }
#heimdall.stats-expanded .hd-cmp table,
#heimdall.stats-expanded .hd-cmp td,
#heimdall.stats-expanded .hd-cmp td.lab,
#heimdall.stats-expanded .hd-cmp th,
#heimdall.stats-expanded .hd-pt,
#heimdall.stats-expanded .hd-sp,
#heimdall.stats-expanded .hd-line td { font-size: 15px; }
#heimdall.stats-expanded .hd-cmp th,
#heimdall.stats-expanded .hd-pt th { font-size: 11px; }
#heimdall.stats-expanded .hd-src { font-size: 12px; }
#heimdall.stats-expanded .hd-expand-btn { font-size: 12px; padding: 6px 11px; }
#heimdall.stats-expanded .hd-sf-mini .sf-cap-t { font-size: 16px !important; line-height: 1.35; }
#heimdall.stats-expanded .hdg-bubbles button { font-size: 12px !important; padding: 7px 10px !important; }
#heimdall.stats-expanded .hdg-ghead,
#heimdall.stats-expanded .hdg-gtitle { font-size: 12px; }
#heimdall.stats-expanded .hdg-legend span { font-size: 13px; }
#heimdall.stats-expanded .hdg-qlabels { font-size: 11px; height: 18px; }

/* Taller graph when there's room */
#heimdall.stats-expanded .hdg-plot svg,
#heimdall.stats-expanded.hd-port .hdg-plot svg,
#heimdall.stats-expanded.hd-land .hdg-plot svg,
#heimdall.stats-expanded.hd-desk .hdg-plot svg {
  max-height: 220px !important;
  min-height: 160px !important;
  aspect-ratio: 2.15 / 1 !important;
}
@media (min-width: 700px) {
  #heimdall.stats-expanded .hdg-plot svg,
  #heimdall.stats-expanded.hd-port .hdg-plot svg,
  #heimdall.stats-expanded.hd-land .hdg-plot svg,
  #heimdall.stats-expanded.hd-desk .hdg-plot svg {
    max-height: 280px !important;
    min-height: 200px !important;
  }
}
@media (min-width: 1000px) {
  #heimdall.stats-expanded.hd-desk .hdg-plot svg {
    max-height: 320px !important;
    min-height: 220px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #heimdall .hd-sheet,
  #heimdall.hd-desk .hd-dock,
  #heimdall.stats-expanded .hd-sheet,
  #heimdall.stats-expanded.hd-desk .hd-dock,
  #heimdall.stats-expanded.hd-desk .hd-grid {
    transition: none !important;
  }
}
