:root {
    --primary: #EF4444;
    --primary-hover: #DC2626;
    --primary-glow: rgba(239, 68, 68, .3);
    --secondary: #F87171;
    --accent: #FBBF24;
    --accent-hover: #F59E0B;
    --bg: #1A0A0A;
    --bg-surface: #231010;
    --bg-elevated: #2D1515;
    --bg-card: rgba(45, 21, 21, .7);
    --text: #F5E6E6;
    --text-secondary: #B08888;
    --text-muted: #7A5555;
    --border: rgba(239, 68, 68, .15);
    --border-strong: rgba(239, 68, 68, .3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', monospace;
    --shadow: 0 4px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .6);
    --transition: 250ms cubic-bezier(.4, 0, .2, 1)
}

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

html,
body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
}

.hidden {
    display: none !important
}

.editor-view {
    display: flex;
    flex-direction: column;
    height: 100vh
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px
}

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

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.02em
}

.slide-count {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border)
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px
}

.theme-selector select {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 6px 12px;
    font-family: var(--font);
    font-size: .8rem;
    cursor: pointer;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23B08888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center
}

.theme-selector select:hover {
    border-color: var(--border-strong)
}

.theme-selector select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 2px 12px var(--primary-glow)
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--primary-glow)
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border)
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-elevated)
}

.btn-sm {
    padding: 4px 10px;
    font-size: .75rem
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition)
}

.btn-icon:hover {
    color: var(--text);
    border-color: var(--border-strong)
}

.btn-icon:disabled {
    opacity: .4;
    cursor: not-allowed
}

.btn:focus-visible,
.btn-icon:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden
}

.editor-pane,
.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden
}

.editor-pane {
    border-right: 1px solid var(--border)
}

.pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0
}

.pane-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em
}

.help-hint {
    font-size: .7rem;
    color: var(--text-muted)
}

.help-hint code {
    background: var(--bg-elevated);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: .65rem;
    color: var(--accent)
}

.markdown-textarea {
    flex: 1;
    width: 100%;
    padding: 20px;
    background: var(--bg);
    color: var(--text);
    border: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: .875rem;
    line-height: 1.7;
    tab-size: 2;
    outline: none;
    overflow-y: auto
}

.markdown-textarea::placeholder {
    color: var(--text-muted);
    opacity: .6
}

.markdown-textarea::-webkit-scrollbar {
    width: 6px
}

.markdown-textarea::-webkit-scrollbar-track {
    background: transparent
}

.markdown-textarea::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px
}

.editor-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    font-size: .7rem;
    color: var(--text-muted);
    flex-shrink: 0
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: 8px
}

.slide-num {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 48px;
    text-align: center
}

.slide-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
    background: var(--bg);
    position: relative
}

.slide-frame {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 16/9;
    background: var(--bg-surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center
}

.slide-content {
    padding: 40px;
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.slide-content h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    line-height: 1.2
}

.slide-content h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px
}

.slide-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 10px
}

.slide-content p {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 12px
}

.slide-content ul,
.slide-content ol {
    margin: 8px 0 12px 20px;
    font-size: .9rem;
    line-height: 1.8;
    color: var(--text)
}

.slide-content li::marker {
    color: var(--primary)
}

.slide-content strong {
    color: var(--accent);
    font-weight: 700
}

.slide-content em {
    color: var(--secondary);
    font-style: italic
}

.slide-content code {
    font-family: var(--font-mono);
    font-size: .8rem;
    background: rgba(239, 68, 68, .1);
    color: var(--secondary);
    padding: 2px 6px;
    border-radius: 4px
}

.slide-content pre {
    background: #0D0505;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0
}

.slide-content pre code {
    background: none;
    padding: 0;
    font-size: .75rem;
    line-height: 1.6;
    color: var(--text)
}

.slide-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 8px 16px;
    margin: 12px 0;
    background: rgba(239, 68, 68, .05);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text-secondary);
    font-style: italic
}

.slide-content img {
    max-width: 100%;
    max-height: 60%;
    border-radius: var(--radius-sm);
    margin: 8px auto;
    display: block
}

.slide-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px
}

.slide-content hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 16px 0
}

.progress-bar-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    max-width: 600px;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 2px;
    transition: width var(--transition);
    width: 0%
}

.speaker-notes-panel {
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    background: var(--bg-surface);
    max-height: 120px;
    overflow-y: auto;
    flex-shrink: 0
}

.speaker-notes-content {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 6px
}

.thumbnails-bar {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    overflow-x: auto;
    flex-shrink: 0
}

.thumbnails-bar::-webkit-scrollbar {
    height: 4px
}

.thumbnails-bar::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 2px
}

.thumbnail {
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition);
    position: relative
}

.thumbnail:hover {
    border-color: var(--border-strong)
}

.thumbnail.active {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow)
}

.thumbnail-content {
    transform: scale(.15);
    transform-origin: top left;
    width: 800px;
    padding: 30px;
    pointer-events: none;
    font-size: 14px
}

.thumbnail-number {
    position: absolute;
    bottom: 3px;
    right: 5px;
    font-size: .6rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(26, 10, 10, .8);
    padding: 1px 5px;
    border-radius: 3px
}

.presentation-view {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center
}

.presentation-slide {
    width: 90vw;
    height: 85vh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    overflow: auto
}

.presentation-slide h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    line-height: 1.15
}

.presentation-slide h2 {
    font-size: clamp(1.5rem, 3.5vw, 2.8rem);
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 20px
}

.presentation-slide h3 {
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 16px
}

.presentation-slide p {
    font-size: clamp(1rem, 2vw, 1.5rem);
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 16px
}

.presentation-slide ul,
.presentation-slide ol {
    margin: 12px 0 20px 30px;
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 2;
    color: var(--text)
}

.presentation-slide li::marker {
    color: var(--primary)
}

.presentation-slide strong {
    color: var(--accent)
}

.presentation-slide em {
    color: var(--secondary)
}

.presentation-slide code {
    font-family: var(--font-mono);
    font-size: .9em;
    background: rgba(239, 68, 68, .1);
    color: var(--secondary);
    padding: 2px 8px;
    border-radius: 4px
}

.presentation-slide pre {
    background: #0D0505;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    overflow-x: auto;
    margin: 16px 0
}

.presentation-slide pre code {
    background: none;
    padding: 0;
    font-size: clamp(.8rem, 1.5vw, 1.1rem);
    line-height: 1.6;
    color: var(--text)
}

.presentation-slide blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 24px;
    margin: 16px 0;
    background: rgba(239, 68, 68, .05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: var(--text-secondary);
    font-style: italic
}

.presentation-slide img {
    max-width: 80%;
    max-height: 50vh;
    border-radius: var(--radius);
    margin: 16px auto;
    display: block
}

.presentation-slide a {
    color: var(--accent);
    text-decoration: underline
}

.presentation-slide hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 24px 0
}

.presentation-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--border)
}

.presentation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width var(--transition)
}

.presentation-controls {
    position: fixed;
    bottom: 16px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity var(--transition)
}

.presentation-view:hover .presentation-controls {
    opacity: 1
}

.presentation-controls span {
    font-size: .75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums
}

.token-keyword {
    color: #EF4444;
    font-weight: 600
}

.token-string {
    color: #FBBF24
}

.token-comment {
    color: #7A5555;
    font-style: italic
}

.token-number {
    color: #F87171
}

.token-function {
    color: #60A5FA
}

.token-operator {
    color: #B08888
}

.token-punctuation {
    color: #7A5555
}

.token-class {
    color: #34D399
}

.token-tag {
    color: #EF4444
}

.token-attr {
    color: #FBBF24
}

.token-builtin {
    color: #C084FC
}

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(26, 10, 10, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px)
}

.drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 600;
    animation: dropPulse 2s ease-in-out infinite
}

@keyframes dropPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: .9
    }

    50% {
        transform: scale(1.05);
        opacity: 1
    }
}

.theme-ocean {
    --primary: #3B82F6;
    --primary-hover: #2563EB;
    --primary-glow: rgba(59, 130, 246, .3);
    --secondary: #60A5FA;
    --accent: #22D3EE;
    --bg: #0A0F1A;
    --bg-surface: #0F1729;
    --bg-elevated: #15203A;
    --bg-card: rgba(21, 32, 58, .7);
    --text: #E0E7F5;
    --text-secondary: #8893AD;
    --text-muted: #556080;
    --border: rgba(59, 130, 246, .15);
    --border-strong: rgba(59, 130, 246, .3)
}

.theme-forest {
    --primary: #22C55E;
    --primary-hover: #16A34A;
    --primary-glow: rgba(34, 197, 94, .3);
    --secondary: #4ADE80;
    --accent: #A3E635;
    --bg: #0A1A0F;
    --bg-surface: #0F2917;
    --bg-elevated: #153A20;
    --bg-card: rgba(21, 58, 32, .7);
    --text: #E0F5E7;
    --text-secondary: #88AD93;
    --text-muted: #556B5D;
    --border: rgba(34, 197, 94, .15);
    --border-strong: rgba(34, 197, 94, .3)
}

.theme-royal {
    --primary: #8B5CF6;
    --primary-hover: #7C3AED;
    --primary-glow: rgba(139, 92, 246, .3);
    --secondary: #A78BFA;
    --accent: #F472B6;
    --bg: #0F0A1A;
    --bg-surface: #170F29;
    --bg-elevated: #20153A;
    --bg-card: rgba(32, 21, 58, .7);
    --text: #EDE0F5;
    --text-secondary: #9688AD;
    --text-muted: #6B5580;
    --border: rgba(139, 92, 246, .15);
    --border-strong: rgba(139, 92, 246, .3)
}

.theme-minimal {
    --primary: #1F2937;
    --primary-hover: #111827;
    --primary-glow: rgba(31, 41, 55, .15);
    --secondary: #4B5563;
    --accent: #6366F1;
    --bg: #FFFFFF;
    --bg-surface: #F9FAFB;
    --bg-elevated: #F3F4F6;
    --bg-card: rgba(243, 244, 246, .7);
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: rgba(31, 41, 55, .1);
    --border-strong: rgba(31, 41, 55, .2)
}

.theme-minimal .markdown-textarea {
    color: #1F2937
}

.theme-minimal .slide-content h1,
.theme-minimal .presentation-slide h1 {
    background: linear-gradient(135deg, #1F2937, #6366F1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

@media(max-width:768px) {
    .editor-main {
        flex-direction: column
    }

    .editor-pane {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 40vh
    }

    .header-actions {
        gap: 4px
    }

    .help-hint {
        display: none
    }

    .btn {
        padding: 7px 10px
    }

    .slide-frame {
        max-width: 100%
    }

    .slide-content {
        padding: 24px
    }

    .slide-content h1 {
        font-size: 1.4rem
    }

    .slide-content h2 {
        font-size: 1.1rem
    }

    .presentation-slide {
        padding: 30px 40px
    }

    .thumbnails-bar {
        display: none
    }
}

@media(max-width:480px) {
    .logo h1 {
        display: none
    }

    .theme-selector {
        display: none
    }

    .editor-pane {
        max-height: 35vh
    }
}

@media print {

    .header,
    .thumbnails-bar,
    .editor-pane,
    .speaker-notes-panel,
    .pane-header,
    .presentation-controls,
    .progress-bar-container {
        display: none !important
    }

    .editor-view {
        height: auto;
        overflow: visible
    }

    .editor-main {
        display: block
    }

    .preview-pane {
        display: block
    }

    .slide-preview-container {
        padding: 0;
        page-break-inside: avoid
    }

    .slide-frame {
        max-width: 100%;
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-after: always;
        aspect-ratio: auto;
        min-height: 90vh
    }
}