/* View switcher — scrollable with arrows */
.view-switcher-wrap {
  display:flex; align-items:center; gap:0; position:relative;
  max-width: 520px; width: 100%; min-width: 0;
}
.view-switcher {
  display:flex; flex-wrap:nowrap; gap:2px; background:#eeedf0; border-radius: 0; padding:3px;
  overflow-x:auto; scroll-behavior:smooth; -webkit-overflow-scrolling:touch;
  scrollbar-width:none; /* Firefox */
  min-width: 0; flex: 1 1 0;
}
.view-switcher::-webkit-scrollbar { display:none; }
.vs-arrow {
  flex-shrink:0; width:26px; height:26px; border:none; border-radius:50%;
  background:#e5e5e7; color:#666; font-size:1.1rem; font-weight:700;
  cursor:pointer; display:flex; align-items:center; justify-content:center;
  transition:background .15s, opacity .15s; opacity:0; pointer-events:none;
  line-height:1;
}
.vs-arrow:hover { background:#d4d4d7; color:#333; }
.vs-arrow.vs-visible { opacity:1; pointer-events:auto; }
.vs-arrow-left { margin-right:4px; }
.vs-arrow-right { margin-left:4px; }
.vs-btn {
  display:inline-block; padding:.28rem .75rem; border-radius: 0;
  font-size:.8rem; font-weight:600; white-space:nowrap;
  text-decoration:none; line-height:1.4; color:#888;
  transition:background .1s, color .1s; flex-shrink:0;
}
a.vs-btn:hover { background:#e0dfe4; color:#333; }
.vs-active { background:#fff; color:#1a1a2e; box-shadow:0 1px 3px rgba(0,0,0,.1); cursor:default; }
.vs-locked { color:#bbb; cursor:pointer; font-size:.75rem; }
.vs-locked:hover { background:#f5f5f5; color:#999; }

/* Test meta panel */
.test-meta-block { margin: -.25rem 0 .9rem; }
.test-meta-static { font-size: .8rem; color: #999; margin-bottom: .3rem; }
.towner-name { font-weight: 600; color: #444; }
.tset-label { font-weight: 400; color: #888; }
.tmeta-sep { color: #ccc; }
.tmeta-desc {
  margin-top: .4rem; font-size: .85rem; color: #555; line-height: 1.65;
  background: #f7f7f8; border-radius: 0; padding: .55rem .85rem;
  white-space: pre-wrap; word-break: break-word;
}

/* ── Unified result page header ────────────────────────────────── */
.res-page-header { margin-bottom: 1.25rem; }

.res-ph-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .4rem;
  font-size: .8rem;
  color: var(--color-text-3);
  margin-bottom: .35rem;
}
.res-ph-left  { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.res-ph-sep   { color: var(--color-text-3); margin: 0 .1rem; }
.res-ph-date  { white-space: nowrap; }
.res-ph-question {
  font-size: .88rem;
  color: var(--color-text-2);
  font-style: italic;
  margin-bottom: .55rem;
  padding: .4rem .65rem;
  background: var(--color-surface-2);
  border-radius: 0;
}
.res-ph-h1row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
  overflow: hidden;
}
.res-ph-h1row h1 { font-size: 1.3rem; font-weight: 700; margin: 0; }

/* ── Chapter sidebar (right sliding panel) ─────────────────────── */
.chap-sidebar {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%) translateX(calc(100% - 28px));
  transition: transform .3s ease;
  width: 220px;
  max-height: 72vh;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 0;
  box-shadow: -3px 0 14px rgba(0,0,0,.09);
  z-index: 200;
  display: flex;
  flex-direction: row;
}
.chap-sidebar.open { transform: translateY(-50%) translateX(0); }

.chap-sidebar-ear {
  flex: 0 0 28px;
  width: 28px;
  background: var(--color-surface-2, #f4f4f8);
  border: none;
  border-right: 1px solid var(--color-border);
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.chap-sidebar-ear span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: .7rem;
  font-weight: 600;
  color: var(--color-text-3);
  letter-spacing: .06em;
  transform: rotate(180deg);
  user-select: none;
}
.chap-sidebar-ear:hover { background: var(--color-surface-3, #e8e8f0); }

.chap-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: .5rem .3rem;
}
.chap-nav-btn {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: .32rem .5rem;
  font-size: .77rem;
  color: var(--color-text-2);
  cursor: pointer;
  border-radius: 0;
  line-height: 1.35;
  font-family: inherit;
}
.chap-nav-btn:hover { background: var(--color-surface-2); color: var(--color-accent); }

@media (max-width: 640px) { .chap-sidebar { display: none; } }

/* ── Markdown content images — auto size + lightbox trigger ─────────── */
.vykl-note img, .ai-md-body img, .cms-content img,
.portrait-ai-text img, .portrait-ai-poem img, .md-content img {
  max-width: min(350px, 100%);
  max-height: 350px;
  object-fit: contain;
  border-radius: 0;
  cursor: zoom-in;
  display: block;
  margin: .6rem 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}

/* ── Lightbox overlay ──────────────────────────────────────────────── */
#md-lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.82);
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
#md-lightbox.open { display: flex; }
#md-lightbox img {
  max-width: 90vw; max-height: 90vh;
  object-fit: contain;
  border-radius: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  cursor: default;
}

/* ── Chapter card (shared across all views) ─────────────── */
.chapter-card {
  background: #fff;
  border-radius: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.05);
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.5rem 1.4rem;
  overflow: hidden;
}
.chapter-card-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--color-text-3, #6b7280);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin: 0 0 .9rem;
}
.chapter-card-desc {
  font-size: .85rem;
  color: #6b7280;
  margin: -.5rem 0 .9rem;
  line-height: 1.5;
}
