/**
 * Hero Viewer panel (Settings → Hero Viewer)
 * All styles scoped under #hero-viewer-panel to avoid clashes with main game.
 * IDs use hv- prefix (e.g. #hv-hero-canvas, #hv-stats-panel).
 */

#hero-viewer-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: #0a0a0f;
}

/* ─── Top bar (prev/next + hero name) ───────────────────────────────────────── */
#hero-viewer-panel #hv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #111118;
  border-bottom: 1px solid #2a2a3a;
  flex-shrink: 0;
}
#hero-viewer-panel #hv-topbar h1 {
  font-size: 14px;
  color: #ffcc44;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#hero-viewer-panel .hv-nav-btn {
  background: #1e1e2e;
  border: 1px solid #3a3a5a;
  color: #aaa;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  border-radius: 3px;
  transition: all 0.2s;
}
#hero-viewer-panel .hv-nav-btn:hover {
  background: #2a2a4a;
  color: #fff;
  border-color: #6666aa;
}

/* ─── Portrait strip ──────────────────────────────────────────────────────── */
#hero-viewer-panel #hv-portrait-strip {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: #0d0d16;
  border-bottom: 1px solid #1a1a2a;
  flex-shrink: 0;
  overflow-x: auto;
}
#hero-viewer-panel .hv-portrait {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 4px;
  border: 2px solid #2a2a3a;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  text-align: center;
  background: #111120;
  color: #888;
  gap: 2px;
}
#hero-viewer-panel .hv-portrait:hover {
  border-color: #5555aa;
  color: #ccc;
}
#hero-viewer-panel .hv-portrait.active {
  border-color: #ffcc44;
  color: #ffcc44;
  background: #1a1a2e;
}
#hero-viewer-panel .hv-portrait .port-icon {
  font-size: 22px;
  line-height: 1;
}

/* ─── Main layout (viewport + stats) ───────────────────────────────────────── */
#hero-viewer-panel #hv-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}
#hero-viewer-panel #hv-viewport-wrap {
  flex: 0 0 auto;
  width: 55%;
  position: relative;
  background: #07070f;
  border-right: 1px solid #1a1a2a;
}
#hero-viewer-panel #hv-hero-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
#hero-viewer-panel #hv-viewport-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#hero-viewer-panel .hv-anim-btn {
  background: rgba(10, 10, 20, 0.85);
  border: 1px solid #333;
  color: #aaa;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11px;
  border-radius: 3px;
  transition: all 0.15s;
}
#hero-viewer-panel .hv-anim-btn:hover {
  border-color: #6666aa;
  color: #fff;
}
#hero-viewer-panel .hv-anim-btn.active {
  border-color: #ffcc44;
  color: #ffcc44;
}
#hero-viewer-panel #hv-announcer {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  font-weight: bold;
  color: #ffcc44;
  text-shadow: 0 0 20px #ffcc44;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
#hero-viewer-panel #hv-dmg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}
#hero-viewer-panel .hv-dmg-num {
  position: absolute;
  font-size: 18px;
  font-weight: bold;
  animation: hv-floatUp 1.2s ease-out forwards;
}

/* ─── Stats panel ──────────────────────────────────────────────────────────── */
#hero-viewer-panel #hv-stats-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #09090f;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#hero-viewer-panel .hv-panel-section {
  background: #111118;
  border: 1px solid #1e1e2e;
  border-radius: 4px;
  padding: 10px;
}
#hero-viewer-panel .hv-panel-section h3 {
  font-size: 11px;
  color: #6666aa;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
#hero-viewer-panel #hv-hero-title {
  font-size: 16px;
  color: #ffcc44;
  font-weight: bold;
}
#hero-viewer-panel #hv-hero-sub {
  font-size: 11px;
  color: #777;
  margin-top: 2px;
}

/* Vitals (HP/MP bars) */
#hero-viewer-panel .hv-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
#hero-viewer-panel .hv-bar-label {
  font-size: 10px;
  color: #888;
  width: 36px;
  flex-shrink: 0;
}
#hero-viewer-panel .hv-bar-track {
  flex: 1;
  height: 10px;
  background: #0d0d16;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #1a1a2a;
}
#hero-viewer-panel .hv-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s;
}
#hero-viewer-panel .hv-bar-hp {
  background: linear-gradient(90deg, #1a8a1a, #2ecc2e);
}
#hero-viewer-panel .hv-bar-mp {
  background: linear-gradient(90deg, #1a3a9a, #3366ff);
}
#hero-viewer-panel .hv-bar-val {
  font-size: 10px;
  color: #aaa;
  width: 55px;
  text-align: right;
}

/* Attributes (STR/AGI/INT) */
#hero-viewer-panel .hv-attrs {
  display: flex;
  gap: 8px;
}
#hero-viewer-panel .hv-attr-box {
  flex: 1;
  background: #0d0d16;
  border-radius: 4px;
  padding: 6px;
  text-align: center;
  border: 1px solid #1a1a2a;
}
#hero-viewer-panel .hv-attr-box.primary {
  border-color: #ffcc44;
  background: #151510;
}
#hero-viewer-panel .hv-attr-box .attr-icon {
  font-size: 16px;
}
#hero-viewer-panel .hv-attr-box .attr-val {
  font-size: 14px;
  font-weight: bold;
  color: #eee;
}
#hero-viewer-panel .hv-attr-box .attr-gain {
  font-size: 9px;
  color: #777;
}

/* Stats grid */
#hero-viewer-panel .hv-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
#hero-viewer-panel .hv-stat-item {
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  padding: 2px 4px;
}

/* Level & speed sliders */
#hero-viewer-panel .hv-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
#hero-viewer-panel .hv-slider-label {
  font-size: 10px;
  color: #888;
  width: 60px;
}
#hero-viewer-panel .hv-slider-val {
  font-size: 10px;
  color: #ccc;
  width: 28px;
  text-align: right;
}

/* Skills */
#hero-viewer-panel .hv-skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
#hero-viewer-panel .hv-skill-btn {
  background: #0d0d16;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 7px 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
#hero-viewer-panel .hv-skill-btn:hover {
  border-color: #5555aa;
  background: #111128;
}
#hero-viewer-panel .hv-skill-btn.active {
  border-color: #ffcc44;
  background: #15150a;
}
#hero-viewer-panel .hv-skill-btn .skill-key {
  font-size: 10px;
  color: #6666aa;
  font-weight: bold;
}
#hero-viewer-panel .hv-skill-btn .skill-name {
  font-size: 11px;
  color: #ccc;
  margin-top: 1px;
}
#hero-viewer-panel .hv-skill-btn .skill-meta {
  font-size: 9px;
  color: #666;
  margin-top: 2px;
}
#hero-viewer-panel #hv-skill-info {
  background: #0d0d16;
  border: 1px solid #2a2a3a;
  border-radius: 4px;
  padding: 8px;
  font-size: 10px;
  color: #aaa;
  line-height: 1.5;
  min-height: 40px;
  margin-top: 8px;
}
#hero-viewer-panel #hv-skill-info .si-name {
  font-size: 12px;
  color: #ffcc44;
  margin-bottom: 4px;
}

/* ─── Mobile landscape compaction ─────────────────────────────────────────── */
/*
 * Mobile landscape: short screens (≤520px tall). Squeeze all vertical chrome
 * so the 3D viewport and stats get the maximum useful space.
 */
@media (max-height: 520px) and (orientation: landscape) {
  /* Topbar: tighter padding, smaller title */
  #hero-viewer-panel #hv-topbar {
    padding: 4px 8px;
  }
  #hero-viewer-panel #hv-topbar h1 {
    font-size: 11px;
    letter-spacing: 1px;
  }
  #hero-viewer-panel .hv-nav-btn {
    padding: 3px 10px;
    font-size: 11px;
  }

  /* Portrait strip: smaller portraits, less gap/padding */
  #hero-viewer-panel #hv-portrait-strip {
    padding: 4px 8px;
    gap: 4px;
  }
  #hero-viewer-panel .hv-portrait {
    width: 42px;
    height: 42px;
    font-size: 8px;
  }
  #hero-viewer-panel .hv-portrait .port-icon {
    font-size: 17px;
  }

  /* Main area: viewport takes 60%, stats panel scrollable on right */
  #hero-viewer-panel #hv-viewport-wrap {
    width: 60%;
  }

  /* Stats panel: tighter spacing */
  #hero-viewer-panel #hv-stats-panel {
    padding: 6px;
    gap: 5px;
  }
  #hero-viewer-panel .hv-panel-section {
    padding: 6px 8px;
  }
  #hero-viewer-panel .hv-panel-section h3 {
    font-size: 9px;
    margin-bottom: 4px;
  }
  #hero-viewer-panel #hv-hero-title {
    font-size: 13px;
  }
  #hero-viewer-panel #hv-hero-sub {
    font-size: 9px;
  }

  /* Vitals bars: slimmer */
  #hero-viewer-panel .hv-bar-row {
    margin-bottom: 3px;
  }
  #hero-viewer-panel .hv-bar-track {
    height: 7px;
  }
  #hero-viewer-panel .hv-bar-label,
  #hero-viewer-panel .hv-bar-val {
    font-size: 9px;
  }

  /* Attributes: tighter */
  #hero-viewer-panel .hv-attr-box {
    padding: 3px 4px;
  }
  #hero-viewer-panel .hv-attr-box .attr-icon {
    font-size: 13px;
  }
  #hero-viewer-panel .hv-attr-box .attr-val {
    font-size: 11px;
  }

  /* Stats grid: denser */
  #hero-viewer-panel .hv-stat-item {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* Sliders: compact */
  #hero-viewer-panel .hv-slider-row {
    margin-bottom: 3px;
  }
  #hero-viewer-panel .hv-slider-label,
  #hero-viewer-panel .hv-slider-val {
    font-size: 9px;
  }

  /* Skills: smaller cards */
  #hero-viewer-panel .hv-skill-grid {
    gap: 4px;
  }
  #hero-viewer-panel .hv-skill-btn {
    padding: 4px 6px;
  }
  #hero-viewer-panel .hv-skill-btn .skill-key {
    font-size: 9px;
  }
  #hero-viewer-panel .hv-skill-btn .skill-name {
    font-size: 10px;
  }
  #hero-viewer-panel .hv-skill-btn .skill-meta {
    font-size: 8px;
  }

  /* Animation buttons overlay: smaller */
  #hero-viewer-panel .hv-anim-btn {
    padding: 3px 7px;
    font-size: 10px;
  }

  /* Announcer: smaller */
  #hero-viewer-panel #hv-announcer {
    font-size: 16px;
    top: 10px;
  }
}

/* Damage number animation (scoped name to avoid global clash) */
@keyframes hv-floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  50% {
    opacity: 1;
    transform: translateY(-30px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translateY(-60px) scale(0.8);
  }
}
