:root {
    --bg: #050a0f;
    --card-bg: #0b1118;
    --accent: #00f2ff;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --radius: 24px;
    --font-main: 'Inter', sans-serif;
    --font-head: 'Urbanist', sans-serif;
    --slide-width: 1000px;
    --slide-height: 600px;

    --container-padding: 5px;
    --container-height: 256px;
    --container-align-h: center;
    --container-align-v: center;
    --container-font-size: 20px;

    --num-top: 30px;
    --num-right: 40px;
    --num-bottom: auto;
    --num-left: auto;

    --brand-color: #ffffff;
    --brand-top: auto;
    --brand-right: 40px;
    --brand-bottom: 30px;
    --brand-left: auto;

    --btn-bg: rgba(255, 255, 255, 0.1);
    --btn-text: #ffffff;
    --btn-border: rgba(255, 255, 255, 0.2);
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    transition: background 0.3s ease;
    touch-action: none;
}

#editor-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

#main-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

#sidebar {
    width: 200px;
    background: rgba(177, 177, 177, 0.14);
    border-left: 1px solid var(--btn-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

#sidebar h3 {
    color: var(--accent);
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 20px;
}

#slide-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.slide-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--card-bg);
    border: 2px solid var(--btn-border);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: 0.3s;
    overflow: hidden;
}

.slide-thumb .thumb-content {
    width: 1000px;
    /* Base slide width */
    height: 600px;
    /* Base slide height */
    position: absolute;
    top: 0;
    left: 0;
    transform: scale(0.16);
    /* 160px / 1000px roughly */
    transform-origin: top left;
    pointer-events: none;
    background: var(--card-bg);
}

.slide-thumb .thumb-content .branding-text,
.slide-thumb .thumb-content .slide-number {
    display: none;
}

.slide-thumb .thumb-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    font-size: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--text-dim);
    z-index: 10;
}

.slide-thumb.active {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.slide-thumb:hover {
    border-color: var(--accent);
}

.slide-thumb-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    opacity: 0;
    transition: 0.3s;
}

.slide-thumb:hover .slide-thumb-delete {
    opacity: 1;
}

.slide-thumb.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

#slides-container {
    width: var(--slide-width);
    height: var(--slide-height);
    position: relative;
    transition: width 0.5s ease, height 0.5s ease;
}

.slide {
    opacity: 0;
    visibility: hidden;
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    user-select: none;
    display: flex;
    /* Always flex, but hidden by opacity */
}

.slide.active {
    opacity: 1;
    visibility: visible;
}

.off-feature .slide {
    transform: scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.off-feature .slide.active {
    transform: scale(1);
}

.slide-content {
    padding: 50px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    z-index: 2;
}

.slide-content.center {
    justify-content: center;
}

.slide-number {
    position: absolute;
    top: var(--num-top);
    right: var(--num-right);
    bottom: var(--num-bottom);
    left: var(--num-left);
    font-family: var(--font-head);
    font-size: 20px;
    color: var(--accent);
    font-weight: bold;
}

.branding-text {
    position: absolute;
    top: var(--brand-top);
    right: var(--brand-right);
    bottom: var(--brand-bottom);
    left: var(--brand-left);
    font-family: var(--font-head);
    font-size: 14px;
    color: var(--brand-color);
    opacity: 0.8;
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 5;
}

.branding-text a {
    color: inherit;
    text-decoration: none;
    transition: 0.3s;
}

.branding-text a:hover {
    opacity: 1;
    text-shadow: 0 0 10px var(--brand-color);
}

h1,
h2 {
    font-family: var(--font-head);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
}

h1 {
    font-size: 56px;
    line-height: 1.1;
    margin-bottom: 20px;
}

h1 span {
    color: var(--accent);
}

h2 {
    font-size: 32px;
    color: var(--accent);
    margin-bottom: 24px;
}

p {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-dim);
    max-width: 600px;
}

.image-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.vertical .image-container {
    grid-template-columns: 1fr;
    gap: 15px;
}

.vertical .img-box {
    height: calc(var(--container-height) * 0.5);
}

.img-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: calc(var(--radius) * 0.6);
    height: var(--container-height);
    display: flex;
    align-items: var(--container-align-v);
    justify-content: var(--container-align-h);
    text-align: var(--container-align-h);
    padding: var(--container-padding);
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.img-box code,
.img-box span {
    font-size: var(--container-font-size);
}

.badge {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: var(--accent);
    color: #000;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    z-index: 5;
}

.glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.15;
    z-index: 1;
}

.step-list {
    list-style: none;
    padding: 0;
}

.step-list li {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: calc(var(--radius) * 0.5);
}

.step-list i {
    color: var(--accent);
    font-size: 24px;
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    z-index: 10;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(15, 23, 42, 0.3);
    padding: 12px 24px;
    border-radius: 50px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn {
    background: rgba(15, 23, 42, 0.6);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Minimal UI Styles */
.controls-minimal {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    margin-top: 0;
    padding: 12px;
    background: rgba(177, 177, 177, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    width: auto;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

@media (max-height: 850px) and (min-width: 1025px) {
    .controls-minimal {
        display: grid;
        grid-template-columns: repeat(2, 44px);
        grid-auto-rows: min-content;
        gap: 8px;
        padding: 15px;
        border-radius: 30px;
    }

    .controls-minimal .controls-sep {
        grid-column: span 2;
        width: 100% !important;
        height: 1px;
        margin: 4px 0 !important;
    }
}

.controls-minimal .btn {
    padding: 10px;
    width: 44px;
    height: 44px;
    justify-content: center;
    border-radius: 50%;
    gap: 0;
    flex-shrink: 0;
}

.controls-minimal .btn span {
    display: none;
}

.controls-minimal .btn i {
    font-size: 18px;
}

.controls-minimal .controls-sep {
    width: 80%;
    height: 1px;
    margin: 10px auto;
}

.btn:hover {
    background: #ffffff;
    color: #0f172a;
    border-color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#key-hints {
    position: fixed;
    bottom: 20px;
    right: 250px;
    /* Sidebar width + gap */
    display: flex;
    gap: 15px;
    z-index: 5;
    pointer-events: none;
    opacity: 0.6;
    transition: 0.3s;
}

#key-hints:hover {
    opacity: 1;
}

.key-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.key-hint kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-main);
    color: var(--accent);
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.controls-sep {
    width: 1px;
    background: var(--btn-border);
    margin: 0 10px;
}

.btn-green {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.btn-green:hover {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

.btn-red {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-red:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

.btn-blue {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.btn-blue:hover {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #3b82f6 !important;
}

.btn-purple {
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.btn-purple:hover {
    background: #a855f7 !important;
    color: #ffffff !important;
    border-color: #a855f7 !important;
}

#appearance-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1e293b;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid var(--accent);
    z-index: 10000;
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 100px rgba(0, 0, 0, 0.8);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

.settings-group {
    margin-bottom: 20px;
}

.settings-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-dim);
}

.settings-group input,
.settings-group select {
    width: 100%;
    padding: 8px;
    background: #0f172a;
    border: 1px solid #334155;
    color: white;
    border-radius: 8px;
    box-sizing: border-box;
}

.collorpicker {
    height: 40px;
    cursor: pointer;
}

.pos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 80px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid #334155;
}

.pos-dot {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
}

.pos-dot:hover {
    background: rgba(0, 242, 255, 0.2);
    border-color: rgba(0, 242, 255, 0.4);
}

.pos-dot.active {
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent);
    border-color: white;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.preset-btn {
    padding: 15px;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
    color: white;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
}

.cta-button {
    display: inline-block;
    margin-top: 20px;
    padding: 15px 40px;
    background: var(--accent);
    color: #000;
    border-radius: 50px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
}

#save-status {
    position: fixed;
    bottom: 20px;
    background: var(--accent);
    color: #000;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: bold;
    display: none;
    z-index: 1001;
}

.tabs-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    /* Back to center for perfect symmetry without scrollbar */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 0 5px;
    margin-bottom: 20px;
    border: 1px solid #334155;
    overflow: hidden;
}

.tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    white-space: nowrap;
    scroll-behavior: smooth;
    padding: 8px 0;
    flex-grow: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.tabs:active {
    cursor: grabbing;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    cursor: pointer;
    font-size: 13px;
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 8px;
    transition: 0.3s;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
    font-weight: 600;
}

.tabs-nav {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.tabs-nav:hover {
    color: var(--accent);
}

/* Image Editor Field */
.image-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    background: rgba(255, 255, 255, 0.02);
    margin-top: 10px;
    position: relative;
}

.image-dropzone:hover,
.image-dropzone.dragover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.image-preview-container {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    line-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.image-preview-container img {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
}

/* Switch UI */
.editor-switch {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 2px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.editor-switch button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-dim);
    padding: 6px 12px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: 0.2s;
}

.editor-switch button.active {
    background: var(--accent);
    color: #000;
}

.image-field-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* Presentation Mode */
body.presentation-mode #sidebar,
body.presentation-mode #main-controls,
body.presentation-mode #key-hints {
    display: none !important;
}

body.presentation-mode #main-view {
    padding: 0;
    background: #000;
}

body.presentation-mode #slides-container {
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    transform: none !important;
}

body.presentation-mode #slides-container::-webkit-scrollbar {
    display: none;
}

body.presentation-mode .slide {
    border-radius: 0;
    box-shadow: none;
    position: relative;
    height: 100vh;
    width: 100vw;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    flex-shrink: 0;
    transform: none !important;
}

#presentation-controls-mini {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    z-index: 5000;
}

body.presentation-mode #presentation-controls-mini {
    display: flex;
}

.autoplay-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    z-index: 10000;
    width: 0%;
    transition: width 0.1s linear;
}

#editor-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#main-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-only-btn {
    display: none;
}

.mobile-toggle {
    display: none;
    position: fixed;
    z-index: 9500;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 20px;
    align-items: center;
    justify-content: center;
}

#sidebar-toggle {
    top: 20px;
    left: 20px;
}

#menu-toggle {
    top: 20px;
    right: 20px;
}

#slide-viewport {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

#slides-container {
    width: var(--slide-width);
    height: var(--slide-height);
    position: relative;
    /* transition: transform 0.3s ease; Removed width/height transitions to stabilize scaling */
    flex-shrink: 0;
    transform-origin: center center;
}

@media (max-width: 1024px) {
    .mobile-only-btn {
        display: flex;
    }

    .mobile-toggle {
        display: flex;
    }

    #sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 8000;
        transition: left 0.3s ease;
        width: 280px;
        background: #0f172a;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    #sidebar.open {
        left: 0;
    }

    #editor-layout {
        flex-direction: column;
    }

    #main-view {
        padding: 5px;
        width: 100%;
        height: 100vh;
    }

    .controls {
        position: fixed;
        bottom: -100% !important;
        left: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        transition: bottom 0.3s ease;
        z-index: 6000 !important;
        flex-direction: row !important;
        border-radius: 24px 24px 0 0 !important;
        padding: 15px !important;
        background: rgba(15, 23, 42, 0.98) !important;
        justify-content: center !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
        transform: none !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    }

    .controls.open {
        bottom: 0 !important;
    }

    .controls-sep {
        height: 30px;
        width: 1px;
        margin: 0 10px;
        display: block;
    }

    #appearance-popup,
    .settings-popup {
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-sizing: border-box;
        z-index: 11000 !important;
    }

    #key-hints {
        display: none;
    }
}