html,
body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    min-height: 100%;
    background: #101010;
    color: #f4f2ed;
}

a,
.btn-link {
    color: #9dc1ff;
}

button,
input,
textarea {
    font: inherit;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 42px;
    border: 1px solid #525252;
    border-radius: 6px;
    background: #272727;
    color: #f4f2ed;
    padding: 0.55rem 0.85rem;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}

button:hover {
    background: #343434;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

button:active {
    transform: translateY(1px);
}

.primary-action {
    border-color: #8db3ff;
    background: #275a9f;
}

.working-action,
.working-action:hover {
    border-color: #f0c36a;
    background: #76531a;
    box-shadow: 0 0 0 2px rgba(240, 195, 106, 0.22);
    cursor: progress;
}

.confirmed-action,
.confirmed-action:hover {
    border-color: #6ecf87;
    background: #216b39;
    box-shadow: 0 0 0 2px rgba(110, 207, 135, 0.22);
}

.button-spinner {
    width: 0.95rem;
    height: 0.95rem;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: #151515;
    border-right: 1px solid #2f2f2f;
}

main {
    flex: 1;
    min-width: 0;
}

.top-row {
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid #2f2f2f;
    color: #bdb7ad;
}

.content {
    padding-top: 1rem;
}

.navbar-brand {
    color: #ffffff;
}

.nav-link {
    color: #cfc9c0;
}

.nav-link.active {
    color: #ffffff;
    font-weight: 700;
}

.teleprompter-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: calc(100vh - 5.5rem);
}

.workspace-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.workspace-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.workspace-header p {
    margin: 0.35rem 0 0;
    color: #c8c0b4;
}

.workflow-tabs {
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    background: #181818;
}

.tab-button {
    border-color: transparent;
    background: transparent;
    color: #d8d2c8;
}

.tab-button.active,
.tab-button.active:hover {
    border-color: #8db3ff;
    background: #275a9f;
    color: #ffffff;
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    max-width: 980px;
}

.upload-row,
.transport {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.file-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    border: 1px solid #6d6d6d;
    border-radius: 6px;
    background: #f4f2ed;
    color: #151515;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
}

.file-picker input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.setting,
.font-control {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: #d5cfc5;
}

.setting input[type="number"] {
    width: 6rem;
    min-height: 42px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #181818;
    color: #ffffff;
    padding: 0.35rem 0.5rem;
}

.setting input[type="range"] {
    width: 9rem;
    accent-color: #8db3ff;
}

.speed-value {
    min-width: 1.5rem;
    color: #ffffff;
    text-align: center;
}

.font-control input {
    width: 9rem;
}

.script-summary {
    display: grid;
    gap: 0.25rem;
    border-left: 3px solid #8db3ff;
    padding-left: 0.8rem;
    color: #d8d2c8;
}

.script-summary strong {
    color: #ffffff;
}

.status {
    border-radius: 6px;
    padding: 0.75rem;
}

.status.error {
    border: 1px solid #a84242;
    background: #351b1b;
    color: #ffd9d9;
}

.status.warning {
    border: 1px solid #9d7a28;
    background: #332714;
    color: #ffe0a3;
}

.status.success {
    border: 1px solid #4d8a62;
    background: #183121;
    color: #c9f3d7;
}

.markdown-editor {
    display: grid;
    gap: 0.55rem;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    color: #d8d2c8;
}

.editor-header span {
    color: #aeadab;
}

.markdown-editor textarea {
    width: 100%;
    min-height: 12rem;
    resize: vertical;
    border: 1px solid #555;
    border-radius: 6px;
    background: #080808;
    color: #f4f2ed;
    padding: 0.75rem;
    line-height: 1.45;
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.provenance-panel {
    display: grid;
    gap: 0.65rem;
    border-top: 1px solid #353535;
    padding-top: 0.9rem;
}

.metadata-field {
    align-items: stretch;
    flex-direction: column;
}

.metadata-field input {
    min-height: 42px;
    border: 1px solid #555;
    border-radius: 6px;
    background: #181818;
    color: #ffffff;
    padding: 0.35rem 0.5rem;
}

.provenance-details {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    color: #d8d2c8;
}

.provenance-details div {
    display: grid;
    gap: 0.15rem;
}

.provenance-details dt {
    color: #aeadab;
    font-size: 0.85rem;
}

.provenance-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.video-association {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.disabled-picker {
    opacity: 0.6;
    cursor: progress;
}

.stage {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.75rem;
    min-width: 0;
    min-height: 0;
}

.stage-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #d8d2c8;
}

.stage-speed {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    color: #d8d2c8;
}

.stage-speed input {
    width: min(16rem, 36vw);
    accent-color: #8db3ff;
}

.stage-speed strong {
    min-width: 3.5rem;
    color: #ffffff;
    text-align: right;
}

.prompter-window,
.empty-state {
    flex: 1 1 auto;
    min-height: 420px;
    border: 1px solid #3d3d3d;
    border-radius: 8px;
    background: #050505;
}

.prompter-window {
    overflow-y: auto;
    scroll-behavior: auto;
    padding: 0 clamp(1rem, 4vw, 4rem);
}

.script-line {
    margin: 0 0 1.1em;
    font-size: var(--prompter-font-size);
    line-height: 1.45;
    letter-spacing: 0;
    color: #f6f1e8;
    text-wrap: balance;
}

.empty-state {
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 2rem;
    text-align: center;
    color: #c8c0b4;
}

.empty-state h2 {
    margin: 0 0 0.5rem;
    color: #ffffff;
}

#blazor-error-ui {
    background: #b32121;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    color: white;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 900px) {
    .page {
        display: block;
    }

    .sidebar {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid #2f2f2f;
    }

    .top-row {
        display: none;
    }

    .content {
        padding: 0.75rem;
    }

    .teleprompter-shell {
        min-height: calc(100vh - 1.5rem);
    }

    .workspace-header {
        align-items: stretch;
    }

    .workflow-tabs {
        width: 100%;
    }

    .tab-button {
        flex: 1 1 0;
    }

    .stage-speed {
        justify-content: flex-start;
        width: 100%;
    }

    .stage-speed input {
        flex: 1 1 auto;
        width: auto;
    }

    .prompter-window,
    .empty-state {
        flex: 0 0 auto;
        height: 62vh;
        min-height: 360px;
    }

    .script-line {
        font-size: min(var(--prompter-font-size), 12vw);
    }
}
