:root {
  --viewer-bg: #f0eee8;
  --viewer-panel: #fcfbf8;
  --viewer-ink: #1a1a1a;
  --viewer-accent: #7a5230;
  --viewer-border: rgba(28, 28, 28, 0.1);
  --viewer-muted: #6b7280;
}

body.viewer-body {
  background:
    radial-gradient(circle at top right, rgba(122, 82, 48, 0.1), transparent 24rem),
    linear-gradient(180deg, #f6f4ee 0%, var(--viewer-bg) 100%);
  color: var(--viewer-ink);
  min-height: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── panels ── */

.viewer-panel {
  background: var(--viewer-panel);
  border: 1px solid var(--viewer-border);
  border-radius: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  padding: 1.25rem;
}

/* ── scene list ── */

.scene-list-panel {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.scene-list-refresh {
  flex-shrink: 0;
}

.selection-summary-panel {
  border: 1px solid var(--viewer-border);
  background: linear-gradient(180deg, rgba(122, 82, 48, 0.06), rgba(255, 255, 255, 0.9));
  padding: 0.9rem;
}

.selection-summary-grid {
  display: grid;
  grid-template-columns: minmax(4.2rem, 1fr) repeat(3, minmax(0, 1fr));
  gap: 0.45rem 0.6rem;
  align-items: center;
}

.selection-summary-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--viewer-muted);
}

.selection-summary-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.selection-summary-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--viewer-ink);
}

#selection-clear-btn {
  white-space: nowrap;
}

.folder-row {
  width: 100%;
}

.folder-select-wrap {
  margin: 0;
  padding-top: 0.55rem;
}

.folder-select-input {
  cursor: pointer;
}

.scene-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--viewer-border);
  border-radius: 0 !important;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}

/* ── folder toggles ── */

.folder-toggle {
  border-radius: 0 !important;
  font-size: 0.82rem;
  transition: background 120ms ease;
}

.folder-toggle:hover {
  background: rgba(122, 82, 48, 0.05);
}

.folder-toggle:not(.collapsed) .folder-arrow::after {
  content: "▾";
}

.folder-toggle.collapsed .folder-arrow::after {
  content: "▸";
}

.folder-arrow::after {
  font-size: 0.7rem;
  color: var(--viewer-muted);
}

.sub-folder {
  border-left: 2px solid var(--viewer-border);
  padding-left: 0.5rem;
}

.scene-card:hover {
  border-color: rgba(122, 82, 48, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.scene-card.border-primary {
  border-left: 3px solid var(--viewer-accent) !important;
}

.scene-card-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
}

.scene-card-metrics span {
  white-space: nowrap;
}

.scene-card-description {
  font-size: 0.75rem;
}

.scene-badge-compact {
  font-size: 0.65rem;
}

/* ── hero strip ── */

.hero-strip {
  background: linear-gradient(135deg, rgba(122, 82, 48, 0.06), rgba(255, 255, 255, 0.4));
  border: 1px solid var(--viewer-border);
  border-radius: 0;
  padding: 1.25rem;
  border-left: 3px solid var(--viewer-accent);
}

.score-stack {
  min-width: 10rem;
}

/* ── overview gallery ── */

.overview-gallery {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.gallery-thumb {
  display: block;
  overflow: hidden;
  border-radius: 0;
  border: 1px solid var(--viewer-border);
  background: white;
  transition: border-color 120ms ease;
}

.gallery-thumb:hover {
  border-color: var(--viewer-accent);
}

.gallery-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

/* ── summary grid ── */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.summary-grid div {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--viewer-border);
  border-radius: 0;
  padding: 0.7rem 0.85rem;
}

.summary-grid span {
  display: block;
  color: var(--viewer-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.summary-grid strong {
  display: block;
  margin-top: 0.1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

/* ── metric accordion ── */

.metric-header:not(.collapsed) {
  background: rgba(122, 82, 48, 0.06);
  color: var(--viewer-ink);
}

.accordion-item {
  border: 1px solid var(--viewer-border) !important;
  border-radius: 0 !important;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.accordion-button {
  border-radius: 0 !important;
}

.accordion-button::after {
  border-radius: 0 !important;
}

/* ── check cards ── */

.accordion-item.border {
  border-radius: 0 !important;
}

.judgement-col {
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
}

/* ── json block ── */

.json-block {
  margin: 0;
  padding: 0.85rem;
  border-radius: 0;
  background: #18171a;
  color: #f7f3eb;
  font-size: 0.8rem;
  max-height: 22rem;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── evidence ── */

.evidence-primary {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 0;
}

.placeholder-evidence {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border-radius: 0;
  border: 1px dashed rgba(28, 28, 28, 0.12);
  color: var(--viewer-muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
}

/* ── empty state ── */

.empty-state {
  min-height: 18rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── badges ── */

.badge {
  border-radius: 0 !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge.text-bg-success {
  background: #2f9e44 !important;
  color: #fff !important;
}

.badge.text-bg-warning {
  background: #e0a106 !important;
  color: #1f1400 !important;
}

.badge.text-bg-danger {
  background: #cf513d !important;
  color: #fff !important;
}

.badge.text-bg-secondary {
  background: #6b7280 !important;
  color: #fff !important;
}

/* ── buttons ── */

.btn {
  border-radius: 0 !important;
}

/* ── details / summary ── */

details summary {
  cursor: pointer;
  color: var(--viewer-accent);
  font-weight: 500;
}

details summary:hover {
  text-decoration: underline;
}

/* ── section headers ── */

.text-uppercase.small.fw-semibold {
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

/* ── responsive ── */

@media (max-width: 1199.98px) {
  .scene-list-panel {
    position: static;
    max-height: none;
  }
}

/* ── stats modal ── */

.stats-modal-body {
  min-height: 200px;
  max-height: 70vh;
  overflow-y: auto;
}

.method-stats-container {
  padding: 0.5rem;
}

.method-section {
  border-bottom: 1px solid var(--viewer-border);
  padding-bottom: 1.5rem;
}

.method-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.method-title {
  color: var(--viewer-accent);
  font-size: 1.1rem;
}

.overall-stats {
  border: 1px solid var(--viewer-border);
}

.stats-value {
  font-size: 1.25rem;
  color: var(--viewer-ink);
}

.stats-label {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.dimension-stats .table {
  font-size: 0.85rem;
}

.dimension-stats .table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--viewer-muted);
  border-bottom-width: 2px;
}

.dimension-stats .table td {
  vertical-align: middle;
  padding: 0.6rem 0.5rem;
}

.dimension-stats .table tbody tr:hover {
  background: rgba(122, 82, 48, 0.04);
}

/* ── modal adjustments ── */

.modal-content {
  border-radius: 0;
  border: 1px solid var(--viewer-border);
}

.modal-header {
  border-bottom: 1px solid var(--viewer-border);
  background: linear-gradient(180deg, rgba(122, 82, 48, 0.06), rgba(255, 255, 255, 0.9));
}

.modal-footer {
  border-top: 1px solid var(--viewer-border);
}

/* ── selection stats in modal ── */

.selection-stats-modal {
  background: linear-gradient(180deg, rgba(122, 82, 48, 0.06), rgba(255, 255, 255, 0.9));
  border-color: var(--viewer-border) !important;
}

.selection-summary-grid-modal {
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) repeat(3, minmax(0, 1fr));
  gap: 0.5rem 0.8rem;
  align-items: center;
}

.selection-summary-grid-modal .stats-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--viewer-muted);
  font-weight: 600;
}

.selection-summary-grid-modal .stats-label {
  font-size: 0.85rem;
  font-weight: 600;
}

.selection-summary-grid-modal .stats-value {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--viewer-ink);
  text-align: center;
}
