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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #242836;
  --border: #2e3345;
  --text: #e4e7ef;
  --text2: #9ca3b8;
  --accent: #6366f1;
  --accent2: #818cf8;
  --accent-glow: rgba(99,102,241,0.15);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
@media (max-width: 600px) {
  header { padding: 10px 12px; }
  .progress-container { order: 3; width: 100%; }
  .logo { font-size: 15px; }
}

.logo {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.lang-switch { display: flex; gap: 4px; margin-left: 16px; }
.lang-switch button {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text2); font-size: 12px; font-weight: 600; padding: 4px 10px; cursor: pointer; transition: all 0.2s;
}
.lang-switch button:hover { color: var(--text); border-color: var(--accent); }
.lang-switch button.active { background: var(--accent-glow); color: var(--accent2); border-color: var(--accent); }
.resource-tab.active { background: var(--accent-glow) !important; color: var(--accent2) !important; border-color: var(--accent) !important; }
.multi-label { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: rgba(255,180,50,0.12); color: #f0a030; border: 1px solid rgba(255,180,50,0.35); vertical-align: middle; margin-right: 4px; }

.progress-container { display: inline-flex; flex-direction: column; gap: 6px; margin-left: auto; }
.progress-stages { display: flex; gap: 6px; }
.progress-stages .stage { font-size: 11px; padding: 3px 10px; border-radius: 4px; color: var(--text2); opacity: 0.4; white-space: nowrap; transition: all 0.2s; }
.progress-stages .stage.active { opacity: 1; color: #92700a; background: rgba(234,179,8,0.15); font-weight: 600; }
.progress-stages .stage.done { opacity: 0.8; color: var(--success); background: rgba(34,197,94,0.1); }
.progress-row { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; position: relative; }
.progress-pct { font-size: 11px; color: var(--text2); white-space: nowrap; }
.progress-bar::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--pct, 0%); background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px; transition: width 0.4s ease;
}
/* progress-text removed — replaced by stage tabs */
.conf-tip .conf-tooltip { display:none;position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);background:var(--surface2);color:var(--text);font-size:12px;padding:6px 10px;border-radius:6px;white-space:nowrap;z-index:10;box-shadow:0 2px 8px rgba(0,0,0,0.3); }
.conf-tip:hover .conf-tooltip { display:block; }

main { max-width: 720px; margin: 0 auto; padding: 40px 20px; }

.screen { display: none; animation: fadeIn 0.4s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; }

h1 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
h2 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
h3 { font-size: 18px; font-weight: 600; }
.subtitle { font-size: 18px; color: var(--text2); margin-bottom: 32px; }
.question-desc { color: var(--text2); margin-bottom: 24px; font-size: 15px; }

.welcome-features { display: flex; gap: 20px; margin-bottom: 24px; justify-content: center; }
@media (max-width: 600px) { .welcome-features { flex-direction: column; gap: 8px; } }
.feature { padding: 8px 0; font-size: 14px; color: var(--text2); line-height: 1.5; text-align: center; flex: 1; }
.feature strong { color: var(--text); }

.data-note { font-size: 13px; color: var(--text2); padding: 12px 16px; background: var(--surface2); border-radius: 8px; margin-bottom: 16px; line-height: 1.5; }
.data-note strong { color: var(--text); }
.time-note { color: var(--text2); font-size: 14px; margin-bottom: 24px; }
.privacy-note { color: var(--text2); font-size: 12px; margin-bottom: 20px; opacity: 0.7; line-height: 1.6; }

.btn { padding: 12px 28px; border-radius: 8px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface2); color: var(--text2); }
.btn.secondary:hover { color: var(--text); }

.section-label {
  display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent2); margin-bottom: 16px;
  padding: 4px 12px; background: var(--accent-glow); border-radius: 4px;
}

.insight-box {
  background: var(--surface2); border-left: 3px solid var(--accent);
  padding: 12px 16px; margin-bottom: 24px; font-size: 14px; color: var(--text2);
  border-radius: 0 8px 8px 0; line-height: 1.5;
}
.insight-box:empty { display: none; }
.insight-box .source { font-size: 12px; color: var(--accent2); margin-top: 6px; font-style: italic; }

.option {
  display: block; width: 100%; text-align: left; padding: 16px 20px; margin-bottom: 10px;
  background: var(--surface2); border: 2px solid transparent; border-radius: 10px;
  color: var(--text); font-size: 15px; cursor: pointer; transition: all 0.2s;
}
.option:hover { border-color: var(--accent); background: var(--accent-glow); }
.option.selected { border-color: var(--accent); background: var(--accent-glow); }

.nav-buttons { display: flex; justify-content: space-between; margin-top: 32px; }

/* Results */
.results-header { text-align: center; margin-bottom: 40px; }
.results-header h1 { font-size: 28px; margin-bottom: 8px; }
.archetype-badge {
  display: inline-block; font-size: 14px; font-weight: 600; padding: 6px 16px;
  border-radius: 20px; background: var(--accent-glow); color: var(--accent2); margin-bottom: 16px;
}

.result-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; margin-bottom: 20px;
}
.result-section h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

.score-bar { height: 10px; background: var(--surface2); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.score-fill { height: 100%; border-radius: 5px; transition: width 1s ease; }
.score-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); margin-bottom: 4px; }

.action-item {
  padding: 16px; background: var(--surface2); border-radius: 8px; margin-bottom: 10px; font-size: 14px; line-height: 1.6;
}
.action-item strong { color: var(--accent2); }
.action-item .how { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--text2); font-size: 13px; }
.action-item .how a { color: var(--accent2); text-decoration: none; }
.action-item .how a:hover { text-decoration: underline; }

.tag { display: inline-block; padding: 4px 10px; background: var(--surface2); border-radius: 6px; font-size: 13px; margin: 3px; color: var(--text2); }

/* Community chart */
.chart-container { position: relative; width: 100%; max-width: 400px; margin: 0 auto; }
.radar-canvas { width: 100%; height: auto; }
.chart-legend { display: flex; gap: 20px; justify-content: center; margin-top: 12px; font-size: 13px; color: var(--text2); }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.community-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.stat-card { background: var(--surface2); border-radius: 8px; padding: 14px; text-align: center; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--accent2); }
.stat-card .stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* Feedback modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex;
  align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 32px; max-width: 500px; width: 90%;
}
.modal h3 { margin-bottom: 8px; }
.modal-desc { color: var(--text2); font-size: 14px; margin-bottom: 20px; }
.feedback-grid { display: grid; gap: 12px; margin-bottom: 16px; }
.feedback-row { margin-bottom: 12px; }
.feedback-row label { display: block; font-size: 14px; margin-bottom: 6px; color: var(--text2); }
.feedback-row textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; color: var(--text); font-size: 14px; resize: vertical;
}
.star-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--surface2); border-radius: 8px; }
.star-row .dim-label { font-size: 14px; }
.stars { display: flex; gap: 4px; }
.stars button {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: var(--border); transition: color 0.15s;
}
.stars button.active { color: var(--warning); }
.stars button:hover { color: var(--warning); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

.restart-btn { margin-top: 32px; text-align: center; display: flex; gap: 12px; justify-content: center; }

.share-note {
  margin-top: 20px; padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--text2); line-height: 1.5;
}
.share-note code { background: var(--surface2); padding: 2px 8px; border-radius: 4px; font-size: 12px; color: var(--accent2); user-select: all; }
.share-url-row { display: flex; gap: 8px; margin-top: 10px; }
.share-url-row input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; color: var(--text); font-size: 13px; font-family: monospace;
}
.share-url-row .btn { padding: 8px 16px; font-size: 13px; white-space: nowrap; }

/* Dashboard charts */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-grid canvas { width: 100%; height: auto; }
.chart-box { background: var(--surface2); border-radius: 10px; padding: 16px; }
.chart-box h4 { font-size: 14px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.chart-box .chart-note { font-size: 12px; color: var(--text2); margin-top: 8px; }

@media (max-width: 600px) {
  .card { padding: 24px; }
  /* welcome-features already vertical */
  .community-stats { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}
