/* Shared Version 10 finish layer. Loaded last on every public Self Quiz page. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="sepia"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

body.sepia-mode {
  --bg: #f2e6cf;
  --panel: #fff8e9;
  --card: #fffaf0;
  --text: #382c21;
  --muted: #756452;
  --soft-border: #d7c3a3;
  --soft-bg: rgba(120, 83, 38, 0.075);
  --shadow: 0 14px 34px rgba(86, 57, 27, 0.09);
  color-scheme: light;
}

.selfquiz-home-page.light-mode {
  --ink: #f4f7f6;
  --ink-2: #e8efec;
  --paper: #ffffff;
  --paper-2: #eaf1ee;
  --text: #16231f;
  --muted: #5e7069;
  --line: rgba(20, 40, 34, 0.14);
  color-scheme: light;
  color: var(--text);
  background: #f4f7f6;
}

.selfquiz-home-page.sepia-mode {
  --ink: #f2e6cf;
  --ink-2: #ead8b8;
  --paper: #fff8e9;
  --paper-2: #ead9ba;
  --text: #382c21;
  --muted: #756452;
  --line: rgba(86, 57, 27, 0.16);
  color-scheme: light;
  color: var(--text);
  background: #f2e6cf;
}

.selfquiz-home-page.light-mode .hero,
.selfquiz-home-page.light-mode .feature-band,
.selfquiz-home-page.light-mode .proof-section,
.selfquiz-home-page.sepia-mode .hero,
.selfquiz-home-page.sepia-mode .feature-band,
.selfquiz-home-page.sepia-mode .proof-section {
  color: var(--text);
  background: linear-gradient(180deg, var(--ink), var(--ink-2));
}

.selfquiz-home-page.light-mode .site-header,
.selfquiz-home-page.sepia-mode .site-header { color: var(--text); }
.selfquiz-home-page.light-mode .site-header.is-scrolled { background: rgba(244, 247, 246, 0.92); }
.selfquiz-home-page.sepia-mode .site-header.is-scrolled { background: rgba(242, 230, 207, 0.92); }
.selfquiz-home-page.light-mode .main-nav,
.selfquiz-home-page.light-mode .button.secondary,
.selfquiz-home-page.light-mode .hero-metrics div,
.selfquiz-home-page.sepia-mode .main-nav,
.selfquiz-home-page.sepia-mode .button.secondary,
.selfquiz-home-page.sepia-mode .hero-metrics div {
  color: var(--text);
  background: color-mix(in srgb, var(--paper) 68%, transparent);
  border-color: var(--line);
}
.selfquiz-home-page.light-mode .hero-metrics span,
.selfquiz-home-page.sepia-mode .hero-metrics span { color: var(--muted); }

body.sepia-mode,
body.sepia-mode .view,
body.sepia-mode .results-view,
body.sepia-mode .resume-view {
  background-color: var(--bg);
  color: var(--text);
}

body.sepia-mode textarea,
body.sepia-mode input[type="number"],
body.sepia-mode select,
body.sepia-mode .option-item,
body.sepia-mode .nav-dot,
body.sepia-mode .modal-card {
  background: #fffaf0;
  color: var(--text);
}

body.sepia-mode .about-premium-wrapper {
  background: #ead9ba;
}

body.sepia-mode .focus-controls {
  background: rgba(255, 248, 235, 0.94);
  border-color: rgba(86, 57, 27, 0.24);
}

body.sepia-mode .focus-btn:hover,
body.sepia-mode .focus-width-control {
  background: rgba(86, 57, 27, 0.08);
}

body.sepia-mode .focus-sep {
  background: rgba(86, 57, 27, 0.2);
}

.creator-profile-link {
  display: inline-block;
  border-radius: 24px;
}

.creator-profile-link:focus-visible {
  outline: 3px solid var(--primary, #0aa89e);
  outline-offset: 5px;
}

.profile-img,
.creator-media img,
.menu-profile-image {
  object-fit: contain !important;
  object-position: center bottom !important;
}

.about-image-side .creator-profile-link {
  width: 220px;
  height: 220px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(10, 168, 158, 0.14), rgba(10, 168, 158, 0.04));
}

.about-image-side .creator-profile-link .profile-img {
  width: 100%;
  height: 100%;
  box-shadow: none;
}

.input-card-header {
  flex-wrap: wrap;
}

.input-card-header .field-label {
  margin-right: auto;
}

.sample-format-btn {
  min-height: 40px;
  padding: 8px 13px;
}

.cyoq-utility-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 4px;
}

.sample-dialog {
  width: min(640px, calc(100% - 28px));
  max-height: min(82vh, 720px);
  overflow: auto;
  border: 1px solid var(--soft-border);
  border-radius: 18px;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.sample-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
}

.sample-dialog-inner { padding: 22px; }
.sample-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sample-dialog-head h2 { margin: 0; font-size: 1.25rem; }
.sample-dialog pre {
  margin: 18px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 600 0.88rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.sample-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.drm-floating-tools a,
.drm-floating-tools button { min-width: 48px; }

body.sepia-mode .drm-floating-tools a,
body.sepia-mode .drm-floating-tools button {
  background: rgba(255, 248, 235, 0.96);
  color: #382c21;
}

/* Topic landing pages use inline Sepia styles; these two selectors provide the
   requested Light and Dark alternatives without rewriting every generated page. */
body.light-mode .hero,
body.light-mode .content-card,
body.light-mode .related {
  background: rgba(255, 255, 255, 0.94);
}

body.light-mode:not(.features-page) {
  color-scheme: light;
}

body:not(.light-mode):not(.sepia-mode):not(.features-page) .site-header,
body:not(.light-mode):not(.sepia-mode):not(.features-page) .hero,
body:not(.light-mode):not(.sepia-mode):not(.features-page) .content-card,
body:not(.light-mode):not(.sepia-mode):not(.features-page) .related {
  background: rgba(21, 22, 24, 0.94);
  border-color: rgba(255, 255, 255, 0.15);
}

body:not(.light-mode):not(.sepia-mode):not(.features-page) {
  --bg: #0b0c0e;
  --panel: #151618;
  --card: #151618;
  --text: #f7f4ed;
  --muted: #b8bdb2;
  --line: rgba(255, 255, 255, 0.15);
  --soft-border: rgba(255, 255, 255, 0.16);
  color: #f7f4ed;
  background: #0b0c0e;
}

body:not(.light-mode):not(.sepia-mode):not(.features-page) .lead,
body:not(.light-mode):not(.sepia-mode):not(.features-page) .breadcrumbs,
body:not(.light-mode):not(.sepia-mode):not(.features-page) .footer {
  color: #b8bdb2;
}

.features-page[data-feature-theme="sepia"] {
  --feature-bg: #f2e6cf;
  --feature-soft: #ead9ba;
  --feature-panel: #fff8e9;
  --feature-text: #382c21;
  --feature-muted: #756452;
  --feature-line: #d7c3a3;
  --line: rgba(86, 57, 27, 0.16);
  --line-dark: #d7c3a3;
  color-scheme: light;
  color: var(--feature-text);
  background: var(--feature-bg);
}

.features-page[data-feature-theme="sepia"] .feature-visual,
.features-page[data-feature-theme="sepia"] .guide-card,
.features-page[data-feature-theme="sepia"] .mode-card,
.features-page[data-feature-theme="sepia"] .result-demo,
.features-page[data-feature-theme="sepia"] .story-preview,
.features-page[data-feature-theme="sepia"] .guide-jump {
  background: #fff8e9;
  border-color: #d7c3a3;
}

.ai-page.sepia-mode { color:#382c21; background:linear-gradient(145deg,#f2e6cf,#ead9ba); }
.ai-page.sepia-mode .site-header { color:#382c21; background:rgba(255,248,233,.9); }
.ai-page:not(.light-mode):not(.sepia-mode) { color:#f4f7f5; background:linear-gradient(145deg,#0b0c0e,#18191c); }
.ai-page:not(.light-mode):not(.sepia-mode) .site-header { color:#f4f7f5; background:rgba(11,12,14,.92); }
.ai-page:not(.light-mode):not(.sepia-mode) .ai-coming-card,
.ai-page:not(.light-mode):not(.sepia-mode) .ai-preview-form { color:#f4f7f5; background:#171d1a; border-color:rgba(255,255,255,.16); }
.ai-page:not(.light-mode):not(.sepia-mode) .ai-preview-form input,
.ai-page:not(.light-mode):not(.sepia-mode) .ai-preview-form select { color:#f4f7f5; background:#0b0c0e; border-color:rgba(255,255,255,.16); }

@media (max-width: 680px) {
  .about-image-side .creator-profile-link { width: 180px; height: 180px; }
  .setup-actions { gap: 9px; }
  .cyoq-utility-row .btn { flex: 1 1 150px; }
  .sample-dialog-inner { padding: 18px; }
  .sample-dialog-actions .btn { flex: 1 1 140px; }
}

@media (max-width: 390px) {
  .app-topbar { gap: 8px; }
  .split-top-links { gap: 6px; }
  .site-nav-btn { min-height: 40px; }
  .quiz-header { gap: 6px; padding-inline: 8px; }
  .quiz-header .header-left,
  .quiz-header .header-right { gap: 6px; min-width: 0; }
  .quiz-header #quizTitle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .quiz-header .icon-btn,
  .quiz-header .btn { min-width: 40px; padding-inline: 8px; }
  .quiz-header #timerDisplay { white-space: nowrap; }
  .mobile-controls { gap: 6px; padding-inline: 8px; }
  .mobile-controls .btn { min-width: 0; font-size: 0.83rem; }
}

@media (prefers-reduced-motion: reduce) {
  .drm-floating-tools,
  .sample-dialog { scroll-behavior: auto; transition: none !important; }
}
