/* =====================================================================
   二次元浓度检测仪 - 美术样式
   风格参照《男娘潜质综合评估量表》：粉蓝渐变、圆角卡片、柔和阴影
   同时适配手机与电脑
   ===================================================================== */

:root {
    --primary: #ff8fab;
    --primary-deep: #ff5c8a;
    --primary-light: #ffc2d1;
    --secondary: #8eecf5;
    --accent: #a18cd1;
    --text-main: #333;
    --text-light: #777;
    --text-mute: #9aa0a6;
    --card-bg: rgba(255, 255, 255, 0.96);
    --card-border: rgba(255, 255, 255, 0.7);
    --field-bg: #fff;
    --field-border: #ececf1;
    --shadow: 0 15px 35px rgba(120, 90, 130, 0.16);
    --shadow-sm: 0 6px 18px rgba(120, 90, 130, 0.12);
    --radius: 20px;
    --ok: #34c77b;
    --warn: #ff9f43;
    --danger: #ff4d4f;
}

body.dark {
    --text-main: #f0f0f5;
    --text-light: #b9b9c8;
    --text-mute: #8a8a9c;
    --card-bg: rgba(30, 30, 46, 0.94);
    --card-border: rgba(255, 255, 255, 0.08);
    --field-bg: #26263a;
    --field-border: #3a3a52;
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.35);
}

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

html, body { min-height: 100%; }

body {
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    background: linear-gradient(135deg, #ffc2d1 0%, #cdd9ff 50%, #8eecf5 100%);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 22px 12px 40px;
    min-height: 100vh;
    transition: background .4s;
}

body.dark { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); background-attachment: fixed; }

/* 背景装饰气泡 */
.bg i {
    position: fixed;
    border-radius: 50%;
    filter: blur(46px);
    opacity: .5;
    pointer-events: none;
    z-index: 0;
}
.bg .b1 { width: 260px; height: 260px; background: #ffb3c6; top: -60px; left: -70px; animation: float1 14s ease-in-out infinite; }
.bg .b2 { width: 220px; height: 220px; background: #9ee7f1; bottom: -50px; right: -60px; animation: float2 17s ease-in-out infinite; }
.bg .b3 { width: 180px; height: 180px; background: #c7b8f5; top: 45%; right: -70px; animation: float1 20s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(18px, 26px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-22px, -18px); } }

/* 主题切换 */
#theme-toggle {
    position: fixed; top: 14px; right: 14px; z-index: 60;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--card-border);
    background: var(--card-bg); color: var(--text-main);
    font-size: 19px; cursor: pointer; box-shadow: var(--shadow-sm);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px);
    transition: transform .2s;
}
#theme-toggle:active { transform: scale(.92); }

.wrap { width: 100%; max-width: 620px; position: relative; z-index: 1; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 30px 24px;
    backdrop-filter: blur(14px);
    margin-bottom: 16px;
}

/* ---------------- 通用元素 ---------------- */
h1.title { font-size: 25px; text-align: center; color: var(--primary-deep); letter-spacing: .5px; }
body.dark h1.title { color: #ffa8c0; }
.title-icon { font-size: 54px; text-align: center; line-height: 1; margin-bottom: 8px; }
.subtitle { text-align: center; color: var(--text-light); font-size: 13px; margin-top: 8px; line-height: 1.7; }

.section-title {
    font-size: 15px; font-weight: 700; color: var(--text-main);
    margin: 24px 0 12px; display: flex; align-items: center; gap: 8px;
}
.section-title::before {
    content: ''; width: 4px; height: 15px; border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.btn {
    display: block; width: 100%; border: none; cursor: pointer;
    font-family: inherit; font-size: 16px; font-weight: 700;
    padding: 15px 24px; border-radius: 30px;
    transition: transform .15s, box-shadow .2s, opacity .2s;
    margin-top: 12px;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
    color: #fff; background: linear-gradient(45deg, #ff8fab, #ff5c8a);
    box-shadow: 0 8px 22px rgba(255, 92, 138, .34);
}
.btn-cool {
    color: #fff; background: linear-gradient(45deg, #8eecf5, #4facfe);
    box-shadow: 0 8px 22px rgba(79, 172, 254, .32);
}
.btn-candy {
    color: #fff; background: linear-gradient(45deg, #a18cd1, #fbc2eb);
    box-shadow: 0 8px 22px rgba(161, 140, 209, .32);
}
.btn-ghost {
    background: transparent; color: var(--text-light);
    border: 1px solid var(--field-border); box-shadow: none;
    font-weight: 600; font-size: 14px; padding: 12px 20px;
}
.btn-sm { width: auto; display: inline-block; padding: 10px 16px; font-size: 14px; margin: 0; }

.desc-box {
    background: linear-gradient(180deg, rgba(255,143,171,.10), rgba(142,236,245,.10));
    border-left: 4px solid var(--primary);
    border-radius: 12px; padding: 15px 16px; font-size: 13.5px;
    line-height: 1.85; color: var(--text-light);
}
.desc-box b { color: var(--primary-deep); }
body.dark .desc-box b { color: #ffa8c0; }
.desc-box ul { margin: 6px 0 0 18px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field > label {
    display: block; font-size: 13px; font-weight: 700;
    color: var(--text-light); margin-bottom: 8px;
}
.field .hint { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; line-height: 1.6; }

input[type=text], input[type=password], input[type=number], select {
    width: 100%; font-family: inherit; font-size: 15px;
    padding: 13px 16px; border-radius: 14px;
    border: 2px solid var(--field-border);
    background: var(--field-bg); color: var(--text-main);
    outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 143, 171, .16);
}
input::placeholder { color: var(--text-mute); }

/* 模式选择（分段控件） */
.segmented {
    display: flex; gap: 8px; background: rgba(140,140,170,.10);
    padding: 6px; border-radius: 16px;
}
.segmented button {
    flex: 1; border: none; background: transparent; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 700;
    color: var(--text-light); padding: 11px 8px; border-radius: 12px;
    transition: all .2s; line-height: 1.35;
}
.segmented button.active {
    background: var(--card-bg); color: var(--primary-deep);
    box-shadow: var(--shadow-sm);
}
body.dark .segmented button.active { color: #ffa8c0; }
.segmented button small { display: block; font-size: 10.5px; font-weight: 400; opacity: .8; margin-top: 2px; }

.pill-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pill {
    font-size: 11.5px; padding: 4px 10px; border-radius: 20px;
    background: rgba(142,236,245,.25); color: #1b9aaa; font-weight: 700;
}
.pill.warn { background: rgba(255,159,67,.18); color: #e07b12; }
.pill.danger { background: rgba(255,77,79,.15); color: #d9363e; }
.pill.ok { background: rgba(52,199,123,.16); color: #1f9d5c; }

/* ---------------- 加载 ---------------- */
.loading-inner { text-align: center; padding: 42px 8px; }
.loader {
    width: 54px; height: 54px; margin: 0 auto 20px;
    border: 4px solid rgba(255,143,171,.18);
    border-top-color: var(--primary);
    border-radius: 50%; animation: spin .95s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inner h3 { color: var(--primary-deep); font-size: 17px; margin-bottom: 10px; }
body.dark .loading-inner h3 { color: #ffa8c0; }
.loading-text { color: var(--text-light); font-size: 13.5px; min-height: 22px; }
.progress-track {
    height: 8px; border-radius: 6px; overflow: hidden; margin: 22px auto 0;
    max-width: 320px; background: rgba(140,140,170,.16);
}
.progress-fill {
    height: 100%; width: 0; border-radius: 6px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    transition: width .5s ease;
}

/* ---------------- 结果页 ---------------- */
.report-head { text-align: center; padding-bottom: 18px; border-bottom: 2px dashed var(--field-border); }
.report-head .who { font-size: 14px; color: var(--text-light); }
.report-head .who b { color: var(--text-main); }

.score-dial { position: relative; width: 210px; height: 210px; margin: 16px auto 6px; }
.score-dial svg { transform: rotate(-90deg); }
.score-dial .dial-track { fill: none; stroke: rgba(140,140,170,.16); }
.score-dial .dial-value { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.score-dial .dial-center {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.score-dial .num { font-size: 58px; font-weight: 900; line-height: 1; color: var(--primary-deep); }
body.dark .score-dial .num { color: #ffa8c0; }
.score-dial .unit { font-size: 12px; color: var(--text-mute); letter-spacing: 3px; margin-top: 4px; }

.tier-badge {
    display: inline-block; margin: 6px auto 0; padding: 9px 22px;
    border-radius: 22px; font-size: 17px; font-weight: 800;
    background: linear-gradient(135deg, #ffe0e9, #e6f7fb);
    color: var(--primary-deep); letter-spacing: 1px;
}
.tier-desc { font-size: 12.5px; color: var(--text-light); margin-top: 10px; letter-spacing: .5px; }

.dim-item { margin-bottom: 14px; }
.dim-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; color: var(--text-main); }
.dim-head .val { font-weight: 700; }
.dim-bar-bg { height: 10px; border-radius: 6px; background: rgba(140,140,170,.16); overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 6px; width: 0; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.dim-note { font-size: 11.5px; color: var(--text-mute); margin-top: 5px; }

.conclusion {
    background: linear-gradient(180deg, rgba(255,143,171,.07), rgba(142,236,245,.07));
    border: 1px solid var(--card-border); border-radius: 14px; padding: 18px;
    font-size: 13.5px; line-height: 1.9; color: var(--text-main);
}
.conclusion h3 { text-align: center; font-size: 16px; color: var(--primary-deep); margin-bottom: 14px; }
body.dark .conclusion h3 { color: #ffa8c0; }
.trait { margin-bottom: 13px; }
.trait:last-child { margin-bottom: 0; }
.trait .k { font-weight: 800; color: var(--primary-deep); display: block; margin-bottom: 3px; font-size: 13px; }
body.dark .trait .k { color: #ffa8c0; }
.trait .v { text-align: justify; color: var(--text-light); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    font-size: 12px; padding: 6px 13px; border-radius: 20px;
    background: rgba(161,140,209,.14); color: #7b63b8; font-weight: 700;
}
body.dark .chip { color: #c3b2f0; }
.evidence { list-style: none; }
.evidence li {
    font-size: 12.5px; color: var(--text-light); padding: 8px 0 8px 20px;
    position: relative; border-bottom: 1px dashed var(--field-border); line-height: 1.6;
}
.evidence li:last-child { border-bottom: none; }
.evidence li::before {
    content: '◆'; position: absolute; left: 2px; top: 8px;
    color: var(--primary); font-size: 10px;
}

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.meta-cell {
    background: rgba(140,140,170,.08); border-radius: 12px; padding: 11px 13px;
}
.meta-cell .k { font-size: 11px; color: var(--text-mute); }
.meta-cell .v { font-size: 15px; font-weight: 800; margin-top: 3px; }

.notice-bar {
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 12.5px; line-height: 1.7; color: var(--text-light);
    background: rgba(255,159,67,.10); border-radius: 12px; padding: 12px 14px;
    margin-top: 14px;
}
.notice-bar.info { background: rgba(142,236,245,.14); }
.notice-bar .ico { font-size: 15px; line-height: 1.3; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
    position: fixed; inset: 0; background: rgba(20,16,28,.52);
    z-index: 80; display: flex; align-items: center; justify-content: center;
    padding: 20px; backdrop-filter: blur(3px);
    animation: fadeIn .22s ease;
}
.modal {
    background: var(--card-bg); border-radius: 20px; padding: 26px 22px;
    width: 100%; max-width: 430px; box-shadow: var(--shadow);
    border: 1px solid var(--card-border);
    animation: popIn .26s cubic-bezier(.2,.9,.3,1.2);
    max-height: 84vh; overflow-y: auto;
}
.modal h2 { font-size: 19px; color: var(--primary-deep); text-align: center; margin-bottom: 10px; }
body.dark .modal h2 { color: #ffa8c0; }
.modal p { font-size: 13.5px; color: var(--text-light); line-height: 1.85; text-align: center; }
.modal .modal-actions { margin-top: 20px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }

/* toast */
#toast-host { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    background: rgba(35,30,45,.92); color: #fff; font-size: 13px;
    padding: 11px 20px; border-radius: 22px; box-shadow: var(--shadow-sm);
    animation: popIn .25s ease; max-width: 84vw; text-align: center;
}

/* 页面切换 */
.screen { display: none; }
.screen.active { display: block; animation: fadeUp .38s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.foot { text-align: center; font-size: 11.5px; color: var(--text-light); padding: 6px 0 12px; opacity: .85; line-height: 1.8; }
.foot a { color: var(--primary-deep); text-decoration: none; }

/* 页脚里的「管理」入口：纯文字、低强调，不抢眼 */
.foot .foot-admin {
    color: inherit;
    text-decoration: none;
    opacity: .45;
    font-size: 11px;
    letter-spacing: 1px;
}
.foot .foot-admin:hover { opacity: .85; text-decoration: underline; }

.hidden { display: none !important; }

/* ---------------- 桌面适配 ---------------- */
@media (min-width: 760px) {
    body { padding: 40px 20px 60px; }
    .wrap { max-width: 900px; }
    .card { padding: 38px 40px; border-radius: 24px; }
    h1.title { font-size: 30px; }
    .title-icon { font-size: 64px; }
    .result-grid { display: grid; grid-template-columns: 320px 1fr; gap: 28px; align-items: start; }
    .result-grid .side { position: sticky; top: 24px; }
    .meta-grid { grid-template-columns: repeat(4, 1fr); }
    .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .form-grid .full { grid-column: 1 / -1; }
}

@media (max-width: 380px) {
    .card { padding: 24px 16px; }
    h1.title { font-size: 21px; }
    .score-dial { width: 180px; height: 180px; }
    .score-dial .num { font-size: 48px; }
}
