/* === Loot button & progress === */

/* Center loot button */
#loot-button {
  position: fixed;
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: monospace;
  font-size: 1.5rem;

  padding: 10px 18px;
  background: #171a21;
  color: #e0e4e8;
  border: 1px solid #2a2f3a;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0.35), inset 0 0 0 1px rgba(255,255,255,0.02);
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease, border-color .15s ease;
}

#loot-button:hover {
  background: #1c2430;
  border-color: #3a4150;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,0.03);
}

#loot-button:active {
  transform: translate(-50%, -50%) translateY(1px);
  background: #202a36;
}

#loot-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.35), 0 8px 24px rgba(0,0,0,.45);
  border-color: #3b82f6;
}

/* Shared small buttons (trash / equip) */
.trash-btn,
.equip-btn {
  background: transparent;
  color: #a8b3c2;
  border: 1px solid #2a2f3a;
  border-radius: 8px;
  padding: 2px 8px;
  margin-left: 6px;
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.trash-btn:hover,
.equip-btn:hover {
  background: #1b2230;
  color: #e0e4e8;
  border-color: #3a4150;
}

.trash-btn:active,
.equip-btn:active {
  background: #202a36;
}

/* Progress bar under the loot button */
#progress-container {
  position: fixed;
  top: calc(70% + 50px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 10px;
  background: #222;
  display: none;
  border-radius: 5px;
}

#progress {
  height: 100%;
  width: 0%;
  background: #63f;
  border-radius: 5px;
  transition: width 0.1s linear;
}

/* === HP bar near bottom center === */
#hp-bar-container {
  position: fixed;
  bottom: 40px;           /* above the bottom header */
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  display: none;
  font-size: 0.8rem;
  text-align: left;
}

#hp-bar-label {
  margin-bottom: 2px;
  opacity: 0.9;
}

#hp-bar {
  width: 100%;
  height: 10px;
  background: #222;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #333;
}

#hp-bar-fill {
  height: 100%;
  width: 0%;
  background: #22c55e;
  border-radius: 5px;
  transition: width 0.15s linear;
}

/* === Inventory panel === */
#inventory-panel {
  position: fixed;
  top: 70px;   /* <-- pushed down */
  left: 10px;
  display: none;
  background: #111;
  border: 1px solid #555;
  padding: 10px;
  border-radius: 8px;

  /* Resizable width */
  width: 500px;
  min-width: 360px;
  max-width: 70vw;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;    /* columns should always fit */
  resize: none;          /* no manual horizontal resize needed now */
}

/* Panels: draggable header area */
.draggable-handle {
  cursor: move;
  margin-top: 1px;
  user-select: none; /* avoid selecting text while dragging */
}

/* === Equipment panel sits to the right of the inventory panel === */
#equipment-panel {
  position: fixed;
  top: 70px;
  left: 535px; /* 10px left + 500px inventory width + 20px gap */
  display: none;
  background: #111;
  border: 1px solid #555;
  padding: 10px;
  border-radius: 8px;
  width: 350px;
  max-height: 70vh;
  overflow: auto;
}

#equipment-panel h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.equipment-slot-row {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.equipment-slot-label {
  width: 100px;
  font-weight: bold;
  color: #cbd5f5;
}

.equipment-slot-item {
  flex: 1;
}

.equipment-slot-empty {
  flex: 1;
  font-style: italic;
  color: #6b7280;
}

.equipment-summary-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #333;
  font-size: 0.85rem;
}

.equipment-summary-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #d1d5db;
}

.equipment-summary-row {
  display: flex;
  justify-content: flex-start;
  column-gap: 16px;   /* space between label and values */
}

.equipment-summary-row span:first-child {
  width: 100px;
}

.equipped-label {
  color: #4ade80;
  font-size: 0.75rem;
}

/* Inventory stacks + variants */
.inventory-stack summary {
  cursor: pointer;
}

.inventory-stack { margin: 4px 0; }
.inventory-stack > summary { cursor: pointer; }
.stack-variants { margin-left: 12px; padding-left: 8px; border-left: 1px solid #555; }

.meta {
  opacity: 0.8;
  font-size: 0.8rem;
}

/* === Skills panel – fixed on the right side === */
#skills-panel {
  position: fixed;
  top: 70px;

  /* Pop from the left (stacked with other panels) */
  left: 10px;
  right: auto;

  display: none;
  background: #111;
  border: 1px solid #555;
  padding: 10px;
  border-radius: 8px;

  width: 320px;
  max-height: 70vh;
  overflow: auto;
  z-index: 1000;
}

#skills-panel h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1rem;
}

#skills-list {
  display: flex;
  flex-direction: column;
  row-gap: 4px;
}

/* === Rarity colors (accessible on dark bg) === */
.rarity { font-weight: 600; }
.r-abundant { color: #9aa5b1; }   /* gray */
.r-common   { color: #e0e4e8; }   /* light */
.r-uncommon { color: #22c55e; }   /* green */
.r-rare     { color: #3b82f6; }   /* blue */
.r-exotic   { color: #a855f7; }   /* purple */
.r-unique   { color: #FFDF00; }   /* yellow */

/* Optional: subtle hover hint (keeps text-only style) */
.inventory-stack > summary:hover { text-decoration: underline; }

.inventory-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9aa5b1;
  opacity: 0.9;
}

.inventory-category-header::before,
.inventory-category-header::after {
  content: "";
  flex: 1;
  height: 2px;
}

/* Left line */
.inventory-category-header::before {
  background: linear-gradient(to left, transparent, #6b7280);
}

/* Right line */
.inventory-category-header::after {
  background: linear-gradient(to right, transparent, #6b7280);
}

.inventory-category-header {
  cursor: pointer;
}

/* Sort bar above inventory list */
.inventory-sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #9aa5b1;
}

.inventory-sort-bar > span:first-child {
  opacity: 0.9;
}

.inventory-sort-bar .sort-btn {
  background: transparent;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
  color: #a8b3c2;
  font-size: 0.75rem;
}

.inventory-sort-bar .sort-btn.active {
  color: #e0e4e8;
  text-decoration: underline;
}

.inventory-toolbar button {
  background: #1f2430;
  border: 1px solid #313844;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.75rem;
  color: #d0d7e2;
}

.inventory-toolbar button:hover {
  background: #262c3a;
}

/* Make summary rows column-ish */
.inventory-stack > summary {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.inventory-stack > summary .inv-name {
  flex: 1;
}

/* In the All Items flat view, let the grid control the Qty width */
.inventory-stack.inventory-stack-flat > summary .inv-qty {
  width: auto !important;
  text-align: left;
}

.inventory-stack > summary .inv-qty {
  width: 40px;
  text-align: left;
}

.inventory-stack > summary .inv-qrange {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Category tag used in the All Items flat view */
.inventory-stack > summary .inv-category-tag {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-left: 4px;
}

/* Expanded inventory rows: left text + right actions */
.inventory-stack .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

/* Left side text */
.inventory-stack .meta-left {
  display: inline-block;
}

/* Right side buttons */
.inventory-stack .inv-actions {
  display: inline-flex;
  gap: 4px;         /* space between Trash and Equip */
}

/* === Inventory: All Items flat list === */

/* Header row (Item Name | Category | Rarity | Qty | Grades) */
.inventory-flat-header {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr 0.7fr 1.1fr;
  column-gap: 8px;
  padding: 4px 0;
  margin-bottom: 4px;
  font-size: 0.75rem;
  border-bottom: 1px solid #333;
}

.inventory-flat-header .flat-header-cell {
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #d0d7e2;
}

/* === Column separators for All Items flat view === */

/* Header cells */
.inventory-flat-header .flat-header-cell {
  position: relative;
  border-right: 1px solid #3c3c3c; /* thin gray vertical line */
  padding-right: 6px;
}

/* Row cells inside <summary> */
.inventory-stack-flat > summary span {
  display: block;
  border-right: 1px solid #3c3c3c;
  padding-right: 6px;
  text-align: left;
}

.inventory-flat-header .flat-header-cell.active {
  text-decoration: underline;
}

/* Small drag zone on the right edge of header cells */
.inventory-flat-header .col-resize-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -3px; /* tiny overlap so it's easy to grab */
  width: 6px;
  cursor: col-resize;
}

/* Flat rows are also grids; JS sets their grid-template-columns */
.inventory-stack-flat > summary {
  display: grid;
  column-gap: 8px;
  align-items: baseline;
}

.inventory-stack-flat > summary span {
  text-align: left;
}

/* Allow horizontal scrolling if it gets wide */
#inventory-panel {
  overflow-x: auto;
}

/* Make the flat view rows line up with the header */
.inventory-stack-flat > summary {
  display: grid;
  grid-template-columns: 2fr 1.3fr 1fr 0.7fr 1.1fr;
  column-gap: 8px;
  align-items: baseline;
}

.inventory-stack-flat > summary span {
  text-align: left;
}

/* Category + rarity text columns in flat view */
.inventory-stack > summary .inv-category-tag {
  font-size: 0.7rem;
  opacity: 0.85;
}

.inventory-stack > summary .inv-rarity {
  font-size: 0.75rem;
  opacity: 0.9;
}

/* === Unlock attention effect for menu buttons === */
.inventory-unlock {
  position: relative;
  animation: invGlow 2.8s ease-out 0s 1;
  text-shadow: 0 0 0.35rem rgba(246,244,110, 0.9);
}

@keyframes invGlow {
  0%   { text-shadow: 0 0 0rem rgba(246,244,110,0.0); transform: translateY(0); }
  25%  { text-shadow: 0 0 0.6rem rgba(246,244,110,0.95); transform: translateY(-5px); }
  60%  { text-shadow: 0 0 0.25rem rgba(246,244,110,0.65); transform: translateY(0); }
  100% { text-shadow: 0 0 0rem rgba(246,244,110,0.0); }
}

/* A subtle expanding ring behind the text */
.inventory-unlock::after {
  content: "";
  position: absolute;
  inset: -6px -10px;
  border: 3px solid rgba(246,244,110,0.8);
  border-radius: 12px;
  pointer-events: none;
  animation: invPing 2.8s ease-out 0s 1;
}

@keyframes invPing {
  0%   { opacity: 0; transform: scale(0.85); }
  20%  { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* === Zone main panel === */
#zone-panel,
#worldmap-panel {
  margin: 0 auto 10px auto;
  max-width: 850px;
  background: #111;
  border: 1px solid #555;
  padding: 8px 12px;
  border-radius: 8px;
  color: #ddd;
}

#zone-panel h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

/* Main layout: left column + right sidebar */
#zone-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* LEFT MAIN COLUMN */
#zone-main-column {
  flex: 1 1 auto;
}

/* RIGHT DISCOVERIES COLUMN */
#zone-discoveries-column {
  flex: 0 0 240px;
  border-left: 1px solid #333;
  padding-left: 14px;
  min-height: 100%;
}

#zone-discoveries-column .zone-section-title {
  margin-bottom: 6px;
}

/* === Section styling === */
.zone-section {
  margin-bottom: 18px;
}

.zone-section-title {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 4px;
  border-bottom: 1px solid #333;
  padding-bottom: 2px;
}

/* === Controls (buttons) === */
#zone-actions button {
  margin-right: 8px;
  margin-bottom: 0px;
  padding: 4px 8px;
  font-size: 0.80rem;
  background: #222;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
}

#zone-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === Map Grid === */
#zone-grid-container {
  text-align: center;
}

.zone-grid-view {
  display: inline-block;
  font-family: "Fira Code", "Consolas", monospace;
  font-size: 1.2rem;           /* emoji are smaller, slightly increase size */
  line-height: 0.9;
  background: #000;
  border: 1px solid #333;
  padding: 8px;
  border-radius: 4px;
  max-height: 348px;
  overflow: auto;
  text-align: left;
  white-space: pre;          /* keeps perfect grid alignment */
}

/* Zone grid cells (spans). */
.zone-cell {
  display: inline-block;
  width: 1ch;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

/* Content markers (Phase 6). */
.zone-cell-content {
  font-weight: 600;
}

/* “Done” states (opened/depleted/defeated/discovered) — keep subtle. */
.zone-cell-content-done {
  opacity: 0.55;
}

/* === Messages === */
#zone-messages-list {
  list-style-type: disc;
  padding-left: 18px;
  max-height: 110px;
  overflow-y: auto;
}

#zone-messages-list li {
  margin-bottom: 3px;
  font-size: 0.8rem;
}

/* === Discoveries === */
#zone-discoveries-list {
  list-style: none;
  padding-left: 0;
  max-height: 500px;
  overflow-y: auto;
}

#zone-discoveries-list li.zone-discovery-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;

  cursor: pointer;
  user-select: none;
}

#zone-discoveries-list li.zone-discovery-entry:hover {
  text-decoration: underline;
}

#zone-discoveries-list li.zone-discovery-entry:active {
  opacity: 0.8;
}

.zone-discovery-glyph {
  width: 1.2em;
  display: inline-block;
  text-align: center;
  font-weight: 600;
}

.zone-discovery-text {
  flex: 1 1 auto;
}

.zone-discoveries-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px 0;
}

.zone-discoveries-sort-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

/* === Finish Zone Buttons === */
#zone-finish-menu button {
  font-size: 0.85rem;
  margin-right: 10px;
  padding: 4px 8px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
  border-radius: 4px;
}

.worldmap-tile-info {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #444;
  border-radius: 4px;
  background-color: rgba(0, 0, 0, 0.6);
  font-size: 0.9rem;
}

.worldmap-tile-info h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.worldmap-tile-info.hidden {
  display: none;
}

/* -------------------------------------------------------------------------
   Phase 9 — Modal overlay (content interactions)
   ------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
}

.modal-panel {
  width: min(340px, 92vw);
  max-height: 75vh;
  overflow: auto;
  /* Full-opacity window to match other panels */
  background: #202020;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  padding: 10px 12px;
}

.modal-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-body {
  margin: 0.5rem 0 0.75rem 0;
  color: #cfd6dd;
  line-height: 1.35;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  font-size: 0.85rem;
}

#worldmap-enter-zone-button {
  margin-top: 8px;
  padding: 4px 10px;
  cursor: pointer;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: inherit;
  font-size: 0.85rem;
}

/* === Zone exploration: blinking tile === */
.zone-cell-exploring {
  animation: zoneExploringBlink 0.6s infinite;
  font-weight: bold;
}

/* === Zone exploration: blinking "about to be explored" tile === */
.zone-cell-exploring {
  animation: zoneExploringBlink 0.6s infinite;
  font-weight: bold;
}

@keyframes zoneExploringBlink {
  0%   { color: #ffffff; }
  50%  { color: #000000; }
  100% { color: #ffffff; }
}

/* -------------------------------------------------------------------------
   QoL — Locked Gate lockpick UI
   ------------------------------------------------------------------------- */

.lockpick-ui {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.lockpick-ui .lockpick-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  opacity: 0.95;
}

.lockpick-ui input[type="range"] {
  width: 100%;
}

/* -------------------------------------------------------------------------
   Phase D — Top menu bar (menus only, left-aligned)
   ------------------------------------------------------------------------- */

#top-bar {
  /* Keep it tight and centered like zone/world panels */
  margin: 8px auto 10px auto;
  max-width: 850px;

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

  background: #111;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 6px 10px;
}

/* Menu buttons container */
#menu-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Make these buttons match your zone button sizing */
#menu-bar button {
  padding: 4px 10px;
  font-size: 0.85rem;
  background: #222;
  border: 1px solid #444;
  color: #eee;
  border-radius: 6px;
  cursor: pointer;
}

#menu-bar button:hover {
  background: #262626;
}


