/* Neutral preview shell; theme styling lives inside the isolated frame. */
.theme-preview-overlay {
    --preview-surface: #f5f5f7;
    --preview-text: #1c1c1e;
    --preview-muted: #636366;
    --preview-group: #e8e8ed;
    --preview-selected: #fff;
    --preview-action: #1c1c1e;
    --preview-action-text: #fff;
    position: fixed; inset: 0; z-index: 20050; box-sizing: border-box;
    height: calc(var(--skxs-vh, 1vh) * 100); padding: 16px;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,.32); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    -webkit-tap-highlight-color: transparent;
}
html[data-color-mode="dark"] .theme-preview-overlay {
    --preview-surface: #242426; --preview-text: #f5f5f7; --preview-muted: #b1b1b7;
    --preview-group: #353538; --preview-selected: #505054;
    --preview-action: #f5f5f7; --preview-action-text: #1c1c1e;
}
.theme-preview-dialog {
    display: flex; flex-direction: column; gap: 12px; width: min(100%, 680px); min-width: 0;
    height: calc(var(--skxs-vh, 1vh) * 91); max-height: calc(var(--skxs-vh, 1vh) * 100 - 32px);
    box-sizing: border-box; padding: 20px; border-radius: 30px; overflow: auto;
    background: var(--preview-surface); color: var(--preview-text);
    border: 1px solid rgba(128,128,128,.2); box-shadow: 0 24px 80px rgba(0,0,0,.22);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
.theme-preview-overlay .theme-preview-head { position: static; inset: auto; width: auto; height: auto; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.theme-preview-eyebrow { margin: 0 0 3px; font-size: .72rem; line-height: 1.4; color: var(--preview-muted); letter-spacing: .02em; }
.theme-preview-head h2 { margin: 0; font-size: 1.2rem; line-height: 1.25; letter-spacing: -.025em; color: var(--preview-text); }
.theme-preview-overlay button { font: inherit; font-size: .82rem; line-height: 1.35; border: 0; cursor: pointer; touch-action: manipulation; }
.theme-preview-overlay button:active { transform: scale(.97); opacity: .8; }
.theme-preview-overlay button:focus-visible { outline: 2px solid var(--preview-text); outline-offset: 3px; }
.theme-preview-overlay button[hidden] { display: none; }
.theme-preview-close { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--preview-group); color: var(--preview-text); font-size: 1.4rem !important; }
#theme-preview-description { margin: 0; font-size: .76rem; line-height: 1.5; color: var(--preview-muted); }
.theme-preview-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.theme-preview-segment { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--preview-group); }
.theme-preview-segment button { min-height: 34px; padding: 6px 12px; border-radius: 9px; background: transparent; color: var(--preview-muted); }
.theme-preview-segment button[aria-pressed="true"] { background: var(--preview-selected); color: var(--preview-text); box-shadow: 0 1px 4px rgba(0,0,0,.09); font-weight: 650; }
.theme-preview-stage { flex: 1 1 auto; min-height: 120px; overflow: hidden; border-radius: 20px; background: var(--preview-group); border: 1px solid rgba(128,128,128,.15); }
.theme-preview-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.theme-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.theme-preview-actions button { min-height: 42px; border-radius: 14px; padding: 10px 14px; font-weight: 650; }
.theme-preview-apply { flex: 1 1 auto; background: var(--preview-action); color: var(--preview-action-text); }
.theme-preview-secondary { flex: 1 1 auto; background: var(--preview-group); color: var(--preview-text); }
.theme-preview-cancel { background: transparent; color: var(--preview-muted); }
@media (max-width: 420px) {
    .theme-preview-dialog { padding: 14px; border-radius: 24px; gap: 10px; }
    .theme-preview-segment button { padding: 6px 9px; }
    .theme-preview-cancel { flex-basis: 100%; }
}
@media (prefers-reduced-transparency: reduce) { .theme-preview-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0,0,0,.6); } }
@media (prefers-contrast: more) { .theme-preview-dialog { border: 2px solid var(--preview-text); } }

/* Sample-only geometry. Keep actual page/theme colors, cards and course classes. */
html[data-theme-preview] { min-height: 100%; }
html[data-theme-preview] body { min-height: 100%; padding: 0; overflow-x: hidden; background: var(--page-bg); }
html[data-theme-preview] .preview-content { padding: 16px; max-width: 620px; margin: auto; }
html[data-theme-preview] [data-preview-page] { position: relative; inset: auto; min-height: 100%; height: auto; padding: 0 0 20px; overflow: visible; animation: none; }
html[data-theme-preview] [hidden] { display: none !important; }
html[data-theme-preview] .preview-note { display: block; margin: 0 0 12px; color: var(--text-sub); font-size: .7rem; line-height: 1.5; }
html[data-theme-preview] .brand-header { padding: 8px 0 16px; margin: 0; }
html[data-theme-preview] .brand-header h1 { font-size: 1.5rem; line-height: 1.3; margin: 0 0 4px; }
html[data-theme-preview] .preview-stack { display: flex; flex-direction: column; gap: 14px; }
html[data-theme-preview] .preview-section-title { font-size: 1rem; line-height: 1.4; margin: 0 0 10px; }
html[data-theme-preview] .preview-card { padding: 18px; }
html[data-theme-preview] .preview-card p { font-size: .88rem; line-height: 1.65; margin: 8px 0 14px; color: var(--text-sub); }
html[data-theme-preview] .preview-card .btn-primary { width: auto; padding: 10px 18px; border: 0; border-radius: 12px; color: #fff; font: inherit; font-size: .82rem; }
html[data-theme-preview] .preview-caption { font-size: .8rem; color: var(--text-sub); line-height: 1.6; }
html[data-theme-preview] .schedule-app { display: block; height: auto; min-height: 0; padding: 0; margin: 0; width: 100%; }
html[data-theme-preview] .schedule-app .header { position: static; min-height: 0; height: auto; padding: 10px 0 16px; }
html[data-theme-preview] .schedule-app .calendar-strip { position: static; display: grid; grid-template-columns: 36px repeat(7,minmax(0,1fr)); padding: 0 0 10px; gap: 0; text-align: center; }
html[data-theme-preview] .preview-day { font-size: .65rem; line-height: 1.6; color: var(--text-sub); }
html[data-theme-preview] .schedule-app .schedule-grid { grid-template-columns: 36px repeat(7,minmax(0,1fr)); grid-template-rows: repeat(6,4.375rem); padding-bottom: 12px; }
html[data-theme-preview] .preview-course-note { display: block; margin-top: 12px; font-size: .73rem; line-height: 1.5; color: var(--text-sub); }
@media (prefers-reduced-motion: reduce) { html[data-theme-preview] *, html[data-theme-preview] *::before, html[data-theme-preview] *::after { animation: none !important; transition: none !important; } }
