:root {
    --bg: #08080b;
    --panel: #111114;
    --panel-2: #151519;
    --border: #25252c;
    --border-light: #303039;
    --text: #f5f5f7;
    --muted: #94949f;
    --muted-2: #6e6e78;
    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
select {
    font: inherit;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent-hover);
    outline-offset: 2px;
}

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 26px;
    border-bottom: 1px solid var(--border);
    background: #0b0b0f;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.brand-copy {
    min-width: 0;
}

.brand-name {
    font-size: 15px;
    font-weight: 750;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.top-status {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(245px, 285px) minmax(0, 1fr);
    min-height: calc(100vh - 72px);
}

.sidebar {
    padding: 18px;
    border-right: 1px solid var(--border);
    background: #0b0b0e;
}

.panel {
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
}

.panel-title {
    margin-bottom: 14px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
}

label {
    display: block;
    margin: 12px 0 7px;
    color: #b8b8c1;
    font-size: 11px;
    font-weight: 650;
}

input[type="text"],
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: #0d0d11;
    color: var(--text);
    padding: 0 11px;
    font-size: 12px;
}

input[type="text"]:focus,
select:focus {
    border-color: var(--accent);
    outline: none;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.primary-button,
.secondary-button,
.small-button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.primary-button {
    width: 100%;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

.primary-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #996df7, #7c3aed);
}

.secondary-button {
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--border-light);
    background: #17171c;
    color: #eeeeF2;
}

.secondary-button:hover:not(:disabled) {
    background: #1d1d23;
}

.small-button {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--border-light);
    background: #17171c;
    color: #eeeeF2;
}

.file-name {
    margin-top: 10px;
    overflow: hidden;
    color: #c7c7cf;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-info,
.small-status {
    margin-top: 7px;
    color: var(--muted-2);
    font-size: 10px;
    line-height: 1.5;
}

.range-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
    align-items: center;
    gap: 9px;
}

input[type="range"] {
    width: 100%;
}

#fontSizeValue {
    display: grid;
    place-items: center;
    min-height: 30px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #0d0d11;
    color: #d7d7de;
    font-size: 11px;
}

.color-input {
    display: block;
    width: 100%;
    height: 36px;
    padding: 3px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    background: #0d0d11;
    cursor: pointer;
}

.main-area {
    min-width: 0;
    padding: 26px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.eyebrow {
    color: #8d8d99;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.15em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 5px;
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

h2 {
    margin: 5px 0 0;
    font-size: 17px;
}

.header-description {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.status {
    flex: 0 0 auto;
    min-height: 30px;
    display: flex;
    align-items: center;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #101014;
    color: #bcbcc5;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.canvas {
    position: relative;
    width: 100%;
    min-height: 440px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #000;
    isolation: isolate;
}

.source-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.canvas-lyrics {
    position: relative;
    z-index: 2;
    width: min(88%, 850px);
    padding: 30px;
    color: white;
    font-size: 48px;
    font-weight: 800;
    line-height: 1.12;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.75);
    overflow-wrap: anywhere;
}

.timeline-panel {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--panel);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.lyrics-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
}

.lyric-row {
    display: grid;
    grid-template-columns: 55px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 9px;
    padding: 7px;
    border-radius: 9px;
}

.lyric-row:hover {
    background: #15151a;
}

.lyric-time {
    color: #777782;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
}

.lyric-input {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #0d0d11;
    color: #eeeeF2;
    font-size: 12px;
}

.lyric-input:focus {
    border-color: var(--accent);
}

.delete-line {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: transparent;
    color: #777782;
    font-size: 19px;
}

.delete-line:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.empty-state {
    padding: 30px 15px;
    color: var(--muted-2);
    font-size: 12px;
    text-align: center;
}

.render-panel,
.download-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #121216;
}

.render-panel p,
.download-panel p {
    max-width: 600px;
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.render-panel .primary-button,
.download-button {
    width: auto;
    min-width: 175px;
    padding: 0 20px;
}

.download-button {
    background: #16a34a;
    color: white;
    text-decoration: none;
}

.download-button:hover {
    background: #22c55e;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #303039 transparent;
}

::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-thumb {
    background: #303039;
    border-radius: 999px;
}

@media (max-width: 900px) {

    .topbar {
        min-height: 68px;
        padding: 12px 16px;
    }

    .top-status {
        display: none;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 14px;
    }

    .main-area {
        padding: 16px;
    }

    .canvas {
        min-height: 390px;
    }
}

@media (max-width: 600px) {

    .brand-subtitle {
        display: none;
    }

    .main-area {
        padding: 12px;
    }

    .section-header {
        flex-direction: column;
    }

    .canvas {
        min-height: 340px;
    }

    .canvas-lyrics {
        padding: 20px;
        font-size: 36px;
    }

    .timeline-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .render-panel,
    .download-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .render-panel .primary-button,
    .download-button {
        width: 100%;
    }

    .lyric-row {
        grid-template-columns: 48px minmax(0, 1fr) 32px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}