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

/* ===== VARIABLES ===== */
:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #EEF2FF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F9FAFB;
  --white: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --border-interactive: 2px;
  --border-structural: 1px;
}

/* ===== BASE ===== */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

/* ===== LAYOUT ===== */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.page-center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ===== CARD ===== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.card + .card {
  margin-top: 1rem;
}

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 600; }
p  { color: var(--muted); }

/* ===== BUTTONS ===== */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover  { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: transparent;
  color: var(--primary);
  border: var(--border-interactive) solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover { background: var(--primary-light); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-ghost:hover { color: var(--text); background: var(--border); }

/* ===== OPTION CARDS (radio pills) ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 1rem;
}

.option-item {
  position: relative;
}

.option-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.option-item label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: var(--border-interactive) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-size: 0.9375rem;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.option-item label:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item input[type="radio"]:checked + label {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
  color: var(--primary-dark);
  font-weight: 500;
}

/* Radio dot indicator */
.option-item label::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: var(--border-interactive) solid var(--border);
  background: var(--white);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option-item input[type="radio"]:checked + label::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--white);
}

/* Personality pill variant — same as above, slight styling */
.options-personality .option-item label {
  border-radius: 999px;
}

/* ===== PROGRESS BAR ===== */
.progress-wrapper {
  margin-bottom: 1.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.375rem;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ===== QUESTION AREA ===== */
.question-number {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.55;
}

.question-type-label {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border: var(--border-structural) solid var(--border);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
  margin-bottom: 0.75rem;
}

/* ===== NAV BUTTONS ===== */
.nav-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.nav-buttons .btn-primary {
  flex: 1;
}

/* ===== LANDING PAGE ===== */
.landing-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.logo-wrap {
  margin-bottom: 1.25rem;
}

.app-name {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.tagline {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.description {
  font-size: 0.9375rem;
  color: var(--muted);
  text-align: left;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.description p {
  color: var(--text);
}

.description p + p {
  margin-top: 0.5rem;
}

/* ===== RESULT PAGE ===== */
.result-header {
  text-align: center;
  padding: 1.5rem 1rem;
}

.result-header h1 {
  font-size: 1.5rem;
  color: var(--text);
}

.result-header p {
  margin-top: 0.25rem;
  font-size: 0.9375rem;
}

/* RIASEC Chart */
.riasec-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 140px;
  padding-bottom: 2rem;
  position: relative;
}

.riasec-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 0.375rem;
}

.riasec-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
}

.riasec-bar-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  position: absolute;
  bottom: 0;
}

.riasec-pct {
  font-size: 0.6875rem;
  color: var(--muted);
}

.riasec-dim-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
}

/* Career Cards */
.career-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.career-card {
  background: var(--white);
  border: var(--border-structural) solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow);
}

.career-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.career-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.career-rank {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  letter-spacing: 0.025em;
  margin-bottom: 0.5rem;
}

.career-score-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.625rem;
}

.score-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.5s ease;
}

.score-pct {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 2.5rem;
  text-align: right;
}

.career-path {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.career-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.375rem;
  flex-wrap: wrap;
}

.career-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.stretch-reason {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: #B45309;
  background: #FEF3C7;
  border-radius: 6px;
  padding: 0.3rem 0.625rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* AI reason tag inside domain header */
.domain-ai-reason {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.85;
  font-style: italic;
  margin-left: auto;
  text-align: right;
  max-width: 55%;
  line-height: 1.3;
}

/* Domain-grouped career view */
.domain-group {
  margin-bottom: 1rem;
}
.domain-group:last-child {
  margin-bottom: 0;
}
.domain-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid currentColor;
}
.domain-group-header-title {
  font-size: 0.875rem;
  font-weight: 700;
}
.domain-group-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Collapsible section */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0.25rem 0;
}

.collapsible-header h2 {
  font-size: 1.125rem;
}

.collapsible-chevron {
  font-size: 1rem;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.collapsible-header[aria-expanded="true"] .collapsible-chevron {
  transform: rotate(180deg);
}

.collapsible-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  max-height: 0;
  opacity: 0;
}

.collapsible-body.open {
  max-height: 3000px;
  opacity: 1;
}

/* Save Form */
.save-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3125rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-field input {
  border: var(--border-interactive) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6875rem 0.875rem;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  width: 100%;
}

.form-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-field input::placeholder {
  color: var(--muted);
}

.save-status {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.5rem;
}

.save-status.success { color: #059669; }
.save-status.error   { color: #DC2626; }

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.875rem;
}

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0 1rem;
}

/* ===== TEST PAGE HEADER ===== */
.test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.test-header .app-logo {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
}

/* ===== UTILITY ===== */
.text-muted  { color: var(--muted); }
.text-center { text-align: center; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-state {
  text-align: center;
  padding: 3rem 1rem;
}

/* ===== RESPONSIVE (320–640px fine, no horiz scroll) ===== */
@media (max-width: 400px) {
  h1 { font-size: 1.5rem; }
  .app-name { font-size: 1.625rem; }
  .card { padding: 1.125rem; }
  .career-card { padding: 0.875rem; }
}

@media (min-width: 480px) {
  .nav-buttons .btn-primary {
    width: auto;
    flex: 1;
  }
}

/* Career card layout — rank inline, badge below name */
.career-name-block {
  flex: 1;
}

.career-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.career-rank {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.career-summary {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 0.375rem;
  margin-top: 0.375rem;
}

/* ===== EXPLORE (GRAPH) PAGE ===== */
.graph-canvas {
  width: 100%;
  height: 70vh;
  min-height: 400px;
  display: block;
  background: var(--bg);
  border-radius: var(--radius);
  border: var(--border-structural) solid var(--border);
  overflow: hidden;
  cursor: grab;
}

.graph-canvas:active { cursor: grabbing; }

.graph-node {
  cursor: pointer;
}

.graph-node circle {
  stroke: var(--white);
  stroke-width: 2px;
  transition: r 0.15s ease;
}

.graph-node text {
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  fill: var(--text);
  pointer-events: none;
  text-anchor: middle;
}

.graph-link {
  stroke: var(--border);
  stroke-opacity: 0.7;
  stroke-width: 1.5px;
  fill: none;
}

.graph-tooltip {
  position: absolute;
  background: var(--white);
  border: var(--border-structural) solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 0.75rem 1rem;
  max-width: 240px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.graph-tooltip.visible { opacity: 1; pointer-events: auto; }

.graph-tooltip-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.graph-tooltip-summary {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 0.625rem;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.graph-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.graph-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== TIMELINE PAGE ===== */
.timeline-scroll-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

.timeline-svg {
  display: block;
  min-width: 100%;
}

.timeline-stage {
  cursor: default;
}

.timeline-stage circle {
  fill: var(--white);
  stroke: var(--primary);
  stroke-width: 2.5px;
  transition: r 0.15s ease;
}

.timeline-stage.active circle {
  fill: var(--primary);
}

.timeline-stage-label {
  font-size: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  fill: var(--text);
  font-weight: 500;
  text-anchor: middle;
}

.timeline-year-label {
  font-size: 11px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  fill: var(--muted);
  text-anchor: middle;
}

.timeline-connector {
  stroke: var(--primary);
  stroke-width: 2px;
  stroke-opacity: 0.4;
  fill: none;
}

.timeline-select-wrap {
  margin-bottom: 1rem;
}

.timeline-select-wrap label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.timeline-select {
  border: var(--border-interactive) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--white);
  width: 100%;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.timeline-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ===== PRINT STYLES ===== */
@media print {
  body * { visibility: hidden; }
  #print-summary, #print-summary * { visibility: visible; }
  #print-summary {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    padding: 2rem;
    border: none !important;
    background: white !important;
  }
}

/* ===== RESULT2 (DEEP DIVE WINNER) ===== */
#winner-conf-bar {
  background: linear-gradient(90deg, #4F46E5, #7C3AED);
}
