/* extracted from style.css: management-panels pass */
/* safe-first extraction: focus, stats, journal, trash, inventory, quest board, shop, changelog, and late management authority blocks */

/* ==== focus-stats-journal-foundation ==== */
/* ============================

/* ==== trash-inventory-quest-shop-foundation ==== */
/* ============================

/* ==== changelog-panel-foundation ==== */
/* ============================

/* ==== management-panel-hotfixes-shop-trash-stats ==== */
/* ============================
   Phase 5: Panel Contract migrations
   ============================ */

/* TRACKMAKER2: keep header actions left of pin/x and avoid overlap */


/* ============================
   PHASE 5 MERGE HOTFIX (non-destructive)
   Restores: Stats sizing + XP alignment, Shop header/format, Trash header fit
   ============================ */

/* ---- SHOP: force Panel Contract layout so header controls don't drift ---- */


/* Ensure the body is where the shop's two-column layout lives */


/* ---- TRACKMAKER2/TRASH: standardized header spacing ---- */
#trackmaker2-panel > .panel-header > .panel-title,
/* ==== stats-panel-layout-authority ==== */
#stats-panel.panel {
  --stat-level-w: 50px;
  --stat-gap: 6px;
  --stat-bar-w: 208px;
  --stat-points-w: 45px;
  width: 340px !important;
  min-width: 340px !important;
  min-height: 278px !important;
}

#stats-panel .panel-body{
  position: relative;
  padding-top: 12px;
}

.stats-name-row{
  position: relative;
  min-height: 30px;
  margin: 4px 0 10px;
}

.stats-name-row h3{
  margin: 0;
  text-align: center;
  line-height: 30px;
}

#chao-name{
  display: inline-block;
}

#edit-name{
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#stats-panel .stat-block > .stat-row:first-child .stat-points{
  left: calc(var(--stat-level-w) + var(--stat-gap) + var(--stat-bar-w) - var(--stat-points-w) + 10px);
}

/* ===== Patch 5: focus dot + stats layout cleanup ===== */
#stats-panel .panel-body{
  position: relative;
}

.stats-debug-toggle{
  left: auto !important;
  right: 6px !important;
}

#stats-panel .stats-name-row{
  padding: 0 38px 0 38px;
}

#edit-name{
  top: 1px !important;
  left: 0 !important;
}

#stats-panel .stat-block > .stat-row:first-child{
  display: grid !important;
  grid-template-columns: var(--stat-level-w) 1fr !important;
  column-gap: var(--stat-gap) !important;
  align-items: start !important;
  position: relative !important;
  padding-right: 0 !important;
}

#stats-panel .stat-block > .stat-row:first-child .stat-name{
  grid-column: 1 !important;
}

#stats-panel .stat-block > .stat-row:first-child .stat-points{
  position: static !important;
  grid-column: 2 !important;
  justify-self: end !important;
  width: var(--stat-points-w) !important;
  min-width: var(--stat-points-w) !important;
  margin-left: auto !important;
  padding-right: 0 !important;
  text-align: right !important;
}

/* ===== Patch 6: focus/stats/debug cleanup ===== */
#stats-debug-panel .debug-dev-controls{
  position: relative;
  z-index: 1;
}

.stats-debug-toggle,
#edit-name{
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  line-height: 1;
  padding: 0;
}
.stats-debug-toggle:hover,
#edit-name:hover{
  background: rgba(255,255,255,0.14);
}
.stats-debug-toggle{
  top: 1px !important;
  right: 6px !important;
  font-size: 14px;
}
#stats-panel .stats-name-row{
  padding: 0 42px 0 42px;
}

/* ===== Patch 7: stats button alignment cleanup ===== */
#stats-panel .stats-name-row{
  min-height: 34px;
  display: block;
}
#stats-panel .stats-name-row h3{
  line-height: 34px;
}
.stats-debug-toggle,
#edit-name{
  width: 32px !important;
  height: 32px !important;
  top: 1px !important;
  font-size: 16px !important;
}
#edit-name{
  left: 0 !important;
}
.stats-debug-toggle{
  right: 0 !important;
}

/* ===== merged patch overrides on patched7 base ===== */
#stats-panel .stats-panel-header{
  position: relative;
}
#stats-panel .stats-panel-header .panel-title{
  text-align: left !important;
  padding-right: 120px !important;
}
#stats-panel .stats-panel-header .panel-header-controls{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}
#stats-panel .stats-panel-header .stats-debug-toggle{
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 40px !important;
  height: 28px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  z-index: 1;
}
#stats-panel .panel-body > .stats-debug-toggle{
  display: none !important;
}
#stats-panel .stats-name-row{
  padding: 0 0 0 42px !important;
}
#stats-panel .stats-name-row h3{
  text-align: center !important;
}
#edit-name{
  position: absolute !important;
  left: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 34px !important;
  height: 34px !important;
}

/* ==== management-panel-authority-focus-utility ==== */
/* ============================================================
   Display pass patch48 — focus/customizer canonical cleanup layer
   Purpose: prune remaining small-panel fallback ownership around
   focus + UI organizer/editor panels and make one late block the
   authority for their body fit / scroll / chrome behavior.
   ============================================================ */

#focus-panel {
  width: 340px !important;
  min-width: 340px !important;
  height: 348px !important;
  z-index: 9060;
}

#focus-panel > .panel-body,
#ui-options-panel > .panel-body.ui-options-body,
#ui-button-list-panel > .panel-body.ui-button-list-body {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

#focus-panel > .panel-body {
  display: flex;
  flex-direction: column;
  padding: 10px 10px 12px;
  overflow: hidden;
}

#focus-frame,
#focus-viewport {
  width: 304px;
  height: 228px;
}

#focus-canvas {
  position: absolute;
  inset: 0;
  width: 304px;
  height: 228px;
}

.focus-meta {
  flex: 0 0 auto;
  max-height: 68px;
  margin-top: 8px;
  min-width: 0;
}

#ui-options-panel > .panel-body.ui-options-body,
#ui-button-list-panel > .panel-body.ui-button-list-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  scrollbar-gutter: stable;
}

#ui-options-panel .ui-options-body,
#ui-button-list-panel .ui-button-list-body {
  min-width: 0;
  min-height: 0;
}

#ui-button-list-panel .ui-button-list-body {
  padding-bottom: 18px;
  box-sizing: border-box;
  overflow: auto;
}

#ui-options-panel .ui-options-tabpage,
#ui-button-list-panel .ui-button-list-grid {
  min-width: 0;
}

#ui-options-panel .ui-options-tabpage.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

#ui-button-list-panel .ui-button-list-grid {
  scrollbar-gutter: stable;
  padding-bottom: 96px;
  scroll-padding-bottom: 96px;
  box-sizing: border-box;
}

/* ============================================================
   Display pass patch50 — utility/management panel authority cleanup
   Purpose: prune lingering legacy ownership across stats/inventory/
   shop/journal/trash/dev/debug utility panels and pin them under one
   late contract for header fit, body flex, and scroll ownership.
   ============================================================ */

#stats-panel.panel,
#inventory-panel.panel,
#shop-panel.panel,
#journal-panel,
#trash-panel.panel,
#inventory-panel.panel,
#journal-panel,
#trash-panel.panel {
  display: flex;
  flex-direction: column;
}

#stats-panel > .panel-header,
#inventory-panel > .panel-header,
#shop-panel > .panel-header,
#journal-panel > .panel-header,
#trash-panel > .panel-header,
#dev-panel > .panel-header,
#stats-debug-panel > .panel-header {
  position: relative;
  min-width: 0;
  flex: 0 0 auto;
}

#stats-panel > .panel-header > .panel-title,
#inventory-panel > .panel-header > .panel-title,
#shop-panel > .panel-header > .panel-title,
#journal-panel > .panel-header > .panel-title,
#dev-panel > .panel-header > .panel-title,
#stats-debug-panel > .panel-header > .panel-title {
  min-width: 0;
}

#stats-panel > .panel-header > .panel-header-controls,
#inventory-panel > .panel-header > .panel-header-controls,
#shop-panel > .panel-header > .panel-header-controls,
#journal-panel > .panel-header > .panel-header-controls,
#trash-panel > .panel-header > .panel-header-controls,
#dev-panel > .panel-header > .panel-header-controls,
#stats-debug-panel > .panel-header > .panel-header-controls {
  flex: 0 0 auto;
}

#stats-panel > .panel-body,
#inventory-panel > .panel-body,
#shop-panel > .panel-body.shop-body,
#journal-panel > .panel-body.journal-panel-body,
#trash-panel > .panel-body,
#dev-panel > .panel-body,
#stats-debug-panel > .panel-body,
#stats-debug-panel .stats-debug-body {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

#shop-panel > .panel-body.shop-body,
#journal-panel > .panel-body.journal-panel-body,
#dev-panel > .panel-body,
#stats-debug-panel > .panel-body,
#stats-debug-panel .stats-debug-body {
  overflow: auto;
  scrollbar-gutter: stable;
}

#shop-panel .shop-left,
#shop-panel .shop-right,
#journal-panel .journal-page,
#journal-panel .journal-page.active,
#inventory-panel .tabs,
#inventory-panel .grid,
#inventory-panel .equip-grid,
#stats-debug-panel .debug-dev-controls {
  min-width: 0;
  min-height: 0;
}

#trash-panel > .panel-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 14px 18px !important;
  gap: 10px;
}

#stats-panel .stats-name-row {
  z-index: 9055;
}

#shop-panel.panel,
#journal-panel {
  z-index: 150 !important;
}

/* ============================================================
   Migrated from 03-panel-contract.css — focus/stats/journal carve-out
   ============================================================ */

/* ============================
   Focus Canvas (RENDER TARGET)
   ============================ */
#focus-frame {
  width: 100%;
  max-width: 304px;
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border: 2px solid #415a77;
  border-radius: 8px;
  background: #0d1b2a;
  position: relative;
  overflow: hidden;
}

#focus-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#focus-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* ============================
   Focus Details (TEXT ONLY)
   ============================ */
.focus-meta {
  max-height: 60px;
  margin-top: 6px;
  text-align: center;
  overflow-y: auto;

  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE / Edge */
}

.focus-meta::-webkit-scrollbar {
  display: none;
}

#focus-name {
  color: #ffd60a;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 2px;
  text-shadow: 1px 1px 2px #000;
}

#focus-desc {
  font-size: 13px;
  line-height: 1.15em;
  opacity: 0.9;
}

/* ============================
   Stats + Focus (UNCHANGED)
   ============================ */

.stats-page { display: none; }
.stats-page.active { display: block; }

.stat-block { margin-bottom: 6px; }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2px 0;
  font-size: 14px;
}

.stat-name {
  color: #ffffff;
  font-weight: bold;
  text-shadow: 2px 2px 0px #000;
}

.stat-points {
  color: #ffffff;
  font-family: monospace;
  text-shadow: 2px 2px 0px #000;
  min-width: 45px;
  text-align: right;
}

.stat-level {
  color: #fffc00;
  text-shadow: 2px 2px 0px #000;
  font-weight: bold;
  margin-right: 6px;
  min-width: 50px;
  text-align: left;
}

.stat-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 6px;
}

/* Pixel-Perfect Stat Bars */
.upper-bar {
  width: 194px;
  height: 15px;
  background: #848a83;
  border: 4px solid #000;
  border-bottom: 2px solid #000;
  box-sizing: border-box;
  overflow: hidden;
}

.upper-bar .bar-fill {
  height: 100%;
  width: 0%;
  background: yellow;
  transition: width 0.3s, background-color 0.3s;
}

.lower-bar {
  width: 194px;
  height: 15px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  background: #000;
  border: 4px solid #000;
  border-top: 2px solid #000;
  box-sizing: border-box;
}

.lower-bar .pip {
  background: #848a83;
  height: 100%;
}

.lower-bar .pip.filled {
  background: #5b63ff;
}

/* Grades */
#stats-panel [id$="-grade"] {
  color: #ffd60a;
  font-weight: bold;
}

/* ============================
   Chao Titles (Stats + Focus)
   ============================ */
#chao-title {
  display: block;
  font-size: 14px;
  color: #ffd60a;
  text-align: center;
  margin: 4px 0;
  text-shadow: 1px 1px 2px #000;
}

#select-title-btn {
  display: inline-block;
  background: #415a77;
  border: 2px solid #ffd60a;
  border-radius: 6px;
  color: #fff;
  font-weight: bold;
  font-size: 12px;
  padding: 4px 8px;
  margin-top: 4px;
  transition: background 0.2s, transform 0.1s;
}

#select-title-btn:hover {
  background: #5b63ff;
  transform: scale(1.05);
}

.focus-title-line {
  color: #ffd60a;
  font-size: 13px;
  font-style: italic;
  margin-top: 2px;
  text-shadow: 1px 1px 2px #000;
}

.title-highlight {
  color: #ffd60a;
  text-shadow: 1px 1px 2px #000;
}

/* ============================
   Snap-On Debug Panel
   ============================ */
#stats-debug-panel h3 {
  font-size: 18px;
  font-weight: bold;
  color: #ffd60a;
  text-shadow: 2px 2px 0px #000;
  margin: 0 0 6px 0;
  text-align: center;
}

#stats-debug-panel p {
  margin: 4px 0;
  font-size: 16px;
}

#debug-output {
  font-size: 16px;
  font-family: monospace;
  white-space: pre;
  background: #0d1b2a;
  border: 1px solid #415a77;
  border-radius: 6px;
  padding: 4px;
  margin-top: 6px;
  max-height: 300px;
  overflow-y: auto;
}

#stats-debug-panel .debug-header {
  font-weight: bold;
  color: #5bcefa;
  text-align: center;
  margin-bottom: 4px;
  font-size: 16px;
}

/* ============================
   Journal (Profile-style)
   ============================ */
/* ============================
   Journal (Stats & Achievements)
   - Larger, structured layout
   ============================ */
#journal-panel {
  padding: 10px;
  box-sizing: border-box;

  background: rgba(13, 27, 42, 0.95);
  border: 1px solid #415a77;
  border-radius: 10px;

  color: #eaeaea;
  font-size: 14px;

  overflow: hidden; /* pages handle scroll */
}

/* Kill default spacing bleed */
#journal-panel p {
  margin: 0;
}

/* ============================
   Journal Pages
   ============================ */
.journal-page {
  display: none;
  /* Keep content inside the larger panel and avoid "floating text" */
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}
.journal-page.active {
  display: block;
  max-height: 560px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

/* Content layout */
.journal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.journal-grid.two {
  grid-template-columns: repeat(2, 1fr);
}

.journal-grid.one {
  grid-template-columns: 1fr;
}

.journal-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.journal-card h3 {
  margin: 0 0 8px 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.journal-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.journal-kv:last-child {
  border-bottom: 0;
}

.journal-kv span {
  opacity: 0.9;
}

.journal-kv b {
  font-weight: 900;
}

/* ============================
   Tabs (match Profile buttons)
   ============================ */
#journal-panel .tabs {
  display: flex;
  gap: 4px;
  margin: 6px 0 8px 0;
}

#journal-panel .tabs button {
  flex: 1;
  padding: 4px 6px;
  font-size: 13px;
  background: #1b263b;
  border: 1px solid #415a77;
  border-radius: 6px;
  color: #ddd;
  cursor: pointer;
}

#journal-panel .tabs button.active {
  background: #415a77;
  color: #fff;
}

/* ============================
   Highlighted Journal Stats
   ============================ */
#journal-panel #journal-chaoregon-attempts,
#journal-panel #journal-chaoregon-wins {
  color: #ffd60a;
  font-weight: bold;
}

/* ============================
   Chao Preview (Profile-style)
   ============================ */
#journal-chao-preview {
  width: 96px;
  height: 96px;
  margin: 6px auto;

  border: 2px solid #415a77;
  border-radius: 8px;
  background: #000;

  display: flex;
  align-items: center;
  justify-content: center;
}

#journal-chao-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* ============================================================
   Migrated from 03-panel-contract.css — trash/inventory/quest/shop carve-out
   ============================================================ */

/* ============================
   Trash Panel
   ============================ */
#trash-panel.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 340px !important;
  min-width: 340px !important;
  max-width: 340px !important;
  height: 348px !important;
  min-height: 348px !important;
  max-height: 348px !important;
  z-index: 150 !important;
  background: rgba(13, 27, 42, 0.85);
  border: 2px solid #415a77;
  border-radius: 12px;
  color: #fff;
  text-align: center;

  display: none !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  text-align: left !important;
  overflow: hidden !important;
}

#trash-panel .trash-icon {
  width: 132px;
  height: 132px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

#trash-panel .trash-tip {
  font-size: 14px;
  color: #a5b3cf;
  margin-top: 8px;
}

/* ==========================================
   FORCE EQUIP ICONS TO FRONT FRAME ONLY
   ========================================== */

img[src*="/assets/equip/"] {
  width: 32px;
  height: 32px;

  object-fit: none;
  object-position: 0px 0px; /* FRONT frame */

  image-rendering: pixelated;
}

/* ============================
   Inventory Panel (Profile-style)
   ============================ */
#inventory-panel.panel {
  display: flex;
  flex-direction: column;
  z-index: 150 !important;
  background: rgba(13, 27, 42, 0.95);
  border: 1px solid #415a77;
  border-radius: 10px;
  padding: 8px;
  box-sizing: border-box;
  color: #eaeaea;
  font-size: 14px;
}

#inventory-panel h3 {
  margin: 0 0 6px 0;
  text-align: center;
  color: #ffd60a;
  text-shadow: 1px 1px 2px #000;
}

#inventory-panel h3 img {
  height: 24px;
  vertical-align: middle;
  image-rendering: pixelated;
}

/* ============================
   Inventory Tabs (Profile/Journal match)
   ============================ */
#inventory-panel .tabs {
  display: flex;
  gap: 4px;
  margin: 0;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

#inventory-panel .tabs button {
  flex: 1;
  padding: 4px 6px;
  font-size: 13px;

  background: #1b263b;
  border: 1px solid #415a77;
  border-radius: 6px;

  color: #ddd;
  cursor: pointer;
}

#inventory-panel .tabs button.active {
  background: #415a77;
  color: #fff;
  outline: none;
}

/* ============================
   Inventory Ring Counter
   ============================ */
#ring-counter {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 14px;
  font-weight: bold;
  color: #ffd60a;

  margin: 4px 0 6px 0;
  padding-left: 2px;

  flex-shrink: 0;
}

#ring-counter .currency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#ring-counter .currency + .currency {
  margin-left: 10px;
}
#ring-counter img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  vertical-align: middle;
}

#ring-counter .currency-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#ring-counter .currency-divider {
  margin: 0 6px;
  color: #ffd60a;
  font-family: monospace;
}

#ring-counter .specialrings {
  color: #e0e0ff;
}

#inventory-panel > .panel-body {
  --inventory-cols: 12;
  --inventory-rows: 7;
  --inventory-slot-size: 68px;
  --inventory-gap: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px 14px;
  overflow: auto;
  overflow-x: hidden;
}

/* ============================
   Inventory Grids
   ============================ */
#inventory-panel .grid,
#inventory-panel .equip-grid {
  display: grid;
  align-content: start;
  grid-template-columns: repeat(var(--inventory-cols), var(--inventory-slot-size));
  gap: var(--inventory-gap);
  justify-content: center;
}

/* ============================
   Inventory Slots
   ============================ */
#inventory-panel .slot {
  width: var(--inventory-slot-size);
  height: var(--inventory-slot-size);

  background: #1b263b;
  border: 1px solid #415a77;
  border-radius: 6px;

  display: flex;
  align-items: center;
  justify-content: center;

  /* allow stack qty overlay */
  position: relative;
}

/* Stack count overlay (inventory stacks up to 99) */
#inventory-panel .stack-qty {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 12px;
  line-height: 12px;
  color: #ffffff;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}

#inventory-panel .slot.empty {
  background: #0d1b2a;
  border: 1px solid #2a3a52;
}

/* ============================
   Item / Equip Sprites
   ============================ */
#inventory-panel .slot img,
#inventory-panel .equip-grid .slot img {
  width: 48px;
  height: 48px;

  object-fit: none;          /* sprite-sheet safe */
  object-position: 0px 0px;  /* F-facing */

  image-rendering: pixelated;
}

/* ============================
   Quest Board Styles (Contract pass)
   ============================ */
#quest-board-panel.panel {
  background: rgba(15, 20, 35, 0.94);
  border: 2px solid #2b4b7e;
  border-radius: 10px;
  overflow: hidden;
  color: #fff;
  font-family: var(--font-ui, "Verdana", sans-serif);
  display: none;
  position: absolute;
  z-index: 1200;
  flex-direction: column;
}

#quest-board-panel .panel-header {
  background: linear-gradient(90deg, #1b273d, #2b4b7e);
  color: #fff;
  font-weight: bold;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #415a77;
}

#quest-board-panel .panel-title {
  font-size: 18px;
  color: #E9FC4E;
  font-weight: bold;
  flex-shrink: 0;
}

#quest-board-panel .panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px 10px;
}
/* Tabs container directly under title bar */
#quest-board-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.quest-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 86px;
  padding: 6px 10px;
  background: rgba(10, 15, 25, 0.6);
  border: 1px solid #324a6f;
  border-radius: 4px;
  color: #bbb;
  font-size: 13px;
  line-height: 1.1;
  font-weight: bold;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s, border 0.2s;
}

.quest-tab:hover {
  color: #fff;
  background: rgba(60, 90, 130, 0.5);
}

.quest-tab.active {
  color: #fff;
  background: rgba(70, 120, 180, 0.4);
  border: 1px solid #5da9f1;
}

/* Scrollable content area below header */
.quest-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 20px;
  background: rgba(10, 15, 25, 0.85);
}

.quest-list {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
}

.quest-list.visible {
  display: flex;
}

/* ============================
   Quest Entry Box (Expanded)
   ============================ */
.quest-entry {
  background: rgba(25, 35, 55, 0.92);
  border: 1px solid #324a6f;
  border-radius: 8px;
  padding: 14px 18px;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
  font-size: 14px;
  line-height: 1.5;
}

.quest-entry:hover {
  background: rgba(50, 80, 120, 0.9);
  border-color: #5da9f1;
  transform: scale(1.02);
}

.quest-title {
  font-weight: bold;
  color: #5da9f1;
  margin-bottom: 6px;
  font-size: 1.05em;
}

.quest-desc {
  font-size: 0.9em;
  color: #ddd;
  line-height: 1.4;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

/* ✅ Step list display */
.quest-steps {
  margin: 6px 0 4px 0;
  padding: 10px 12px;
  color: #ccc;
  font-size: 0.9em;
  line-height: 1.4;
  background: rgba(15, 25, 40, 0.75);
  border-radius: 6px;
}

.quest-step {
  display: block;
  margin-bottom: 8px;
}

.quest-step-status {
  font-size: 0.95em;
  margin-right: 4px;
  color: #8fffa8;
}

.quest-step-title {
  font-weight: 600;
  color: #fff;
}

.quest-step-meta{
  margin-left: auto;
  font-size: 0.85em;
  opacity: 0.9;
  color: #d7e6ff;
}

.quest-badge{
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.12);
  color: #d7e6ff;
  vertical-align: middle;
}

.quest-accept{
  margin-top: 10px;
  padding: 8px 10px;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
}

.quest-accept:hover{
  background: rgba(255,255,255,0.10);
}

.quest-step-desc {
  margin-left: 24px;
  margin-top: 2px;
  color: #b8c9e3;
  font-size: 0.85em;
  line-height: 1.35;
  opacity: 0.9;
  white-space: pre-wrap;
}

/* ✅ Progress + Reward footer */
.quest-status,
.quest-progress,
.quest-reward {
  font-size: 0.85em;
  color: #8fd3ff;
  margin-top: 6px;
  text-align: right;
  opacity: 0.9;
}

/* Locked / Completed styling */
.quest-entry.locked {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.quest-entry.completed {
  border-color: #4caf50;
  background: rgba(40, 60, 40, 0.9);
}

/* ✅ Mini-banner (active quest indicator) */
#quest-minibanner {
  display: none;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 30, 50, 0.92);
  border: 1px solid #5da9f1;
  border-radius: 6px;
  padding: 4px 10px;
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  z-index: 1500;
  text-align: center;
  box-shadow: 0 0 6px rgba(93, 169, 241, 0.5);
}

/* ============================
   Shop Panel (FINAL — CLEAN)
   ============================ */
#shop-panel.panel {
  display: none;
  background: rgba(13, 27, 42, 0.9);
  border: 2px solid #415a77;
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
}

#shop-panel.visible {
  display: flex;
  flex-direction: row;
}

/* ============================
   LEFT SIDE (IMAGE + RINGS + BUY/SELL)
   ============================ */
#shop-panel .shop-left {
  width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  border-right: 2px solid #415a77;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Shopkeeper image */
#shop-panel #shop-keeper {
  width: 240px;
  height: 240px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  margin-bottom: 6px;
}

/* Rings — directly under image */
#shop-ring-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  color: #ffd60a;
  margin: 4px 0 10px 0;
  flex-wrap: wrap;
  flex-shrink: 0;
}

#shop-ring-display .currency {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#shop-ring-display .currency + .currency {
  margin-left: 10px;
}
#shop-ring-display img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

/* BUY / SELL — pinned near bottom, not flush */
.mode-tabs {
  margin-top: auto;
  margin-bottom: 6px; /* ⬅ lifts buttons upward */
  display: flex;
  gap: 8px;
  width: 100%;
}

.mode-tabs .mode-btn {
  flex: 1;
  padding: 10px 0;
  font-size: 18px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: #415a77;
  color: #fff;
}

.mode-tabs .mode-btn.active {
  background: #1b263b;
  outline: 2px solid #ffd60a;
}

/* ============================
   RIGHT SIDE (CONTENT — FULL HEIGHT)
   ============================ */
#shop-panel .shop-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  color: #fff;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
}

/* ============================
   Shop mode containers
   ============================ */
.shop-mode {
  display: none;
  flex: 1;
  min-height: 0;
}

.shop-mode.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ============================
   BUY MODE CATEGORY TABS
   ============================ */
#shop-panel .tabs button {
  flex: 1;
  padding: 8px 0;
  font-size: 15px;
  font-weight: bold;
  background: #415a77;
  border: none;
  border-radius: 8px;
  color: #fff;
}

#shop-panel .tabs button.active {
  background: #1b263b;
  outline: 2px solid #ffd60a;
}

/* ============================
   Scrollable BUY list (FULL HEIGHT)
   ============================ */
#shop-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #0d1b2a;
  border-radius: 8px;
  padding: 6px;
}

#shop-panel .shop-item {
  padding: 8px;
  background: #415a77;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
}

#shop-panel .shop-item img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  object-fit: none;          /* sprite-sheet safe */
  object-position: 0px 0px;
  image-rendering: pixelated;
}

#shop-panel .shop-item.equip img {
  width: 32px;
  height: 32px;

  object-fit: none;          /* ✅ sprite-sheet safe */
  object-position: 0px 0px;  /* ✅ F-facing frame */

  image-rendering: pixelated;
}

/* ============================
   SELL MODE
   ============================ */
#sell-box {
  flex: 1;
  min-height: 0;
  background: #0d1b2a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed #415a77;
}

#sell-dropzone {
  width: 72px;
  height: 72px;
  background: #1b263b;
  border: 2px solid #415a77;
  border-radius: 8px;
  margin-bottom: 10px;
}

#sell-label {
  font-size: 14px;
  color: #a5b3cf;
  margin: 0;
}

#sell-info {
  font-size: 13px;
  color: #ffd60a;
  text-align: center;
  margin-top: 6px;
}

.hidden {
  display: none;
}

/* ============================
   Shop Confirm Panel (UNCHANGED)
   ============================ */
.shop-confirm-header {
  font-size: 18px;
  font-weight: bold;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}

.shop-confirm-body {
  padding: 16px;
  text-align: center;
}

.shop-confirm-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px 0 16px 0;
}

.shop-confirm-buttons .ui-btn {
  background: rgba(0, 180, 216, 0.25);
  border: 1px solid #00b4d8;
  color: #fff;
  border-radius: 6px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.shop-confirm-buttons .ui-btn:hover {
  background: rgba(0, 180, 216, 0.45);
}

/* Stats panel debug toggle */
.stats-debug-toggle {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.25);
  color: #fff;
  cursor: pointer;
}
.stats-debug-toggle:hover {
  background: rgba(0,0,0,0.35);
}



/* ============================================================
   Shop revamp — cart-based buy flow + inventory-sized shell
   ============================================================ */
#shop-panel.panel {
  display: flex;
  flex-direction: column;
}

#shop-panel.hidden {
  display: none !important;
}

#shop-panel > .panel-body.shop-body {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

#shop-panel .shop-left {
  width: 320px;
  min-width: 320px;
  max-width: 320px;
  padding: 12px;
  gap: 10px;
  justify-content: flex-start;
  background: rgba(8, 15, 24, 0.68);
}

#shop-panel #shop-keeper {
  width: 100%;
  max-width: 280px;
  height: 220px;
  margin-bottom: 0;
}

#shop-ring-display {
  width: 100%;
  justify-content: center;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(11, 27, 42, 0.85);
  box-sizing: border-box;
}

#shop-panel .shop-right {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  gap: 10px;
}

#shop-panel .mode-tabs {
  margin: 0;
  width: 100%;
  flex: 0 0 auto;
}

#shop-panel .mode-tabs .mode-btn {
  cursor: pointer;
}

#shop-panel .shop-mode.active {
  gap: 10px;
}


#shop-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  align-content: start;
}

#shop-panel .shop-item {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.08s ease;
}

#shop-panel .shop-item:hover {
  background: #4f7398;
}

#shop-panel .shop-item.in-cart {
  background: #1f3449;
  border-color: #ffd60a;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.45);
  transform: translateY(2px);
}

#shop-panel .shop-item:active {
  transform: translateY(2px);
}

#shop-panel .shop-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
}

#shop-panel .shop-item-name {
  font-weight: 700;
}

#shop-panel .shop-item-price {
  font-size: 13px;
  color: #ffd60a;
}

#shop-panel .shop-item-qty {
  flex: 0 0 auto;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 214, 10, 0.2);
  color: #ffe98c;
  font-weight: 700;
  text-align: center;
}

#shop-cart {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 10px;
  border: 2px solid rgba(65, 90, 119, 0.9);
  border-radius: 10px;
  background: rgba(13, 27, 42, 0.92);
  box-sizing: border-box;
}

.shop-cart-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  text-align: center;
}

.shop-cart-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.shop-cart-empty {
  color: #a9bdd6;
  font-size: 14px;
  text-align: center;
  padding: 20px 8px;
}

.shop-cart-item {
  display: grid;
  grid-template-columns: auto 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: rgba(27, 38, 59, 0.95);
}

.shop-cart-remove {
  border: none;
  border-radius: 6px;
  background: rgba(160, 38, 38, 0.95);
  color: #fff;
  padding: 6px 8px;
  cursor: pointer;
  font-weight: 700;
}

.shop-cart-remove:hover {
  background: rgba(188, 48, 48, 0.98);
}

.shop-cart-sprite {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  object-fit: none;
  object-position: 0 0;
}

.shop-cart-item-info {
  min-width: 0;
}

.shop-cart-item-name {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-cart-item-price {
  color: #ffd60a;
  font-size: 13px;
}

.shop-cart-footer {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.shop-cart-total {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

#shop-cart-buy {
  width: 100%;
  min-height: 40px;
  font-size: 16px;
  font-weight: 700;
}

#shop-cart-buy:disabled {
  opacity: 0.45;
  cursor: default;
}

#shop-panel[data-shop-mode="sell"] #shop-cart-buy {
  opacity: 0.45;
}

.shop-confirm-body {
  overflow: auto;
}

.shop-confirm-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.shop-confirm-summary-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.shop-confirm-list {
  margin: 0;
  padding-left: 18px;
  max-height: 180px;
  overflow: auto;
}

.shop-confirm-list li {
  margin-bottom: 6px;
}

.shop-confirm-total {
  text-align: center;
}


/* ============================================================
   Display pass patch51 — Options/Button List owner migration
   Purpose: finish the last active customizer spill previously living
   in 99-legacy-overrides-b.css so this family fully owns its chrome.
   ============================================================ */

/* Options + Button List — cleaner control surfaces */
#ui-options-panel > .panel-body.ui-options-body,
#ui-button-list-panel > .panel-body.ui-button-list-body {
  padding: 14px !important;
  gap: 14px !important;
}

#ui-button-list-panel .ui-button-list-view-tabs,
#ui-button-list-panel .ui-button-list-cat-tabs {
  gap: 10px;
}

#ui-options-panel .ui-options-body,
#ui-options-panel > .panel-body.ui-options-body {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: 100% !important;
  max-height: none !important;
  overflow: hidden !important;
  padding: 14px !important;
  box-sizing: border-box !important;
  gap: 14px !important;
}

#ui-options-panel .ui-options-tabpage {
  display: none !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

#ui-options-panel .ui-options-tabpage.active {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: auto !important;
  overflow-x: hidden !important;
  padding: 4px 6px 0 2px !important;
  box-sizing: border-box !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable !important;
}

#ui-options-panel .ui-options-tab,
#ui-button-list-panel .ui-button-list-view-tab,
#ui-button-list-panel .ui-button-list-cat-tab,
#ui-button-list-panel .ui-button-card-toggle,
#ui-options-panel .ui-options-actions button,
#ui-options-panel .ui-add-target-btn,
#ui-button-list-panel .ui-button-list-top-actions button,
#ui-button-list-panel button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(117, 156, 198, 0.26);
  background: linear-gradient(180deg, rgba(35, 50, 72, 0.94), rgba(17, 26, 40, 0.96));
  color: #dceafb;
}

#ui-options-panel .ui-options-tab {
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

#ui-options-panel .ui-options-tab.active,
#ui-button-list-panel .ui-button-list-view-tab.active,
#ui-button-list-panel .ui-button-list-cat-tab.active {
  background: linear-gradient(180deg, rgba(70, 107, 150, 0.94), rgba(29, 49, 74, 0.96));
  border-color: rgba(160, 205, 250, 0.7);
  color: #fff;
  box-shadow: 0 8px 18px rgba(41, 75, 112, 0.26), inset 0 1px 0 rgba(255,255,255,0.1);
}

.ui-options-actions,
.ui-toolbar-actions,
.ui-custom-hub-actions,
#ui-button-list-panel .ui-button-list-topbar {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(111, 151, 194, 0.22);
  background: linear-gradient(180deg, rgba(18, 28, 43, 0.94), rgba(11, 17, 28, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.ui-options-actions button,
.ui-add-target-btn,
#ui-button-list-panel .ui-button-list-top-actions button,
#ui-button-list-panel .ui-button-card-toggle {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.45);
  color: #fff;
  padding: 8px 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.ui-options-actions button:hover,
.ui-add-target-btn:hover,
#ui-button-list-panel .ui-button-list-top-actions button:hover,
#ui-button-list-panel .ui-button-card-toggle:hover {
  filter: none;
  transform: translateY(-1px);
  border-color: rgba(165, 206, 247, 0.52);
}

#ui-button-list-panel .ui-button-list-grid {
  padding: 4px 2px 110px;
}

.ui-custom-hub-row,
#ui-button-list-panel .ui-button-card,
#ui-button-list-panel .ui-button-row,
#ui-options-panel .ui-audio-row,
#ui-options-panel .ui-keybinds-section {
  border-radius: 14px;
  border: 1px solid rgba(112, 150, 192, 0.18);
  background: linear-gradient(180deg, rgba(21, 31, 47, 0.92), rgba(11, 18, 29, 0.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

#ui-options-panel .ui-audio-row,
#ui-options-panel .ui-keybinds-section {
  padding: 12px 14px;
}

#ui-options-panel .ui-audio-row {
  display: grid;
  grid-template-columns: 150px 1fr 80px;
  gap: 12px;
  align-items: center;
}


/* pass12: customizer action-row/layout ownership migrated from 07-management-panels-c.css */
.ui-options-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.ui-options-actions button,
.ui-add-target-btn {
  border-radius: 8px;
  cursor: pointer;
}

.ui-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}

.ui-custom-hub-actions {
  margin: 0 0 10px;
}

.ui-custom-hub-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
}
