/* ============================================================================
   COLD CARGO — shell chrome (FACADE-1)
   Two shells, per the ruled canon:
     · BUILD  — no top bar; folder band (THE WORLD / THE DATA) + wing rail.
       Rail follows its tab: LEFT under THE WORLD, RIGHT under THE DATA.
     · SESSION — top bar (back · SESSION · chip · QUICK EDIT · END SESSION ·
       CONNECTION HUB) + seven-preset chip strip + body + 264px Player rail
       (suppressed on Tile Dock).
   Threshold pages (index/sanctum/bookshelf/connections/crafter/vtt/aftermath)
   wear no shell — a lone back flag instead.
   ========================================================================== */

.shell-frame { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ═══════════════ BUILD SHELL ═══════════════ */

/* folder band: two manila-folder tabs, grouped together, back flag alongside.
   Active tab's fill IS the page fill — molded, no seam. */
.folder-band {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 10px 18px 0 18px;
  background: var(--surface-shell-deep);
  flex: none;
}
.folder-tab {
  padding: 8px 22px 9px;
  border: 1px solid var(--border-dark);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-raised);
  color: var(--text-muted);
  font: var(--type-panel-title);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  top: 1px;
}
.folder-tab.active {
  background: var(--surface-panel);      /* = page fill: molded, no seam */
  color: var(--accent-bright);
  border-color: var(--border-light);
  z-index: 2;
}
.folder-tab:not(.active):hover { color: var(--text-on-dark); }
.back-flag {
  margin-right: 12px;
  width: 34px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 15px;
}
.back-flag:hover { color: var(--accent-bright); border-color: var(--accent); }

/* build body: rail + page (rail side flips per tab) */
.build-body { display: flex; flex: 1; min-height: 0; background: var(--surface-panel); border-top: 1px solid var(--border-light); }
.build-body.rail-right { flex-direction: row-reverse; }

/* wing rail: bookmark flags cut from the desk. Labels only, equal plaques,
   vertically centred on its edge. */
.wing-rail {
  width: 118px;
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 10px 10px;
  background: var(--surface-shell-deep);
}
.build-body.rail-right .wing-rail { padding: 10px 10px 10px 0; }
.wing-flag {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border-dark);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface-raised);
  color: var(--text-muted);
  font: var(--type-label-caps);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  text-align: right;
  overflow-wrap: break-word;
}
.build-body.rail-right .wing-flag {
  border-right: 1px solid var(--border-dark);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  text-align: left;
}
.wing-flag:hover { color: var(--text-on-dark); border-color: var(--border-light); }
.wing-flag.active {
  background: var(--surface-panel);      /* molds into the page */
  color: var(--accent-bright);
  border-color: var(--border-light);
}

.build-page { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ═══════════════ SESSION SHELL ═══════════════ */

.session-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--surface-shell);
  border-bottom: 1.5px solid var(--rule-accent);
  flex: none;
}
.session-topbar .sess-name {
  font: var(--type-panel-title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-on-dark);
}
.session-topbar .sess-name .mode-word { color: var(--amber); }

.mode-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rule-amber);
  background: var(--amber-soft);
  color: var(--amber);
  font: var(--type-label-caps);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}
.mode-chip:hover { border-color: var(--amber); }

/* preset chip strip — exactly seven, locked canon */
.preset-strip {
  display: flex;
  gap: 6px;
  padding: 7px 14px;
  background: var(--surface-shell-deep);
  border-bottom: 1px solid var(--rule-accent-faint);
  flex: none;
  overflow-x: auto;
}
.preset-chip {
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-dark);
  background: var(--surface-raised);
  color: var(--text-muted);
  font: var(--type-label-caps);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  white-space: nowrap;
}
.preset-chip:hover { color: var(--text-on-dark); border-color: var(--border-light); }
.preset-chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.session-body { display: flex; flex: 1; min-height: 0; }
.session-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; padding: 14px; gap: 12px; }

/* Player Display rail — 264px, right. The player-safe projection. */
.player-rail {
  width: 264px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--surface-shell);
  border-left: 1px solid var(--border-dark);
  overflow-y: auto;
}
.player-rail .rail-head { display: flex; align-items: center; gap: 8px; }
.rail-preview {
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  background: var(--well-on-dark);
  min-height: 150px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.rail-modes { display: flex; flex-wrap: wrap; gap: 5px; }

/* ═══════════════ THRESHOLD PAGES ═══════════════ */

.threshold {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse at 50% -10%, var(--surface-panel-alt) 0%, var(--surface-shell-deep) 62%);
}
.threshold-inner { width: min(1080px, 100%); }
.threshold .back-flag { position: fixed; top: 16px; left: 16px; z-index: 40; }

/* ═══════════════ OVERLAYS / TOASTS ═══════════════ */

.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 7, 16, 0.68);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 96px;
}
.overlay-card {
  width: min(620px, calc(100vw - 48px));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.overlay-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--rule-accent);
}
.overlay-body { padding: 16px; }
.overlay-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--rule-accent-faint);
}
.jump-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }

#facade-toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(8px);
  z-index: 99;
  background: var(--surface-raised);
  border: 1px solid var(--rule-amber);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 9px 18px;
  font: var(--type-ui);
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
#facade-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════ responsive floor ═══════════════ */
@media (max-width: 860px) {
  .player-rail { display: none; }
  .wing-rail { width: 92px; }
}
