:root {
  --ka-blue: #4f6ef7;
  --ka-blue-deep: #3651d4;
  --ka-gold: #f0b429;
  --ka-gold-deep: #d99a1b;
  --ka-tint: #eaf0ff;

  --bg: #0b0e1a;
  --panel: #131a2e;
  --panel2: #1a2340;
  --text: #eef1fb;
  --muted: #8d95bc;
  --border: #262f52;
  --error: #ff6b6b;
  --radius: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle, rgba(79, 110, 247, 0.10) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow-x: hidden;
}

body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -1;
  pointer-events: none;
  opacity: .3;
}
body::before { width: 440px; height: 440px; background: var(--ka-blue); top: -140px; left: -160px; }
body::after { width: 400px; height: 400px; background: var(--ka-gold); bottom: -120px; right: -160px; }

.topbar {
  background: linear-gradient(135deg, var(--ka-blue-deep), var(--ka-blue));
  color: #fff;
  padding: 22px 20px;
  text-align: center;
}
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; }
.topbar .brand-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  animation: pop-in .5s var(--ease);
}
.topbar .tagline { margin: 6px 0 0; font-size: 14px; color: #dbe3ff; }

.wrap { max-width: 640px; margin: 0 auto; padding: 28px 20px 80px; }

.screen { animation: fade-up .4s var(--ease); }
.screen.hidden { display: none; }
.hidden { display: none !important; }

h1 { font-size: clamp(24px, 6vw, 32px); text-align: center; margin: 6px 0 10px; }
h2 { font-size: 21px; margin: 0; }
h3 { font-size: 16px; margin: 0 0 14px; color: var(--ka-blue); display: flex; align-items: center; gap: 6px; }

.hero-emoji { font-size: 52px; text-align: center; margin-bottom: 4px; }
.hero-emoji.pulse { animation: pulse-scale 1.6s ease-in-out infinite; }
.hero-sub { color: var(--muted); text-align: center; margin: 0 0 18px; font-size: 15px; line-height: 1.5; }

.science-note {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ka-gold);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0 0 20px;
}

/* ---------- Form alanlari ---------- */

.field-block { margin-bottom: 18px; }
.field-label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }

.text-input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color .15s;
}
.text-input:focus { border-color: var(--ka-blue); }

.chips-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rel-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.rel-chip:hover { border-color: var(--ka-blue); }
.rel-chip.active {
  background: linear-gradient(135deg, var(--ka-blue), var(--ka-blue-deep));
  border-color: transparent;
  color: #fff;
}

.privacy-note {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 16px 0;
}

.counter-line { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.counter-line #counterValue { font-weight: 700; color: var(--ka-blue); }

.error { color: var(--error); font-size: 14px; min-height: 18px; text-align: center; }

/* ---------- Butonlar ---------- */

.primaryBtn {
  background: linear-gradient(135deg, var(--ka-blue), var(--ka-blue-deep));
  color: white;
  border: none;
  padding: 15px 20px;
  min-height: 50px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: block;
  width: 100%;
  box-shadow: 0 4px 18px rgba(79, 110, 247, .35);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), opacity .12s;
}
.primaryBtn:hover { box-shadow: 0 6px 22px rgba(79, 110, 247, .45); }
.primaryBtn:active { transform: scale(.97); opacity: .92; }
.primaryBtn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.secondaryBtn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s;
}
.secondaryBtn:hover { border-color: var(--ka-blue); }

.linkBtn { background: none; border: none; color: var(--ka-blue); cursor: pointer; font-size: 14px; font-weight: 600; padding: 8px; }

/* ---------- Soru akisi ---------- */

.progress-wrap { margin-bottom: 24px; }
.progress-bar { height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ka-blue), var(--ka-gold));
  border-radius: 999px;
  transition: width .35s var(--ease);
}
.progress-text { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 600; }

.question-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 22px;
  text-align: center;
  animation: fade-up .3s var(--ease);
}

.question-dimension {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ka-gold);
  background: rgba(240, 180, 41, .13);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.question-text { font-size: 20px; margin: 0 0 26px; line-height: 1.4; }

.answer-options { display: flex; flex-direction: column; gap: 12px; }
.answerBtn {
  padding: 16px 18px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-align: left;
  transition: transform .12s var(--ease), border-color .12s var(--ease), background .12s var(--ease);
}
.answerBtn:hover { border-color: var(--ka-blue); }
.answerBtn:active { transform: scale(.98); }

/* ---------- Bekleme ekrani ---------- */

.share-link-box { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link-box .text-input { flex: 1; font-size: 14px; }

.waiting-indicator {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  margin-top: 32px; color: var(--muted); font-size: 14px;
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--ka-tint);
  border-top-color: var(--ka-blue);
  animation: spin .7s linear infinite;
}

/* ---------- Sonuc ekrani ---------- */

.result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0 20px; }

.stat-card {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ka-blue);
  border-radius: 14px;
  padding: 16px;
  animation: fade-up .4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.stat-card .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; font-weight: 600; }
.stat-card .value { font-size: 19px; font-weight: 700; }
.stat-card.wide { grid-column: 1 / -1; }

.card-section, .ai-section {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
}

/* trait karsilastirma */
.trait-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.trait-row:last-child { border-bottom: none; }
.trait-row .trait-name { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.trait-bar-group { display: flex; flex-direction: column; gap: 6px; }
.trait-bar-line { display: flex; align-items: center; gap: 10px; }
.trait-bar-line .who { flex: none; width: 70px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trait-bar-line .bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; }
.trait-bar-line .bar-fill { height: 100%; border-radius: 999px; }
.trait-bar-line .bar-fill.a { background: linear-gradient(90deg, var(--ka-blue), var(--ka-blue-deep)); }
.trait-bar-line .bar-fill.b { background: linear-gradient(90deg, var(--ka-gold), var(--ka-gold-deep)); }
.trait-bar-line .pct { flex: none; width: 38px; text-align: right; font-size: 12.5px; font-weight: 700; }
.trait-similarity { margin-top: 8px; font-size: 12px; color: var(--muted); }
.trait-similarity b { color: var(--ka-gold); }

/* stil rozetleri */
.style-block { margin-bottom: 18px; }
.style-block:last-child { margin-bottom: 0; }
.style-block .style-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.style-badges { display: flex; gap: 10px; flex-wrap: wrap; }
.style-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
}
.style-badge .who-dot { width: 8px; height: 8px; border-radius: 50%; }
.style-badge .who-dot.a { background: var(--ka-blue); }
.style-badge .who-dot.b { background: var(--ka-gold); }
.style-badge b { font-weight: 700; }

/* flags */
.flag-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.5;
}
.flag-item:last-child { border-bottom: none; }
.flag-icon { flex: none; font-size: 20px; }

#shareCanvas {
  width: 100%; max-width: 300px; aspect-ratio: 9 / 16;
  display: block; margin: 0 auto 18px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(79, 110, 247, .25);
}

.ai-desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: -6px 0 14px; }

.ai-result {
  margin-top: 16px;
  background: var(--ka-tint);
  border: 1px solid #c9d7ff;
  border-radius: 14px;
  padding: 20px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: #131a2e;
  animation: fade-up .35s var(--ease);
  font-size: 14.5px;
}
.ai-result-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ka-blue-deep); margin-bottom: 10px; }

.ai-skeleton { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.skel-line { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--panel2) 25%, var(--ka-tint) 50%, var(--panel2) 75%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skel-line.w-90 { width: 90%; }
.skel-line.w-100 { width: 100%; }
.skel-line.w-70 { width: 70%; }

/* tum cevaplar */
.all-answers summary { cursor: pointer; font-weight: 700; color: var(--ka-blue); font-size: 14px; }
.aa-group { margin-top: 16px; }
.aa-group-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.aa-item { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.aa-item:last-child { border-bottom: none; }
.aa-item .aa-q { font-weight: 600; margin-bottom: 6px; }
.aa-item .aa-ans { color: var(--muted); font-size: 12.5px; }

/* ---------- Animasyonlar ---------- */

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse-scale { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
