/* Dead Ringer — design tokens and components, from the owner's Claude Design
   mockup (docs/design-handoff). Palette and voice carried over from
   thread-fall.com: Spectral display serif, IBM Plex Sans UI, gold accent. */

:root {
  --bg: #07090C;
  --bg-1: #0B0F14;
  --bg-2: #0E141B;
  --bg-3: #121A22;
  --bg-4: #141C24;
  --bg-5: #1B242E;
  --line-1: #161E27;
  --line-2: #1E2731;
  --line-3: #2C3844;
  --line-4: #3D4A57;
  --text-1: #E8E3D9;
  --text-2: #B9C2CB;
  --text-3: #8C97A3;
  --text-4: #6C7885;
  --text-5: #5F6B78;
  --text-6: #39434E;
  --gold: #C9A227;
  --gold-hover: #E0B94A;
  --gold-ink: #0B0F14;
  --working: #D97742;
  --fail: #B4553F;
  --ok: #6FA88A;
  --serif: 'Spectral', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text-1); font-family: var(--sans); font-size: 14px; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hover); }
.hidden { display: none !important; }
.gold { color: var(--gold); }

@keyframes drSweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(220%); } }
@keyframes drSpin { to { transform: rotate(360deg); } }
@keyframes drPulse { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }

/* ── logo, buttons, inputs ─────────────────────────────────────────────── */
.dr-logo { font-family: var(--serif); font-size: 19px; cursor: pointer; user-select: none; }
.dr-logo-lg { font-size: 34px; cursor: default; }

button { font-family: var(--sans); cursor: pointer; }
.btn-gold { background: var(--gold); color: var(--gold-ink); border: 0; border-radius: 7px;
  padding: 9px 17px; font-size: 13px; font-weight: 600; }
.btn-gold:hover { background: var(--gold-hover); }
.btn-gold:disabled { background: var(--bg-5); color: var(--text-5); cursor: default; }
.btn-quiet { background: transparent; color: var(--text-2); border: 1px solid var(--line-3);
  border-radius: 7px; padding: 9px 15px; font-size: 13px; }
.btn-quiet:hover { border-color: var(--line-4); }
.btn-ghost-gold { background: transparent; border: 1px solid var(--line-3); color: var(--gold);
  border-radius: 6px; padding: 8px; font-size: 12px; }
.btn-ghost-gold:hover { border-color: var(--gold); }
.btn-wide { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 12px; }

input[type=email], input[type=password], input[type=text] {
  background: var(--bg-1); border: 1px solid var(--line-3); border-radius: 7px;
  color: var(--text-1); font-family: var(--sans); font-size: 13.5px; padding: 11px 13px; width: 100%;
}
input:focus { outline: none; border-color: var(--gold); }

.eyebrow { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--text-5); }

/* ── auth ──────────────────────────────────────────────────────────────── */
.screen { min-height: 100vh; }
#auth-screen { display: flex; align-items: center; justify-content: center; padding: 24px; }
#auth-screen.hidden { display: none; }
.auth-card { width: 380px; background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 34px 30px; display: flex; flex-direction: column; gap: 18px; }
.auth-tagline { font-family: var(--serif); font-size: 17px; color: var(--text-3); }
.auth-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-2); }
.auth-tab { background: transparent; border: 0; color: var(--text-4); font-size: 13px;
  padding: 8px 12px; border-bottom: 2px solid transparent; }
.auth-tab.active { color: var(--text-1); border-bottom-color: var(--gold); }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-error { color: var(--fail); font-size: 12.5px; line-height: 1.5; }
.auth-note { font-size: 12px; color: var(--text-5); line-height: 1.6; }

/* ── shell ─────────────────────────────────────────────────────────────── */
#app-screen { display: flex; }
.sidebar { width: 224px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column; padding: 20px 16px; gap: 22px; min-height: 100vh; }
.side-section { display: flex; flex-direction: column; gap: 7px; }
.side-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px;
  border-radius: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.side-row:hover { background: var(--bg-4); }
.side-row.active { background: var(--bg-4); color: var(--text-1); }
.side-row .count { font-size: 11px; color: var(--text-5); }
.side-row .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--working);
  animation: drPulse 1.6s infinite; }
.side-empty { font-size: 12.5px; color: var(--text-4); line-height: 1.6;
  border: 1px dashed var(--line-3); border-radius: 7px; padding: 14px; }
.side-new { padding: 8px 10px; font-size: 13px; color: var(--gold); cursor: pointer; }
.side-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--line-2); padding-top: 16px; }
.meter-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.meter-row .val { color: var(--text-1); }
.meter-bar { height: 4px; background: var(--bg-5); border-radius: 2px; overflow: hidden; }
.meter-bar > div { height: 100%; background: var(--gold); }
.meter-note { font-size: 11px; color: var(--text-5); line-height: 1.5; }
.side-flagship { font-size: 11px; color: var(--text-5); line-height: 1.55; display: block;
  border-top: 1px solid var(--line-1); padding-top: 12px; margin-top: 2px; }
.side-flagship:hover { color: var(--text-3); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar { height: 56px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center;
  padding: 0 28px; justify-content: space-between; flex: none; }
.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-3); }
.breadcrumb .here { color: var(--text-1); }
.breadcrumb .sep { color: var(--text-6); }
.breadcrumb .crumb-link { cursor: pointer; }
.breadcrumb .crumb-link:hover { color: var(--text-1); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-note { font-size: 12px; color: var(--text-4); }
.account-chip { width: 28px; height: 28px; border-radius: 50%; background: var(--line-2);
  border: 1px solid var(--line-3); cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 11px; color: var(--text-3); }
.view { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ── empty state / hero ────────────────────────────────────────────────── */
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px; }
.hero-fleuron { font-family: var(--serif); font-size: 15px; color: var(--gold); letter-spacing: .02em; }
.hero-title { font-family: var(--serif); font-size: 40px; line-height: 1.2; text-align: center;
  max-width: 680px; text-wrap: pretty; }
.hero-sub { font-size: 14.5px; color: var(--text-3); text-align: center; max-width: 560px;
  line-height: 1.7; text-wrap: pretty; }
.dropzone { width: min(620px, 90%); border: 1px dashed var(--line-3); border-radius: 12px;
  background: var(--bg-2); padding: 44px; display: flex; flex-direction: column; align-items: center;
  gap: 16px; cursor: pointer; }
.dropzone.dragover, .dropzone:hover { border-color: var(--gold); }
.dropzone-ring { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center; color: var(--gold); font-size: 22px; }
.dropzone-label { font-size: 15px; }
.dropzone-hint { font-size: 12.5px; color: var(--text-4); }
.dropzone-slim { border: 1px dashed var(--line-3); border-radius: 9px; padding: 20px;
  text-align: center; font-size: 12.5px; color: var(--text-4); cursor: pointer; }
.dropzone-slim.dragover, .dropzone-slim:hover { border-color: var(--gold); }

/* ── session layout ────────────────────────────────────────────────────── */
.session-wrap { flex: 1; display: flex; min-height: 0; }
.session-left { flex: 1; padding: 26px 28px; display: flex; flex-direction: column; gap: 18px;
  min-width: 0; overflow-y: auto; }
.session-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.session-title { font-family: var(--serif); font-size: 24px; }
.session-title-input { background: transparent; border: 0; border-bottom: 1px dashed transparent;
  color: var(--text-1); font-family: var(--serif); font-size: 24px; padding: 0; width: 100%; }
.session-title-input:hover, .session-title-input:focus { border-bottom-color: var(--line-3); outline: none; }
.session-sub { font-size: 12.5px; color: var(--text-4); }
.session-actions { display: flex; gap: 9px; flex: none; }
.progress-track { height: 5px; background: var(--line-1); border-radius: 3px; overflow: hidden; display: flex; }
.progress-done { background: var(--gold); }
.progress-working { background: var(--working); position: relative; overflow: hidden; }
.progress-working::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: drSweep 1.4s infinite; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
  align-items: start; }
.tile { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; gap: 10px; }
.tile:hover { border-color: var(--line-4); }
.tile.open { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,39,.09); }
.tile-art { aspect-ratio: 1; border-radius: 8px; background: var(--bg-3); position: relative;
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tile-art img.token { width: 84%; aspect-ratio: 1; object-fit: contain; }
.tile-art img.source-art { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .5; }
.tile-art .grid-ref { position: absolute; inset: 14px; border: 1px dashed rgba(201,162,39,.4);
  border-radius: 4px; pointer-events: none; }
.size-badge { position: absolute; top: 8px; left: 8px; font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold-ink); background: var(--text-3); border-radius: 3px;
  padding: 2px 5px; cursor: pointer; z-index: 2; border: 0; font-family: var(--sans); }
.size-badge.gold { background: var(--gold); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #232D38;
  border-top-color: var(--working); animation: drSpin 1s linear infinite; }
.tile-wait { font-size: 11.5px; color: var(--text-6); letter-spacing: .08em; text-transform: uppercase; }
.tile-fail { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tile-fail .mark { font-size: 19px; color: var(--fail); }
.tile-name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tile-name-input { background: transparent; border: 0; border-bottom: 1px dashed transparent;
  color: var(--text-2); font-family: var(--sans); font-size: 12px; padding: 1px 0; width: 100%; }
.tile-name-input:hover, .tile-name-input:focus { border-bottom-color: var(--line-3); outline: none; }
.tile-name-input.dup { border-bottom-color: var(--fail); color: var(--fail); }
.tile-more { font-size: 15px; color: var(--text-6); cursor: pointer; background: none; border: 0;
  padding: 0 2px; }
.tile-more:hover { color: var(--text-3); }
.tile-status { font-size: 11px; }
.tile-status.done { color: var(--ok); }
.tile-status.working { color: var(--working); }
.tile-status.failed { color: var(--fail); }
.tile-status.queued { color: #4A5561; }
.tile-status.blocked { color: var(--gold); cursor: pointer; }

/* open-state controls */
.nudge { display: flex; flex-direction: column; gap: 10px; }
.nudge-row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-3); }
.nudge-row .val { color: var(--gold); }
.scale-line { display: flex; align-items: center; gap: 9px; }
.scale-btn { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line-3);
  background: none; display: flex; align-items: center; justify-content: center; font-size: 13px;
  color: var(--text-3); flex: none; }
.scale-track { flex: 1; height: 3px; background: var(--bg-5); border-radius: 2px; position: relative; }
.scale-fill { height: 100%; background: var(--gold); border-radius: 2px; }
.scale-knob { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 11px;
  height: 11px; border-radius: 50%; background: var(--gold); }
.nudge-label { font-size: 11.5px; color: var(--text-3); }
.nudge input[type=text] { padding: 7px 10px; font-size: 12px; border-radius: 6px; }
.nudge-actions { display: flex; gap: 7px; }
.nudge-actions .btn-gold { flex: 1; padding: 8px; font-size: 12px; border-radius: 6px; }
.nudge-actions .btn-quiet { padding: 8px 11px; font-size: 12px; border-radius: 6px; }

/* ── batch defaults rail ───────────────────────────────────────────────── */
.session-rail { width: 308px; flex: none; border-left: 1px solid var(--line-2); background: var(--bg-2);
  padding: 24px 22px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.rail-group { display: flex; flex-direction: column; gap: 9px; }
.rail-label { font-size: 12.5px; color: var(--text-2); }
.rail-help { font-size: 11.5px; color: var(--text-5); line-height: 1.55; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--line-3);
  color: var(--text-3); background: none; font-family: var(--sans); }
.chip.active { background: var(--gold); color: var(--gold-ink); font-weight: 600; border-color: var(--gold); }
.rail-footer { margin-top: auto; border-top: 1px solid var(--line-2); padding-top: 16px;
  display: flex; flex-direction: column; gap: 7px; }
.forecast-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.forecast-row .lbl { color: var(--text-3); }
.forecast-row .gold { color: var(--gold); }

/* ── library ───────────────────────────────────────────────────────────── */
.library { flex: 1; padding: 26px 28px; display: flex; flex-direction: column; gap: 22px; overflow-y: auto; }
.library-head { display: flex; align-items: flex-end; justify-content: space-between; }
.library-title { font-family: var(--serif); font-size: 28px; }
.library-sub { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }
.session-row { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 18px 20px; display: flex; align-items: center; gap: 22px; }
.session-row:hover { border-color: var(--line-3); }
.session-row-info { display: flex; flex-direction: column; gap: 4px; width: 300px; flex: none; }
.session-row-title { font-family: var(--serif); font-size: 18px; }
.session-row-meta { font-size: 11.5px; color: var(--text-4); }
.disc-strip { display: flex; flex: 1; min-width: 0; }
.disc { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-4);
  border: 2px solid var(--bg-2); margin-left: -10px; overflow: hidden; flex: none; }
.disc:first-child { margin-left: 0; }
.disc img { width: 100%; height: 100%; object-fit: contain; }
.session-row-actions { display: flex; gap: 9px; flex: none; }

/* ── modals ────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(7,9,12,.72); display: flex;
  align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-box { width: 600px; max-width: 100%; max-height: 92vh; overflow-y: auto; background: #101820;
  border: 1px solid var(--line-3); border-radius: 12px; padding: 30px; display: flex;
  flex-direction: column; gap: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal-box--sm { width: 420px; }
.modal-title { font-family: var(--serif); font-size: 26px; }
.modal-sub { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.modal-eyebrow { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-5); }
.option-card { border: 1px solid #232D38; border-radius: 8px; padding: 13px 15px; display: flex;
  align-items: center; justify-content: space-between; cursor: pointer; }
.option-card.selected { border-color: var(--gold); background: rgba(201,162,39,.07); }
.option-main { display: flex; flex-direction: column; gap: 3px; }
.option-title { font-size: 13.5px; color: var(--text-2); }
.option-card.selected .option-title { color: var(--text-1); }
.option-desc { font-size: 11.5px; color: var(--text-4); }
.radio-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--text-6); flex: none; }
.option-card.selected .radio-dot { border: 4px solid var(--gold); }
.modal-footer { display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line-2); padding-top: 18px; }
.modal-footnote { font-size: 11.5px; color: var(--text-4); }
.modal-actions { display: flex; gap: 9px; }
.filelist { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
  color: var(--text-4); line-height: 1.8; background: #0B1118; border: 1px solid #1A222B;
  border-radius: 7px; padding: 12px 14px; }

/* PC chip: recurring characters carry into every new session */
.pc-chip { font-size: 9px; letter-spacing: .1em; border: 1px solid var(--line-3);
  color: var(--text-5); background: none; border-radius: 3px; padding: 2px 5px;
  font-family: var(--sans); flex: none; }
.pc-chip.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink);
  font-weight: 600; }
.pc-chip:hover { border-color: var(--gold); }

/* ── test-placement playground ─────────────────────────────────────────── */
.test-map { position: relative; height: 420px; border: 1px solid var(--line-2);
  border-radius: 8px; overflow: hidden; background: #0B1118; }
.test-map-bg { position: absolute; inset: 0; }
.test-token { position: absolute; object-fit: contain; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-drag: none; }
.test-token:active { cursor: grabbing; }
.test-tray { display: flex; gap: 8px; flex-wrap: wrap; }
.test-tray-item { width: 52px; height: 52px; border-radius: 8px; background: var(--bg-3);
  border: 1px solid var(--line-2); cursor: pointer; display: flex; align-items: center;
  justify-content: center; overflow: hidden; }
.test-tray-item:hover { border-color: var(--gold); }
.test-tray-item img { width: 88%; height: 88%; object-fit: contain; }

/* banner */
.banner { margin: 14px 28px 0; border: 1px solid var(--line-3); background: var(--bg-2);
  border-radius: 8px; padding: 11px 15px; font-size: 12.5px; color: var(--text-3);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.banner .gold { cursor: pointer; }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #101820;
  border: 1px solid var(--line-3); color: var(--text-1); border-radius: 8px; padding: 11px 18px;
  font-size: 13px; z-index: 2000; box-shadow: 0 10px 40px rgba(0,0,0,.5); }

/* ── mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .sidebar { display: none; }
  .session-rail { display: none; }
  .session-left { padding: 16px; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero-title { font-size: 26px; }
  .library { padding: 16px; }
  .session-row { flex-wrap: wrap; gap: 12px; }
  .session-row-info { width: 100%; }
  .topbar { padding: 0 16px; }
  .topbar-note { display: none; }
  .modal-box { padding: 20px; }
}
