:root {
  color-scheme: light dark;
  --bg: #0f1115;
  --card: #171a21;
  --text: #e8eaed;
  --muted: #9aa0a6;
  --accent: #6c8cff;
  --danger: #ff6b6b;
  --border: #2a2e37;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.card.wide { max-width: 520px; }

h1 {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

p.lead {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 0.92rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 14px 0 6px;
}

input[type=text], input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #10131a;
  color: var(--text);
  font-size: 1rem;
}

input:focus { outline: 2px solid var(--accent); }

button {
  width: 100%;
  margin-top: 22px;
  padding: 11px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #0b0d12;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

button:hover { opacity: 0.92; }

.error {
  background: rgba(255,107,107,0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.notice {
  background: rgba(108,140,255,0.1);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.qr-wrap { text-align: center; margin: 18px 0; }
.qr-wrap img { background: #fff; padding: 10px; border-radius: 8px; }

.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #10131a;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  word-break: break-all;
  font-size: 0.85rem;
  text-align: center;
}

.backup-codes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #10131a;
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 8px;
  margin: 14px 0;
}

.muted { color: var(--muted); font-size: 0.85rem; }

.top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

a { color: var(--accent); }

/* ==========================================================================
   App shell — appended for the asset-management build.
   Everything below is either scoped under body.app-shell or uses new class
   names that never appear in the login flow, so pages WITHOUT .app-shell
   (login / 2FA / password screens) render pixel-identical to before.
   ========================================================================== */

:root {
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --bg-input: #10131a;
  --ok: #57d9a3;
  --tint-player: #6c8cff;
  --tint-npc: #57d9a3;
  --tint-enemy: #ff6b6b;
  --tint-monster: #c58cff;
}

/* --- Shell layout ------------------------------------------------------- */

body.app-shell {
  display: block;
  padding: 0;
}

/* Restore normal control sizing inside the shell (login flow uses full-width
   buttons; the app does not). */
.app-shell button {
  width: auto;
  margin-top: 0;
}

.app-shell .topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  margin-left: var(--sidebar-w);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.app-shell .topbar-title {
  font-size: 1.05rem;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-shell .nav-toggle {
  /* Visible at every width now: below 900px it opens the off-canvas drawer,
     above it collapses the fixed rail. It used to be display:none on desktop,
     which left no way to reclaim the 240px. */
  display: inline-flex;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.user-chip-name {
  color: var(--muted);
  font-size: 0.85rem;
}

.signout-form { margin: 0; }

.app-shell .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  flex: none;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  padding: 10px;
}

.nav-section {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  padding: 14px 10px 4px;
}

.app-shell .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.app-shell .nav-item:hover { background: rgba(108, 140, 255, 0.08); }

.app-shell .nav-item.active {
  background: rgba(108, 140, 255, 0.16);
  color: var(--accent);
}

.nav-icon { flex: none; }

.sidebar-footer {
  flex: none;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}

.app-shell .app-main {
  margin-left: var(--sidebar-w);
  padding: 24px;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
}

.nav-overlay[hidden] { display: none; }

/* --- Components --------------------------------------------------------- */

.flash { margin-bottom: 16px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel > h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(154, 160, 166, 0.1);
}

.badge-player  { color: var(--tint-player);  border-color: var(--tint-player);  background: rgba(108, 140, 255, 0.12); }
.badge-npc     { color: var(--tint-npc);     border-color: var(--tint-npc);     background: rgba(87, 217, 163, 0.12); }
.badge-enemy   { color: var(--tint-enemy);   border-color: var(--tint-enemy);   background: rgba(255, 107, 107, 0.12); }
.badge-monster { color: var(--tint-monster); border-color: var(--tint-monster); background: rgba(197, 140, 255, 0.12); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text);
}

.chip a { text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #0b0d12;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover { opacity: 0.92; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}

.btn-ghost:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  opacity: 1;
  background: rgba(255, 107, 107, 0.12);
}

.app-shell select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.95rem;
}

.app-shell textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

.app-shell select:focus,
.app-shell textarea:focus { outline: 2px solid var(--accent); }

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.slot-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.slot-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.slot-empty {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 140px;
}

.drawer {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 10px;
  background: var(--bg-input);
}

.drawer > summary {
  cursor: pointer;
  padding: 9px 12px;
  font-size: 0.85rem;
  color: var(--muted);
  border-radius: 8px;
}

.drawer > summary:hover { color: var(--text); }

.drawer[open] > summary {
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}

.drawer-body { padding: 12px; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 18px;
}

.tabs a {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs a:hover { color: var(--text); }

.tabs a.active {
  color: var(--accent);
  background: var(--card);
  border-color: var(--border);
  margin-bottom: -1px;
}

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table th,
.table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.filter-bar label { margin: 0 0 4px; }

.filter-bar input[type=text],
.filter-bar select {
  width: auto;
  min-width: 160px;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.quick-link {
  display: block;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
}

.quick-link:hover { border-color: var(--accent); }

.quick-link strong {
  display: block;
  color: var(--accent);
  margin-bottom: 6px;
}

.quick-link span {
  font-size: 0.85rem;
  color: var(--muted);
}

/* --- Upload widget ------------------------------------------------------ */

.uploader { margin: 0; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.dropzone:focus-visible { outline: 2px solid var(--accent); }

.dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 140, 255, 0.08);
}

.dropzone-hint {
  font-size: 0.92rem;
  font-weight: 600;
}

.dropzone-sub { font-size: 0.8rem; }

.uploader-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

/* Camera button is a JS-only enhancement; uploader.js reveals it. */
.btn-camera { display: none; }
.btn-camera.js-show { display: inline-flex; }

.uploader-progress {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.app-shell progress {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}

.app-shell progress::-webkit-progress-bar {
  background: var(--bg-input);
  border-radius: 999px;
}

.app-shell progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.app-shell progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

.uploader-msg {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 8px 0 0;
  min-height: 1.2em;
}

.uploader-msg.is-error { color: var(--danger); }
.uploader-msg.is-ok { color: var(--ok); }

/* --- Motion (respects prefers-reduced-motion) --------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .app-shell .sidebar { transition: transform 180ms ease; }
  .btn,
  .app-shell .nav-item,
  .dropzone,
  .quick-link {
    transition: background-color 150ms ease, border-color 150ms ease,
                color 150ms ease, opacity 150ms ease;
  }
}

/* --- Off-canvas drawer below 900px -------------------------------------- */

@media (max-width: 899px) {
  .app-shell .topbar { margin-left: 0; }
  .app-shell .app-main {
    margin-left: 0;
    padding: 16px;
  }
  .app-shell .nav-toggle { display: inline-flex; }
  .app-shell .sidebar {
    transform: translateX(-100%);
    z-index: 60;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  }
  body.app-shell.nav-open .sidebar { transform: translateX(0); }
}

/* --- Phone refinements (<600px): 48px touch targets, stacked filters ----- */

@media (max-width: 599px) {
  .asset-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }
  .app-shell .btn,
  .app-shell button,
  .app-shell .nav-item,
  .tabs a {
    min-height: 48px;
  }
  .app-shell .nav-toggle {
    width: 48px;
    height: 48px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar input[type=text],
  .filter-bar select { width: 100%; }
  .user-chip-name { display: none; }
  .app-shell .app-main { padding: 12px; }
}

/* ==========================================================================
   Notifications — sidebar unread pill + topbar bell and dropdown.
   Appended for the messaging build. Everything here is scoped under
   body.app-shell or uses new .notify-* / .nav-badge class names that never
   appear in the login flow, so pages WITHOUT .app-shell (login / 2FA /
   password screens) are untouched.
   ========================================================================== */

/* --- Sidebar unread pill ------------------------------------------------ */

/* Always emitted as a hook for notifications.js; empty means zero, so it
   collapses out of the layout entirely rather than rendering a bare dot. */
.app-shell .nav-badge {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #0b0d12;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.app-shell .nav-badge:empty { display: none; }

/* --- Topbar bell -------------------------------------------------------- */

.app-shell .notify {
  position: relative;
  flex: none;
}

.app-shell .notify-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.app-shell .notify-bell:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

.app-shell .notify-bell:focus-visible { outline: 2px solid var(--accent); }

.app-shell .notify-bell[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.app-shell .notify-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  border: 2px solid var(--card);
  color: #0b0d12;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.app-shell .notify-count:empty { display: none; }

/* --- Dropdown panel ----------------------------------------------------- */

.app-shell .notify-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: 420px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.app-shell .notify-panel[hidden] { display: none; }

.app-shell .notify-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.app-shell .notify-head-title {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
}

.app-shell .notify-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* Compact variant of .btn-ghost for the panel chrome. */
.app-shell .notify-mini {
  padding: 4px 9px;
  font-size: 0.76rem;
  min-height: 0;
  line-height: 1.4;
}

.app-shell .notify-mini[hidden] { display: none; }

.app-shell .notify-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.app-shell .notify-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
}

.app-shell .notify-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  color: var(--text);
  text-decoration: none;
}

.app-shell .notify-row:last-child { border-bottom: none; }

.app-shell .notify-row:hover { background: rgba(108, 140, 255, 0.08); }

.app-shell .notify-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.app-shell .notify-row.is-unread {
  border-left-color: var(--accent);
  background: rgba(108, 140, 255, 0.07);
}

.app-shell .notify-row.is-unread:hover { background: rgba(108, 140, 255, 0.13); }

.app-shell .notify-row-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--muted);
}

.app-shell .notify-row.is-unread .notify-row-icon { color: var(--accent); }

.app-shell .notify-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-shell .notify-row-title {
  font-size: 0.86rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell .notify-row-count {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(108, 140, 255, 0.18);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.app-shell .notify-row-body {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.app-shell .notify-row-time {
  flex: none;
  font-size: 0.72rem;
  white-space: nowrap;
  padding-top: 1px;
  font-variant-numeric: tabular-nums;
}

.app-shell .notify-foot {
  flex: none;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

/* The footer only ever holds the desktop-alerts opt-in, which JS reveals;
   with nothing to show it must not leave a stray 1px rule, so it ships
   hidden and notifications.js unhides it alongside the button. */
.app-shell .notify-foot[hidden] { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .app-shell .notify-bell,
  .app-shell .notify-row {
    transition: background-color 150ms ease, border-color 150ms ease,
                color 150ms ease;
  }
}

/* --- Phone: full-width panel, roomier bell ------------------------------ */

@media (max-width: 599px) {
  .app-shell .notify-bell {
    width: 48px;
    height: 48px;
  }
  /* Anchor to the viewport instead of the bell so a 340px panel cannot push
     the topbar sideways on a narrow screen. */
  .app-shell .notify-panel {
    position: fixed;
    top: calc(var(--topbar-h) + 6px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - var(--topbar-h) - 20px);
  }
  /* Undo the global 48px touch-target floor for the panel's chrome buttons. */
  .app-shell .notify-mini { min-height: 34px; }
}

/* =====================================================================
   Leonardo low-resolution upscale: the offer panel, the API-key setup
   explainer, and the LOW RES marker on historical versions.
   ===================================================================== */

/* The inline offer under an upload widget (uploader.js reveals it when the
   server answers upscale_offer or upscale_setup). Bordered in the accent
   colour rather than red: it is a choice being offered, not an error. */
.uploader-upscale {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(108, 140, 255, 0.08);
}

.uploader-upscale-msg {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.uploader-upscale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* The setup link is an <a>, so it needs the .btn line-height/decoration that
   a <button> gets for free. */
a.uploader-upscale-setup {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* -------- LOW RES marker on a historical version -------------------- */

/* Dave asked for a red border on the low-resolution original that the
   upscale demoted to history. COLOUR IS NEVER THE ONLY SIGNAL: every call
   site pairs this with the .badge-lowres pill and a title/aria-label from
   Lib\LowRes::describe(), so the meaning survives greyscale, colour
   blindness and screen readers. */
.ver-lowres {
  border: 2px solid var(--danger) !important;
  border-radius: 6px;
  /* Faint halo so the border reads even against a red-ish thumbnail. */
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.35);
}

.badge-lowres {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.12);
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* -------- api_keys.php setup deep-link + explainer ------------------ */

/* Arrived from the upload offer (?setup=1): make it obvious which panel the
   user was sent to. */
.panel-setup {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(108, 140, 255, 0.25);
}

.setup-lead {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text);
}

.explain-leonardo {
  margin: 0 0 18px;
  max-width: 640px;
}

.explain-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.explain-steps li { margin-bottom: 8px; }
.explain-steps code {
  background: #10131a;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* --- Collapsible sidebar on desktop -------------------------------------
 * Below 900px the hamburger opens the sidebar as an off-canvas drawer (see the
 * media block above). At desktop widths it now collapses the fixed 240px rail
 * instead, which is what gives a full-width embedded view — Story Studio and
 * its map — the room it needs.
 *
 * The collapsed state is rendered server-side from the lcg_nav cookie (see
 * partials/app_header.php) rather than applied by JavaScript on load. With a
 * class toggled after paint, the rail would flash into view and then jump away
 * on every single page load.
 */
@media (min-width: 900px) {
  body.app-shell.nav-collapsed .sidebar {
    transform: translateX(-100%);
  }

  body.app-shell.nav-collapsed .topbar,
  body.app-shell.nav-collapsed .app-main {
    margin-left: 0;
  }
}

@media (min-width: 900px) and (prefers-reduced-motion: no-preference) {
  .app-shell .topbar,
  .app-shell .app-main {
    transition: margin-left 180ms ease;
  }
}
