/* ==========================================================
   AI浓度检测 — Duolingo 风视觉系统
   主色 电光紫蓝 #6C5CE7 · 成功绿 #58CC02 · 错误红 #FF4B4B
   ========================================================== */

:root {
    --purple: #6C5CE7;
    --purple-deep: #5040C9;      /* 厚底按钮阴影色 */
    --purple-soft: #EDEAFF;
    --lime: #7FE030;             /* Bito 描边荧光绿 */
    --green: #58CC02;
    --green-deep: #46A302;
    --green-soft: #EAFBDE;
    --red: #FF4B4B;
    --red-deep: #D93B3B;
    --red-soft: #FFECEC;
    --ink: #2B2653;
    --ink-2: #6B679B;
    --line: #EDE7DB;
    --bg: #FBF8F3;
    --card: #FFFFFF;
    --radius: 22px;
    --font-fun: 'ZCOOL KuaiLe', 'Baloo 2', sans-serif;
    --font-body: 'Baloo 2', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    /* 网点底纹，轻科技感 */
    background-image: radial-gradient(rgba(108, 92, 231, 0.07) 1.5px, transparent 1.5px);
    background-size: 26px 26px;
}

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative; overflow-x: hidden; }

/* ---------- 屏幕切换 ---------- */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 32px 22px 40px;
    min-height: 100vh;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .35s ease, transform .35s ease;
}
.screen.shown { display: flex; }
.screen.active { display: flex; opacity: 1; transform: translateY(0); }

/* ---------- 通用组件 ---------- */
.hot-pill {
    background: #FFF1D6;
    color: #A96B00;
    font-weight: 700;
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1.5px solid #F5D9A0;
}

.card {
    width: 100%;
    background: var(--card);
    border-radius: var(--radius);
    border: 1.5px solid #F2EDE3;
    padding: 22px 20px;
    margin-top: 16px;
    box-shadow: 0 14px 30px -16px rgba(64, 54, 128, .14), 0 2px 6px rgba(64, 54, 128, .05);
}
.card-h { font-size: 16px; margin-bottom: 12px; }

/* Duolingo 式厚底按钮 */
.btn3d {
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 16px;
    color: #fff;
    background: var(--purple);
    border: none;
    border-radius: 18px;
    padding: 15px 30px;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--purple-deep);
    transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
    user-select: none;
}
.btn3d:hover { filter: brightness(1.05); }
.btn3d:active { transform: translateY(5px); box-shadow: 0 0 0 var(--purple-deep); }
.btn-xl { width: 100%; font-size: 18px; padding: 17px 30px; letter-spacing: 1px; }
.btn-sm { font-size: 14px; padding: 11px 22px; }
.btn-ghost {
    background: #fff; color: var(--purple);
    box-shadow: 0 5px 0 var(--line);
    border: 2px solid var(--line);
}
.btn-ghost:active { box-shadow: 0 0 0 var(--line); }

/* ---------- ① 欢迎页 ---------- */
.logo {
    font-family: var(--font-fun);
    font-size: 58px;
    line-height: 1.1;
    margin-top: 18px;
    color: var(--purple);
    text-shadow: 3px 3px 0 var(--purple-soft);
}
.logo-accent { color: var(--ink); }
.tagline { color: var(--ink-2); font-weight: 700; margin-top: 6px; font-size: 15px; }

.mascot-stage { position: relative; margin-top: 18px; }
.welcome-bito { width: 210px; animation: float 3.2s ease-in-out infinite; }
.spark { position: absolute; font-weight: 800; animation: sparkTwinkle 2.6s ease-in-out infinite; pointer-events: none; }
.spark.s1 { top: 14%; left: -34px; color: var(--purple); font-size: 20px; }
.spark.s2 { top: 4%; right: -30px; color: #F5B93D; font-size: 15px; animation-delay: .7s; }
.spark.s3 { bottom: 22%; right: -42px; color: var(--green); font-size: 13px; animation-delay: 1.3s; }
.spark.s4 { bottom: 12%; left: -26px; color: #FF7B9C; font-size: 16px; animation-delay: 1.9s; }

.ticker-wrap {
    margin-top: 14px; height: 30px; overflow: hidden; width: 100%;
    display: flex; justify-content: center;
}
.ticker {
    font-size: 13px; color: var(--ink-2); font-weight: 700;
    background: #fff; border: 1.5px solid var(--line);
    padding: 5px 14px; border-radius: 999px;
    animation: tickerIn .4s ease;
    white-space: nowrap;
}
@keyframes tickerIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.intro-card {
    background: var(--card); border: 2px solid var(--line);
    border-radius: var(--radius); padding: 18px 20px; margin-top: 16px;
    font-size: 15px; line-height: 1.75; color: var(--ink);
}
.intro-card strong { color: var(--purple); }
#btn-start { margin-top: 22px; }
.welcome-foot { margin-top: 16px; font-size: 12px; color: #B0A896; font-weight: 700; }

/* ---------- ② 答题页 ---------- */
.quiz-head { width: 100%; display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.progress-track {
    flex: 1; height: 16px; background: #ECE6DA; border-radius: 999px; position: relative;
}
.progress-fill {
    height: 100%; width: 8%;
    background: linear-gradient(90deg, var(--green), var(--lime));
    border-radius: 999px;
    transition: width .5s cubic-bezier(.5, 1.6, .4, 1);
}
.progress-buddy {
    position: absolute; top: -31px; left: 8%; width: 42px;
    transform: translateX(-50%);
    transition: left .5s cubic-bezier(.5, 1.6, .4, 1);
    filter: drop-shadow(0 3px 4px rgba(64, 54, 128, .14));
}
.progress-chip { font-weight: 800; font-size: 13px; color: var(--ink-2); }

.q-card {
    width: 100%; background: var(--card);
    border: 1.5px solid #F2EDE3; border-radius: var(--radius);
    padding: 22px 22px 26px; text-align: center;
    box-shadow: 0 14px 30px -16px rgba(64, 54, 128, .14), 0 2px 6px rgba(64, 54, 128, .05);
    animation: cardIn .4s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.q-meta { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.q-tag {
    font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 999px;
    background: var(--purple-soft); color: var(--purple);
}
.q-tag.habit { background: #FFE9F3; color: #D6408B; }
.q-num { font-size: 12px; font-weight: 800; color: #B4B0DE; padding: 4px 0; }
.q-emoji {
    width: 92px; height: 92px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 46px; position: relative;
    background: radial-gradient(circle at 38% 30%, #F5F2FF, #E9E3FD);
    border-radius: 50%;
    box-shadow: inset 0 -5px 0 rgba(108, 92, 231, .08), 0 6px 14px -6px rgba(64, 54, 128, .12);
    animation: pop .45s cubic-bezier(.5, 1.8, .4, 1);
}
.q-emoji::before, .q-emoji::after {
    position: absolute; font-size: 15px; font-weight: 800;
    animation: sparkTwinkle 2.4s ease-in-out infinite;
}
.q-emoji::before { content: "✦"; color: var(--purple); top: -2px; right: -8px; }
.q-emoji::after { content: "＋"; color: #F5B93D; bottom: 2px; left: -12px; animation-delay: 1.2s; }
@keyframes sparkTwinkle { 0%, 100% { opacity: .35; transform: scale(.85) rotate(0deg); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.q-text { font-size: 18px; line-height: 1.6; font-weight: 800; }

.options { width: 100%; margin-top: 18px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 130px; }
.options.locked { pointer-events: none; }

.opt {
    display: flex; align-items: center; gap: 13px;
    width: 100%; text-align: left;
    background: var(--card);
    border: 2px solid var(--line); border-radius: 18px;
    box-shadow: 0 4px 0 var(--line);
    padding: 14px 16px;
    font-family: var(--font-body); font-size: 15px; font-weight: 700; color: var(--ink);
    line-height: 1.5;
    cursor: pointer;
    transition: transform .08s ease, box-shadow .08s ease, background .2s, border-color .2s;
    animation: optIn .35s ease backwards;
}
.opt:nth-child(1) { animation-delay: .03s; } .opt:nth-child(2) { animation-delay: .09s; }
.opt:nth-child(3) { animation-delay: .15s; } .opt:nth-child(4) { animation-delay: .21s; }
@keyframes optIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.opt:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }

.opt-label {
    flex: none; width: 30px; height: 30px; border-radius: 50%;
    background: var(--purple); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
}

.opt.correct {
    background: var(--green-soft); border-color: var(--green);
    box-shadow: 0 4px 0 var(--green);
    animation: bounce .45s ease;
}
.opt.correct .opt-label { background: var(--green); }
.opt.wrong {
    background: var(--red-soft); border-color: var(--red);
    box-shadow: 0 4px 0 var(--red);
    animation: shake .4s ease;
}
.opt.wrong .opt-label { background: var(--red); }
.opt.picked {
    background: var(--purple-soft); border-color: var(--purple);
    box-shadow: 0 4px 0 var(--purple);
    animation: bounce .45s ease;
}
.opt.dim { opacity: .45; }

@keyframes bounce { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 55% { transform: translateX(6px); } 80% { transform: translateX(-3px); } }

/* ---------- 反馈底部弹层 ---------- */
.feedback-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-width: 480px; margin: 0 auto;
    background: var(--green-soft);
    border-top: 3px solid var(--green);
    border-radius: 26px 26px 0 0;
    padding: 20px 22px 26px;
    transform: translateY(110%);
    visibility: hidden;
    transition: transform .38s cubic-bezier(.4, 1.4, .5, 1), visibility 0s .4s;
}
.feedback-sheet.show { transform: translateY(0); visibility: visible; transition: transform .38s cubic-bezier(.4, 1.4, .5, 1), visibility 0s; }
.feedback-sheet.bad { background: var(--red-soft); border-top-color: var(--red); }
.feedback-sheet.neutral { background: var(--purple-soft); border-top-color: var(--purple); }

.fb-inner { display: flex; gap: 14px; align-items: flex-start; }
.fb-bito { flex: none; width: 72px; }
.fb-title { font-size: 17px; margin-bottom: 5px; color: var(--green-deep); }
.feedback-sheet.bad .fb-title { color: var(--red-deep); }
.feedback-sheet.neutral .fb-title { color: var(--purple); }
.fb-text { font-size: 14px; line-height: 1.7; color: var(--ink); }

.btn-continue { width: 100%; margin-top: 16px; background: var(--green); box-shadow: 0 5px 0 var(--green-deep); }
.btn-continue:active { box-shadow: 0 0 0 var(--green-deep); }
.feedback-sheet.bad .btn-continue { background: var(--red); box-shadow: 0 5px 0 var(--red-deep); }
.feedback-sheet.bad .btn-continue:active { box-shadow: none; }
.feedback-sheet.neutral .btn-continue { background: var(--purple); box-shadow: 0 5px 0 var(--purple-deep); }
.feedback-sheet.neutral .btn-continue:active { box-shadow: none; }

/* ---------- ③ 分析页 ---------- */
#screen-analyzing { justify-content: center; }
.analyzing-bito { width: 170px; animation: float 2.6s ease-in-out infinite; }
.an-title { font-family: var(--font-fun); font-size: 24px; color: var(--purple); margin-top: 22px; }
.scanbar {
    width: 240px; height: 12px; margin-top: 20px;
    background: #ECE6DA; border-radius: 999px; overflow: hidden;
}
.scanbar-fill {
    width: 40%; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--purple), var(--lime));
    animation: scan 1.2s ease-in-out infinite;
}
@keyframes scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.an-sub { margin-top: 16px; font-size: 14px; font-weight: 700; color: var(--ink-2); min-height: 22px; }

/* ---------- ④ 结果页 ---------- */
#screen-result { padding: 26px 18px 40px; }
.result-scroll { width: 100%; display: flex; flex-direction: column; align-items: center; }

.density-hero { text-align: center; margin-top: 18px; }
.density-num {
    font-family: var(--font-fun);
    font-size: 92px; line-height: 1; color: var(--purple);
    text-shadow: 4px 4px 0 var(--purple-soft);
}
.density-pct { font-size: 44px; }
.density-label { font-weight: 800; color: var(--ink-2); letter-spacing: 6px; margin-top: 2px; }
.badge-wrap { width: 216px; margin: 16px auto 0; animation: badgeIn .8s cubic-bezier(.35, 1.4, .4, 1); }
.medal-sheen { animation: sheenSweep 3.6s ease-in-out infinite; }
@keyframes sheenSweep { 0%, 55% { transform: translateX(0); } 100% { transform: translateX(400px); } }
@keyframes badgeIn { from { opacity: 0; transform: scale(.3) rotate(-16deg); } to { opacity: 1; transform: none; } }
.beat-line { margin-top: 10px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.beat-line strong { color: #E09E00; font-size: 17px; }

.title-card { text-align: center; position: relative; padding-top: 16px; }
.title-bito { width: 86px; margin: 0 auto; }
.title-label { font-size: 12px; font-weight: 800; color: #B4B0DE; letter-spacing: 2px; margin-top: 4px; }
.title-name { font-family: var(--font-body); font-weight: 800; font-size: 24px; color: var(--ink); margin-top: 6px; letter-spacing: .5px; }
.title-en { font-size: 12px; font-weight: 800; color: var(--purple); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.title-desc { font-size: 14px; color: var(--ink-2); line-height: 1.7; margin-top: 10px; }

.diagnosis { font-size: 14.5px; line-height: 1.85; }

.axis-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.axis-lbl { flex: none; width: 78px; font-size: 12px; font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.axis-lbl:last-child { text-align: right; }
.axis-lbl.win { color: var(--purple); }
.axis-bar { flex: 1; height: 14px; border-radius: 999px; overflow: hidden; display: flex; position: relative; background: #ECE6DA; }
.axis-fill-l { height: 100%; background: #C9BFFF; width: 50%; transition: width .9s cubic-bezier(.4, 1.2, .4, 1); }
.axis-fill-r { height: 100%; background: var(--purple); width: 50%; transition: width .9s cubic-bezier(.4, 1.2, .4, 1); }
.axis-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #fff; }
.axis-note { font-size: 13px; color: var(--ink-2); line-height: 1.7; margin-top: 4px; }

.result-actions { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

.directory { display: flex; flex-direction: column; gap: 10px; }
.dir-item {
    border: 2px solid var(--line); border-radius: 16px; padding: 13px 14px;
    display: flex; gap: 10px; align-items: flex-start;
}
.dir-item.mine { border-color: var(--purple); background: var(--purple-soft); }
.dir-emoji { font-size: 22px; flex: none; }
.dir-name { font-size: 14px; font-weight: 800; }
.dir-name .you { color: var(--purple); font-size: 11px; margin-left: 4px; }
.dir-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-top: 3px; }

.result-foot { margin-top: 22px; font-size: 12px; color: #A5A1CF; font-weight: 700; }

/* ---------- 海报弹窗 ---------- */
.modal {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(43, 38, 83, .55);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal.show { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
    background: var(--bg); border-radius: 24px; padding: 20px;
    max-width: 380px; width: 100%; max-height: 92vh; overflow-y: auto;
    text-align: center; position: relative;
    animation: cardIn .3s ease;
}
.modal-close {
    position: absolute; top: 10px; right: 14px;
    background: none; border: none; font-size: 30px; color: var(--ink-2); cursor: pointer;
}
.modal-title { font-size: 15px; margin-bottom: 14px; }
.poster-wrap img { width: 100%; border-radius: 14px; border: 2px solid var(--line); }
#btn-download { margin-top: 14px; }

/* ---------- Bito SVG 动画 ---------- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

.bito .lid { transform: scaleY(0); transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } 98% { transform: scaleY(0); } }

.bito .wave-arm { transform-box: fill-box; transform-origin: 12% 88%; animation: wave 1.6s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-22deg); } 60% { transform: rotate(8deg); } }

.bito .glow { animation: glowPulse 2s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { opacity: .3; } 50% { opacity: .75; } }

.bito .confetti-bit { animation: confettiFall 1.4s ease-in infinite; }
@keyframes confettiFall { 0% { transform: translateY(-6px); opacity: 1; } 100% { transform: translateY(26px); opacity: 0; } }

.bito .zzz { animation: zzzFloat 2.2s ease-in-out infinite; }
@keyframes zzzFloat { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-7px); opacity: 1; } }

.bito .clap-arm-l { transform-box: fill-box; transform-origin: 88% 88%; animation: clapL .5s ease-in-out infinite alternate; }
.bito .clap-arm-r { transform-box: fill-box; transform-origin: 12% 88%; animation: clapR .5s ease-in-out infinite alternate; }
@keyframes clapL { from { transform: rotate(0); } to { transform: rotate(14deg); } }
@keyframes clapR { from { transform: rotate(0); } to { transform: rotate(-14deg); } }

.bito .shock-sparks { animation: sparkPop .6s ease-in-out infinite alternate; }
@keyframes sparkPop { from { opacity: .3; transform: scale(.9); } to { opacity: 1; transform: scale(1.08); } }

/* 小屏适配 */
@media (max-width: 360px) {
    .logo { font-size: 46px; }
    .q-text { font-size: 16px; }
    .density-num { font-size: 74px; }
}
