/* styles.css */
:root {
  --bg-base: #0B1325;
  --bg-panel: #141E34;
  --text-main: #E2E8F0;
  --text-muted: #94A3B8;
  --accent-blue: #3B82F6;
  --accent-red: #EF4444;
  --border-color: rgba(59, 130, 246, 0.25);
  --btn-bg: rgba(59, 130, 246, 0.1);
  color: var(--text-main);
  background: var(--bg-base);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }

body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg-base); }
button { font: inherit; cursor: pointer; border: none; background: none; }
button:disabled { cursor: wait; opacity: .64; }

#copyright-splash { position: fixed; inset: 0; z-index: 100; background: var(--bg-base); padding: 30px 20px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
#copyright-splash > div { width: 100%; max-width: 500px; }
#copyright-splash h1 { color: var(--accent-blue); font-size: 1.8rem; margin-bottom: 20px; }
#copyright-splash p { color: var(--text-muted); line-height: 1.7; font-size: 0.95rem; margin-bottom: 30px; }

/* 【关键修复1】：全屏绝对沉浸的解码加载页 */
.loading-screen-dedicated { position: fixed; inset: 0; z-index: 150; background: var(--bg-base); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; animation: ink-reveal 0.4s ease; padding: 20px;}
.loading-spinner { width: 64px; height: 64px; border: 4px solid rgba(59,130,246,0.15); border-top-color: var(--accent-blue); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 35px;}
.loading-screen-dedicated h2 { color: var(--text-main); font-size: 1.55rem; margin-bottom: 12px; }
.loading-screen-dedicated p { color: var(--accent-blue); font-size: 1rem; opacity: 0.9;}
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.hero, .panel { width: min(100%, 560px); text-align: center; padding: 40px 18px; }
.hero h1, .result-screen h1, .question-card h1 { font-weight: 600; letter-spacing: 0; color: var(--text-main); }
.hero h1 { font-size: clamp(2rem, 8vw, 3.2rem); line-height: 1.25; margin: 18px 0; }
.hero p:not(.eyebrow) { color: var(--text-muted); line-height: 1.75; }

.eyebrow { margin: 0; color: var(--accent-blue); font-size: .85rem; letter-spacing: .12em; font-weight: bold; }
.version-badge { display: inline-block; margin-bottom: 16px; border: 1px solid var(--accent-blue); border-radius: 4px; padding: 4px 8px; color: var(--accent-blue); font-size: .72rem; }
.hero-description { display: grid; gap: 6px; margin: 0; }

.primary-button, .secondary-button { width: 100%; min-height: 48px; border-radius: 6px; padding: 12px 24px; transition: all .2s; font-weight: bold; margin-top: 15px;}
.primary-button { background: var(--accent-blue); color: #fff; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); }
.primary-button:hover { background: #2563EB; }
.secondary-button { border: 1px solid var(--border-color); color: var(--text-main); background: var(--btn-bg); }
.secondary-button:hover { background: rgba(59, 130, 246, 0.2); }

.quiz-screen { width: min(100%, 680px); min-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.quiz-header { display: grid; gap: 12px; margin-bottom: 20px;}
.quiz-top-bar { display: flex; justify-content: space-between; align-items: center; }
.nav-btn { color: var(--text-muted); font-size: 0.9rem; padding: 6px 12px; border-radius: 4px; background: rgba(255,255,255,0.05); }
.quiz-progress-text { font-size: 0.95rem; font-weight: bold; color: var(--accent-blue); }

.progress-track { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--accent-blue); transition: width .3s ease; }
.question-card { margin: auto 0; }
.quiz-question-text { font-size: clamp(1.4rem, 5.5vw, 1.8rem) !important; line-height: 1.5; margin: 0 0 35px; text-align: left; }
.options { display: grid; gap: 12px; }
.option { min-height: 68px; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; text-align: left; padding: 16px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-panel); color: var(--text-main); line-height: 1.55; transition: all .2s; }
.option:hover, .option.selected { border-color: var(--accent-blue); background: rgba(59, 130, 246, 0.15); box-shadow: 0 0 10px rgba(59, 130, 246, 0.1); }
.option b { color: var(--accent-blue); font-size: 1.1rem; }

.result-screen { width: min(100%, 720px); background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.result-tier { padding: 32px clamp(15px, 5vw, 40px); border-bottom: 1px solid rgba(255,255,255,0.05); }
.result-tier-one { text-align: center; background: linear-gradient(180deg, rgba(59,130,246,0.1) 0%, transparent 100%); }
.dynasty-anchor { color: var(--accent-red); font-size: 1.1rem; letter-spacing: 0.1em; margin: 10px 0; font-weight: bold;}
.identity-summary { color: var(--text-muted); line-height: 1.75; font-size: 1.1rem; margin-top: 20px;}
.keyword-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 15px; }
.keyword-list span { padding: 5px 12px; border: 1px solid var(--accent-blue); border-radius: 4px; color: var(--accent-blue); font-size: .82rem; background: rgba(59,130,246,0.1); }
.classical-heading { text-align: center; font-weight: bold; letter-spacing: .1em; color: var(--accent-blue); font-size: 1.1rem; margin-bottom: 25px;}
.result-tier h2 { margin: 25px 0 10px; color: var(--text-main); font-size: 1.3rem; border-left: 4px solid var(--accent-blue); padding-left: 10px; }
.result-tier p { color: #CBD5E1; line-height: 1.75; font-size: 1rem;}

.affirmation-box, .final-message-box { margin-top: 15px; padding: 15px; background: rgba(59, 130, 246, 0.08); border-left: 4px solid var(--accent-blue); border-radius: 0 6px 6px 0; color: #E2E8F0; line-height: 1.6; font-size: 0.95rem; }
.final-message-box { border-left-color: var(--accent-red); background: rgba(239, 68, 68, 0.08); text-align: center; border: 1px solid rgba(239,68,68,0.2); border-radius: 6px;}
.portrait-panel, .survival-panel { margin-top: 20px; padding: 16px; background: rgba(0,0,0,0.2); border-radius: 6px; border: 1px solid rgba(255,255,255,0.05);}
.portrait-panel p { margin: 0; }

/* 【关键优化】：动态副维度卡片样式 */
.dynamic-dim-box { background: rgba(239, 68, 68, 0.05); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 8px; padding: 18px; margin-top: 15px;}
.dynamic-dim-box.lowest-box { background: rgba(148, 163, 184, 0.05); border-color: rgba(148, 163, 184, 0.2); margin-top: 15px;}
.dynamic-dim-box h4 { margin: 0 0 8px; font-size: 0.95rem; color: #FCA5A5; }
.dynamic-dim-box.lowest-box h4 { color: #CBD5E1; }
.dynamic-dim-box p { margin: 0; font-size: 0.95rem; color: #E2E8F0; line-height: 1.6; }

/* 大气的图表外壳容器设计 */
.chart-container { background: linear-gradient(145deg, rgba(30,41,59,0.5), rgba(15,23,42,0.8)); border: 1px solid rgba(59,130,246,0.2); border-radius: 12px; padding: 25px 10px; margin-bottom: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.chart-title { color: var(--accent-blue) !important; font-size: 1.05rem !important; font-weight: bold; text-align: center; margin-top: 0; margin-bottom: 20px; letter-spacing: 2px;}
.radar-wrap { display: flex; justify-content: center; align-items: center; width: 100%;}
.radar-wrap canvas { width: 100%; display: block; max-width: 450px;}

/* 高颜值矩阵排位条状图 */
.score-bars-list { display: grid; gap: 15px; }
.score-bar-item { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.2); padding: 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.03);}
.score-bar-label { width: 68px; font-weight: bold; color: var(--text-main); text-align: right; font-size: 0.9rem; }
.score-bar-track { flex: 1; height: 10px; background: rgba(255,255,255,0.08); border-radius: 5px; overflow: hidden; }
.score-bar-fill { height: 100%; background: linear-gradient(90deg, #3B82F6, #60A5FA); border-radius: 5px; }
.score-bar-value { width: 30px; font-weight: bold; color: #60A5FA; font-size: 1.05rem; text-align: center;}
.score-bar-tag { width: 65px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 0; border-radius: 4px; line-height: 1.2; }
.score-bar-tag span { font-size: 0.75rem; font-weight: bold; }
.score-bar-tag small { font-size: 0.55rem; opacity: 0.8; margin-top: 2px;}
.tag-danger { background: rgba(239, 68, 68, 0.15); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.3);}
.tag-warning { background: rgba(245, 158, 11, 0.15); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.3);}
.tag-safe { background: rgba(16, 185, 129, 0.15); color: #10B981; border: 1px solid rgba(16, 185, 129, 0.3);}

/* 图鉴系统 */
.gallery-screen { width: min(100%, 1040px); min-height: calc(100vh - 48px); padding: 12px 0 36px; }
.gallery-header { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; margin-bottom: 24px; }
.gallery-header .secondary-button { min-width: 72px; width: auto; margin-top:0;}
.gallery-header h1 { margin: 5px 0; font-size: clamp(1.5rem, 5vw, 2.2rem); }
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 15px; } }
@media (min-width: 900px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }

.gallery-card { display: flex; flex-direction: column; align-items: flex-start; padding: 14px; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 8px; text-align: left; transition: all 0.2s; }
.gallery-card:hover { transform: translateY(-3px); border-color: var(--accent-blue); box-shadow: 0 5px 15px rgba(59,130,246,0.15); }
.gallery-card p { margin: 0; color: var(--accent-red); font-size: .75rem; font-weight: bold; }
.gallery-card h2 { margin: 6px 0 10px; font-size: 1.05rem; color: var(--text-main); }
.gallery-card div { display: flex; flex-wrap: wrap; gap: 4px; }
.gallery-card span { padding: 3px 6px; border-radius: 4px; background: rgba(59,130,246,0.15); color: var(--accent-blue); font-size: .65rem; }

.gallery-modal { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px); }
.gallery-modal-card { position: relative; width: min(100%, 500px); max-height: 85vh; overflow-y: auto; padding: 35px 25px; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,0.5); }
.gallery-modal-close { position: absolute; top: 15px; right: 15px; z-index: 100; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-panel); border: 1px solid var(--accent-blue); color: var(--text-main); font-size: 1.8rem; line-height: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: all 0.2s;}
.gallery-modal-close:hover { background: var(--accent-blue); color: #fff; }
.gallery-modal-subtitle { color: var(--accent-red); text-align: center; margin: 0; font-weight: bold; letter-spacing: 1px;}
.gallery-modal-card h2 { text-align: center; margin: 10px 0; font-size: 1.8rem; }
.gallery-modal-summary { text-align: center; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px;}
.gallery-modal-keywords { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 25px; }
.gallery-modal-keywords span { padding: 4px 10px; border: 1px solid var(--accent-blue); border-radius: 4px; color: var(--accent-blue); font-size: 0.8rem; }
.gallery-modal-copy section { margin-bottom: 25px; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 20px; }
.gallery-modal-copy h3 { color: var(--accent-blue); font-size: 1rem; margin: 0 0 10px; }
.gallery-modal-copy p { margin: 0; line-height: 1.7; color: #CBD5E1; }

@keyframes ink-reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.hero, .quiz-screen, .result-screen, .gallery-screen, .gallery-modal-card { animation: ink-reveal .4s ease-out both; }