/* ═══════════════════════════════════════════════════════════
   IKIGAI QUIZ — styles
   Namespace: .quiz-screen, .qz-*, .qprogress
═══════════════════════════════════════════════════════════ */

/* ── Screen wrapper ── */
.quiz-screen {
  animation: qz-in .22s ease both;
  padding-bottom: 40px;
}

@keyframes qz-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Badge ── */
.qz-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(91,92,246,.28);
  background: rgba(91,92,246,.09);
  font-size: 13px;
  font-weight: 700;
  color: #5b5cf6;
  margin-bottom: 16px;
  letter-spacing: -.01em;
}
.qz-badge--success { border-color: rgba(22,163,74,.30); background: rgba(22,163,74,.09); color: #16a34a; }
.qz-badge--error   { border-color: rgba(220,38,38,.30); background: rgba(220,38,38,.09); color: #dc2626; }

/* ── Typography ── */
.qz-h1 {
  font-size: clamp(26px, 5vw, 40px);
  font-weight: 870;
  letter-spacing: -.035em;
  line-height: 1.12;
  margin: 0 0 14px;
  color: #0f172a;
}
.qz-h1 em {
  color: #5b5cf6;
  font-style: normal;
}
.qz-h2 {
  font-size: clamp(20px, 3.5vw, 27px);
  font-weight: 820;
  letter-spacing: -.03em;
  line-height: 1.2;
  margin: 0 0 8px;
  color: #0f172a;
}
.qz-lead {
  font-size: clamp(15px, 1.5vw, 17px);
  color: #475569;
  line-height: 1.65;
  font-weight: 450;
  margin: 0 0 22px;
}
.qz-hint {
  font-size: 14px;
  color: #64748b;
  line-height: 1.55;
  margin: 4px 0 14px;
}
.qz-hint a { color: #5b5cf6; text-underline-offset: 2px; }

/* ── Welcome meta list ── */
.qz-meta {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.qz-meta li {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.80);
  font-size: 14px;
  color: #475569;
  font-weight: 500;
}

/* ── Progress bar ── */
.qprogress {
  margin-bottom: 22px;
}
.qprogress__bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(91,92,246,.12);
  overflow: hidden;
  margin-bottom: 10px;
}
.qprogress__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5b5cf6, #8b5cf6);
  transition: width .35s cubic-bezier(.4,0,.2,1);
}
.qprogress__blocks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.qp-block {
  color: #94a3b8;
  font-weight: 500;
  transition: color .15s;
}
.qp-block--on {
  color: #5b5cf6;
  font-weight: 750;
}
.qp-sep {
  color: #cbd5e1;
  font-size: 10px;
}

/* ── Question meta ── */
.qz-counter {
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 650;
  margin-bottom: 3px;
}
.qz-block-label {
  font-size: 14px;
  font-weight: 750;
  color: #5b5cf6;
  margin-bottom: 12px;
}

/* ── Input area ── */
.qz-input-wrap {
  margin: 16px 0;
}

.qz-textarea {
  width: 100%;
  min-height: 115px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(91,92,246,.22);
  background: rgba(255,255,255,.92);
  font-size: 15px;
  font-family: inherit;
  font-weight: 450;
  line-height: 1.6;
  color: #0f172a;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.qz-textarea:focus {
  border-color: #5b5cf6;
  box-shadow: 0 0 0 3px rgba(91,92,246,.11);
}
.qz-textarea::placeholder { color: #94a3b8; }

/* ── Radio / Checkbox options ── */
.qz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qz-options--multi {
  gap: 7px;
}

.qz-option {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1.5px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.82);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #334155;
  transition: border-color .12s, background .12s, color .12s;
  user-select: none;
}
.qz-option input { display: none; }
.qz-option:hover {
  border-color: rgba(91,92,246,.35);
  background: rgba(91,92,246,.05);
}
.qz-option--on {
  border-color: #5b5cf6;
  background: rgba(91,92,246,.09);
  color: #3730a3;
  font-weight: 650;
}

/* Other text input */
.qz-other-wrap {
  margin-top: 10px;
}
.qz-other-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(91,92,246,.18);
  background: rgba(255,255,255,.88);
  font-family: inherit;
  font-size: 15px;
  color: #0f172a;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.qz-other-input:focus {
  border-color: #5b5cf6;
  box-shadow: 0 0 0 3px rgba(91,92,246,.10);
}
.qz-other-input::placeholder { color: #94a3b8; }

/* ── Buttons ── */
.qz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.88);
  font-family: inherit;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: #0f172a;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .12s;
  white-space: nowrap;
}
.qz-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(15,23,42,.10); }
.qz-btn:active { transform: none; }
.qz-btn:focus-visible { outline: 3px solid rgba(91,92,246,.25); outline-offset: 2px; }

.qz-btn--primary {
  background: linear-gradient(135deg, #5b5cf6, #8b5cf6);
  color: #fff;
  border-color: rgba(91,92,246,.40);
  box-shadow: 0 10px 28px rgba(91,92,246,.22);
}
.qz-btn--primary:hover { box-shadow: 0 14px 36px rgba(91,92,246,.30); }
.qz-btn--ghost { background: rgba(255,255,255,.72); }
.qz-btn--big { padding: 14px 26px; font-size: 16px; }

/* ── Navigation row ── */
.qz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.qz-nav--center {
  justify-content: center;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.qz-nav--center .qz-btn { text-align: center; }

/* ── Field error ── */
.qz-field-error {
  font-size: 13px;
  color: #dc2626;
  background: rgba(220,38,38,.07);
  border: 1px solid rgba(220,38,38,.18);
  padding: 8px 13px;
  border-radius: 10px;
  margin: 0 0 12px;
}

/* ── API key block ── */
.qz-api-block {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(91,92,246,.18);
  background: rgba(91,92,246,.04);
}
.qz-api-label {
  display: block;
  font-size: 14px;
  font-weight: 750;
  color: #0f172a;
  margin-bottom: 6px;
}
.qz-api-input {
  width: 100%;
  padding: 10px 13px;
  margin-top: 8px;
  border-radius: 11px;
  border: 1.5px solid rgba(91,92,246,.22);
  background: rgba(255,255,255,.92);
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: #0f172a;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.qz-api-input:focus {
  border-color: #5b5cf6;
  box-shadow: 0 0 0 3px rgba(91,92,246,.10);
}
.qz-api-saved {
  font-size: 13px;
  color: #16a34a;
  font-weight: 650;
  margin: 8px 0 0;
}

/* ── Review screen ── */
.qz-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}
.qz-review-list::-webkit-scrollbar { width: 4px; }
.qz-review-list::-webkit-scrollbar-thumb { background: rgba(91,92,246,.25); border-radius: 999px; }

.qz-review-row {
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.09);
  background: rgba(255,255,255,.78);
}
.qz-review-q {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 3px;
  line-height: 1.4;
}
.qz-review-a {
  font-size: 14px;
  font-weight: 650;
  color: #0f172a;
  line-height: 1.45;
}

/* ── Loading screen ── */
.qz-loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 20px 80px;
  gap: 14px;
}

.qz-spinner {
  width: 46px;
  height: 46px;
  border: 3px solid rgba(91,92,246,.14);
  border-top-color: #5b5cf6;
  border-radius: 50%;
  animation: qz-spin .75s linear infinite;
}
@keyframes qz-spin { to { transform: rotate(360deg); } }

.qz-thinking-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}
.qz-thinking-chips span {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(91,92,246,.10);
  color: #5b5cf6;
  font-weight: 600;
  animation: qz-pulse 1.6s ease-in-out infinite;
}
.qz-thinking-chips span:nth-child(2) { animation-delay: .3s; }
.qz-thinking-chips span:nth-child(3) { animation-delay: .6s; }
@keyframes qz-pulse {
  0%, 100% { opacity: .45; }
  50%       { opacity: 1; }
}

/* ── Result screen ── */
.qz-result-body {
  margin: 20px 0;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(15,23,42,.09);
  background: rgba(255,255,255,.88);
  line-height: 1.7;
}
.qz-result-body h2 {
  font-size: 20px;
  font-weight: 820;
  letter-spacing: -.025em;
  color: #0f172a;
  margin: 22px 0 8px;
}
.qz-result-body h2:first-child { margin-top: 0; }
.qz-result-body h3 {
  font-size: 17px;
  font-weight: 750;
  color: #1e293b;
  margin: 18px 0 6px;
}
.qz-result-body h4 {
  font-size: 15px;
  font-weight: 700;
  color: #5b5cf6;
  margin: 14px 0 4px;
}
.qz-result-body h5 {
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  margin: 10px 0 3px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.qz-result-body p {
  font-size: 15px;
  color: #475569;
  margin: 6px 0;
  font-weight: 430;
}
.qz-result-body ul,
.qz-result-body ol {
  padding-left: 20px;
  color: #475569;
  font-size: 15px;
  margin: 8px 0;
}
.qz-result-body li { margin: 5px 0; }
.qz-result-body strong { color: #0f172a; font-weight: 700; }
.qz-result-body em { color: #5b5cf6; font-style: normal; font-weight: 600; }
.qz-result-body code {
  background: rgba(91,92,246,.08);
  border: 1px solid rgba(91,92,246,.15);
  padding: 1px 5px;
  border-radius: 6px;
  font-size: .9em;
}
.qz-result-body hr {
  border: none;
  border-top: 1px solid rgba(15,23,42,.09);
  margin: 18px 0;
}

.qz-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* ── Error screen ── */
.qz-error-pre {
  background: rgba(220,38,38,.06);
  border: 1px solid rgba(220,38,38,.15);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  color: #991b1b;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 12px 0;
}

/* ── Mobile ── */
@media (max-width: 520px) {
  .qz-nav { flex-direction: column; }
  .qz-btn { width: 100%; }
  .qz-result-actions { flex-direction: column; }
  .qz-result-actions .qz-btn { width: 100%; }
  .qz-meta { flex-direction: column; }
  .qz-meta li { text-align: center; }
}
