@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    font-family: 'DM Sans', sans-serif;
    background: #101211;
    color: #e9ece6;
    --muted: #969d94;
    --accent: #c5ed98
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

button,
input {
    font: inherit
}

button,
a,
input {
    touch-action: manipulation
}

a {
    color: inherit
}

.masthead {
    max-width: 1200px;
    margin: auto;
    padding: 28px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2b302a
}

.brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -2px;
    text-decoration: none
}

.brand span {
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 0;
    margin-left: 12px
}

.tagline,
.eyebrow,
.reader-bar {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.8px
}

.tagline {
    color: var(--muted)
}

.controls {
    max-width: 1128px;
    margin: 0 auto;
    padding: 62px 0 40px
}

.eyebrow {
    color: var(--accent);
    margin-bottom: 20px
}

h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(40px, 6vw, 68px);
    line-height: 1.08;
    letter-spacing: -3px;
    margin: 0
}

h1 span {
    color: var(--muted)
}

.intro {
    color: var(--muted);
    margin: 22px 0 32px;
    font-size: 16px
}

form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap
}

.field {
    display: flex;
    flex-direction: column;
    gap: 10px
}

label {
    font-size: 13px
}

input[type=number] {
    width: 180px;
    background: #1b1e1a;
    border: 1px solid #3c4338;
    border-radius: 8px;
    padding: 15px;
    color: #fff
}

button {
    border: 1px solid #3c4338;
    border-radius: 8px;
    padding: 16px 22px;
    background: #232820;
    color: #e9ece6;
    cursor: pointer;
    font-weight: 600
}

.primary {
    background: var(--accent);
    color: #1b2514;
    border-color: var(--accent);
    min-width: 184px
}

.primary span {
    margin-left: 20px
}

button:hover {
    filter: brightness(1.1)
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px
}

.options {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-top: 22px;
    color: var(--muted);
    font-size: 12px
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dce1d7
}

input[type=checkbox] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px
}

.reader-shell {
    border-top: 1px solid #30352c;
    background: #151814;
    min-height: 340px
}

.reader-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 36px;
    max-width: 1200px;
    margin: auto;
    color: var(--muted)
}

#chapter-label {
    color: var(--accent)
}

#status {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 0 20px;
    line-height: 1.6
}

#empty {
    text-align: center;
    padding: 30px 20px 65px
}

.empty-icon {
    font-size: 42px;
    color: #627253
}

h2 {
    font-size: 20px;
    font-weight: 500;
    margin: 18px 0 8px
}

#empty p {
    font-size: 14px;
    color: var(--muted)
}

#pages {
    overflow-x: auto;
    width: 100%;
    background: #0c0d0c
}

#pages img {
    display: block;
    max-width: none;
    height: auto;
    margin: 0 auto
}

#pages.fit img {
    max-width: 100%
}

footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 28px 20px;
    line-height: 1.6
}

.top {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: #272e22;
    border: 1px solid #47513e;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    text-align: center;
    line-height: 40px;
    text-decoration: none
}

[hidden] {
    display: none !important
}

@media(max-width:1200px) {
    .controls {
        padding-left: 36px;
        padding-right: 36px
    }
}

@media(max-width:600px) {
    .masthead {
        padding: 20px
    }

    .tagline {
        display: none
    }

    .controls {
        padding: 40px 20px 28px
    }

    h1 {
        letter-spacing: -2px
    }

    .options {
        align-items: start;
        flex-direction: column;
        gap: 12px
    }

    .reader-bar {
        padding: 20px;
        font-size: 10px
    }

    .field {
        flex: 1
    }

    input[type=number] {
        width: 100%
    }

    .primary {
        min-width: 0;
        padding: 16px
    }

    .primary span {
        margin-left: 8px
    }
}