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

:root {
  --panel:        #ffffff;
  --accent:       #3b82f6;
  --accent-light: #eff6ff;
  --accent-hover: #2563eb;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --option-bg:    #f8fafc;
  --shadow:       0 4px 24px rgba(0,0,0,0.08);
  --shadow-panel: 0 -8px 48px rgba(0,0,0,0.07);
  --radius:       16px;
  --gold:         #f59e0b;
  --silver:       #94a3b8;
  --bronze:       #b45309;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(150deg, #a8c8e8 0%, #c2d9f0 28%, #daeaf8 58%, #f0f7fc 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  line-height: 1.6;
}

#app { min-height: 100vh; }

/* ── Screens ── */
.screen { display: none; }

#screen-welcome.active  { display: flex;  flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 40px 16px; }
#screen-question.active { display: flex;  flex-direction: column; min-height: 100vh; }
#screen-results.active  { display: block; }

/* ── Welcome ── */
.welcome-card {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 48px rgba(59,130,246,0.12), 0 2px 16px rgba(0,0,0,0.06);
}

.logo {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

h1 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

.info-blocks {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  background: var(--option-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.info-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 8px;
  border-right: 1px solid var(--border);
  gap: 3px;
}
.info-block:last-child { border-right: none; }

.info-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.section-preview {
  text-align: left;
  background: var(--option-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 4px 0;
  margin-bottom: 28px;
  overflow: hidden;
}

.preview-item {
  font-size: 13px;
  color: var(--text-muted);
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
}
.preview-item:last-child { border-bottom: none; }
.preview-item strong { color: var(--text); }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 18px rgba(59,130,246,0.32);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(59,130,246,0.38); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; box-shadow: none; transform: none; }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Question Screen Header ── */
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 36px 0;
}

.btn-nav-back {
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  transition: opacity 0.15s;
}
.btn-nav-back:hover { opacity: 0.65; }

.q-counter {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ── Progress Bar ── */
.progress-bar-wrap {
  margin: 10px 36px 0;
  height: 3px;
  background: rgba(255,255,255,0.38);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-inner {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}

/* ── Question Body (gradient area) ── */
.q-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 40px 12px;
  text-align: center;
}

.q-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.45;
  max-width: 620px;
  margin-bottom: 28px;
}

.q-illustration {
  font-size: 96px;
  line-height: 1;
  user-select: none;
  animation: float 3.5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0px);  }
  50%       { transform: translateY(-10px); }
}

/* ── Bottom White Panel ── */
.q-panel {
  background: var(--panel);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow-panel);
  padding: 28px 40px 40px;
}

.q-panel-inner {
  max-width: 800px;
  margin: 0 auto;
}

.dim-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 6px;
  padding: 4px 10px;
  margin-bottom: 14px;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  padding: 0 4px;
}

/* ── Option Containers ── */
.options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.options.emoji-row {
  flex-direction: row;
  justify-content: center;
  gap: 12px;
}

.options.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.options.two-col .option-btn { height: 100%; }

.options.four-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Regular Option Buttons ── */
.option-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background: var(--option-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
  line-height: 1.4;
}
.option-btn:hover { border-color: var(--accent); background: var(--accent-light); transform: translateY(-1px); }
.option-btn.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 600; }
.option-label { font-weight: 700; margin-right: 8px; color: var(--accent); }

/* ── Emoji Option Cards ── */
.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 10px 16px;
  background: var(--option-bg);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  flex: 1;
  max-width: 160px;
  min-width: 64px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
  font-family: inherit;
}
.option-card:hover { border-color: var(--accent); background: var(--accent-light); transform: translateY(-3px); box-shadow: 0 6px 20px rgba(59,130,246,0.12); }
.option-card.selected { border-color: var(--accent); background: var(--accent-light); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.18); }

.option-emoji { font-size: 36px; line-height: 1; user-select: none; }

.option-card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
}
.option-card.selected .option-card-label { color: var(--accent); font-weight: 600; }

/* ── Nav Row ── */
.nav-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 4px;
}

/* CTX text input & continue button */
.ctx-continue {
  margin-top: 12px;
  width: 100%;
}

.ctx-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  outline: none;
  background: var(--option-bg);
  color: var(--text);
  transition: border-color 0.15s;
  margin-bottom: 4px;
}
.ctx-input:focus { border-color: var(--accent); background: var(--accent-light); }

/* ── Results Screen ── */
#screen-results { background: #f0f5fa; min-height: 100vh; }

.results-header {
  text-align: center;
  padding: 44px 24px 32px;
  background: linear-gradient(150deg, #a8c8e8 0%, #daeaf8 100%);
}
.results-header h1 { font-size: 30px; font-weight: 800; }
.results-header .subtitle { margin-bottom: 0; color: var(--text-muted); }

.results-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px 60px;
}

.top3 { display: flex; flex-direction: column; gap: 16px; margin-bottom: 36px; }

.result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow);
}
.result-card.rank-1 { border-left: 4px solid var(--gold); }
.result-card.rank-2 { border-left: 4px solid var(--silver); }
.result-card.rank-3 { border-left: 4px solid var(--bronze); }

.result-rank-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.medal { font-size: 22px; }
.result-rank-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.result-match { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--accent); }
.result-role { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.result-cluster { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px; }
.result-titles { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.result-desc { font-size: 14px; color: var(--text); line-height: 1.6; }

.full-breakdown-wrap {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.full-breakdown-wrap h2 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.breakdown-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.breakdown-rank { width: 24px; text-align: right; color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.breakdown-name { flex: 1; font-weight: 500; }
.breakdown-bar-wrap { width: 120px; background: var(--option-bg); border-radius: 99px; height: 6px; flex-shrink: 0; }
.breakdown-bar { height: 100%; background: var(--accent); border-radius: 99px; }
.breakdown-pct { width: 42px; text-align: right; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.context-reflection {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.context-reflection h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 14px; }
.context-reflection p { margin-bottom: 8px; color: var(--text); line-height: 1.6; }
.context-reflection strong { color: var(--text); }

.results-footer { text-align: center; padding-top: 8px; }

/* ── Responsive ── */
@media (max-width: 600px) {
  h1 { font-size: 24px; }
  .q-text { font-size: 18px; }
  .q-illustration { font-size: 68px; }
  .q-header { padding: 18px 20px 0; }
  .progress-bar-wrap { margin: 10px 20px 0; }
  .q-panel { padding: 22px 20px 36px; }
  .q-body { padding: 16px 20px 8px; }
  .options.emoji-row { gap: 8px; }
  .option-card { padding: 14px 6px; }
  .option-emoji { font-size: 28px; }
  .options.two-col { grid-template-columns: 1fr; }
  .welcome-card { padding: 32px 24px; }
  .results-body { padding: 24px 16px 48px; }
}
