/* quiz.css — 页面布局、答题、结果 */
.app {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: calc(14px + var(--safe-t)) 18px calc(28px + var(--safe-b));
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.page { display: none; }
.page.is-active { display: flex; flex-direction: column; flex: 1; gap: 22px; }

/* 语言分段控件 */
.seg {
    --idx: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-self: center;
    width: min(100%, 340px);
    padding: 4px;
    border-radius: 999px;
}
.seg-thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc((100% - 8px) / 4);
    border-radius: 999px;
    background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .72));
    box-shadow: 0 2px 10px rgba(232, 93, 117, .28), inset 0 1px 0 #fff;
    transform: translateX(calc(var(--idx) * 100%));
    transition: transform .45s cubic-bezier(.3, 1.35, .5, 1);
}
.seg button {
    position: relative;
    z-index: 1;
    padding: 9px 0;
    border: 0;
    background: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-soft);
    cursor: pointer;
    transition: color .2s;
}
.seg button.is-active { color: var(--pink-deep); }
.seg button:focus-visible { outline: 2px solid var(--pink-deep); outline-offset: -2px; border-radius: 999px; }

/* 进度行 */
.progress-row { display: flex; align-items: center; gap: 14px; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border-radius: 50%;
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), opacity .2s;
}
.icon-btn:active:not(:disabled) { transform: scale(.9); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn:focus-visible { outline: 3px solid var(--pink-deep); outline-offset: 3px; }

.track {
    flex: 1;
    height: 22px;
    padding: 3px;
    border-radius: 999px;
}
.track-fill {
    height: 100%;
    width: calc(var(--p, 0) * 100%);
    min-width: 16px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffa6b4, #ff6f88);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 2px 8px rgba(255, 111, 136, .4);
    transition: width .45s cubic-bezier(.3, 1.2, .5, 1);
}

.counter {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 52px;
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.counter .ic { width: 16px; height: 16px; color: #ff6f88; }

/* 题目 */
.stage.to-next { animation: slide-next .38s cubic-bezier(.2, .8, .2, 1); }
.stage.to-prev { animation: slide-prev .38s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide-next { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slide-prev { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }

.q-title {
    margin: 8px 4px 24px;
    font-size: clamp(21px, 5.6vw, 25px);
    line-height: 1.45;
    font-weight: 800;
    letter-spacing: .02em;
}

.opts { display: flex; flex-direction: column; gap: 14px; }

.opt {
    --tint: #ff8c9a;
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 15px 18px;
    text-align: left;
    cursor: pointer;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, .75);
    background: linear-gradient(145deg,
        color-mix(in srgb, var(--tint) 14%, rgba(255, 255, 255, .68)),
        rgba(255, 255, 255, .3));
    transition: transform .28s cubic-bezier(.3, 1.5, .5, 1), background .25s, border-color .25s;
}
.opt:active { transform: scale(.97); }
.opt:focus-visible { outline: 3px solid var(--tint); outline-offset: 3px; }

.opt.is-selected {
    border-color: color-mix(in srgb, var(--tint) 65%, #fff);
    background: linear-gradient(145deg,
        color-mix(in srgb, var(--tint) 40%, rgba(255, 255, 255, .6)),
        color-mix(in srgb, var(--tint) 14%, rgba(255, 255, 255, .3)));
    animation: pop .36s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes pop { 0% { transform: scale(.96); } 60% { transform: scale(1.025); } 100% { transform: scale(1); } }

.badge {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--tint);
    background: rgba(255, 255, 255, .85);
    color: color-mix(in srgb, var(--tint) 65%, #3a2a30);
    font-size: 14px;
    font-weight: 800;
    flex-shrink: 0;
    transition: background .25s, color .25s;
}
.opt.is-selected .badge { background: var(--tint); color: #fff; }

.opt-text { flex: 1; font-size: 16px; font-weight: 600; line-height: 1.45; }

.opt .ic-check {
    width: 24px;
    height: 24px;
    color: var(--tint);
    opacity: 0;
    transform: scale(.4);
    transition: opacity .2s, transform .3s cubic-bezier(.3, 1.6, .5, 1);
}
.opt.is-selected .ic-check { opacity: 1; transform: scale(1); }

.notice { color: var(--ink-soft); text-align: center; font-size: 14px; }

/* 结果 */
.page-title {
    margin: 6px 0 0;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: var(--pink-deep);
}
.page-title:focus { outline: none; }

.result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px 24px 26px;
    text-align: center;
}
.result.reveal .avatar { animation: pop-in .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop-in { from { opacity: 0; transform: scale(.6) rotate(-6deg); } to { opacity: 1; transform: none; } }

.avatar { width: 158px; height: auto; filter: drop-shadow(0 8px 14px rgba(255, 111, 136, .28)); }
.result-name { margin: 4px 0 0; font-size: 25px; font-weight: 800; color: var(--pink-deep); }
.result-desc { margin: 0 0 10px; font-size: 15px; line-height: 1.75; color: var(--ink-soft); }

.credits {
    margin-top: auto;
    padding-top: 30px;
    text-align: center;
    font-size: 12px;
    line-height: 1.9;
    color: var(--ink-soft);
}
.credits p { margin: 0; }
.credit-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 6px 0 !important; }

/* 404 */
.nf { align-items: center; text-align: center; gap: 12px; padding: 36px 24px 30px; margin-top: 8vh; }
.nf h1 { margin: 6px 0 0; font-size: 24px; font-weight: 800; }
.nf p { margin: 0 0 10px; color: var(--ink-soft); line-height: 1.7; }
.nf .btn-primary { text-decoration: none; }
.nf-icon { width: 120px; height: 120px; color: #ff6f88; filter: drop-shadow(0 8px 14px rgba(255, 111, 136, .3)); }
