@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #4A3DB5;
  --accent: #FF6B6B;
  --accent-light: #FF8E8E;
  --bg: #F8F9FE;
  --card-bg: #FFFFFF;
  --text: #2D3436;
  --text-light: #636E72;
  --text-muted: #B2BEC3;
  --border: #E8ECF0;
  --success: #00B894;
  --warning: #FDCB6E;
  --E-color: #FF6B6B;
  --I-color: #6C5CE7;
  --S-color: #00B894;
  --N-color: #E17055;
  --T-color: #0984E3;
  --F-color: #E17055;
  --J-color: #6C5CE7;
  --P-color: #00CEC9;
  --shadow: 0 4px 20px rgba(108,92,231,0.12);
  --shadow-lg: 0 8px 40px rgba(108,92,231,0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes barGrow { from { width: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }

.bg-decoration { position: fixed; top:0;left:0;right:0;bottom:0; pointer-events:none; z-index:0; overflow:hidden; }
.bg-decoration .orb { position:absolute; border-radius:50%; filter:blur(80px); opacity:0.15; }
.bg-decoration .orb-1 { width:400px;height:400px; background:var(--primary); top:-100px;right:-100px; animation:float 8s ease-in-out infinite; }
.bg-decoration .orb-2 { width:300px;height:300px; background:var(--accent); bottom:-50px;left:-50px; animation:float 6s ease-in-out infinite 2s; }
.bg-decoration .orb-3 { width:200px;height:200px; background:var(--success); top:50%;left:50%; animation:float 7s ease-in-out infinite 1s; }

.container { max-width:800px; margin:0 auto; padding:20px; position:relative; z-index:1; }

.header { text-align:center; padding:20px 0; }
.header .logo { display:inline-flex; align-items:center; gap:10px; font-size:22px; font-weight:700; color:var(--primary); cursor:pointer; transition:var(--transition); }
.header .logo:hover { opacity:0.8; }
.header .logo-icon { width:36px;height:36px; background:var(--primary); color:white; border-radius:10px; display:flex; align-items:center; justify-content:center; font-weight:900; font-size:16px; }

.page { display:none; }
.page.active { display:block; }

/* ===== HOME PAGE ===== */
.home-hero { text-align:center; padding:50px 20px 30px; }
.home-hero h1 { font-size:42px; font-weight:900; color:var(--text); line-height:1.2; margin-bottom:16px; animation:fadeInUp 0.8s ease-out; }
.home-hero h1 .gradient-text { background:linear-gradient(135deg,var(--primary),var(--accent)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.home-hero .subtitle { font-size:18px; color:var(--text-light); line-height:1.6; margin-bottom:40px; animation:fadeInUp 0.8s ease-out 0.2s both; }

.mbti-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:40px; animation:fadeInUp 0.8s ease-out 0.3s both; }
.mbti-type-card { background:var(--card-bg); border-radius:var(--radius-sm); padding:14px 8px; text-align:center; border:2px solid var(--border); transition:var(--transition); cursor:pointer; }
.mbti-type-card:hover { border-color:var(--primary-light); transform:translateY(-4px); box-shadow:var(--shadow); }
.mbti-type-card .type-emoji { font-size:20px; margin-bottom:4px; }
.mbti-type-card .type-code { font-size:16px; font-weight:700; color:var(--primary); margin-bottom:2px; }
.mbti-type-card .type-name { font-size:12px; color:var(--text-light); }

/* ===== TYPE DETAIL MODAL ===== */
.modal-overlay { position:fixed; top:0;left:0;right:0;bottom:0; background:rgba(0,0,0,0.45); z-index:200; display:none; animation:fadeIn 0.25s ease-out; backdrop-filter:blur(4px); }
.modal-overlay.active { display:flex; align-items:center; justify-content:center; }
.modal-content { background:var(--card-bg); border-radius:var(--radius); max-width:560px; width:90%; max-height:85vh; overflow-y:auto; padding:28px; animation:scaleIn 0.35s ease-out; box-shadow:var(--shadow-lg); position:relative; }
.modal-close { position:absolute; top:16px; right:16px; width:36px;height:36px; border-radius:50%; background:var(--bg); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:18px; transition:var(--transition); z-index:10; line-height:1; }
.modal-close:hover { background:var(--accent); color:white; border-color:var(--accent); }
.modal-type-header { text-align:center; margin-bottom:20px; }
.modal-type-emoji { font-size:48px; margin-bottom:8px; }
.modal-type-code { font-size:36px; font-weight:900; letter-spacing:4px; color:var(--primary); }
.modal-type-name { font-size:20px; font-weight:700; }
.modal-type-tagline { font-size:14px; color:var(--text-light); margin-top:4px; }
.modal-section { margin-top:20px; }
.modal-section-title { font-size:15px; font-weight:700; color:var(--primary); border-bottom:1px solid var(--border); padding-bottom:6px; margin-bottom:10px; }
.modal-text { font-size:14px; line-height:1.7; color:var(--text-light); }
.modal-tags { display:flex; flex-wrap:wrap; gap:6px; }
.modal-tag { padding:4px 12px; border-radius:16px; font-size:12px; font-weight:500; }
.modal-tag.green { background:rgba(0,184,148,0.1); color:#00B894; }
.modal-tag.red { background:rgba(255,107,107,0.1); color:#FF6B6B; }
.modal-tag.purple { background:rgba(108,92,231,0.1); color:var(--primary-dark); }
.modal-compat { margin-top:8px; }
.modal-compat-row { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
.modal-compat-label { padding:4px 10px; border-radius:6px; font-size:12px; font-weight:700; }
.modal-compat-desc { font-size:12px; color:var(--text-light); }
.modal-start-btn { text-align:center; margin-top:24px; }
.modal-start-btn button { background:var(--primary); color:white; padding:12px 30px; border-radius:50px; border:none; font-size:15px; font-weight:600; cursor:pointer; transition:var(--transition); }
.modal-start-btn button:hover { background:var(--primary-dark); }

.dimensions-section { margin-bottom:40px; animation:fadeInUp 0.8s ease-out 0.4s both; }
.dimensions-section h2 { font-size:24px; font-weight:700; text-align:center; margin-bottom:20px; }
.dimension-card { background:var(--card-bg); border-radius:var(--radius); padding:20px; margin-bottom:12px; display:flex; align-items:center; gap:16px; border:1px solid var(--border); transition:var(--transition); }
.dimension-card:hover { box-shadow:var(--shadow); }
.dimension-card .dim-icon { width:48px;height:48px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:900; color:white; }
.dimension-card .dim-content { flex:1; }
.dimension-card .dim-title { font-size:16px; font-weight:700; margin-bottom:4px; }
.dimension-card .dim-desc { font-size:13px; color:var(--text-light); }
.dimension-card .dim-tags { display:flex; gap:8px; margin-top:8px; }
.dimension-card .dim-tag { font-size:12px; padding:2px 10px; border-radius:20px; font-weight:500; }

/* ===== LEVEL SELECTION ===== */
.level-section { text-align:center; margin-bottom:40px; animation:fadeInUp 0.8s ease-out 0.5s both; }
.level-section h2 { font-size:24px; font-weight:700; margin-bottom:16px; }
.level-section .level-subtitle { font-size:14px; color:var(--text-light); margin-bottom:20px; }
.level-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.level-card { background:var(--card-bg); border-radius:var(--radius); padding:24px 20px; border:2px solid var(--border); cursor:pointer; transition:var(--transition); text-align:center; position:relative; overflow:hidden; }
.level-card:hover { transform:translateY(-4px); box-shadow:var(--shadow); }
.level-card .level-badge { font-size:24px; margin-bottom:8px; }
.level-card .level-name { font-size:18px; font-weight:700; margin-bottom:4px; }
.level-card .level-desc { font-size:13px; color:var(--text-light); line-height:1.4; margin-bottom:10px; }
.level-card .level-meta { font-size:12px; color:var(--text-muted); }
.level-card .level-time { font-size:12px; color:var(--primary); font-weight:600; }
.level-card::after { content:''; position:absolute; top:0;left:0;right:0; height:4px; }
.level-card.speed::after { background:var(--success); }
.level-card.standard::after { background:var(--primary); }
.level-card.advanced::after { background:var(--warning); }
.level-card.deep::after { background:var(--accent); }
.level-card:hover::after { height:6px; }

/* ===== TYPES SHOWCASE ===== */
.types-showcase-section { margin-top:40px; margin-bottom:30px; }
.types-showcase-section h2 { font-size:24px; font-weight:700; text-align:center; margin-bottom:8px; }
.showcase-subtitle { font-size:14px; color:var(--text-light); text-align:center; margin-bottom:20px; }
.types-showcase-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.showcase-card { background:var(--card-bg); border-radius:var(--radius); padding:20px; border:2px solid var(--border); cursor:pointer; transition:var(--transition); display:flex; gap:14px; align-items:flex-start; }
.showcase-card:hover { border-color:var(--primary-light); box-shadow:var(--shadow); transform:translateY(-2px); }
.showcase-card .sc-emoji { font-size:32px; line-height:1; flex-shrink:0; }
.showcase-card .sc-code { font-size:16px; font-weight:900; color:var(--primary); letter-spacing:2px; }
.showcase-card .sc-name { font-size:14px; font-weight:700; }
.showcase-card .sc-tagline { font-size:13px; color:var(--text-light); line-height:1.4; margin-top:4px; }
.showcase-card .sc-arrow { font-size:14px; color:var(--text-muted); margin-top:4px; transition:var(--transition); }
.showcase-card:hover .sc-arrow { color:var(--primary); transform:translateX(4px); }

.home-footer { text-align:center; padding:20px; font-size:13px; color:var(--text-muted); }

/* ===== TEST PAGE ===== */
.test-progress { background:var(--card-bg); border-radius:var(--radius); padding:16px 24px; margin-bottom:20px; box-shadow:var(--shadow); }
.test-progress .progress-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; flex-wrap:wrap; gap:4px; }
.test-progress .progress-label { font-size:14px; font-weight:500; color:var(--text-light); }
.test-progress .progress-count { font-size:14px; font-weight:700; color:var(--primary); }
.test-progress .progress-level { font-size:12px; color:var(--text-muted); }
.progress-bar { height:8px; background:var(--border); border-radius:4px; overflow:hidden; }
.progress-bar .progress-fill { height:100%; background:linear-gradient(90deg,var(--primary),var(--primary-light)); border-radius:4px; transition:width 0.5s cubic-bezier(0.4,0,0.2,1); }

.test-question-card { background:var(--card-bg); border-radius:var(--radius); padding:32px 28px; box-shadow:var(--shadow); transition:opacity 0.2s; }
.test-question-card.anim-right { animation:slideIn 0.35s ease-out; }
.test-question-card.anim-left { animation:slideInLeft 0.35s ease-out; }
.test-question-card .q-meta { display:flex; align-items:center; gap:8px; margin-bottom:16px; }
.test-question-card .question-dimension { display:inline-block; font-size:12px; font-weight:600; padding:4px 12px; border-radius:20px; }
.test-question-card .question-depth { display:inline-block; font-size:11px; font-weight:500; padding:3px 8px; border-radius:12px; background:rgba(253,203,110,0.15); color:#E17055; }
.test-question-card .question-number { font-size:14px; color:var(--text-muted); margin-bottom:8px; }
.test-question-card .question-text { font-size:18px; font-weight:500; line-height:1.6; margin-bottom:24px; }

.option-btn { display:flex; align-items:center; gap:14px; width:100%; padding:16px 20px; margin-bottom:12px; background:var(--bg); border:2px solid var(--border); border-radius:var(--radius-sm); cursor:pointer; transition:var(--transition); text-align:left; font-size:15px; line-height:1.5; color:var(--text); }
.option-btn:hover { border-color:var(--primary-light); background:rgba(108,92,231,0.05); transform:translateX(4px); }
.option-btn.selected { border-color:var(--primary); background:rgba(108,92,231,0.08); color:var(--primary-dark); font-weight:500; }
.option-btn.selected .option-letter { background:var(--primary); color:white; }
.option-btn .option-letter { width:32px;height:32px; border-radius:8px; background:var(--border); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; color:var(--text-light); transition:var(--transition); flex-shrink:0; }

.test-nav { display:flex; justify-content:space-between; align-items:center; margin-top:24px; gap:12px; }
.nav-btn { display:inline-flex; align-items:center; gap:8px; padding:12px 24px; border-radius:50px; border:2px solid var(--border); background:var(--card-bg); font-size:15px; font-weight:600; cursor:pointer; transition:var(--transition); color:var(--text); }
.nav-btn:hover:not(:disabled) { border-color:var(--primary-light); color:var(--primary); }
.nav-btn:disabled { opacity:0.4; cursor:not-allowed; }
.nav-btn.submit-btn { background:var(--primary); color:white; border-color:var(--primary); }
.nav-btn.submit-btn:hover:not(:disabled) { background:var(--primary-dark); border-color:var(--primary-dark); }

/* ===== RESULT PAGE ===== */
.result-header { text-align:center; padding:40px 20px 20px; animation:fadeInUp 0.6s ease-out; }
.result-header .result-label { font-size:14px; color:var(--text-light); margin-bottom:10px; }
.result-header .result-level { display:inline-block; font-size:12px; padding:4px 12px; border-radius:16px; background:rgba(108,92,231,0.1); color:var(--primary); font-weight:600; margin-bottom:16px; }
.result-type-display { display:inline-flex; flex-direction:column; align-items:center; animation:fadeInUp 0.8s ease-out 0.2s both; }
.result-type-code { font-size:72px; font-weight:900; letter-spacing:8px; line-height:1; margin-bottom:8px; }
.result-type-code .letter { display:inline-block; animation:fadeInUp 0.5s ease-out both; }
.result-type-name { font-size:22px; font-weight:700; margin-bottom:8px; }
.result-type-tagline { font-size:15px; color:var(--text-light); margin-bottom:16px; }
.result-avatar { width:100px;height:100px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:48px; margin:0 auto 16px; background:linear-gradient(135deg,var(--primary),var(--accent)); color:white; animation:float 3s ease-in-out infinite; }

.dimension-bars { background:var(--card-bg); border-radius:var(--radius); padding:24px; margin-bottom:20px; box-shadow:var(--shadow); animation:fadeInUp 0.6s ease-out 0.3s both; }
.dimension-bars h3 { font-size:18px; font-weight:700; margin-bottom:20px; text-align:center; }
.dim-bar-row { display:flex; align-items:center; gap:12px; margin-bottom:16px; }
.dim-bar-row:last-child { margin-bottom:0; }
.dim-bar-label { width:80px; font-size:14px; font-weight:700; text-align:center; flex-shrink:0; }
.dim-bar-track { flex:1; height:28px; background:var(--border); border-radius:14px; overflow:hidden; position:relative; }
.dim-bar-fill { height:100%; border-radius:14px; animation:barGrow 1s ease-out both; position:relative; display:flex; align-items:center; justify-content:flex-end; padding-right:10px; }
.dim-bar-fill .dim-bar-pct { font-size:12px; font-weight:700; color:white; }
.dim-bar-fill.left { justify-content:flex-start; padding-left:10px; }

.trait-section { margin-bottom:20px; animation:fadeInUp 0.6s ease-out 0.4s both; }
.trait-section h3 { font-size:18px; font-weight:700; margin-bottom:16px; }
.trait-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.trait-card { background:var(--card-bg); border-radius:var(--radius-sm); padding:16px; border:1px solid var(--border); transition:var(--transition); }
.trait-card:hover { box-shadow:var(--shadow); }
.trait-card .trait-icon { font-size:24px; margin-bottom:8px; }
.trait-card .trait-title { font-size:14px; font-weight:700; margin-bottom:4px; }
.trait-card .trait-desc { font-size:12px; color:var(--text-light); }

.career-section { background:var(--card-bg); border-radius:var(--radius); padding:24px; margin-bottom:20px; box-shadow:var(--shadow); animation:fadeInUp 0.6s ease-out 0.5s both; }
.career-section h3 { font-size:18px; font-weight:700; margin-bottom:16px; }
.career-tags { display:flex; flex-wrap:wrap; gap:8px; }
.career-tag { padding:8px 16px; border-radius:20px; font-size:13px; font-weight:500; border:1px solid var(--primary-light); color:var(--primary-dark); background:rgba(108,92,231,0.06); transition:var(--transition); }
.career-tag:hover { background:rgba(108,92,231,0.12); transform:translateY(-2px); }

.description-card { background:var(--card-bg); border-radius:var(--radius); padding:24px; margin-bottom:20px; box-shadow:var(--shadow); animation:fadeInUp 0.6s ease-out 0.35s both; }
.description-card h3 { font-size:18px; font-weight:700; margin-bottom:12px; }
.description-card p { font-size:15px; line-height:1.8; color:var(--text-light); }

.compat-section { background:var(--card-bg); border-radius:var(--radius); padding:24px; margin-bottom:20px; box-shadow:var(--shadow); animation:fadeInUp 0.6s ease-out 0.6s both; }
.compat-section h3 { font-size:18px; font-weight:700; margin-bottom:16px; }
.compat-row { display:flex; gap:12px; align-items:center; margin-bottom:12px; }
.compat-type { padding:8px 16px; border-radius:var(--radius-sm); font-size:14px; font-weight:700; text-align:center; min-width:60px; }
.compat-desc { font-size:13px; color:var(--text-light); }
.compat-best { background:rgba(0,184,148,0.12); color:#00B894; }
.compat-good { background:rgba(108,92,231,0.1); color:var(--primary); }
.compat-challenge { background:rgba(253,203,110,0.15); color:#E17055; }

.result-actions { display:flex; justify-content:center; gap:16px; margin:30px 0; animation:fadeInUp 0.6s ease-out 0.7s both; flex-wrap:wrap; }
.action-btn { display:inline-flex; align-items:center; gap:8px; padding:14px 28px; border-radius:50px; font-size:15px; font-weight:600; cursor:pointer; transition:var(--transition); border:2px solid transparent; }
.action-btn.download-btn { background:linear-gradient(135deg,var(--primary),var(--primary-dark)); color:white; box-shadow:0 4px 20px rgba(108,92,231,0.3); }
.action-btn.download-btn:hover { transform:translateY(-3px); box-shadow:0 8px 30px rgba(108,92,231,0.4); }
.action-btn.retest-btn { background:var(--card-bg); color:var(--text); border-color:var(--border); }
.action-btn.retest-btn:hover { border-color:var(--primary-light); color:var(--primary); transform:translateY(-2px); }
.action-btn.share-btn { background:var(--card-bg); color:var(--text); border-color:var(--border); }
.action-btn.share-btn:hover { border-color:var(--accent-light); color:var(--accent); transform:translateY(-2px); }

.loading-overlay { position:fixed; top:0;left:0;right:0;bottom:0; background:rgba(255,255,255,0.95); z-index:100; display:none; flex-direction:column; align-items:center; justify-content:center; gap:16px; }
.loading-overlay.active { display:flex; }
.loading-spinner { width:48px;height:48px; border:4px solid var(--border); border-top:4px solid var(--primary); border-radius:50%; animation:spin 0.8s linear infinite; }
.loading-text { font-size:16px; font-weight:500; color:var(--text-light); }

.report-container { position:fixed; top:0;left:0; width:800px; background:white; z-index:-9999; opacity:0; pointer-events:none; }
.report-container .report-page { width:800px; padding:40px; background:white; }
.report-container .report-header { text-align:center; padding-bottom:20px; border-bottom:3px solid var(--primary); }
.report-container .report-title { font-size:28px; font-weight:900; color:var(--primary); }
.report-container .report-subtitle { font-size:14px; color:#666; margin-top:8px; }
.report-container .report-type-block { text-align:center; padding:30px 0; }
.report-container .report-type-code { font-size:56px; font-weight:900; color:var(--text); letter-spacing:6px; }
.report-container .report-type-name { font-size:20px; font-weight:700; color:var(--text); }
.report-container .report-section { margin-top:24px; }
.report-container .report-section-title { font-size:16px; font-weight:700; color:var(--primary); border-bottom:1px solid var(--border); padding-bottom:8px; margin-bottom:12px; }
.report-container .report-text { font-size:13px; line-height:1.7; color:#444; }
.report-container .report-bar-row { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.report-container .report-bar-label { width:70px; font-size:13px; font-weight:700; }
.report-container .report-bar-track { flex:1; height:22px; background:#eee; border-radius:11px; overflow:hidden; }
.report-container .report-bar-fill { height:100%; border-radius:11px; }
.report-container .report-bar-pct { width:50px; font-size:13px; font-weight:700; text-align:right; }
.report-container .report-tags { display:flex; flex-wrap:wrap; gap:6px; }
.report-container .report-tag { padding:4px 12px; border-radius:16px; font-size:12px; background:rgba(108,92,231,0.1); color:var(--primary-dark); }
.report-container .report-footer { text-align:center; margin-top:30px; padding-top:16px; border-top:1px solid var(--border); font-size:11px; color:#999; }

@media (max-width:600px) {
  .home-hero h1 { font-size:28px; }
  .level-grid { grid-template-columns:1fr; }
  .types-showcase-grid { grid-template-columns:1fr; }
  .result-type-code { font-size:48px; }
  .trait-grid { grid-template-columns:1fr; }
  .result-actions { flex-direction:column; }
  .test-question-card { padding:20px 16px; }
  .container { padding:12px; }
  .modal-content { width:95%; padding:20px; }
}
