/* ================================== */
/* --- GLOBAIS E RESETS --- */
/* ================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ================================== */
/* --- VARIÁVEIS CSS (TEMA) --- */
/* ================================== */
:root {
    --bg-color: #000000;
    --text-color: #ffffff;
    --text-color-rgb: 255, 255, 255;
    --text-size: 100px;
    --margin: 10%;
}

/* ================================== */
/* --- ESTILOS BASE --- */
/* ================================== */
body {
    background-color: var(--bg-color);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    transition: background-color 0.3s ease;
    margin: 0;
    overflow-x: hidden;
}

/* Diminui a opacidade da UI durante a rolagem */
body.playing nav,
body.playing footer {
    opacity: 0.2;
}

/* Impede a rolagem da página quando o menu mobile está aberto */
.noscroll {
    overflow: hidden;
}

/* ================================== */
/* --- BARRA DE NAVEGAÇÃO E CONTROLES --- */
/* ================================== */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 8px 24px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(var(--text-color-rgb), 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Suporte para Safari */
    border-bottom: 1px solid rgba(var(--text-color-rgb), 0.15);
    transition: opacity 0.3s ease-in-out;
}

/* Em desktops, a UI volta ao normal ao passar o mouse */
@media(hover: hover) and (pointer: fine) {

    nav:hover,
    footer:hover {
        opacity: 1 !important;
    }
}

.controls-container-left,
.controls-container-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Estilo padrão para todos os botões da barra */
nav button {
    height: 48px;
    min-width: 48px;
    padding: 0 12px;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

nav button svg path {
    fill: var(--text-color);
    transition: fill 0.2s;
}

nav button:hover,
nav button:focus {
    background-color: rgba(var(--text-color-rgb), 0.1);
    border-color: rgba(var(--text-color-rgb), 0.2);
    outline: none;
}

#expand {
    display: none;
}

/* ================================== */
/* --- PAINEL DE OPÇÕES (DRAWER) --- */
/* ================================== */
.drawer {
    display: flex;
    align-items: center;
    gap: 24px;
    text-align: center;
}

.drawer>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    min-width: 90px;
}

.drawer label {
    white-space: nowrap;
}

/* Seletor de Cor */
input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 24px;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(var(--text-color-rgb), 0.5);
    border-radius: 4px;
}

input[type="color"]::-moz-color-swatch {
    border: 1px solid rgba(var(--text-color-rgb), 0.5);
    border-radius: 4px;
}

/* Seletores de Faixa (Sliders) */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    background: transparent;
    cursor: pointer;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    height: 6px;
    background: rgba(var(--text-color-rgb), 0.4);
    border-radius: 3px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px;
    width: 16px;
    height: 16px;
    background: var(--text-color);
    border-radius: 50%;
}

input[type=range]::-moz-range-track {
    height: 6px;
    background: rgba(var(--text-color-rgb), 0.4);
    border-radius: 3px;
}

input[type=range]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--text-color);
    border-radius: 50%;
    border: none;
}

/* ================================== */
/* --- CONTEÚDO DO TELEPROMPTER --- */
/* ================================== */
.content {
    color: var(--text-color);
    line-height: 1.8;
    font-size: var(--text-size);
    padding-left: var(--margin);
    padding-right: var(--margin);
    padding-top: 120px;
    padding-bottom: calc(100vh + 80px);
    /* Espaço extra para rolagem além do rodapé */
    overflow-wrap: break-word;
    transition: color 0.3s ease;
}

/* Classes de transformação para o texto */
.flipx {
    transform: rotateY(180deg);
}

.flipy {
    transform: rotateX(180deg);
}

.flipx.flipy {
    transform: rotateY(180deg) rotateX(180deg);
}

/* ================================== */
/* --- GUIA DE LEITURA DINÂMICO --- */
/* ================================== */
#reading-guide {
    position: fixed;
    top: 200px;
    left: 0;
    right: 0;
    z-index: 5;
    pointer-events: none;
    /* Permite cliques através do guia */
    display: none;
    align-items: center;
}

#reading-guide.visible {
    display: flex;
}

#reading-guide.flipped {
    /* Posição para o modo de rolagem invertida */
    top: unset;
    bottom: 200px;
}

#guide-bar {
    width: 100%;
    height: calc(var(--text-size) * 1.8);
    /* Altura se ajusta ao tamanho da fonte */
    background-color: rgba(var(--text-color-rgb), 0.15);
    border-top: 1px solid rgba(var(--text-color-rgb), 0.25);
    border-bottom: 1px solid rgba(var(--text-color-rgb), 0.25);
}

#guide-arrow {
    position: absolute;
    left: 0;
    width: 0;
    height: 0;
    border-top: 15px solid transparent;
    border-bottom: 15px solid transparent;
    border-left: 15px solid var(--text-color);
}

#reading-guide.flipped #guide-arrow,
#guide-arrow.flipped {
    left: unset;
    right: 0;
    border-left: unset;
    border-right: 15px solid var(--text-color);
}

/* ================================== */
/* --- RODAPÉ (FOOTER) --- */
/* ================================== */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px 24px;
    background-color: var(--bg-color);
    color: rgba(var(--text-color-rgb), 0.6);
    font-size: 13px;
    text-align: center;
    z-index: 10;
    border-top: 1px solid rgba(var(--text-color-rgb), 0.1);
    line-height: 1.5;
    transition: opacity 0.3s ease-in-out;
}

footer b {
    color: rgba(var(--text-color-rgb), 0.8);
}

.disable-select {
    user-select: none;
    -webkit-user-select: none;
}

/* ================================== */
/* --- RESPONSIVIDADE (MOBILE) --- */
/* ================================== */
@media only screen and (max-width: 1023px) {
    nav {
        flex-wrap: wrap;
        padding: 8px 16px;
    }

    nav.expanded {
        height: auto;
    }

    #expand {
        display: block;
    }

    nav.expanded #expand svg {
        transform: rotateX(180deg);
    }

    .drawer {
        display: none;
    }

    nav.expanded .drawer {
        display: flex;
        flex-direction: column;
        flex-basis: 100%;
        order: 3;
        padding: 20px 0;
        gap: 20px;
    }

    .drawer>div {
        width: 100%;
    }

    .drawer input[type="range"] {
        width: 80%;
    }

    footer {
        font-size: 12px;
        padding: 10px;
        line-height: 1.4;
    }
}