/* ============================================================
   光愈 · 主播辅助分析中枢 —— B 端样式
   独立文件，不影响 C 端
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    --bg:           #0a0812;
    --bg-card:      #13102080;
    --bg-card-solid:#13102099;
    --border:       #2e2448;
    --border-accent:#6c4fcf55;
    --purple-bright:#9b7ae8;
    --purple-dim:   #6c4fcf;
    --purple-glow:  #9b7ae840;
    --text-primary: #e8e0ff;
    --text-secondary:#a99cc8;
    --text-dim:     #6b5f8a;
    --success:      #7ee8a2;
    --error:        #f87171;
    --error-bg:     #f8717115;
    --drop-hover:   #7c5cbf;

    --radius:       14px;
    --radius-sm:    8px;
    --transition:   0.22s ease;

    /* iOS / Android 安全区域（刘海 + 底部 Home 条） */
    --sab: env(safe-area-inset-bottom, 0px);
    --sat: env(safe-area-inset-top, 0px);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- html：三层 height 写法，根治微信 100vh 毒瘤 ---------- */
html {
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;
    background-color: var(--bg);
    overflow-x: hidden;
}

/* ---------- Body ---------- */
body {
    /* 三层 height 兜底，确保 iOS Safari / 微信 WebView 均撑满 */
    height: 100%;
    height: 100dvh;
    height: -webkit-fill-available;

    /* position: fixed 防止 iOS 微信键盘弹出时整个 body 被推走 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;

    /* 让滚动发生在 #app 内部，body 本身不滚 */
    overflow: hidden;

    background-color: var(--bg);
    color: var(--text-primary);
    /* 完整字体栈，覆盖 iOS / OPPO / 华为 / 小米 系统字体 */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "OPPOSans",
                 "HarmonyOS Sans SC", "MiSans", "Helvetica Neue",
                 "Noto Sans SC", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 星点背景 */
.stars-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%,   #1a0f3a 0%, transparent 70%),
        radial-gradient(ellipse 40% 30% at 80% 20%,  #2a1050 0%, transparent 60%),
        radial-gradient(ellipse 30% 40% at 10% 80%,  #1a0832 0%, transparent 60%);
    z-index: 0;
}
.stars-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, #ffffff44, transparent),
        radial-gradient(1px 1px at 50% 15%, #ffffff33, transparent),
        radial-gradient(1px 1px at 75% 50%, #ffffff2a, transparent),
        radial-gradient(1px 1px at 10% 70%, #ffffff3a, transparent),
        radial-gradient(1px 1px at 90% 80%, #ffffff22, transparent),
        radial-gradient(1.5px 1.5px at 35% 60%, #9b7ae866, transparent),
        radial-gradient(1px 1px at 60% 85%, #ffffff2a, transparent);
}

/* ---------- Layout ---------- */
#app {
    position: relative;
    z-index: 1;
    /* body 是 fixed，#app 负责真正的滚动容器 */
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS 惯性滚动 */
    display: flex;
    flex-direction: column;
    max-width: 760px;
    margin: 0 auto;
    /* 底部留出 Home 条安全区域 */
    padding: 0 16px calc(32px + var(--sab));
    /* 顶部留出刘海安全区域 */
    padding-top: var(--sat);
}

/* ---------- Header ---------- */
.console-header {
    padding: 32px 0 20px;
    text-align: center;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

.header-icon {
    font-size: 18px;
    color: var(--purple-bright);
    opacity: 0.7;
}

.header-title {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, #c4b3f5 0%, #e8e0ff 50%, #9b7ae8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-sub {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 0.03em;
}

/* ---------- Main ---------- */
.console-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---------- Card ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 0 0 1px var(--border-accent),
        0 4px 32px #00000033,
        inset 0 1px 0 #ffffff08;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 20px;
}

/* ---------- Drop Zone ---------- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition:
        border-color var(--transition),
        background var(--transition),
        box-shadow var(--transition);
    outline: none;
    /* 移除 iOS 点击蓝框，防止安卓长按菜单 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--purple-dim);
    background: #1c1438;
}

.drop-zone.drag-over {
    border-color: var(--purple-bright);
    background: #20194a;
    box-shadow: 0 0 0 4px var(--purple-glow), inset 0 0 20px #6c4fcf18;
}

/* idle hint */
.drop-zone-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    pointer-events: none;
}

.upload-icon {
    color: var(--purple-dim);
    opacity: 0.8;
    transition: color var(--transition), transform var(--transition);
}
.drop-zone:hover .upload-icon,
.drop-zone.drag-over .upload-icon {
    color: var(--purple-bright);
    transform: translateY(-3px);
}

.drop-hint-main {
    color: var(--text-secondary);
    font-size: 14px;
}
.drop-hint-sub {
    color: var(--text-dim);
    font-size: 12px;
}

/* preview */
.drop-zone-preview {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.thumbnail {
    max-height: 200px;
    max-width: 100%;
    border-radius: 6px;
    object-fit: contain;
    box-shadow: 0 0 0 2px var(--purple-dim), 0 8px 24px #00000044;
}

.clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #1a1430cc;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.clear-btn:hover {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error);
}

/* ---------- Analyze Button ---------- */
.analyze-btn {
    margin-top: 18px;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--purple-dim), #4a2fa0);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity var(--transition), box-shadow var(--transition), transform var(--transition);
    box-shadow: 0 4px 20px var(--purple-glow);
    /* 移除 iOS / 安卓微信点击时的蓝色高亮框 */
    -webkit-tap-highlight-color: transparent;
    /* 防止长按触发系统菜单（安卓） */
    -webkit-touch-callout: none;
}

.analyze-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}
.analyze-btn:not(:disabled):hover {
    box-shadow: 0 6px 28px #6c4fcf66;
    transform: translateY(-1px);
}
.analyze-btn:not(:disabled):active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 14px;
    color: #c4b3f5;
}

/* ---------- Result Section ---------- */
.result-section {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.empty-state {
    color: var(--text-dim);
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Loading */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.orbit-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    position: relative;
    animation: orbit-spin 1.6s linear infinite;
}
.orbit-ring::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--purple-bright);
    border-right-color: var(--purple-dim);
}
.orbit-dot {
    width: 8px;
    height: 8px;
    background: var(--purple-bright);
    border-radius: 50%;
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 8px var(--purple-bright);
}

@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    animation: pulse-text 2s ease-in-out infinite;
}
@keyframes pulse-text {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

/* Error */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px;
    text-align: center;
    width: 100%;
}

.error-icon {
    font-size: 32px;
    color: var(--error);
}

.error-message {
    color: var(--error);
    font-size: 14px;
    background: var(--error-bg);
    border: 1px solid #f8717130;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    width: 100%;
    line-height: 1.7;
}

.retry-btn {
    padding: 9px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.retry-btn:hover {
    border-color: var(--purple-dim);
    color: var(--text-primary);
}

/* Success */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px;
    width: 100%;
}

.success-icon {
    font-size: 28px;
    color: var(--success);
    animation: glow-pulse 2s ease-in-out infinite;
}
@keyframes glow-pulse {
    0%, 100% { text-shadow: 0 0 6px var(--success), 0 0 12px #7ee8a244; }
    50%       { text-shadow: 0 0 16px var(--success), 0 0 32px #7ee8a266; }
}

.success-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--success);
    letter-spacing: 0.05em;
}

.result-card {
    width: 100%;
    background: #0e0b1a;
    border: 1px solid #2a2040;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.result-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}
.result-row + .result-row {
    border-top: 1px solid #1e1730;
}

.result-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    min-width: 64px;
}

.result-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-ok {
    color: var(--success);
    font-size: 13px;
}

.result-reason {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

/* ---------- 聊天攻略卡专有样式 ---------- */
.success-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.strategy-card {
    width: 100%;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 8px 32px #00000040;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

/* 画像头部 & 标签 */
.user-profile-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}

.user-name-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.user-name-row .label {
    font-size: 14px;
    color: #ffffff;
}

.user-name-row .highlight {
	    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: var(--purple-bright);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--purple-glow);
    color: var(--text-primary);
    border: 1px solid var(--purple-dim);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    letter-spacing: 0.05em;
}

/* 模块通用标题 */
.box-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.sub-title {
    font-size: 11px;
    font-weight: normal;
    color: var(--text-dim);
}

.box-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* 雷区警示框 */
.warning-box {
    background: var(--error-bg);
    border: 1px solid #f8717140;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}
.warning-title {
    color: var(--error);
}
.warning-box .box-content {
    color: #ffd6d6;
    font-size: 13px;
}

/* 破冰话术列表 */
.icebreaker-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.icebreaker-item {
    background: #1a1528;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: border-color var(--transition);
}

.icebreaker-item:hover {
    border-color: var(--purple-dim);
}

.icebreaker-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.copy-btn {
    background: var(--purple-dim);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), transform 0.1s;
}

.copy-btn:hover {
    background: var(--purple-bright);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: var(--success);
    color: #000;
}

/* ---------- Footer ---------- */
.console-footer {
    padding: 24px 0 8px;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
}

/* ---------- Utility: hidden ---------- */
[hidden] { display: none !important; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
    #app { padding: 0 32px calc(48px + var(--sab)); padding-top: var(--sat); }
    .console-header { padding-top: 48px; }
    .card { padding: 10px 10px; }
    .drop-zone { min-height: 220px; }
}

@media (min-width: 1024px) {
    #app { padding: 0 0 calc(64px + var(--sab)); padding-top: var(--sat); }
    .console-main {
        display: grid;
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
    .result-section { min-height: 360px; }
}
/* ---------- 账户与档案室样式 ---------- */
.account-bar {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    font-size: 13px;
}
.quota-display {
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.quota-display strong { color: var(--purple-bright); font-size: 15px; }

.text-btn {
    background: transparent;
    border: none;
    color: var(--purple-dim);
    cursor: pointer;
    font-size: 13px;
    transition: color var(--transition);
}
.text-btn:hover { color: var(--purple-bright); }

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.archive-header .section-title { margin-bottom: 0; }

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}
.archive-card {
    background: #1a1528;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: pointer;
    transition: border-color var(--transition);
}
.archive-card:hover { border-color: var(--purple-dim); }
.archive-time { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; display: block; }
/* 🌟 改造：打破卡片束缚，释放移动端空间 */
.strategy-card {
    width: 100%;
    background: transparent !important; /* 去掉背景 */
    border: none !important;            /* 去掉边框 */
    box-shadow: none !important;        /* 去掉阴影 */
    padding: 0 !important;              /* 去掉内边距 */
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
}

/* 新增的性格解释段落样式 */
.tag-explanations-text {
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--text-primary);
    line-height: 1.6;
    background: #1a152866;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--purple-bright);
}