:root {
    --bg: #121316;
    --panel: #1a1c21;
    --panel-alt: #202329;
    --border: #2c2f36;
    --text: #edeeef;
    --text-muted: #8d9199;
    --accent: var(--primary);
    --accent-soft: rgba(226, 163, 63, 0.14);
    --accent-dim: var(--hover);
    --radius: 4px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

p {
    color: var(--dark);
}

.page-hero-title {
    font-weight: 800;
    display: block;
    font-family: 'Bricolage Grotesque', 'DM Sans', sans-serif;
    font-size: clamp(2.2rem, 5.5vw, 3.75rem);
    background: linear-gradient(to right, #a3c43a, #a866ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ---------- Layout ---------- */
.studio {
    display: flex;
    min-height: calc(100vh - 76px);
}

.canvas-zone {
    flex: 1;
    padding: 28px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px dashed var(--dark);
    border-radius: 2px;
    /* background: var(--bg); */
}

.control-rail {
    width: 400px;
    flex-shrink: 0;
    border-left: 1px solid var(--border);
    /* background: var(--panel); */
    padding: 24px 26px 100px;
    overflow-y: auto;
    max-height: calc(100vh - 76px);
    position: sticky;
    top: 76px;
}

@media (max-width: 991.98px) {
    .studio {
        flex-direction: column;
    }

    .control-rail {
        width: 100%;
        position: static;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-bottom: 40px;
    }
}

/* ---------- Canvas toolbar ---------- */
.canvas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-info {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-info span b {
    color: var(--text);
    font-weight: 500;
}

.toolbar-buttons .btn {
    font-size: 0.8rem;
}

/* ---------- Stage ---------- */
.stage {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-image:
        linear-gradient(45deg, #1e2025 25%, transparent 25%),
        linear-gradient(-45deg, #1e2025 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1e2025 75%),
        linear-gradient(-45deg, transparent 75%, #1e2025 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0px;
    background-color: #161719;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 420px;
    overflow: hidden;
}

.stage canvas {
    max-width: 100%;
    max-height: 68vh;
    display: block;
}

.stage.empty {
    cursor: pointer;
}

.dropzone {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    pointer-events: none;
}

.dropzone i {
    font-size: 2.4rem;
    color: var(--accent);
    display: block;
    margin-bottom: 14px;
}

.dropzone .dz-title {
    color: var(--text);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.dropzone .dz-sub {
    font-size: 0.82rem;
}

.stage.drag-over {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.compare-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(18, 19, 22, 0.85);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 2px;
    letter-spacing: 0.02em;
    display: none;
}

/* ---------- Control rail sections ---------- */
.rail-section {
    margin-bottom: 28px;
}

.rail-section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rail-section-title i {
    /* color: var(--accent); */
    font-size: 0.95rem;
}

.rail-section-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.rail-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* Quality readout block */
.quality-readout {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.quality-readout-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 3px 0;
}

.quality-readout-row b {
    color: var(--text);
    font-weight: 500;
}

.quality-readout-row.savings b {
    color: var(--accent);
}

/* Sliders */
.slider-row {
    margin-bottom: 18px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.slider-label .val {
    color: var(--accent);
    font-size: 0.78rem;
    min-width: 42px;
    text-align: right;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #121316;
    box-shadow: 0 0 0 1px var(--accent);
    margin-top: -1px;
}

input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid #121316;
    box-shadow: 0 0 0 1px var(--accent);
}

input[type="range"]:disabled {
    opacity: 0.35;
}

/* format select */
.format-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.format-pill {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    background: var(--panel-alt);
    transition: border-color .15s ease, color .15s ease;
}

.format-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Buttons */
.btn-accent {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #121316;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-accent:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    color: #121316;
}

.btn-outline-line {
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.82rem;
    background: transparent;
}

.btn-outline-line:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: transparent;
}

.btn-ghost {
    color: var(--text-muted);
    font-size: 0.78rem;
    background: transparent;
    border: none;
}

.btn-ghost:hover {
    color: var(--accent);
}

#fileInput {
    display: none;
}

.rail-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-msg {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-alt);
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.82rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 50;
}

.toast-msg.show {
    opacity: 1;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--panel);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ================================
   Section Heading
================================ */

.section-heading {
    max-width: 700px;

    margin: 100px auto 45px;
}

.section-tag {
    display: inline-block;

    margin-bottom: 12px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 750;
    letter-spacing: 1px;
}

.section-heading h2 {
    margin-bottom: 12px;

    font-size: clamp(26px, 4vw, 34px);
    font-weight: 750;
    letter-spacing: -0.8px;
}

.section-heading p {
    margin: 0;

    color: var(--muted);
}


/* ================================
   Feature Cards
================================ */

.feature-card {
    height: 100%;

    padding: 26px;

    border: 1px solid var(--border);
    border-radius: 16px;

    background: var(--white);

    box-shadow: var(--shadow-sm);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 20px;

    border-radius: 12px;

    background: rgba(108, 92, 231, 0.10);

    color: var(--primary);

    font-size: 22px;
}

.feature-card h4 {
    margin-bottom: 10px;

    font-size: 17px;
    font-weight: 700;
}

.feature-card p {
    margin: 0;

    color: var(--muted);

    font-size: 14px;
    line-height: 1.7;
}


/* ================================
   How To Section
================================ */

.how-section {
    padding-bottom: 20px;
}

.steps-container {
    display: flex;
    align-items: flex-start;

    gap: 15px;

    max-width: 1100px;

    margin: 0 auto;
    margin-bottom: 50px;
}

.step {
    flex: 1;

    text-align: center;
}

.step h4 {
    color: var(--dark);
}
.feature-card h4 {
    color: var(--dark);
}

.step-number {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 18px;

    border-radius: 50%;

    background: var(--primary);

    color: var(--dark);

    font-weight: 750;
}

.step h4 {
    margin-bottom: 8px;

    font-size: 16px;
    font-weight: 700;
}

.step p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.6;
}

.step-line {
    width: 70px;
    height: 1px;

    margin-top: 24px;

    background: var(--border);
}