:root {
    --cream: #fff9ed;
    --cream-deep: #f7edd9;
    --berry: #a83d64;
    --berry-dark: #7f294a;
    --pink: #e8aec0;
    --pink-pale: #f7dfe6;
    --olive: #81820b;
    --sage: #aab9b5;
    --gold: #bda866;
    --ink: #482e36;
    --muted: #7f6970;
    --white: #fffdfa;
    --shadow: 0 18px 50px rgba(92, 55, 63, .12);
    --serif: Georgia, 'Times New Roman', serif;
    --sans: 'Trebuchet MS', 'Segoe UI', sans-serif;
    --script: 'Segoe Script', 'Bradley Hand', cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background:
        radial-gradient(circle at 6% 7%, rgba(232, 174, 192, .2) 0 3px, transparent 4px),
        radial-gradient(circle at 94% 13%, rgba(189, 168, 102, .22) 0 2px, transparent 3px),
        var(--cream);
    font-family: var(--sans);
    line-height: 1.55;
    overflow-x: hidden;
}

body.modal-open,
body.player-open { overflow: hidden; }

button, input { font: inherit; }
button { color: inherit; }

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

[hidden] { display: none !important; }

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 1rem;
    left: 1rem;
    padding: .7rem 1rem;
    color: white;
    background: var(--berry-dark);
    border-radius: 999px;
    transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.hero {
    position: relative;
    display: grid;
    min-height: 470px;
    place-content: center;
    padding: 5.5rem 1.5rem 4.5rem;
    overflow: hidden;
    text-align: center;
    isolation: isolate;
}

.hero::before {
    position: absolute;
    z-index: -2;
    inset: 0;
    background: radial-gradient(ellipse at top, rgba(255,255,255,.92), transparent 63%);
    content: '';
}

.hero__eyebrow,
.modal__eyebrow {
    margin: 0 0 .4rem;
    color: var(--gold);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .24em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    color: var(--berry);
    font-family: var(--serif);
    font-size: clamp(4.7rem, 13vw, 9.5rem);
    font-weight: 400;
    letter-spacing: .12em;
    line-height: .88;
    text-shadow: 0 5px 0 rgba(232, 174, 192, .2);
}

.hero__subtitle {
    margin: .65rem 0 0;
    color: var(--olive);
    font-family: var(--script);
    font-size: clamp(1.7rem, 4.5vw, 3rem);
    transform: rotate(-2deg);
}

.hero__sparkles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    min-height: 30px;
    margin: 1rem 0 .55rem;
    color: var(--pink);
}

.hero__sparkles span:nth-child(2) { color: var(--berry); font-size: 1.15rem; }
.hero__sparkles span:nth-child(3) { color: var(--gold); }

.hero__instruction {
    margin: 0;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 1.02rem;
}

.hero__film {
    position: absolute;
    z-index: -1;
    width: 310px;
    height: 58px;
    border-block: 10px dotted rgba(168, 61, 100, .12);
    background: rgba(168, 61, 100, .045);
    transform: rotate(-28deg);
}

.hero__film--left { top: 90px; left: -95px; }
.hero__film--right { right: -95px; bottom: 82px; transform: rotate(23deg); }

.hero__sprig {
    position: absolute;
    color: rgba(129, 130, 11, .28);
    font-family: var(--serif);
    font-size: 7rem;
}

.hero__sprig--left { bottom: 25px; left: 5%; transform: rotate(-22deg); }
.hero__sprig--right { top: 34px; right: 7%; transform: rotate(158deg); }

.session-actions {
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.2rem;
    font-size: .85rem;
}

.session-actions:not([hidden]) { display: flex; }
.session-actions__status { color: var(--olive); }
.session-actions__status span { font-size: .55rem; }

.text-button {
    padding: 0;
    border: 0;
    border-bottom: 1px solid currentColor;
    color: var(--berry);
    background: transparent;
    cursor: pointer;
}

main#chapters {
    width: min(1220px, calc(100% - 2rem));
    margin: 0 auto;
    padding-bottom: 5rem;
}

.chapter-section + .chapter-section { margin-top: 5.5rem; }

.section-heading {
    display: grid;
    grid-template-columns: minmax(30px, 1fr) auto minmax(30px, 1fr);
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.section-heading__line { height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.section-heading__line:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.section-heading p { margin: 0; color: var(--gold); font-size: .7rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.section-heading h2 { margin: .25rem 0 0; color: var(--berry); font-family: var(--serif); font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 400; letter-spacing: .06em; text-transform: uppercase; }

.chapter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.35rem;
}

.chapter-card {
    position: relative;
    display: flex;
    min-height: 310px;
    min-width: 0;
    width: 100%;
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid rgba(189, 168, 102, .25);
    border-radius: 24px;
    background: var(--white);
    box-shadow: 0 9px 24px rgba(83, 50, 60, .08);
    text-align: left;
    cursor: pointer;
    transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}

.chapter-card::after {
    position: absolute;
    inset: 7px;
    border: 1px solid rgba(189, 168, 102, .18);
    border-radius: 18px;
    content: '';
    pointer-events: none;
}

.chapter-card:hover { transform: translateY(-7px); border-color: rgba(168, 61, 100, .35); box-shadow: var(--shadow); }

.chapter-card__art {
    position: relative;
    display: grid;
    height: 178px;
    flex: 0 0 178px;
    overflow: hidden;
    place-items: center;
    background: var(--pink-pale);
}

.chapter-card__art::before,
.chapter-card__art::after {
    position: absolute;
    width: 70px;
    height: 70px;
    border: 1px solid rgba(255,255,255,.6);
    border-radius: 50%;
    content: '';
}

.chapter-card__art::before { top: -32px; right: -12px; }
.chapter-card__art::after { bottom: -41px; left: 17px; width: 95px; height: 95px; }
.chapter-card__art svg { width: 76%; height: 76%; fill: rgba(255,255,255,.35); stroke: var(--berry); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chapter-card__art--rattle, .chapter-card__art--balloon, .chapter-card__art--blossom { background: #e8d7cc; }
.chapter-card__art--flower, .chapter-card__art--blocks, .chapter-card__art--tennis { background: #dbe0c1; }
.chapter-card__art--shoes, .chapter-card__art--kite, .chapter-card__art--waves { background: #cddbd7; }
.chapter-card__art--stars, .chapter-card__art--plane, .chapter-card__art--ship { background: #e9ddb7; }
.chapter-card__art--hearts { background: #edc6d1; }
.chapter-card__art--snow { background: #dbe7e6; }

.chapter-card__number {
    position: absolute;
    top: .85rem;
    left: 1rem;
    color: rgba(72, 46, 54, .55);
    font-family: var(--serif);
    font-size: .8rem;
    letter-spacing: .16em;
}

.chapter-card__body { display: flex; min-height: 132px; padding: 1.25rem 1.35rem 1.3rem; flex: 1; flex-direction: column; }
.chapter-card__kicker { color: var(--gold); font-size: .65rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.chapter-card__title { margin-top: .24rem; color: var(--berry-dark); font-family: var(--serif); font-size: 1.17rem; line-height: 1.25; }
.chapter-card__meta { display: flex; align-items: center; gap: .45rem; margin-top: auto; color: var(--muted); font-size: .72rem; }

.lock-icon {
    position: relative;
    width: 10px;
    height: 9px;
    border-radius: 2px;
    background: currentColor;
}

.lock-icon::before {
    position: absolute;
    bottom: 6px;
    left: 2px;
    width: 6px;
    height: 6px;
    border: 1.5px solid currentColor;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    content: '';
}

.lock-icon--large { width: 20px; height: 17px; color: var(--berry); }
.lock-icon--large::before { bottom: 12px; left: 4px; width: 12px; height: 12px; border-width: 2px; }
.availability { margin-left: auto; color: var(--olive); font-weight: 700; }
.chapter-card.is-missing .availability { color: var(--muted); font-weight: 400; }

footer { display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: 2.5rem 1rem; color: var(--gold); border-top: 1px solid rgba(189,168,102,.25); font-family: var(--serif); font-style: italic; }
footer p { margin: 0; }

.modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    padding: 1rem;
    place-items: center;
}

.modal__backdrop { position: absolute; inset: 0; background: rgba(51, 31, 38, .62); backdrop-filter: blur(7px); }
.modal__panel { position: relative; width: min(470px, 100%); padding: 3rem 2.7rem 2.7rem; border: 1px solid rgba(189,168,102,.4); border-radius: 30px; background: var(--cream); box-shadow: 0 30px 90px rgba(40,20,28,.3); text-align: center; animation: modal-in .35s ease both; }
.modal__panel::before { position: absolute; inset: 9px; border: 1px solid rgba(189,168,102,.22); border-radius: 22px; content: ''; pointer-events: none; }
.modal__close { position: absolute; z-index: 1; top: 1rem; right: 1rem; width: 38px; height: 38px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 1.7rem; line-height: 1; cursor: pointer; }
.modal__close:hover { background: var(--pink-pale); }
.modal__icon { display: grid; width: 58px; height: 58px; margin: 0 auto 1rem; place-items: center; border-radius: 50%; color: var(--berry); background: var(--pink-pale); }
.modal h2 { margin: .2rem 0 .65rem; color: var(--berry); font-family: var(--serif); font-size: 2rem; font-weight: 400; }
.modal p { color: var(--muted); }
.modal form { position: relative; z-index: 1; margin-top: 1.5rem; text-align: left; }
.modal label { display: block; margin-bottom: .45rem; color: var(--ink); font-size: .78rem; font-weight: 700; }
.password-field { display: flex; padding: .3rem; border: 1px solid rgba(168,61,100,.28); border-radius: 13px; background: white; }
.password-field:focus-within { border-color: var(--berry); box-shadow: 0 0 0 3px rgba(168,61,100,.12); }
.password-field input { min-width: 0; padding: .7rem .75rem; flex: 1; border: 0; outline: 0; background: transparent; }
.password-field button { border: 0; color: var(--berry); background: transparent; cursor: pointer; font-size: .75rem; font-weight: 700; }
.form-message { min-height: 1.4rem; margin: .5rem 0; color: var(--berry-dark) !important; font-size: .8rem; }
.primary-button { display: flex; width: 100%; align-items: center; justify-content: center; gap: .6rem; padding: .9rem 1rem; border: 0; border-radius: 999px; color: white; background: var(--berry); box-shadow: 0 9px 20px rgba(168,61,100,.22); cursor: pointer; transition: background .2s, transform .2s; }
.primary-button:hover { background: var(--berry-dark); transform: translateY(-2px); }
.primary-button:disabled { opacity: .65; cursor: wait; transform: none; }

.player-view { position: fixed; z-index: 80; inset: 0; overflow-y: auto; color: var(--cream); background: radial-gradient(circle at 50% -20%, #6d3b4e, transparent 48%), #251b1f; animation: fade-in .35s ease both; }
.player-view__topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.4rem 0; }
.back-button { justify-self: start; padding: .55rem .8rem; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; color: var(--cream); background: rgba(255,255,255,.05); cursor: pointer; }
.player-view__brand { grid-column: 2; color: var(--pink); font-family: var(--serif); letter-spacing: .16em; }
.player-view__brand em { margin-left: .55rem; color: var(--sage); font-family: var(--script); font-size: .9rem; font-weight: 400; letter-spacing: 0; }
.player-view__content { width: min(1080px, calc(100% - 2rem)); margin: 1.6rem auto 0; padding-bottom: 3rem; text-align: center; }
.player-view__kicker { margin: 0; color: var(--gold); font-size: .7rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.player-view h2 { margin: .35rem 0 1.5rem; color: white; font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 3rem); font-weight: 400; }
.video-shell { position: relative; display: grid; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; place-items: center; border: 1px solid rgba(189,168,102,.3); border-radius: 24px; background: #100d0e; box-shadow: 0 25px 70px rgba(0,0,0,.35); }
.video-shell--square { width: min(100%, 760px); aspect-ratio: 1 / 1; margin-inline: auto; }
.video-shell--portrait { width: min(100%, 430px); aspect-ratio: 9 / 16; margin-inline: auto; }
.video-shell video { width: 100%; height: 100%; background: #000; object-fit: contain; }
.video-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .8rem; background: radial-gradient(circle, #38272e, #171114); color: var(--sage); }
.video-state--ready {
    flex-direction: column;
    gap: .75rem;
    background:
        radial-gradient(circle at 50% 44%, rgba(168, 61, 100, .34), transparent 29%),
        radial-gradient(circle at 15% 20%, rgba(232, 174, 192, .12), transparent 22%),
        radial-gradient(circle at 85% 80%, rgba(189, 168, 102, .12), transparent 24%),
        linear-gradient(145deg, #4a2c38, #1d1518 72%);
}
.video-state--ready::before,
.video-state--ready::after {
    position: absolute;
    width: 150px;
    height: 34px;
    border-block: 6px dotted rgba(232, 174, 192, .11);
    background: rgba(232, 174, 192, .035);
    content: '';
    transform: rotate(-28deg);
}
.video-state--ready::before { top: 12%; left: -35px; }
.video-state--ready::after { right: -35px; bottom: 12%; transform: rotate(25deg); }
.video-ready__sparkles { color: var(--gold); font-size: .8rem; letter-spacing: .18em; }
.video-ready__play {
    position: relative;
    z-index: 1;
    display: grid;
    width: clamp(74px, 10vw, 98px);
    height: clamp(74px, 10vw, 98px);
    margin: .15rem 0 .35rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    color: var(--berry-dark);
    background: rgba(255, 249, 237, .95);
    box-shadow: 0 12px 38px rgba(0, 0, 0, .3), 0 0 0 9px rgba(255, 249, 237, .07);
    cursor: pointer;
    transition: transform .25s ease, background .25s ease, box-shadow .25s ease;
}
.video-ready__play:hover {
    background: white;
    box-shadow: 0 15px 44px rgba(0, 0, 0, .35), 0 0 0 12px rgba(255, 249, 237, .1);
    transform: scale(1.06);
}
.video-ready__play span {
    width: 0;
    height: 0;
    margin-left: 7px;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 21px solid currentColor;
}
.video-state--ready strong { color: var(--cream); font-family: var(--serif); font-size: clamp(1.2rem, 3vw, 1.75rem); font-weight: 400; }
.video-state--ready > span:last-child { color: var(--sage); font-size: .82rem; }
.video-state--message { flex-direction: column; padding: 1rem; }
.video-state--message strong { color: var(--cream); font-family: var(--serif); font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 400; }
.video-state--message > span:last-child { color: var(--sage); }
.video-state__flower { color: var(--pink); font-size: 2.2rem; }
.spinner { width: 24px; height: 24px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--pink); border-radius: 50%; animation: spin .8s linear infinite; }
.player-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin-top: 1.4rem; }
.player-navigation button { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; border: 0; color: var(--cream); background: transparent; text-align: left; cursor: pointer; }
.player-navigation button:last-child { justify-self: end; text-align: right; }
.player-navigation button:disabled { opacity: .25; cursor: default; }
.player-navigation small, .player-navigation strong { display: block; }
.player-navigation small { color: var(--sage); font-size: .65rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; }
.player-navigation strong { max-width: 220px; overflow: hidden; font-family: var(--serif); font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.player-navigation__counter { color: var(--gold); font-family: var(--serif); font-size: .85rem; }
.toast { position: fixed; z-index: 200; right: 1rem; bottom: 1rem; max-width: min(360px, calc(100% - 2rem)); padding: .9rem 1.1rem; border-radius: 12px; color: white; background: var(--berry-dark); box-shadow: var(--shadow); }

@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { min-height: 420px; }
}

@media (max-width: 560px) {
    .hero { min-height: 390px; padding: 4.2rem 1.2rem 3rem; }
    .hero h1 { font-size: clamp(4.1rem, 24vw, 6rem); letter-spacing: .06em; }
    .hero__sprig { display: none; }
    main#chapters { width: min(100% - 1.25rem, 1220px); }
    .chapter-section + .chapter-section { margin-top: 4rem; }
    .section-heading { grid-template-columns: 40px minmax(0, 1fr) 40px; gap: .65rem; }
    .section-heading h2 { font-size: 1.35rem; }
    .chapter-grid { gap: .75rem; }
    .chapter-card { min-height: 250px; border-radius: 18px; }
    .chapter-card::after { inset: 5px; border-radius: 13px; }
    .chapter-card__art { height: 134px; flex-basis: 134px; }
    .chapter-card__body { min-height: 116px; padding: 1rem .9rem; }
    .chapter-card__title { overflow-wrap: anywhere; font-size: 1rem; }
    .lock-label { display: none; }
    .availability { font-size: .65rem; }
    .modal__panel { padding: 2.7rem 1.35rem 1.6rem; border-radius: 22px; }
    .player-view__topbar { grid-template-columns: 1fr auto; }
    .player-view__brand { grid-column: 2; font-size: .8rem; }
    .player-view__brand em { display: none; }
    .player-view__content { margin-top: 1rem; }
    .video-shell { border-radius: 14px; }
    .player-navigation { grid-template-columns: 1fr 1fr; }
    .player-navigation__counter { grid-column: 1 / -1; grid-row: 1; }
    .player-navigation button { grid-row: 2; padding-inline: .2rem; }
    .player-navigation strong { max-width: 120px; }
}

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

