:root {
    --bg-dark: #050507;
    --primary: #ffffff;
    --accent-red: #ff3b30;
    --accent-amber: #ff9500;
    --accent-green: #34c759;
    --glass: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
}

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

body { 
    background: var(--bg-dark); 
    color: var(--primary); 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
    overflow: hidden;
    height: 100vh;
}

/* Container Principal */
.studio-container { 
    position: relative; 
    width: 100vw; 
    height: 100vh; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

#video-preview { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    background: #000; 
}

/* Tela Inicial de Configuração */
#setup-screen {
    position: absolute; 
    z-index: 10; 
    width: 100%; 
    height: 100%;
    background: var(--bg-dark); 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    padding: 20px;
}

.setup-box {
    background: rgba(20, 20, 20, 0.85); 
    border: 1px solid var(--glass-border);
    padding: 40px; 
    border-radius: 24px; 
    max-width: 600px; 
    width: 100%; 
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6); 
    backdrop-filter: blur(15px);
}

.setup-box h2 { 
    font-size: 1.8rem; 
    margin-bottom: 20px; 
    font-weight: 600; 
    letter-spacing: -0.5px; 
}

#script-input {
    width: 100%; 
    height: 200px; 
    background: rgba(0,0,0,0.5); 
    border: 1px solid var(--glass-border);
    border-radius: 14px; 
    color: #fff; 
    padding: 15px; 
    font-size: 1rem; 
    resize: none; 
    outline: none;
    margin-bottom: 25px; 
    transition: border-color 0.3s;
}

#script-input:focus { 
    border-color: #fff; 
}

/* Interface de Gravação Sobreposta */
.ui-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    padding: 15px; 
    box-sizing: border-box; 
    pointer-events: none; 
    z-index: 5;
}

.ui-overlay * { 
    pointer-events: auto; 
}

/* Barra de Controle Superior */
.top-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%; 
    max-width: 650px; 
    margin: 0 auto; 
    z-index: 6; 
    position: absolute; 
    top: 15px; 
    left: 50%; 
    transform: translateX(-50%);
}

.btn-back { 
    background: rgba(0,0,0,0.65); 
    border: 1px solid var(--glass-border); 
    color: #fff; 
    padding: 8px 18px; 
    border-radius: 50px; 
    text-decoration: none; 
    font-size: 0.85rem; 
    backdrop-filter: blur(5px); 
    transition: 0.3s; 
}

.btn-back:hover { 
    background: rgba(255,255,255,0.2); 
}

.status-badge { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    background: rgba(0, 0, 0, 0.75); 
    padding: 8px 16px; 
    border-radius: 50px; 
    border: 1px solid var(--glass-border);
    font-weight: bold; 
    font-size: 0.85rem; 
    backdrop-filter: blur(5px);
}

.dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    background: #aaa; 
}

.recording .dot { 
    background: var(--accent-red); 
    animation: blink 1s infinite; 
}

.paused .dot { 
    background: var(--accent-amber); 
}

/* Teleprompter Superior */
.teleprompter-view {
    position: absolute;
    top: 7px; 
    left: 50%;
    transform: translateX(-50%);
    width: 96%;
    max-width: 650px;
    height: 160px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    overflow: hidden;
    backdrop-filter: blur(15px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 25%, black 75%, transparent 100%);
    z-index: 4;
}

#prompter-scroll-box {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    padding: 10px 30px;
    text-align: center;
    color: #fff;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: -0.5px;
    scrollbar-width: none;
}

#prompter-scroll-box::-webkit-scrollbar { 
    display: none; 
}

#prompter-text-content {
    padding-top: 55px;
    padding-bottom: 140px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.reading-line {
    position: absolute; 
    top: 50%; 
    left: 0; 
    width: 100%; 
    height: 2px;
    background: rgba(255, 255, 255, 0.25); 
    pointer-events: none; 
    transform: translateY(-50%);
    z-index: 5;
}

/* Controle de Velocidade Lateral */
.speed-panel {
    position: absolute;
    right: 15px;
    top: 185px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0,0,0,0.8);
    padding: 12px 10px;
    border-radius: 32px;
    border: 1px solid var(--glass-border);
    align-items: center;
    backdrop-filter: blur(10px);
    z-index: 6;
}

.btn-speed {
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    border: none;
    background: var(--glass); 
    border: 1px solid var(--glass-border);
    color: #fff; 
    font-size: 1.2rem; 
    font-weight: bold; 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: 0.2s;
}

.btn-speed:active { 
    transform: scale(0.9); 
    background: rgba(255,255,255,0.2); 
}

.speed-label { 
    font-size: 0.7rem; 
    font-weight: bold; 
    color: var(--accent-amber); 
    margin: 2px 0; 
}

/* Barra Inferior com Elevação Anti-Recorte */
.control-bar { 
    position: absolute; 
    bottom: calc(40px + env(safe-area-inset-bottom, 15px)); 
    left: 50%; 
    transform: translateX(-50%);
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 24px; 
    background: rgba(15, 15, 20, 0.85); 
    padding: 18px 40px; 
    border-radius: 100px;
    border: 1px solid var(--glass-border); 
    backdrop-filter: blur(20px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.7);
    z-index: 6;
}

.btn-action { 
    border: none; 
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.btn-primary { 
    background: #fff; 
    color: #000; 
    padding: 16px 36px; 
    border-radius: 50px; 
    font-weight: 700; 
}

.btn-circle { 
    width: 62px; 
    height: 62px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    background: rgba(255,255,255,0.1); 
    border: 1px solid var(--glass-border); 
    color: #fff; 
    font-size: 1.1rem; 
}

.btn-circle:disabled { 
    opacity: 0.25; 
    cursor: not-allowed; 
    transform: scale(1) !important; 
}

/* Botão de Gravação Estilo Câmera Profissional */
.btn-rec-start { 
    background: rgba(255, 255, 255, 0.15); 
    border: 3px solid #ffffff; 
    position: relative; 
}

.btn-rec-start::after { 
    content: ''; 
    width: 42px; 
    height: 42px; 
    background: var(--accent-red); 
    border-radius: 50%; 
    position: absolute; 
    transition: 0.3s; 
}

.recording-active.btn-rec-start::after { 
    border-radius: 8px; 
    width: 28px; 
    height: 28px; 
}

/* Loading Overlay Rápido */
.loader-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.85);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    z-index: 20;
}

.spinner { 
    width: 45px; 
    height: 45px; 
    border: 4px solid var(--glass); 
    border-top-color: var(--accent-green); 
    border-radius: 50%; 
    animation: spin 1s infinite linear; 
    margin-bottom: 15px; 
}

.hidden { 
    display: none !important; 
}

@keyframes blink { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.3; } 
}

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