:root {
    --bg-color: #121212;
    --text-color: #ffffff;
    --accent-color: #3b82f6;
    --control-bg: #1e1e1e;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    /* Default for desktop app-like feel */
    height: 100vh;
}

/* Views Management */
.view {
    display: none;
    height: 100vh;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Editor View Styles */
#editor-view {
    padding: 2rem;
    max-width: 1400px;
    width: 90%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn.primary {
    background-color: var(--accent-color);
    color: white;
}

#start-btn {
    background-color: var(--accent-color);
    color: white;
}

#start-btn:hover {
    background-color: #2563eb;
}


.main-content {
    display: flex;
    gap: 2rem;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    overflow: hidden;
}

#script-input {
    flex: 0 1 600px;
    /* Default width on desktop */
    background-color: var(--control-bg);
    border: 1px solid #333;
    border-radius: 8px;
    color: var(--text-color);
    padding: 1.5rem;
    font-size: 1.1rem;
    resize: none;
    outline: none;
    line-height: 1.6;
}

#script-input:focus {
    border-color: var(--accent-color);
}

.controls {
    flex: 0 0 300px;
    background-color: var(--control-bg);
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group.toggle {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 600;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.btn.small {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    background-color: #333;
    color: #ccc;
    border: 1px solid #444;
}

.btn.small:hover {
    background-color: #444;
    color: white;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-color);
}

/* Prompter View Styles */
#prompter-view {
    background-color: black;
    position: relative;
    overflow: hidden;
}

.prompter-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.btn.icon {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    pointer-events: auto;
    /* Enable clicks */
    z-index: 20;
}

.guide-line {
    position: absolute;
    top: 35%;
    /* Updated to 35% as requested */
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 0, 0, 0.3);
    pointer-events: none;
    z-index: 5;
}

/* Arrow indicator on the guide line */
.guide-line::before,
.guide-line::after {
    content: '';
    position: absolute;
    top: -10px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.guide-line::before {
    left: 0;
    border-left: 10px solid rgba(255, 0, 0, 0.5);
}

.guide-line::after {
    right: 0;
    border-right: 10px solid rgba(255, 0, 0, 0.5);
}

#scrolling-text-container {
    width: 100%;
    height: 100%;
    overflow-y: hidden;
    /* Hide scrollbar but allow JS scroll */
    /* Add padding to center text vertically initially */
    padding-top: 45vh;
    padding-bottom: 45vh;
    box-sizing: border-box;
}

#scrolling-text {
    color: white;
    line-height: 1.5;
    text-align: center;
    max-width: 90%;
    margin: 0 auto;
    white-space: pre-wrap;
    /* Preserve newlines */
    padding-bottom: 50vh;
    /* Ensure last line can reach top */
}

.mirrored {
    transform: scaleX(-1);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {

    html,
    body {
        height: auto !important;
        min-height: 100vh;
        overflow-y: auto !important;
        position: relative !important;
    }

    #editor-view {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start !important;
        /* Start from top */
        height: auto !important;
        min-height: 100vh;
        padding: 1rem 1rem 120px 1rem !important;
        /* Bottom padding for fixed button */
        overflow: visible !important;
    }

    .header {
        position: static;
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1rem;
        text-align: center;
        flex-shrink: 0;
    }

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

    /* Floating Start Button */
    #start-btn {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 400px;
        z-index: 1000;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        padding: 1rem;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-start !important;
        height: auto !important;
        overflow: visible !important;
        gap: 1.5rem;
    }

    .controls {
        width: 100%;
        max-width: none;
        order: -1;
        /* Keep controls at top */
        margin: 0;
        padding: 1rem;
        background: rgba(30, 30, 30, 0.5);
        border-radius: 8px;
        flex-shrink: 0;
    }

    #script-input {
        width: 100%;
        flex: none;
        height: 60vh;
        /* Make it tall */
        min-height: 400px;
        margin-bottom: 2rem;
    }
}