/* Quartermaster "how slots work" dialog — mirrors item-dialog base modal behavior
   (centered on desktop, bottom-sheet on mobile), with its own slot-grid content.

   NB: the trigger button (.slot-guide-btn) is styled INLINE in quartermaster.html,
   not here — so it paints correctly on first load before this file arrives. This
   stylesheet only styles the dialog, which opens on click after CSS has loaded. */

/* ── backdrop + panel (same feel as #item-dialog-backdrop) ── */
#slot-guide-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 12, 22, .75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
  will-change: opacity;
}
#slot-guide-backdrop.is-open { opacity: 1; pointer-events: auto; }

#slot-guide {
  position: relative;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px); /* stays the same when the phone's address bar moves */
  overflow-y: auto;                /* overlay scrollbar → no corner squaring, no width taken */
  overscroll-behavior: contain;
  padding: 20px 20px 22px;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition: transform .2s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
#slot-guide-backdrop.is-open #slot-guide { transform: none; opacity: 1; }

#slot-guide-close {
  position: relative;
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-body);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  z-index: 2;
}
#slot-guide-close:hover { border-color: var(--accent); color: var(--text-hi); }
#slot-guide-close svg { width: 16px; height: 16px; }

/* ── header: title + close, sticky so the close button stays reachable while
   scrolling; negative margins cancel the panel padding so it spans edge to edge */
.sg-header {
  /* sticky offsets are measured inside the panel padding — negative top pins it
     flush to the panel edge (equal to the padding) */
  position: sticky; top: -20px; z-index: 3;
  margin: -20px -20px 0;
  padding: 16px 20px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-lo);
}
.sg-handle { display: none; }   /* mobile drag-handle pill */
.sg-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sg-title {
  margin: 0;
  font-size: 17px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-hi); line-height: 1.3;
}


/* ── content ──────────────────────────────────────────────────────────────
   Visual hierarchy (what to read, in order):
     L0 title           — bright, largest
     L1 group titles    — accent-blue, the two section anchors
     L2 slot labels     — bright/legible, the actual content you scan
     L3 meta (intro,
        sub, eg-note)   — clearly MUTED, so it recedes and stops competing      */
/* intro is the lead description now (dialog title removed) — bright & important.
   right margin clears the absolutely-positioned close button. */
.sg-intro { font-size: 14px; color: var(--text-body); line-height: 1.55; margin: 16px 0 0; }

.sg-group { margin-top: 24px; }
/* section header: accent title, muted sub, with a divider to separate the two blocks */
.sg-group-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 8px; margin-bottom: 14px;
  border-bottom: 1px solid var(--border-lo);
}
.sg-group-title {
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-text);
}
.sg-group-sub { font-size: 12px; color: var(--text-lo); }          /* meta → muted */

.sg-eg-note { font-size: 12px; color: var(--text-lo); font-style: italic; margin-top: 20px; }

/* shared icon box */
.sg-icon {
  background: var(--bg-raised);
  border: 1px solid var(--border-lo);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 3px;
}
.sg-icon img { width: 100%; height: 100%; object-fit: contain; }
.sg-icon-placeholder { font-size: 20px; opacity: .5; }
.sg-icon.is-bp { background: url('../images/misc/slot_blueprint.png') center / contain no-repeat var(--bg-raised); }

/* ── DESKTOP: icon + label under each cell ── */
.sg-mobile { display: none; }
.sg-grid { display: grid; gap: 16px 12px; }
.sg-grid-top, .sg-grid-weekly { grid-template-columns: repeat(5, 1fr); }
.sg-slot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; min-width: 0; }
.sg-slot .sg-icon { width: 60px; height: 60px; }
.sg-slot-cat { font-size: 12px; line-height: 1.35; color: var(--text-body); font-weight: 500; }

/* ── MOBILE: real numbered grid + numbered legend below ── */
@media (max-width: 780px) {
  #slot-guide-backdrop { padding: 0; align-items: flex-end; }
  #slot-guide {
    max-width: none; border-radius: 16px 16px 0 0;
    max-height: 92vh; max-height: 92svh; padding: 18px 16px 20px; transform: translateY(100%);
  }
  #slot-guide-backdrop.is-open #slot-guide { transform: none; }
  .sg-intro { font-size: 14px; }
  .sg-group { margin-top: 18px; }
  .sg-group-head { padding-bottom: 7px; margin-bottom: 12px; }

  .sg-desktop { display: none; }
  .sg-mobile  { display: block; }

  /* header: drag-handle pill like the item popup; margins match mobile padding */
  .sg-header { top: -18px; margin: -18px -16px 0; padding: 8px 16px 12px; }
  .sg-handle {
    display: block; width: 36px; height: 4px; margin: 0 auto 10px;
    background: var(--border); border-radius: 2px;
  }
  .sg-title { font-size: 15px; }
  .sg-intro { font-size: 14px; margin-top: 14px; }

  /* the grid: 5 columns, mirrors the in-game shop */
  .sg-numgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .sg-cell { position: relative; aspect-ratio: 1; }
  .sg-cell .sg-icon { width: 100%; height: 100%; padding: 4px; }
  .sg-cell-num {
    position: absolute; top: 2px; left: 3px; z-index: 1;
    font-size: 12px; font-weight: 700; line-height: 1;
    color: var(--text-hi); background: rgba(5,12,22,.7);
    border-radius: 4px; padding: 2px 4px;
  }

  /* legend under the grid: [number] mini-icon label */
  .sg-legend { list-style: none; margin: 12px 0 0; padding: 0; }
  .sg-legend-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
  .sg-legend-row + .sg-legend-row { border-top: 1px solid var(--border-lo); }
  .sg-legend-num {
    flex-shrink: 0; width: 24px; height: 24px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; line-height: 1;
    color: var(--accent-text); background: var(--bg-raised);
    border: 1px solid var(--border); border-radius: 6px;
  }
  .sg-legend-icon { width: 32px; height: 32px; flex-shrink: 0; padding: 2px; border-radius: 6px; }
  .sg-legend-label { font-size: 14px; line-height: 1.35; color: var(--text-hi); min-width: 0; }
}

/* ── MOBILE READABILITY (≤780px) ── */
@media (max-width: 780px) {
  #slot-guide-close { width: 44px; height: 44px; }
  .sg-eg-note,
  .sg-group-sub     { font-size: 13px; }
}
