/* ============================================================
   StoryForge AI — 主样式表
   设计令牌 → 重置 → 布局 → 组件 → 动画 → 响应式
   ============================================================ */

/* ---------- 设计令牌 ---------- */
:root {
    /* 颜色 */
    --bg: #ffffff;
    --bg-soft: #f7f8fc;
    --text: #1a1d2e;
    --text-soft: #5b6079;
    --text-mute: #9499ae;
    --border: #e6e8f0;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef0ff;
    --accent: #f59e0b;
    --accent-soft: #fef3c7;
    --success: #10b981;

    /* 渐变 */
    --grad-hero: radial-gradient(1200px 500px at 80% -10%, rgba(99,102,241,.18), transparent 60%),
                 radial-gradient(900px 600px at 10% 20%, rgba(244,114,182,.10), transparent 55%);
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #ec4899 100%);
    --grad-text: linear-gradient(120deg, #6366f1, #ec4899);

    /* 半径 */
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-pill: 999px;

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(30, 32, 60, .06);
    --shadow-md: 0 12px 32px rgba(30, 32, 60, .10);
    --shadow-lg: 0 24px 60px rgba(30, 32, 60, .16);
    --shadow-glow: 0 16px 40px rgba(99, 102, 241, .35);

    /* 动效 */
    --ease: cubic-bezier(.22, .9, .24, 1);
    --dur: .35s;

    /* 布局 */
    --container: 1160px;
    --nav-h: 68px;
}

/* ---------- 重置 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input { font: inherit; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

/* ---------- 工具类 ---------- */
.container { width: min(100% - 40px, var(--container)); margin-inline: auto; }
.section { padding: 96px 0; }
.section-head { text-align: center; max-width: 620px; margin: 0 auto 56px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -.02em; }
.section-head p { color: var(--text-soft); margin-top: 12px; }
.section-tag {
    display: inline-block;
    font-size: .8rem; font-weight: 600;
    color: var(--primary); background: var(--primary-soft);
    padding: 6px 14px; border-radius: var(--r-pill);
    margin-bottom: 14px; letter-spacing: .04em;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px; border-radius: var(--r-pill);
    font-weight: 600; font-size: .92rem;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur), color var(--dur);
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { color: #fff; background: var(--grad-primary); box-shadow: var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 48px rgba(99,102,241,.45); }
.btn-ghost { color: var(--text); padding: 9px 18px; }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-outline { color: var(--text); border: 1.5px solid var(--border); background: rgba(255,255,255,.6); backdrop-filter: blur(6px); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-lg { padding: 15px 30px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- 导航 ---------- */
.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-h);
    transition: background var(--dur), box-shadow var(--dur), backdrop-filter var(--dur);
}
.navbar.scrolled {
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow-sm);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.1rem; }
.logo-icon { color: var(--primary); display: inline-flex; }
.logo-accent { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 30px; }
.nav-link { color: var(--text-soft); font-weight: 500; font-size: .94rem; position: relative; padding: 4px 0; }
.nav-link::after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 2px; background: var(--primary); transition: width var(--dur) var(--ease); }
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s, opacity .3s; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: calc(var(--nav-h) + 60px) 0 100px; overflow: hidden; background: var(--grad-hero); }
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.glow-1 { width: 420px; height: 420px; right: -60px; top: -80px; background: var(--primary); }
.glow-2 { width: 360px; height: 360px; left: -80px; bottom: -60px; background: var(--accent); opacity: .25; }
.floating-words { position: absolute; inset: 0; }
.fw-word {
    position: absolute; font-size: .8rem; font-weight: 600;
    color: var(--text-mute); opacity: .35;
    animation: floatUp linear infinite;
}
@keyframes floatUp {
    0%   { transform: translateY(20px); opacity: 0; }
    20%  { opacity: .5; }
    80%  { opacity: .5; }
    100% { transform: translateY(-80px); opacity: 0; }
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 50px; align-items: center; }

.badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.8); border: 1px solid var(--border);
    padding: 7px 16px; border-radius: var(--r-pill);
    font-size: .83rem; color: var(--text-soft); font-weight: 500;
    box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(16,185,129,.18); }
.hero-title { font-size: clamp(2.2rem, 4.6vw, 3.8rem); font-weight: 800; line-height: 1.12; letter-spacing: -.035em; }
.title-accent { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 1.1rem; color: var(--text-soft); margin: 22px 0 32px; max-width: 480px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-stats { display: flex; gap: 44px; margin-top: 44px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: .85rem; color: var(--text-mute); }

/* 编辑器预览 */
.hero-visual { position: relative; perspective: 1000px; }
.editor-mock {
    background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); overflow: hidden;
    transform: rotateY(-6deg) rotateX(3deg); transform-style: preserve-3d;
    transition: transform .6s var(--ease);
}
.hero-visual:hover .editor-mock { transform: rotateY(-2deg) rotateX(1deg); }
.editor-bar { display: flex; align-items: center; gap: 12px; padding: 13px 18px; background: var(--bg-soft); border-bottom: 1px solid var(--border); }
.editor-dots { display: flex; gap: 6px; }
.editor-dots i { width: 11px; height: 11px; border-radius: 50%; background: #e0e2ec; }
.editor-title { font-size: .85rem; font-weight: 600; flex: 1; }
.editor-ai { font-size: .72rem; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: var(--r-pill); font-weight: 600; }
.editor-body { padding: 26px 24px; min-height: 200px; position: relative; }
.typed-line { font-size: .98rem; line-height: 1.85; color: var(--text); }
.typed-line .hl { background: var(--accent-soft); padding: 1px 4px; border-radius: 4px; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--primary); vertical-align: middle; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.editor-suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.chip {
    font-size: .78rem; font-weight: 600; color: var(--primary);
    background: var(--primary-soft); padding: 6px 12px; border-radius: var(--r-pill);
    border: 1px solid rgba(99,102,241,.2); cursor: default;
    transition: transform var(--dur), background var(--dur);
}
.chip:hover { transform: translateY(-2px); background: #e2e4ff; }

.float-card {
    position: absolute; background: #fff; border-radius: var(--r-md);
    box-shadow: var(--shadow-md); padding: 12px 16px;
    display: flex; align-items: center; gap: 12px; font-size: .85rem;
    border: 1px solid var(--border);
    animation: cardBob 4s ease-in-out infinite;
}
.float-card b { display: block; font-size: .88rem; }
.float-card small { color: var(--text-mute); font-size: .74rem; }
.float-emoji { font-size: 1.4rem; }
.float-card-1 { top: 30px; left: -30px; animation-delay: 0s; }
.float-card-2 { bottom: 24px; right: -20px; animation-delay: 1.2s; }
@keyframes cardBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- 功能特性 ---------- */
.features { background: var(--bg); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 32px 28px; transition: transform var(--dur) var(--ease), box-shadow var(--dur), border-color var(--dur);
}
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: transparent; }
.feature-icon {
    width: 52px; height: 52px; border-radius: var(--r-md);
    background: color-mix(in srgb, var(--c) 14%, white);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 18px;
}
.feature-card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-soft); font-size: .93rem; }

/* ---------- 写作流程 ---------- */
.how { background: var(--bg-soft); }
.steps { display: flex; align-items: center; justify-content: center; gap: 0; }
.step { flex: 1; text-align: center; padding: 0 20px; }
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--grad-primary); color: #fff; font-size: 1.3rem; font-weight: 800;
    box-shadow: var(--shadow-glow); margin-bottom: 18px;
}
.step h3 { font-size: 1.2rem; margin-bottom: 8px; }
.step p { color: var(--text-soft); font-size: .92rem; max-width: 240px; margin: 0 auto; }
.step-line { width: 60px; height: 2px; background: linear-gradient(90deg, var(--primary), transparent); margin-bottom: 60px; }

/* ---------- CTA / 定价 ---------- */
.cta { background: var(--bg); }
.cta-box {
    background: var(--grad-primary); color: #fff;
    border-radius: var(--r-xl); padding: 64px 40px; text-align: center;
    box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.cta-box::before { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1.5' fill='rgba(255,255,255,.18)'/%3E%3C/svg%3E") repeat; opacity: .5; }
.cta-box > * { position: relative; }
.cta-box h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 12px; }
.cta-box > p { opacity: .9; max-width: 480px; margin: 0 auto 28px; }
.pricing-toggle { display: inline-flex; background: rgba(255,255,255,.18); border-radius: var(--r-pill); padding: 4px; margin-bottom: 24px; }
.price-tab { padding: 9px 22px; border-radius: var(--r-pill); color: rgba(255,255,255,.8); font-weight: 600; transition: background .25s; }
.price-tab.active { background: #fff; color: var(--primary); }
.save { background: var(--accent); color: #fff; font-size: .68rem; padding: 2px 8px; border-radius: var(--r-pill); margin-left: 6px; }
.price-display { font-size: 1rem; margin-bottom: 28px; display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.price-currency { font-size: 1.6rem; font-weight: 700; }
.price-number { font-size: 4rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; transition: opacity .3s; }
.price-period { opacity: .85; }
.cta-box .btn-primary { background: #fff; color: var(--primary); box-shadow: var(--shadow-md); }

/* ---------- 页脚 ---------- */
.footer { background: #11131f; color: #c5c8da; padding: 64px 0 0; }
.footer-inner { display: grid; grid-template-columns: 1.4fr 2fr; gap: 50px; padding-bottom: 50px; }
.logo-light { color: #fff; }
.footer-brand p { margin-top: 14px; font-size: .9rem; max-width: 280px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.footer-cols h4 { color: #fff; font-size: .95rem; margin-bottom: 16px; }
.footer-cols a { display: block; font-size: .88rem; color: #9499ae; padding: 5px 0; transition: color .2s; }
.footer-cols a:hover { color: #fff; }
.footer-bottom { text-align: center; padding: 24px; border-top: 1px solid rgba(255,255,255,.08); font-size: .82rem; color: #6b6f85; }

/* ---------- 登录 / 注册 弹窗 ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.28), transparent 60%),
                rgba(15, 17, 32, .58);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
    padding: 20px;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    background: #fff; border-radius: var(--r-xl);
    box-shadow: 0 30px 80px -20px rgba(17,19,31,.45), 0 8px 24px -12px rgba(79,70,229,.25);
    width: min(440px, 100%); padding: 34px 36px 30px;
    position: relative; transform: translateY(24px) scale(.96); transition: transform .38s var(--ease);
    max-height: 92vh; overflow-y: auto;
}
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-close {
    position: absolute; top: 16px; right: 16px; width: 34px; height: 34px;
    display: grid; place-items: center;
    color: var(--text-mute); border-radius: 50%;
    transition: background .2s, color .2s, transform .2s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); transform: rotate(90deg); }

.modal-panel { animation: panelIn .35s var(--ease) both; }
@keyframes panelIn {
    from { opacity: 0; transform: translateX(14px); }
    to   { opacity: 1; transform: translateX(0); }
}
.modal-head { text-align: center; margin-bottom: 24px; }
.modal-badge {
    width: 58px; height: 58px; margin: 0 auto 14px;
    display: grid; place-items: center; color: #fff;
    border-radius: 18px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    box-shadow: 0 10px 24px -8px rgba(99,102,241,.65);
}
.modal-head h2 { font-size: 1.55rem; letter-spacing: -.02em; }
.modal-head p { color: var(--text-soft); font-size: .88rem; margin-top: 6px; }

.field { display: block; margin-bottom: 14px; }
.field > span {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .83rem; font-weight: 600; margin-bottom: 7px; color: var(--text);
}
.field > span em {
    font-style: normal; font-size: .68rem; font-weight: 700; letter-spacing: .05em;
    color: var(--text-mute); background: var(--bg-soft); border-radius: var(--r-pill); padding: 2px 9px;
}
.input-wrap { position: relative; }
.input-ico {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    font-style: normal; font-size: .95rem; opacity: .75; pointer-events: none;
}
.field input {
    width: 100%; padding: 12px 15px 12px 42px;
    border: 1.5px solid var(--border); border-radius: var(--r-md);
    background: #fbfbfe; color: var(--text); font-size: .92rem;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input::placeholder { color: var(--text-mute); }
.field input:focus {
    outline: none; border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.field.has-error input { border-color: #ef4444; background: #fff5f5; }
.field.has-error input:focus { box-shadow: 0 0 0 4px rgba(239,68,68,.12); }
.field-invite .input-wrap input { letter-spacing: .06em; }
.field-options { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 18px; font-size: .85rem; }
.remember { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); cursor: pointer; }
.forgot { color: var(--primary); font-weight: 600; }
.forgot:hover { color: var(--primary-hover); }

.btn-auth { position: relative; margin-top: 2px; }
.btn-auth .btn-spinner {
    display: none; width: 17px; height: 17px; margin-left: 8px;
    border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
    animation: authSpin .7s linear infinite; vertical-align: middle;
}
@keyframes authSpin { to { transform: rotate(360deg); } }
.btn-auth.is-loading { opacity: .85; pointer-events: none; }
.btn-auth.is-loading .btn-spinner { display: inline-block; }

.form-tip { text-align: center; font-size: .76rem; color: var(--text-mute); margin-top: 12px; }
.modal-switch { text-align: center; font-size: .88rem; color: var(--text-soft); margin-top: 20px; }
.modal-switch a { color: var(--primary); font-weight: 700; }
.modal-switch a:hover { text-decoration: underline; }

@media (max-width: 480px) {
    .modal { padding: 30px 22px 26px; border-radius: var(--r-lg); }
    .modal-head h2 { font-size: 1.35rem; }
}

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: #11131f; color: #fff; padding: 13px 26px; border-radius: var(--r-pill);
    font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 300;
    opacity: 0; transition: transform .4s var(--ease), opacity .4s; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- 滚动出现动画 ---------- */
[data-aos] { opacity: 0; transform: translateY(30px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-aos].in { opacity: 1; transform: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: 60px; }
    .hero-visual { order: -1; max-width: 460px; margin: 0 auto; }
    .float-card-1 { left: 0; } .float-card-2 { right: 0; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .section { padding: 64px 0; }
    .nav-links {
        position: fixed; top: var(--nav-h); left: 0; right: 0;
        flex-direction: column; gap: 0; padding: 12px 20px;
        background: #fff; box-shadow: var(--shadow-md);
        transform: translateY(-110%); transition: transform .35s var(--ease);
    }
    .nav-links.open { transform: translateY(0); }
    .nav-link { padding: 14px 0; border-bottom: 1px solid var(--border); }
    .nav-toggle { display: flex; }
    .nav-actions .btn-ghost { display: none; }
    .hero-stats { gap: 26px; flex-wrap: wrap; }
    .feature-grid { grid-template-columns: 1fr; }
    .steps { flex-direction: column; gap: 30px; }
    .step-line { width: 2px; height: 40px; background: linear-gradient(180deg, var(--primary), transparent); margin: 0; }
    .footer-cols { grid-template-columns: 1fr 1fr; }
}
