:root {
    --fundo: #03050b;
    --painel: #06111f;
    --painel-2: #08172a;
    --ciano: #38e8ff;
    --texto: #f3f8ff;
    --texto-suave: rgba(226, 239, 255, 0.74);
    --texto-fraco: rgba(226, 239, 255, 0.52);
    --borda: rgba(56, 232, 255, 0.18);
    --borda-forte: rgba(56, 232, 255, 0.42);
    --vidro: rgba(4, 16, 31, 0.92);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scrollbar-color: var(--ciano) #02040a;
    scrollbar-width: thin;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 82% 8%, rgba(56, 232, 255, 0.16), transparent 30rem),
        radial-gradient(circle at 10% 22%, rgba(255, 45, 69, 0.1), transparent 26rem),
        linear-gradient(180deg, #02040a 0%, var(--fundo) 52%, #010206 100%);
    color: var(--texto);
    font-family: "JetBrains Mono", monospace;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

.grade-fundo,
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.grade-fundo {
    z-index: 1;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(56, 232, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 232, 255, 0.08) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
}

.scanlines {
    z-index: 50;
    opacity: 0.16;
    background: linear-gradient(rgba(255, 255, 255, 0.02) 50%, rgba(0, 0, 0, 0.22) 50%);
    background-size: 100% 3px;
}

.leitor-topo,
.leitor {
    position: relative;
    z-index: 10;
}

.leitor-topo,
.visualizador,
.toolbar,
.toolbar__grupo,
.marca,
.titulo-livro,
.texto-botao,
.icone-botao,
.pagina-campo,
.zoom-valor,
.estado,
#pdf-canvas {
    -webkit-user-select: none;
    user-select: none;
}

.pagina-campo input {
    -webkit-user-select: text;
    user-select: text;
}

.leitor-topo {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px max(20px, calc((100vw - 1540px) / 2)) 12px;
    border-bottom: 1px solid var(--borda);
    background:
        radial-gradient(circle at 50% 0%, rgba(56, 232, 255, 0.12), transparent 34rem),
        linear-gradient(90deg, rgba(255, 45, 69, 0.09), transparent 30%, rgba(56, 232, 255, 0.1)),
        var(--vidro);
    box-shadow: 0 12px 42px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
}

.leitor-topo__linha {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 18px;
}

.marca {
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: 1.2rem;
    font-weight: 900;
    text-shadow: 0 0 18px rgba(56, 232, 255, 0.18);
}

.texto-botao {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--borda);
    border-radius: 6px;
    background: rgba(56, 232, 255, 0.06);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.texto-botao:hover {
    border-color: var(--borda-forte);
    background: rgba(56, 232, 255, 0.12);
    color: var(--ciano);
}

.titulo-livro {
    width: min(100%, 860px);
    margin: 0;
    padding-top: 2px;
    border-top: 1px solid rgba(56, 232, 255, 0.12);
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: clamp(0.82rem, 1.6vw, 1.08rem);
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.2;
    text-align: center;
    text-transform: uppercase;
    opacity: 0.9;
}

.leitor {
    width: min(100% - 28px, 1540px);
    min-height: calc(100vh - 128px);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-inline: auto;
    padding: 14px 0 34px;
}

.breadcrumb {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--texto-fraco);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.breadcrumb a {
    color: var(--ciano);
    transition: color 160ms ease;
}

.breadcrumb a:hover {
    color: #fff;
}

.visualizador {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--borda);
    border-radius: 8px;
    background: rgba(4, 12, 25, 0.58);
    box-shadow: 0 28px 96px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}

.toolbar__grupo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border: 1px solid rgba(56, 232, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
}

.toolbar__grupo--final {
    justify-content: flex-end;
}

.icone-botao {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--borda);
    border-radius: 6px;
    background: rgba(56, 232, 255, 0.06);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icone-botao:hover {
    border-color: var(--borda-forte);
    background: rgba(56, 232, 255, 0.12);
    transform: translateY(-1px);
}

.icone-botao svg {
    width: 22px;
    height: 22px;
    fill: var(--ciano);
}

.pagina-campo {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid rgba(56, 232, 255, 0.12);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--texto-fraco);
    font-size: 0.78rem;
    font-weight: 900;
}

.pagina-campo input {
    width: 58px;
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: 900;
    outline: none;
}

.zoom-valor {
    min-width: 58px;
    color: var(--ciano);
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
}

.texto-botao {
    min-height: 42px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.estado {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(56, 232, 255, 0.1);
    background: rgba(1, 6, 13, 0.72);
    color: var(--texto-fraco);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.estado:empty {
    display: none;
}

.canvas-area {
    min-height: calc(100vh - 250px);
    display: flex;
    justify-content: center;
    align-items: start;
    padding: 20px;
    overflow: auto;
    overscroll-behavior: contain;
    background:
        linear-gradient(135deg, rgba(56, 232, 255, 0.04) 0 1px, transparent 1px 18px),
        #02040a;
}

.canvas-area--rolagem-x {
    justify-content: flex-start;
}

#pdf-canvas {
    max-width: none;
    background: #fff;
    -webkit-user-drag: none;
    touch-action: pan-x pan-y;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.18),
        0 24px 70px rgba(0, 0, 0, 0.5);
}

.seo-conteudo {
    width: min(100%, 980px);
    margin: 28px auto 0;
    padding: 0;
    border: 1px solid rgba(56, 232, 255, 0.16);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(56, 232, 255, 0.08), transparent 42%),
        rgba(4, 16, 31, 0.68);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
    overflow: hidden;
    scroll-margin-top: 128px;
}

.seo-conteudo__detalhes summary {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    cursor: pointer;
    list-style: none;
}

.seo-conteudo__detalhes summary::-webkit-details-marker {
    display: none;
}

.seo-conteudo__detalhes summary span:first-child {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.seo-conteudo__detalhes small {
    color: var(--ciano);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.seo-conteudo__detalhes summary strong {
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: clamp(1.1rem, 2.6vw, 1.55rem);
    font-weight: 900;
    line-height: 1.15;
}

.seo-conteudo__icone {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 1px solid var(--borda);
    border-radius: 6px;
    background: rgba(56, 232, 255, 0.06);
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.seo-conteudo__icone svg {
    width: 22px;
    height: 22px;
    fill: var(--ciano);
    transition: transform 160ms ease;
}

.seo-conteudo__detalhes summary:hover .seo-conteudo__icone {
    border-color: var(--borda-forte);
    background: rgba(56, 232, 255, 0.12);
}

.seo-conteudo__detalhes[open] .seo-conteudo__icone svg {
    transform: rotate(45deg);
}

.seo-conteudo__corpo {
    padding: 0 26px 26px;
    border-top: 1px solid rgba(56, 232, 255, 0.12);
}

.seo-conteudo h2 {
    margin: 22px 0 0;
    color: #fff;
    font-family: "Inter", sans-serif;
    font-size: clamp(1.35rem, 3vw, 2.25rem);
    font-weight: 900;
    line-height: 1.08;
}

.seo-conteudo p,
.seo-conteudo li {
    color: var(--texto-suave);
    font-family: "Inter", sans-serif;
    font-size: 1rem;
    line-height: 1.72;
}

.seo-conteudo p {
    margin: 16px 0 0;
}

.seo-conteudo strong,
.seo-conteudo a {
    color: #fff;
}

.seo-conteudo a {
    border-bottom: 1px solid rgba(56, 232, 255, 0.42);
    transition: border-color 160ms ease, color 160ms ease;
}

.seo-conteudo a:hover {
    border-color: var(--ciano);
    color: var(--ciano);
}

.seo-conteudo ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 18px;
    margin: 20px 0 0;
    padding-left: 20px;
}

.seo-conteudo__links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.seo-conteudo__links a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 13px;
    border: 1px solid var(--borda);
    border-radius: 6px;
    background: rgba(56, 232, 255, 0.06);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.seo-conteudo__links a:hover {
    border-color: var(--borda-forte);
    background: rgba(56, 232, 255, 0.12);
    color: var(--ciano);
}

.menu-contexto {
    position: fixed;
    z-index: 220;
    width: min(270px, calc(100vw - 20px));
    display: none;
    padding: 6px;
    border: 1px solid rgba(56, 232, 255, 0.24);
    border-radius: 8px;
    background: rgba(4, 16, 31, 0.97);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-user-select: none;
    user-select: none;
}

.menu-contexto.ativo {
    display: grid;
    gap: 2px;
}

.menu-contexto button {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 11px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgba(226, 239, 255, 0.84);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
    text-align: left;
}

.menu-contexto button:hover,
.menu-contexto button:focus-visible {
    background: rgba(56, 232, 255, 0.12);
    color: #fff;
    outline: none;
}

.menu-contexto__separador {
    height: 1px;
    margin: 5px 4px;
    background: rgba(56, 232, 255, 0.14);
}

@media (max-width: 980px) {
    .leitor-topo__linha {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .toolbar {
        justify-content: center;
    }

    .toolbar__grupo--final {
        justify-content: stretch;
    }

    .toolbar__grupo--final .texto-botao {
        flex: 1;
    }
}

@media (max-width: 640px) {
    body {
        overflow-x: hidden;
    }

    .leitor-topo {
        position: relative;
        width: 100vw;
        gap: 6px;
        padding: 8px 10px 9px;
    }

    .marca {
        font-size: 1rem;
        order: -1;
    }

    .leitor {
        width: 100%;
        max-width: 100vw;
        min-height: auto;
        padding: 8px 0 18px;
        overflow: hidden;
    }

    .toolbar {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar__grupo {
        width: auto;
        flex: 0 0 auto;
        min-width: 0;
        justify-content: space-between;
        gap: 6px;
        padding: 5px;
    }

    .toolbar__grupo--final {
        display: flex;
        gap: 6px;
    }

    .pagina-campo {
        flex: 0 0 auto;
        min-width: 0;
        min-height: 38px;
        padding-inline: 10px;
        justify-content: center;
    }

    .pagina-campo input {
        width: 38px;
    }

    .icone-botao {
        width: 38px;
        height: 38px;
    }

    .zoom-valor {
        min-width: 46px;
        font-size: 0.72rem;
    }

    .texto-botao {
        width: auto;
        min-width: 0;
        min-height: 38px;
        padding-inline: 12px;
        overflow: hidden;
        font-size: 0.6rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .visualizador {
        width: calc(100% - 20px);
        max-width: calc(100vw - 20px);
        overflow: hidden;
    }

    .canvas-area {
        min-height: calc(100svh - 176px);
        padding: 10px;
        overflow: auto;
        overscroll-behavior: contain;
    }

    .breadcrumb {
        width: calc(100% - 20px);
        font-size: 0.58rem;
    }

    .seo-conteudo {
        width: calc(100% - 20px);
        scroll-margin-top: 18px;
    }

    .seo-conteudo__detalhes summary {
        min-height: 68px;
        gap: 12px;
        padding: 15px 16px;
    }

    .seo-conteudo__corpo {
        padding: 0 18px 18px;
    }

    .seo-conteudo__detalhes small {
        font-size: 0.58rem;
        line-height: 1.35;
    }

    .seo-conteudo__icone {
        width: 38px;
        height: 38px;
    }

    .seo-conteudo ul {
        grid-template-columns: 1fr;
    }

    .seo-conteudo__links a {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .titulo-livro {
        max-width: 100%;
        padding-top: 4px;
        font-size: 0.58rem;
        letter-spacing: 0.06em;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
}
