:root {
    color-scheme: dark;
    --forest-950: #071713;
    --forest-900: #0d241f;
    --forest-800: #143b33;
    --forest-700: #1d5145;
    --teal-500: #45c8c0;
    --teal-300: #9be7df;
    --violet-700: #4e3475;
    --violet-500: #7953a8;
    --gold-500: #e7ad42;
    --gold-300: #f5d68e;
    --cream-100: #fffaf0;
    --paper-100: #f6ead3;
    --paper-200: #ead7b7;
    --ink-900: #2d2a24;
    --ink-700: #51483c;
    --shadow-deep: 0 30px 90px rgba(0, 0, 0, 0.48);
    --radius-xl: 34px;
    --radius-lg: 24px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--forest-950);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--cream-100);
    background:
        radial-gradient(circle at 12% 16%, rgba(69, 200, 192, 0.14), transparent 30%),
        radial-gradient(circle at 85% 12%, rgba(121, 83, 168, 0.18), transparent 30%),
        linear-gradient(160deg, var(--forest-950), var(--forest-900) 52%, #0b201c);
}

img {
    display: block;
    max-width: 100%;
}

button,
a {
    font: inherit;
}

a {
    color: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--teal-300);
    outline-offset: 4px;
}

.ambient-lights {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.ambient-light {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--gold-300);
    box-shadow: 0 0 9px 3px rgba(245, 214, 142, 0.46);
    opacity: 0.16;
    animation: firefly var(--duration) ease-in-out var(--delay) infinite alternate;
}

@keyframes firefly {
    0% {
        transform: translate3d(-9px, 12px, 0) scale(0.7);
        opacity: 0.12;
    }

    55% {
        opacity: 0.92;
    }

    100% {
        transform: translate3d(18px, -25px, 0) scale(1.15);
        opacity: 0.24;
    }
}

.cover-page {
    position: relative;
    background-image:
        linear-gradient(90deg, rgba(4, 17, 14, 0.93) 0%, rgba(4, 17, 14, 0.72) 42%, rgba(4, 17, 14, 0.28) 100%),
        url('../images/world/wendelwald-academy.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.cover-page::before,
.reader-page::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% -10%, rgba(255, 218, 133, 0.12), transparent 35%),
        linear-gradient(180deg, rgba(4, 17, 14, 0), rgba(4, 17, 14, 0.38));
}

.cover-stage {
    position: relative;
    z-index: 1;
    width: min(1320px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 56px 0;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.78fr);
    gap: clamp(42px, 7vw, 100px);
    align-items: center;
}

.cover-copy {
    max-width: 720px;
    text-shadow: 0 4px 30px rgba(0, 0, 0, 0.55);
}

.magic-kicker,
.story-eyebrow {
    margin: 0 0 14px;
    color: var(--gold-300);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.cover-copy h1 {
    max-width: 780px;
    margin: 0;
    color: #fff7df;
    font-size: clamp(3.3rem, 8vw, 7rem);
    font-weight: 700;
    line-height: 0.91;
    letter-spacing: -0.045em;
}

.cover-subtitle {
    margin: 23px 0 0;
    color: var(--gold-300);
    font-size: clamp(1.3rem, 2.3vw, 2rem);
    line-height: 1.2;
}

.cover-intro {
    max-width: 650px;
    margin: 24px 0 0;
    color: #efe9d8;
    font-size: clamp(1.05rem, 1.8vw, 1.28rem);
    line-height: 1.7;
}

.academy-rule {
    width: fit-content;
    margin: 28px 0 0;
    padding: 15px 19px;
    border: 1px solid rgba(245, 214, 142, 0.42);
    border-radius: 999px;
    background: rgba(8, 31, 27, 0.62);
    color: var(--teal-300);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.93rem;
    font-weight: 750;
    backdrop-filter: blur(10px);
}

.academy-rule span:not(:last-child)::after {
    content: ' ✦ ';
    color: var(--gold-300);
}

.cover-actions {
    display: flex;
    gap: 14px;
    margin-top: 34px;
}

.magic-button {
    min-height: 56px;
    padding: 0 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 1px solid rgba(245, 214, 142, 0.6);
    border-radius: 999px;
    color: #fffdf7;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 13px 32px rgba(0, 0, 0, 0.28);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.magic-button:hover {
    transform: translateY(-2px);
    border-color: var(--gold-300);
    box-shadow: 0 17px 38px rgba(0, 0, 0, 0.38), 0 0 25px rgba(231, 173, 66, 0.18);
}

.magic-button--primary {
    background: linear-gradient(135deg, var(--violet-700), #285e67 72%);
}

.version-mark {
    margin: 17px 0 0;
    color: rgba(255, 250, 240, 0.62);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
}

.cover-art {
    position: relative;
    margin: 0;
    justify-self: center;
}

.cover-art img {
    position: relative;
    z-index: 2;
    width: min(440px, 100%);
    border: 1px solid rgba(245, 214, 142, 0.5);
    border-radius: 19px;
    box-shadow: var(--shadow-deep);
    transform: rotate(1.2deg);
}

.cover-glow {
    position: absolute;
    inset: 8% 5%;
    z-index: 1;
    border-radius: 50%;
    background: rgba(231, 173, 66, 0.32);
    filter: blur(55px);
}

.reader-page {
    padding-bottom: 50px;
    background:
        linear-gradient(rgba(5, 24, 20, 0.89), rgba(5, 24, 20, 0.95)),
        url('../images/world/wendelwald-academy.webp') center / cover fixed;
}

.reader-header {
    position: relative;
    z-index: 3;
    width: min(1380px, calc(100% - 36px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.reader-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--cream-100);
    font-weight: 700;
    text-decoration: none;
}

.reader-brand__rune {
    color: var(--gold-300);
    font-size: 1.25rem;
}

.chapter-badge {
    padding: 9px 13px;
    border: 1px solid rgba(245, 214, 142, 0.3);
    border-radius: 999px;
    color: var(--gold-300);
    background: rgba(13, 36, 31, 0.75);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.78rem;
}

.storybook {
    position: relative;
    z-index: 2;
    width: min(1380px, calc(100% - 36px));
    margin: 20px auto 0;
}

.book-spread {
    min-height: min(750px, calc(100vh - 175px));
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(410px, 0.92fr);
    overflow: hidden;
    border: 1px solid rgba(245, 214, 142, 0.5);
    border-radius: var(--radius-xl);
    background: #0b211d;
    box-shadow: var(--shadow-deep);
}

.book-spread[hidden] {
    display: none;
}

.book-spread.is-active {
    animation: pageReveal 420ms ease both;
}

@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.995);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.story-illustration {
    position: relative;
    min-height: 620px;
    margin: 0;
    overflow: hidden;
    background: var(--forest-800);
}

.story-illustration img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-illustration figcaption {
    position: absolute;
    left: 22px;
    bottom: 20px;
    max-width: calc(100% - 44px);
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(5, 24, 20, 0.73);
    color: rgba(255, 250, 240, 0.92);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    backdrop-filter: blur(8px);
}

.story-paper {
    position: relative;
    padding: clamp(38px, 5vw, 72px);
    color: var(--ink-900);
    background:
        radial-gradient(circle at 84% 14%, rgba(231, 173, 66, 0.12), transparent 23%),
        repeating-linear-gradient(0deg, rgba(88, 65, 39, 0.018), rgba(88, 65, 39, 0.018) 1px, transparent 1px, transparent 4px),
        linear-gradient(145deg, #fff9ea, var(--paper-100));
}

.story-paper::before {
    content: '';
    position: absolute;
    top: 24px;
    bottom: 24px;
    left: 0;
    width: 1px;
    background: linear-gradient(transparent, rgba(87, 64, 36, 0.23), transparent);
}

.story-paper h1 {
    margin: 0;
    color: #2b332d;
    font-size: clamp(2.2rem, 4.2vw, 4.4rem);
    line-height: 1.04;
    letter-spacing: -0.035em;
}

.story-text {
    margin-top: 28px;
    color: var(--ink-700);
    font-size: clamp(1.04rem, 1.5vw, 1.2rem);
    line-height: 1.84;
}

.story-text p {
    margin: 0 0 1.2em;
}

.story-text p:first-child::first-letter {
    float: left;
    margin: 0.08em 0.1em 0 0;
    color: var(--violet-700);
    font-size: 3.35em;
    font-weight: 700;
    line-height: 0.78;
}

.story-quote {
    margin-top: 28px;
    padding: 19px 21px;
    border-left: 4px solid var(--gold-500);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: rgba(78, 52, 117, 0.08);
    color: var(--violet-700);
    font-size: 1.08rem;
    font-weight: 700;
}

.coming-soon {
    margin-top: 28px;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 13px;
    border: 1px solid rgba(69, 102, 84, 0.24);
    border-radius: var(--radius-md);
    background: rgba(45, 101, 89, 0.08);
    color: #345148;
}

.coming-soon__spark {
    flex: 0 0 auto;
    color: var(--violet-500);
    font-size: 1.4rem;
}

.coming-soon strong,
.coming-soon span {
    display: block;
}

.coming-soon span {
    margin-top: 5px;
    color: #5b6c66;
    font-size: 0.9rem;
    line-height: 1.5;
}

.page-navigation {
    margin-top: 22px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
}

.page-button {
    width: fit-content;
    min-height: 48px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(245, 214, 142, 0.32);
    border-radius: 999px;
    color: var(--cream-100);
    background: rgba(17, 52, 45, 0.82);
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 750;
    transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.page-button:hover:not(:disabled) {
    transform: translateY(-1px);
    background: rgba(31, 82, 70, 0.95);
}

.page-button:disabled {
    cursor: not-allowed;
    opacity: 0.28;
}

.page-button--next {
    justify-self: end;
}

.page-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 250, 240, 0.25);
    transition: width 160ms ease, background 160ms ease;
}

.page-dot.is-active {
    width: 25px;
    border-radius: 999px;
    background: var(--gold-300);
}

.back-to-cover {
    width: fit-content;
    margin: 20px auto 0;
    display: block;
    color: rgba(255, 250, 240, 0.68);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.84rem;
    text-decoration: none;
}

.back-to-cover:hover {
    color: var(--gold-300);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .cover-stage {
        grid-template-columns: 1fr;
        padding: 42px 0 60px;
    }

    .cover-copy {
        text-align: center;
        justify-self: center;
    }

    .academy-rule,
    .cover-actions {
        margin-left: auto;
        margin-right: auto;
    }

    .cover-art {
        width: min(420px, 78vw);
    }

    .book-spread {
        grid-template-columns: 1fr;
    }

    .story-illustration {
        min-height: min(62vw, 520px);
        max-height: 520px;
    }

    .story-paper::before {
        display: none;
    }
}

@media (max-width: 640px) {
    .cover-page {
        background-attachment: scroll;
    }

    .cover-stage {
        width: min(100% - 26px, 1320px);
        padding-top: 34px;
        gap: 34px;
    }

    .cover-copy h1 {
        font-size: clamp(3rem, 15vw, 4.4rem);
    }

    .cover-subtitle {
        font-size: 1.25rem;
    }

    .academy-rule {
        display: grid;
        gap: 4px;
        border-radius: var(--radius-md);
    }

    .academy-rule span:not(:last-child)::after {
        content: '';
    }

    .cover-art {
        width: min(360px, 86vw);
    }

    .reader-header {
        width: min(100% - 26px, 1380px);
        padding: 13px 0;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .storybook {
        width: min(100% - 20px, 1380px);
        margin-top: 8px;
    }

    .book-spread {
        min-height: 0;
        border-radius: 22px;
    }

    .story-illustration {
        min-height: 320px;
        max-height: 430px;
    }

    .story-illustration figcaption {
        right: 14px;
        left: 14px;
        bottom: 12px;
        max-width: none;
        border-radius: 13px;
    }

    .story-paper {
        padding: 31px 23px 36px;
    }

    .story-paper h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .story-text {
        font-size: 1.05rem;
        line-height: 1.76;
    }

    .page-navigation {
        grid-template-columns: 1fr 1fr;
    }

    .page-indicator {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .page-button {
        grid-row: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
