/* ═══════════════════════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════════════════════ */
:root {
    /* Backgrounds */
    --bg:             linear-gradient(180deg, #0b1020 0%, #151b31 100%);
    --bg-app:         #0b1020;
    --bg-canvas:      #080c18;
    --bg-panel:       #151b31;
    --bg-surface:     #1a1f35;
    --bg-hover:       #1c2440;
    --bg-active:      #222847;
    --bg-input:       rgba(255,255,255,.05);
    --bg-input-hover: rgba(255,255,255,.08);

    /* Surfaces (cards, modals) */
    --surface:        #151b31;
    --surface-hover:  #1c2440;
    --surface-card:   rgba(255,255,255,.03);

    /* Borders */
    --border:         rgba(255,255,255,.08);
    --border-hi:      rgba(255,255,255,.14);
    --border-input:   rgba(255,255,255,.12);
    --border-focus:   #8b7cf6;

    /* Text */
    --text:           #f5f7fa;
    --text-1:         #e8eaf0;
    --text-2:         #8b8fa8;
    --text-3:         #555870;
    --text-muted:     #a4adc2;
    --text-code:      #8b7cf6;

    /* Accent / Primary */
    --primary:        #8b7cf6;
    --primary-hover:  #7a6bea;
    --accent:         #8b7cf6;
    --accent-soft:    #2a2f5e;
    --accent-glow:    rgba(139,124,246,.25);

    /* Secondary */
    --secondary:      #6074a6;

    /* Semantic */
    --success:        #35c98b;
    --success-bg:     rgba(53,201,139,.15);
    --success-border: rgba(53,201,139,.25);

    --danger:         #f56565;
    --danger-bg:      rgba(245,101,101,.15);
    --danger-border:  rgba(245,101,101,.25);
    --danger-text:    #fca5a5;

    --warning:        #ecc94b;
    --warning-bg:     rgba(236,201,75,.12);

    --green:          #35c98b;
    --red:            #f56565;
    --yellow:         #ecc94b;

    /* Layout - editor */
    --panel-left:     220px;
    --topbar-h:       52px;
    --toolbar-h:      44px;
    --slide-w:        960px;
    --slide-h:        540px;

    /* Typography */
    font-family: 'DM Sans', Inter, ui-sans-serif, system-ui, sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   RESET
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ═══════════════════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════════════════ */
body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

code {
    font-size: .85rem;
    background: rgba(255,255,255,.06);
    padding: 1px 6px;
    border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR (shared)
═══════════════════════════════════════════════════════════ */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 60px;
    background: rgba(11,16,32,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    overflow: hidden;
}

.topbar-logo-mark img {
    width: 100%;
    height: 100%;
    display: block;
}

.topbar-logo-text {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .08em;
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS (shared)
═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
    transition: .2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--text);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--bg-input);
    border-color: var(--border);
    color: var(--text);
}
.btn-secondary:hover { background: var(--bg-input-hover); }

.btn-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: var(--success-border);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: var(--danger-border);
}

/* Editor button variants */
.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: none;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-stroke {
    background: transparent;
    color: var(--text-1);
    border: 1px solid var(--border-hi);
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
}
.btn-stroke:hover { background: var(--bg-hover); }

.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
}
.btn-accent:hover { filter: brightness(1.1); }

/* ═══════════════════════════════════════════════════════════
   LANGUAGE DROPDOWN (shared)
═══════════════════════════════════════════════════════════ */
.lang-dropdown { position: relative; display: inline-block; }

.lang-trigger {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 14px; border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text); font-size: .9rem;
    font-family: inherit; cursor: pointer;
    transition: .2s ease;
}
.lang-trigger:hover { background: var(--bg-input-hover); }

.lang-trigger .chevron {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform .2s;
}
.lang-trigger.open .chevron { transform: rotate(180deg); }

.lang-menu {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden;
    min-width: 160px; z-index: 999;
    box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.lang-menu.open { display: block; }

.lang-opt {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 16px;
    background: transparent; border: none;
    color: var(--text-muted); font-size: .9rem;
    font-family: inherit; cursor: pointer; text-align: left;
    transition: .15s;
}
.lang-opt:hover { background: var(--surface-hover); color: var(--text); }
.lang-opt.active { color: var(--primary); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   FORMS (shared)
═══════════════════════════════════════════════════════════ */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.form-input {
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
    width: 100%;
}
.form-input:focus { border-color: var(--border-focus); }
.form-input::placeholder { color: var(--text-muted); }

.form-input-file {
    padding: 6px 10px;
    cursor: pointer;
}

.alert {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: .875rem;
    margin-bottom: 12px;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}
.alert--hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   INDEX — Layout
═══════════════════════════════════════════════════════════ */
.container {
    max-width: 1000px;
    margin: auto;
    padding: 100px 24px 60px;
}

.hero { margin-bottom: 50px; }

.hero h1 {
    font-size: 3rem;
    margin: 0 0 12px 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 650px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.section-title {
    margin-top: 50px;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

/* ── Cards ── */
.card {
    background: var(--surface-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    margin-bottom: 16px;
    transition: .2s ease;
}
.card:hover {
    background: var(--surface-hover);
    transform: translateY(-2px);
}
.card h3 { margin-top: 0; margin-bottom: 10px; }

.card-meta {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.card-lock {
    font-size: .75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.card-delete-form { margin: 0; }

/* ── Action grid ── */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}
@media(max-width: 640px) {
    .action-grid { grid-template-columns: 1fr; }
}

.action-card {
    background: var(--surface-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
}
.action-card h4 {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
}
.action-card p {
    margin: 0 0 16px 0;
    color: var(--text-muted);
    font-size: .875rem;
    line-height: 1.5;
}

.action-btn-full { width: 100%; }

/* ── Empty state ── */
.empty {
    color: var(--text-muted);
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 16px;
}

/* ═══════════════════════════════════════════════════════════
   EDITOR — Base
═══════════════════════════════════════════════════════════ */
body.editor {
    overflow: hidden;
    height: 100%;
    background: var(--bg-app);
    color: var(--text-1);
}

html.editor { height: 100%; overflow: hidden; }

/* ── Editor topbar ── */
#topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.tb-left  { display: flex; align-items: center; gap: 10px; }
.tb-right { display: flex; align-items: center; gap: 8px; }

#pres-title {
    font-size: 14px; font-weight: 500;
    background: transparent; border: none; color: var(--text-1);
    padding: 4px 8px; border-radius: 6px;
    min-width: 180px; max-width: 320px;
    outline: none; cursor: text;
    font-family: inherit;
}
#pres-title:hover  { background: var(--bg-hover); }
#pres-title:focus  { background: var(--bg-active); outline: 1px solid var(--accent); }

#save-status {
    font-size: 11px; padding: 3px 9px; border-radius: 20px;
    background: var(--surface); color: var(--text-2);
    transition: all .3s;
}
#save-status.unsaved { background: var(--danger-bg);  color: var(--red); }
#save-status.saving  { background: var(--warning-bg); color: var(--yellow); }
#save-status.saved   { background: var(--success-bg); color: var(--green); }

/* ── Format toolbar ── */
#format-toolbar {
    position: fixed;
    top: var(--topbar-h); left: var(--panel-left); right: 0; z-index: 90;
    height: var(--toolbar-h);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 2px; padding: 0 12px;
    overflow-x: auto;
}
#format-toolbar.panel-open { right: 240px; }

.ft-sep {
    width: 1px; height: 20px;
    background: var(--border-hi);
    margin: 0 6px; flex-shrink: 0;
}

.ft-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 5px;
    background: transparent; border: none; cursor: pointer;
    color: var(--text-2); font-size: 13px; font-family: inherit;
    transition: all .12s; flex-shrink: 0;
}
.ft-btn:hover  { background: var(--bg-hover); color: var(--text-1); }
.ft-btn.active { background: var(--accent-soft); color: var(--accent); }
.ft-btn b { font-weight: 700; }
.ft-btn i { font-style: italic; }
.ft-btn u { text-decoration: underline; }

.ft-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-1); font-size: 12px; font-family: inherit;
    padding: 3px 6px; border-radius: 5px; cursor: pointer; outline: none;
}
.ft-select:hover { border-color: var(--border-hi); }

.ft-select--font   { width: 110px; }
.ft-select--size   { width: 62px; }
.ft-select--theme  { font-size: 12px; }

.ft-color-btn {
    position: relative; width: 30px; height: 30px; border-radius: 5px;
    background: transparent; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.ft-color-btn input[type=color] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}
.ft-color-preview {
    width: 16px; height: 16px; border-radius: 3px;
    border: 1.5px solid var(--border-hi); pointer-events: none;
}
.ft-color-preview--dashed { border-style: dashed; background: transparent; }

.ft-label {
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    flex-shrink: 0;
}

.ft-section { display: flex; align-items: center; gap: 2px; }
.ft-spacer  { flex: 1; }

#zoom-label {
    font-size: 11px; color: var(--text-2);
    font-family: 'DM Mono', monospace;
    padding: 3px 8px; background: var(--surface); border-radius: 4px;
    user-select: none; flex-shrink: 0;
}

#zoom-range { width: 90px; accent-color: var(--accent); flex-shrink: 0; }

/* ── Slide panel (left) ── */
#slide-panel {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: var(--panel-left); z-index: 80;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    overflow: hidden;
}

.sp-header {
    padding: 10px 12px 8px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sp-header span {
    font-size: 11px; font-weight: 600;
    letter-spacing: .06em; color: var(--text-2); text-transform: uppercase;
}

.sp-add-btn {
    width: 24px; height: 24px; border-radius: 5px;
    background: var(--bg-hover); border: 1px solid var(--border-hi);
    color: var(--text-2); font-size: 16px; cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: all .12s;
}
.sp-add-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

#slide-list {
    flex: 1; overflow-y: auto; padding: 8px;
    display: flex; flex-direction: column; gap: 6px;
}
#slide-list::-webkit-scrollbar { width: 4px; }
#slide-list::-webkit-scrollbar-track { background: transparent; }
#slide-list::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }

.slide-thumb {
    position: relative; flex-shrink: 0;
    width: 100%; aspect-ratio: 16/9;
    border-radius: 6px; overflow: hidden;
    border: 2px solid transparent;
    background: #fff;
    cursor: pointer; transition: all .15s;
}
.slide-thumb:hover  { border-color: var(--border-hi); }
.slide-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.slide-thumb iframe {
    width: var(--slide-w); height: var(--slide-h);
    border: none; pointer-events: none;
    transform-origin: top left;
}

.thumb-num {
    position: absolute; bottom: 4px; right: 6px;
    font-size: 9px; font-weight: 600; color: var(--text-2);
    font-family: 'DM Mono', monospace;
}

.thumb-del {
    position: absolute; top: 4px; right: 4px;
    width: 18px; height: 18px; border-radius: 3px;
    background: rgba(0,0,0,.6); border: none; cursor: pointer;
    color: #fff; font-size: 10px;
    display: none; align-items: center; justify-content: center;
}
.slide-thumb:hover .thumb-del { display: flex; }
.thumb-del:hover { background: var(--red); }

/* ── Canvas area ── */
#canvas-area {
    position: fixed;
    background: var(--bg-canvas);
    top: calc(var(--topbar-h) + var(--toolbar-h));
    left: var(--panel-left);
    right: 0; bottom: 0;
    overflow: auto;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 40px 80px;
}
#canvas-area.panel-open { right: 240px; }
#canvas-area::-webkit-scrollbar { width: 8px; height: 8px; }
#canvas-area::-webkit-scrollbar-track { background: transparent; }
#canvas-area::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }

#slide-canvas {
    position: relative; flex-shrink: 0;
    width: var(--slide-w); height: var(--slide-h);
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 24px 80px rgba(0,0,0,.7);
    overflow: hidden;
    cursor: default;
    transition: box-shadow .2s;
}
#slide-canvas.drag-over {
    box-shadow: 0 0 0 3px var(--accent), 0 24px 80px rgba(0,0,0,.7);
}

/* ── Slide elements ── */
.slide-el {
    position: absolute;
    cursor: move;
    user-select: none;
    outline: none;
}
.slide-el.selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.slide-el.editing  { cursor: text; outline: 2px solid rgba(91,106,248,.67); outline-offset: 1px; }

.el-text {
    min-width: 80px; min-height: 24px;
    padding: 4px 6px;
    word-break: break-word;
    line-height: 1.4;
}
.el-text[contenteditable="true"] { cursor: text; }
.el-text:empty::before { content: attr(data-placeholder); color: #aaa; pointer-events: none; }

.el-image { overflow: hidden; }
.el-image img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    pointer-events: none;
}

.el-shape svg { width: 100%; height: 100%; display: block; }

.resize-handle {
    position: absolute; right: -5px; bottom: -5px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); border: 2px solid #fff;
    cursor: se-resize; z-index: 10;
    display: none;
}
.slide-el.selected .resize-handle { display: block; }

#empty-hint {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; pointer-events: none; opacity: .35;
}
.hint-icon { font-size: 40px; }
#empty-hint p { font-size: 14px; color: #666; text-align: center; }

/* Fragment badge */
.fragment-badge {
    position: absolute; top: -9px; left: -9px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    z-index: 20; pointer-events: none;
    box-shadow: 0 0 0 2px var(--bg-app);
}

/* iFrame placeholder */
.el-iframe-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
    background: var(--bg-panel);
    border: 2px dashed var(--border-hi);
    border-radius: 4px; overflow: hidden; pointer-events: none;
}
.el-iframe-placeholder .if-icon { font-size: 28px; }
.el-iframe-placeholder .if-url {
    font-size: 10px; color: var(--text-2);
    max-width: 90%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
}

/* ── Insert FAB ── */
#insert-fab {
    position: fixed; bottom: 28px; right: 28px; z-index: 200;
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent); border: none; cursor: pointer; color: #fff;
    font-size: 22px; box-shadow: 0 4px 20px var(--accent-glow);
    transition: all .18s;
    display: flex; align-items: center; justify-content: center;
}
#insert-fab:hover  { transform: scale(1.1); box-shadow: 0 6px 30px var(--accent-glow); }
#insert-fab.open   { transform: rotate(45deg); }

#insert-menu {
    position: fixed; bottom: 86px; right: 28px; z-index: 199;
    background: var(--surface); border: 1px solid var(--border-hi);
    border-radius: 12px; padding: 8px;
    display: flex; flex-direction: column; gap: 2px; width: 180px;
    box-shadow: 0 16px 50px rgba(0,0,0,.5);
    transform: translateY(8px) scale(.97); opacity: 0;
    pointer-events: none; transition: all .18s;
}
#insert-menu.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: all; }

.im-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 7px; cursor: pointer;
    font-size: 13px; color: var(--text-2); transition: all .12s;
    border: none; background: transparent; font-family: inherit; text-align: left;
    width: 100%;
}
.im-item:hover { background: var(--bg-hover); color: var(--text-1); }
.im-item .im-icon { font-size: 16px; width: 20px; text-align: center; }

/* ── Prop panel (right) ── */
#prop-panel {
    position: fixed;
    top: calc(var(--topbar-h) + var(--toolbar-h)); right: 0; bottom: 0;
    width: 240px; z-index: 70;
    background: var(--bg-panel); border-left: 1px solid var(--border);
    display: none; flex-direction: column;
    transition: all .2s;
}
#prop-panel.open { display: flex; }

.pp-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.pp-header span { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .05em; }

.pp-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-2); font-size: 14px; padding: 2px;
}
.pp-close:hover { color: var(--text-1); }

.pp-body {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 14px;
}

.pp-group label {
    display: block; font-size: 11px; font-weight: 600;
    color: var(--text-2); letter-spacing: .06em;
    text-transform: uppercase; margin-bottom: 6px;
}

.pp-input {
    width: 100%; padding: 7px 10px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-1); font-size: 13px; font-family: inherit;
    outline: none;
}
.pp-input:focus { border-color: var(--accent); }

.pp-color {
    width: 100%; height: 36px;
    border-radius: 6px; border: 1px solid var(--border);
    cursor: pointer;
}

.pp-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pp-swatch {
    width: 24px; height: 24px; border-radius: 4px; cursor: pointer;
    border: 2px solid transparent; transition: all .12s;
}
.pp-swatch:hover, .pp-swatch.active { border-color: #fff; }

.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.theme-btn {
    padding: 7px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--surface); cursor: pointer; color: var(--text-2);
    font-size: 11px; font-family: inherit; transition: all .12s; text-align: center;
}
.theme-btn:hover  { border-color: var(--accent); color: var(--text-1); }
.theme-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   MODALS (shared)
═══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface); border: 1px solid var(--border-hi);
    border-radius: 14px; padding: 28px; width: 460px; max-width: 90vw;
    box-shadow: 0 30px 100px rgba(0,0,0,.6);
    animation: modal-in .18s ease;
}
@keyframes modal-in { from { opacity:0; transform:scale(.96) translateY(8px); } }

.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; color: var(--text-1); }

.modal-field { margin-bottom: 14px; }
.modal-field label {
    display: block; font-size: 12px; color: var(--text-2);
    margin-bottom: 6px; font-weight: 500;
}
.modal-field input, .modal-field select {
    width: 100%; padding: 9px 12px;
    background: var(--bg-panel); border: 1px solid var(--border-hi);
    border-radius: 8px; color: var(--text-1); font-size: 14px; font-family: inherit;
    outline: none; transition: border-color .15s;
}
.modal-field input:focus, .modal-field select:focus { border-color: var(--accent); }

.modal-actions {
    display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px;
}
.modal-actions--center { justify-content: center; }

/* ── Save modal ── */
.save-tabs {
    display: flex; margin-bottom: 20px;
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border-hi);
}
.save-tab {
    flex: 1; padding: 9px 0; text-align: center; cursor: pointer;
    font-size: 13px; font-weight: 500; font-family: inherit; border: none;
    background: var(--bg-panel); color: var(--text-2); transition: all .15s;
}
.save-tab.active { background: var(--accent); color: #fff; }
.save-tab:not(.active):hover { background: var(--bg-hover); color: var(--text-1); }

.save-pane { display: none; }
.save-pane.active { display: block; }

.save-hint { font-size: 12px; color: var(--text-2); margin-bottom: 14px; line-height: 1.5; }

.save-id-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg-panel); border: 1px solid var(--border-hi);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}
.save-id-box code {
    flex: 1; font-size: 14px; color: var(--accent);
    font-family: 'DM Mono', monospace; letter-spacing: .06em;
    background: transparent; padding: 0;
}
.save-id-box button {
    background: none; border: none; cursor: pointer;
    color: var(--text-2); font-size: 14px; padding: 2px 4px; border-radius: 4px;
}
.save-id-box button:hover { color: var(--text-1); background: var(--bg-hover); }

.save-error {
    font-size: 12px; color: var(--red);
    margin-top: -6px; margin-bottom: 10px;
    display: none;
}

.offline-icon { font-size: 40px; text-align: center; margin: 8px 0 12px; }
.offline-desc {
    font-size: 13px; color: var(--text-2);
    line-height: 1.6; margin-bottom: 20px; text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   TOAST (shared)
═══════════════════════════════════════════════════════════ */
#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--surface); border: 1px solid var(--border-hi);
    padding: 10px 20px; border-radius: 40px;
    font-size: 13px; color: var(--text-1);
    box-shadow: 0 8px 30px rgba(0,0,0,.4);
    z-index: 9999; pointer-events: none;
    opacity: 0; transition: opacity .2s;
    white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   VIEW — Reveal.js slide layout
═══════════════════════════════════════════════════════════ */
.slide-root {
    position: relative;
    width: 960px;
    height: 540px;
    overflow: hidden;
}

/* slide-el is shared with editor but view needs its own base */
.reveal .slide-el {
    position: absolute;
    box-sizing: border-box;
    line-height: 1.4;
    padding: 4px 6px;
    cursor: default;
    user-select: text;
}
.reveal .slide-el img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reveal .slide-el svg { width: 100%; height: 100%; display: block; }
.reveal .slide-el iframe { width: 100%; height: 100%; border: none; display: block; }