:root {
    --ink: #2f2a28;
    --muted: #7d736c;
    --paper: #fffaf1;
    --cream: #f8ecd9;
    --orange: #f9743d;
    --orange-dark: #da5525;
    --orange-soft: #ffeadc;
    --green: #9bbd7d;
    --line: rgba(71, 57, 48, 0.12);
    --shadow: 0 24px 80px rgba(99, 64, 38, 0.12);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 12% 10%, rgba(255, 211, 171, 0.36), transparent 26rem),
        radial-gradient(circle at 88% 22%, rgba(205, 225, 186, 0.35), transparent 28rem),
        var(--paper);
    font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.paper-grain {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.32;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

.site-nav {
    max-width: 1240px;
    margin: 0 auto;
    padding: 26px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    color: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 47px;
    height: 47px;
    display: grid;
    place-items: center;
    border-radius: 50% 50% 44% 56%;
    color: #fff;
    background: var(--orange);
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 25px;
    box-shadow: 0 8px 20px rgba(249, 116, 61, 0.26);
    transform: rotate(-7deg);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 24px;
    line-height: 1;
}

.brand small {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.12em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    font-size: 14px;
}

.nav-links a,
.nav-resume {
    color: #645a53;
    border: 0;
    background: none;
    text-decoration: none;
    cursor: pointer;
}

.nav-links a:hover,
.nav-resume:hover {
    color: var(--orange-dark);
}

.nav-resume {
    padding: 9px 14px;
    border-radius: 999px;
    color: var(--orange-dark);
    background: var(--orange-soft);
}

.admin-link {
    padding: 10px 17px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
}

main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}

.hero {
    min-height: 620px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 58px;
    align-items: center;
    padding: 46px 0 82px;
}

.eyebrow,
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--orange-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.eyebrow i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 5px rgba(249, 116, 61, 0.13);
}

.hero h1 {
    margin: 22px 0;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: clamp(48px, 5.4vw, 76px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.hero h1 em {
    position: relative;
    color: var(--orange);
    font-style: normal;
}

.hero h1 em::after {
    content: "";
    position: absolute;
    left: 2%;
    right: -2%;
    bottom: -9px;
    height: 12px;
    border-radius: 50%;
    border-top: 3px solid rgba(249, 116, 61, 0.34);
    transform: rotate(-1deg);
}

.hero-lead {
    max-width: 570px;
    margin: 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.9;
}

.hero-actions {
    margin-top: 34px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    gap: 28px;
    padding: 17px 22px 17px 27px;
    border-radius: 14px;
    color: #fff;
    background: var(--orange);
    box-shadow: 0 15px 30px rgba(249, 116, 61, 0.24);
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 19px 34px rgba(249, 116, 61, 0.3);
}

.primary-button span {
    font-size: 21px;
}

.text-button {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #655a53;
    border: 0;
    background: none;
    cursor: pointer;
}

.play-dot {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    font-size: 11px;
}

.trust-row {
    display: flex;
    gap: 34px;
    margin-top: 48px;
}

.trust-row div {
    padding-right: 34px;
    border-right: 1px solid var(--line);
}

.trust-row div:last-child {
    border: 0;
}

.trust-row strong,
.trust-row span {
    display: block;
}

.trust-row strong {
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 24px;
}

.trust-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.story-stage {
    position: relative;
    height: 492px;
    overflow: hidden;
    border-radius: 46% 46% 30px 30px;
    background:
        radial-gradient(circle at 50% 20%, rgba(255, 252, 225, 0.22), transparent 20rem),
        linear-gradient(160deg, #334b50 0%, #253d41 58%, #1d3334 100%);
    box-shadow: var(--shadow);
    isolation: isolate;
}

.stage-sky {
    position: absolute;
    inset: 0;
}

.moon {
    position: absolute;
    top: 48px;
    left: 50%;
    width: 178px;
    height: 178px;
    border-radius: 50%;
    background: #ffdd91;
    box-shadow: 0 0 0 18px rgba(255, 225, 161, 0.08), 0 0 80px rgba(255, 220, 132, 0.28);
    transform: translateX(-50%);
}

.moon-eye {
    position: absolute;
    top: 77px;
    width: 8px;
    height: 13px;
    border-radius: 50%;
    background: #5c4b3e;
}

.moon-eye-left {
    left: 55px;
}

.moon-eye-right {
    right: 55px;
}

.moon-mouth {
    position: absolute;
    left: 50%;
    top: 101px;
    width: 22px;
    height: 11px;
    border-bottom: 3px solid #5c4b3e;
    border-radius: 0 0 50% 50%;
    transform: translateX(-50%);
}

.moon-cheek {
    position: absolute;
    top: 94px;
    width: 19px;
    height: 8px;
    border-radius: 50%;
    background: rgba(238, 128, 98, 0.34);
}

.moon-cheek-left {
    left: 29px;
}

.moon-cheek-right {
    right: 29px;
}

.star {
    position: absolute;
    color: #ffe3a8;
    animation: twinkle 2.8s ease-in-out infinite;
}

.star-a {
    left: 14%;
    top: 16%;
    font-size: 20px;
}

.star-b {
    right: 14%;
    top: 32%;
    font-size: 13px;
    animation-delay: 0.9s;
}

.star-c {
    right: 22%;
    top: 12%;
    font-size: 32px;
    animation-delay: 1.4s;
}

@keyframes twinkle {
    50% { opacity: 0.38; transform: scale(0.8); }
}

.cloud {
    position: absolute;
    height: 22px;
    border-radius: 999px;
    background: rgba(255, 247, 225, 0.13);
}

.cloud::before,
.cloud::after {
    content: "";
    position: absolute;
    bottom: 2px;
    border-radius: 50%;
    background: inherit;
}

.cloud::before {
    left: 25%;
    width: 44px;
    height: 44px;
}

.cloud::after {
    right: 12%;
    width: 32px;
    height: 32px;
}

.cloud-one {
    left: -20px;
    top: 202px;
    width: 160px;
}

.cloud-two {
    right: -30px;
    top: 270px;
    width: 210px;
}

.floating-book {
    position: absolute;
    top: 257px;
    left: 50%;
    width: 184px;
    padding: 23px 26px;
    border-radius: 10px 24px 12px 18px;
    color: #534638;
    background: #fff0c7;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    transform: translateX(-50%) rotate(-3deg);
    font-family: "STKaiti", "KaiTi", serif;
}

.floating-book::after {
    content: "";
    position: absolute;
    inset: auto 12px 10px;
    height: 1px;
    background: rgba(98, 73, 50, 0.2);
}

.floating-book span {
    display: block;
    line-height: 1.75;
}

.stage-caption {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 76px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 16px;
    color: #fff9ec;
    background: rgba(9, 28, 28, 0.56);
    backdrop-filter: blur(12px);
}

.live-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ffd36e;
    box-shadow: 0 0 0 5px rgba(255, 211, 110, 0.13);
}

.stage-caption small,
.stage-caption strong {
    display: block;
}

.stage-caption small {
    margin-bottom: 3px;
    color: rgba(255, 249, 236, 0.62);
    font-size: 10px;
}

.stage-caption strong {
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 15px;
    font-weight: 500;
}

.stage-hills {
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: -72px;
    height: 176px;
    border-radius: 50% 50% 0 0;
    background: #1a2e2e;
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.12);
}

.shelf-section,
.how-section {
    padding: 76px 0 90px;
    border-top: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 34px;
}

.section-heading h2 {
    margin: 7px 0 0;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 42px;
    line-height: 1.2;
}

.category-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.category-pill {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.45);
    font-size: 12px;
}

.category-pill.active {
    color: #fff;
    border-color: var(--orange);
    background: var(--orange);
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
}

.story-card {
    overflow: hidden;
    border: 1px solid rgba(80, 58, 43, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 12px 30px rgba(83, 57, 39, 0.06);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.story-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 42px rgba(83, 57, 39, 0.11);
}

.story-cover {
    position: relative;
    height: 205px;
    overflow: hidden;
    background: #f4c6a5;
}

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

.cover-0 { background: linear-gradient(145deg, #f6c79f, #cc8e78); }
.cover-1 { background: linear-gradient(145deg, #cbd9b2, #7fa48c); }
.cover-2 { background: linear-gradient(145deg, #c5d7d8, #759ca6); }
.cover-3 { background: linear-gradient(145deg, #e1c1d0, #a47d9a); }

.cover-orb {
    position: absolute;
    top: 34px;
    left: 50%;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    background: rgba(255, 243, 206, 0.76);
    box-shadow: 0 0 50px rgba(255, 246, 216, 0.45);
    transform: translateX(-50%);
}

.cover-shape {
    position: absolute;
    bottom: -46px;
    width: 150%;
    height: 140px;
    border-radius: 50%;
    background: rgba(44, 63, 58, 0.22);
}

.shape-one {
    left: -55%;
    transform: rotate(8deg);
}

.shape-two {
    right: -60%;
    bottom: -76px;
    background: rgba(62, 55, 44, 0.25);
    transform: rotate(-8deg);
}

.cover-symbol {
    position: absolute;
    left: 50%;
    top: 50%;
    color: rgba(79, 54, 40, 0.58);
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 43px;
    transform: translate(-50%, -50%);
}

.story-time {
    position: absolute;
    right: 12px;
    top: 12px;
    padding: 6px 9px;
    border-radius: 999px;
    color: #423932;
    background: rgba(255, 251, 240, 0.8);
    backdrop-filter: blur(6px);
    font-size: 10px;
}

.story-card-body {
    padding: 19px 18px 18px;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    color: var(--orange-dark);
    font-size: 10px;
    font-weight: 700;
}

.story-meta span:last-child {
    color: var(--muted);
    font-weight: 400;
}

.story-card h3 {
    margin: 9px 0 8px;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 23px;
}

.story-card p {
    min-height: 44px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.story-tags {
    height: 25px;
    margin: 10px 0 15px;
    overflow: hidden;
    color: #9b8d83;
    font-size: 10px;
}

.story-tags span {
    margin-right: 8px;
}

.story-start {
    width: 100%;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(249, 116, 61, 0.16);
    border-radius: 11px;
    color: var(--orange-dark);
    background: var(--orange-soft);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.round-arrow {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--orange);
}

.empty-shelf {
    grid-column: 1 / -1;
    padding: 80px 20px;
    text-align: center;
    border: 1px dashed rgba(84, 64, 50, 0.2);
    border-radius: 24px;
}

.empty-shelf span {
    font-size: 50px;
}

.empty-shelf h3 {
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 30px;
}

.empty-shelf p {
    color: var(--muted);
}

.section-heading.compact {
    margin-bottom: 36px;
}

.how-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.how-grid article {
    position: relative;
    min-height: 220px;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.5);
}

.step-number {
    position: absolute;
    right: 23px;
    top: 22px;
    color: rgba(78, 63, 50, 0.14);
    font-family: Georgia, serif;
    font-size: 40px;
}

.step-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px 16px 16px 4px;
    color: #fff;
    background: var(--orange);
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 22px;
}

.how-grid article:nth-child(2) .step-icon {
    background: #8faf74;
}

.how-grid article:nth-child(3) .step-icon {
    background: #739ca5;
}

.how-grid h3 {
    margin: 23px 0 8px;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 25px;
}

.how-grid p {
    max-width: 310px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

footer {
    max-width: 1240px;
    margin: 0 auto;
    padding: 30px 28px 44px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 11px;
}

.story-dialog {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.story-dialog.open {
    opacity: 1;
    pointer-events: auto;
}

.dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 30, 29, 0.58);
    backdrop-filter: blur(8px);
}

.dialog-shell {
    position: relative;
    z-index: 1;
    width: min(1060px, 100%);
    height: min(760px, calc(100vh - 48px));
    display: grid;
    grid-template-columns: 286px 1fr;
    overflow: hidden;
    border-radius: 30px;
    background: #fffaf2;
    box-shadow: 0 45px 120px rgba(22, 21, 18, 0.28);
    transform: translateY(16px) scale(0.985);
    transition: transform 0.25s ease;
}

.story-dialog.open .dialog-shell {
    transform: translateY(0) scale(1);
}

.dialog-close {
    position: absolute;
    right: 18px;
    top: 17px;
    z-index: 3;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    color: #5e554f;
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    font-size: 25px;
}

.dialog-aside {
    position: relative;
    padding: 42px 26px;
    color: #fff9ed;
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 226, 159, 0.16), transparent 10rem),
        linear-gradient(165deg, #334c50, #1f3739 72%);
}

.aside-moon {
    position: relative;
    width: 106px;
    height: 106px;
    margin-bottom: 28px;
    border-radius: 50%;
    background: #ffdd91;
    box-shadow: 0 0 0 13px rgba(255, 221, 145, 0.07);
}

.aside-moon .moon-eye {
    top: 45px;
    width: 5px;
    height: 8px;
}

.aside-moon .moon-eye-left { left: 33px; }
.aside-moon .moon-eye-right { right: 33px; }
.aside-moon .moon-mouth {
    top: 61px;
    width: 15px;
    height: 7px;
    border-width: 2px;
}

.aside-label {
    display: block;
    color: rgba(255, 249, 237, 0.52);
    font-size: 10px;
    letter-spacing: 0.12em;
}

.dialog-aside > strong {
    display: block;
    margin: 7px 0 8px;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 27px;
}

.dialog-aside > p {
    color: rgba(255, 249, 237, 0.6);
    font-size: 12px;
    line-height: 1.7;
}

.voice-card {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 34px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.06);
}

.voice-rings {
    color: #ffd477;
    font-family: monospace;
    font-size: 13px;
}

.voice-card small,
.voice-card strong {
    display: block;
}

.voice-card small {
    margin-bottom: 4px;
    color: rgba(255, 249, 237, 0.48);
    font-size: 9px;
}

.voice-card strong {
    font-size: 12px;
}

.dialog-aside .voice-note {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 32px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 10px;
}

.dialog-main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 36px 42px 30px;
}

.dialog-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    padding-right: 44px;
}

.dialog-kicker {
    color: var(--orange-dark);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.dialog-header h2 {
    margin: 5px 0 0;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 34px;
    line-height: 1.2;
}

.progress-wrap {
    width: 150px;
    flex: 0 0 auto;
    padding-bottom: 5px;
}

.progress-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #f0e6db;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--orange);
    transition: width 0.35s ease;
}

.progress-wrap small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    text-align: right;
    font-size: 9px;
}

.story-setup {
    margin-top: 40px;
}

.setup-intro {
    display: flex;
    gap: 17px;
    padding: 23px;
    border-radius: 18px;
    background: linear-gradient(135deg, #fff0dd, #f7f2e7);
}

.setup-spark {
    width: 37px;
    height: 37px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--orange);
}

.setup-intro h3 {
    margin: 0 0 5px;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 20px;
}

.setup-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 28px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #625850;
    font-size: 11px;
    font-weight: 700;
}

.voice-select-label {
    grid-column: 1 / -1;
}

.form-grid input,
.form-grid select {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid rgba(85, 67, 55, 0.14);
    border-radius: 11px;
    outline: none;
    color: var(--ink);
    background: #fff;
    font-size: 13px;
}

.form-grid input:focus,
.form-grid select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249, 116, 61, 0.1);
}

.start-story-button {
    width: 100%;
    margin-top: 26px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: var(--orange);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 13px 30px rgba(249, 116, 61, 0.2);
}

.start-story-button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.preview-inline {
    display: block;
    margin: 12px auto 0;
    border: 0;
    color: var(--muted);
    background: none;
    cursor: pointer;
    font-size: 11px;
}

.story-play {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: 26px;
}

.message-list {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 20px 0;
    scrollbar-width: thin;
    scrollbar-color: #d8cec3 transparent;
}

.message {
    max-width: 82%;
    margin-bottom: 18px;
    animation: messageIn 0.35s ease both;
}

.message.narrator {
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #5f4b31;
    background: #ffdc91;
    font-size: 15px;
}

.message-bubble {
    padding: 14px 16px;
    border-radius: 5px 16px 16px 16px;
    color: #51463f;
    background: #fff;
    box-shadow: 0 8px 20px rgba(100, 72, 51, 0.06);
    font-size: 13px;
    line-height: 1.9;
    white-space: pre-wrap;
}

.message.child {
    margin-left: auto;
}

.message.child .message-bubble {
    border-radius: 16px 5px 16px 16px;
    color: #36501c;
    background: #e7f1db;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.choice-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 14px;
}

.choice-chip {
    padding: 9px 13px;
    border: 1px solid rgba(85, 67, 55, 0.13);
    border-radius: 999px;
    color: #655a53;
    background: #fff;
    cursor: pointer;
    font-size: 10px;
}

.choice-chip.selected {
    color: var(--orange-dark);
    border-color: rgba(249, 116, 61, 0.36);
    background: var(--orange-soft);
}

.play-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.secondary-control,
.finish-control {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-size: 10px;
}

.finish-control {
    margin-left: auto;
}

.next-story-button {
    min-width: 150px;
    padding: 11px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 10px;
    color: #fff;
    background: var(--orange);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.next-story-button:disabled {
    opacity: 0.55;
    cursor: wait;
}

.finished-panel {
    padding: 24px;
    text-align: center;
    border-radius: 18px;
    background: linear-gradient(135deg, #fff0dc, #edf2e1);
}

.finished-panel > span {
    color: var(--orange);
    font-size: 34px;
}

.finished-panel h3 {
    margin: 8px 0;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 24px;
}

.finished-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.finished-panel button {
    margin-top: 16px;
    padding: 9px 15px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--orange);
    cursor: pointer;
    font-size: 11px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 100;
    max-width: min(90vw, 500px);
    padding: 12px 17px;
    border-radius: 12px;
    color: #fff;
    background: rgba(37, 41, 39, 0.92);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
    font-size: 12px;
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .story-stage {
        max-width: 580px;
        width: 100%;
        margin: 0 auto;
    }

    .story-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dialog-shell {
        grid-template-columns: 225px 1fr;
    }

    .dialog-main {
        padding: 34px 28px 24px;
    }
}

@media (max-width: 720px) {
    .site-nav {
        padding: 18px 20px;
    }

    .nav-links > a:not(.admin-link),
    .nav-resume {
        display: none;
    }

    main {
        padding: 0 20px;
    }

    .hero {
        min-height: auto;
        padding: 30px 0 58px;
        gap: 38px;
    }

    .hero h1 {
        font-size: 46px;
    }

    .hero-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .trust-row {
        gap: 16px;
    }

    .trust-row div {
        padding-right: 16px;
    }

    .story-stage {
        height: 430px;
        border-radius: 42% 42% 24px 24px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-heading h2 {
        font-size: 34px;
    }

    .category-pills {
        justify-content: flex-start;
    }

    .story-grid,
    .how-grid {
        grid-template-columns: 1fr;
    }

    .story-cover {
        height: 230px;
    }

    footer {
        flex-direction: column;
    }

    .story-dialog {
        padding: 0;
    }

    .dialog-shell {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .dialog-aside {
        min-height: 118px;
        padding: 18px 78px 18px 20px;
        display: grid;
        grid-template-columns: 62px 1fr;
        align-items: center;
        column-gap: 14px;
    }

    .aside-moon {
        grid-row: 1 / span 3;
        width: 58px;
        height: 58px;
        margin: 0;
    }

    .aside-moon .moon-eye {
        top: 24px;
        width: 4px;
        height: 6px;
    }

    .aside-moon .moon-eye-left { left: 18px; }
    .aside-moon .moon-eye-right { right: 18px; }
    .aside-moon .moon-mouth {
        left: 50%;
        top: 35px;
        width: 9px;
        height: 5px;
        border-width: 1px;
    }

    .dialog-aside > strong {
        margin: 0;
        font-size: 21px;
    }

    .dialog-aside > p {
        margin: 2px 0;
    }

    .voice-card,
    .dialog-aside .voice-note,
    .aside-label {
        display: none;
    }

    .dialog-main {
        min-height: 0;
        padding: 24px 20px 18px;
    }

    .dialog-header {
        padding-right: 40px;
    }

    .dialog-header h2 {
        font-size: 27px;
    }

    .progress-wrap {
        display: none;
    }

    .story-setup {
        margin-top: 26px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .voice-select-label {
        grid-column: auto;
    }

    .message {
        max-width: 92%;
    }

    .play-controls {
        flex-wrap: wrap;
    }

    .finish-control {
        margin-left: 0;
    }

    .next-story-button {
        flex: 1;
        min-width: 140px;
    }
}

@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;
    }
}
