@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --bg: #0a0f1e;
  --bg2: #0f172a;
  --bg3: #1e293b;
  --bg4: #1a2540;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.07);
  --accent: #7c3aed;
  --accent2: #2563eb;
  --accent-grad: linear-gradient(135deg, #7c3aed, #2563eb);
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  --transition: 0.25s cubic-bezier(.4, 0, .2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* animated background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(124, 58, 237, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(37, 99, 235, 0.14) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── SCREENS ─────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
}

/* ── HEADER / LOGO ───────────────────────────────────────────── */
.app-header {
  text-align: center;
  margin-bottom: 36px;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.app-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text2);
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text3);
}

/* ── CARD ─────────────────────────────────────────────────────── */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 540px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text2);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* ── FORM ELEMENTS ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.input-wrap {
  position: relative;
}

.form-control {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.form-control.has-icon {
  padding-right: 48px;
}

.form-control option {
  background: #1e293b;
  color: var(--text);
}

/* password toggle */
.pw-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color var(--transition);
}

.pw-toggle:hover {
  color: var(--text);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* anon preview */
.anon-preview-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.25);
  border-radius: 10px;
  margin-top: 16px;
}

.anon-label {
  font-size: 0.78rem;
  color: var(--text2);
  white-space: nowrap;
}

.anon-value {
  font-size: 1rem;
  font-weight: 700;
  color: #a78bfa;
  font-family: 'Courier New', monospace;
}

.anon-icon {
  color: #7c3aed;
  flex-shrink: 0;
}

/* error */
.form-error {
  display: none;
  color: #f87171;
  font-size: 0.82rem;
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 28px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.45);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-ghost {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--glass-hover);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: #a78bfa;
}

.btn-outline:hover {
  background: rgba(124, 58, 237, 0.12);
}

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.progress-header {
  width: 100%;
  max-width: 720px;
  margin-bottom: 24px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 8px;
}

.progress-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-grad);
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

/* ── QUESTION CARD ────────────────────────────────────────────── */
.q-card {
  width: 100%;
  max-width: 720px;
}

.q-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.q-number {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}

.scale-badge {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: #a78bfa;
  letter-spacing: 0.08em;
}

.q-text {
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 40px;
  min-height: 80px;
  text-align: center;
}

/* ── ANSWER OPTIONS (16personalities style) ───────────────────── */
.answer-options {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.answer-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 12px;
  transition: all var(--transition);
  min-width: 80px;
}

.answer-btn:hover .circle {
  transform: scale(1.08);
}

.answer-btn:active .circle {
  transform: scale(0.96);
}

.circle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Circles: outer two are bigger (stronger) */
.answer-btn:nth-child(1) .circle,
.answer-btn:nth-child(4) .circle {
  width: 72px;
  height: 72px;
}

.answer-btn:nth-child(2) .circle,
.answer-btn:nth-child(3) .circle {
  width: 56px;
  height: 56px;
}

.circle {
  border-radius: 50%;
  border: 2.5px solid var(--c, #888);
  background: var(--f, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
}

.answer-btn.selected .circle {
  background: var(--c, #888);
  box-shadow: 0 0 0 6px rgba(from var(--c) r g b / 0.2);
}

.check-icon {
  width: 28px;
  height: 28px;
  stroke: #fff;
  position: absolute;
}

.answer-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text2);
  text-align: center;
  line-height: 1.3;
  max-width: 90px;
  transition: color var(--transition);
}

.answer-btn.selected .answer-label {
  color: var(--text);
  font-weight: 600;
}

/* ── NAV BUTTONS ──────────────────────────────────────────────── */
.q-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.q-nav .btn {
  min-width: 120px;
}

/* ── RESULTS SCREEN ───────────────────────────────────────────── */
.results-header {
  text-align: center;
  margin-bottom: 32px;
  width: 100%;
  max-width: 720px;
}

.results-title {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.results-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--text2);
}

.meta-chip strong {
  color: var(--text);
}

.results-scales {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1100px;
  margin-bottom: 32px;
}

/* result card */
.result-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
}

.result-scale-header {
  margin-bottom: 20px;
}

.scale-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.06em;
}

.scale-full-name {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 2px;
}

.result-numbers {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.raw-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px 20px;
  border: 1px solid var(--glass-border);
}

.score-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.score-label {
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 4px;
  text-align: center;
}

.sten-score {
  flex: 1;
  display: flex;
  justify-content: center;
}

.sten-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--sc, #7c3aed);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(from var(--sc) r g b / 0.1);
  box-shadow: 0 0 20px rgba(from var(--sc) r g b / 0.2);
}

.sten-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--sc);
  line-height: 1;
}

.sten-label {
  font-size: 0.6rem;
  color: var(--text3);
  font-weight: 600;
  letter-spacing: 0.1em;
}

.sten-desc {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  min-width: 80px;
}

/* sten bar */
.sten-bar-wrap {
  margin-top: 4px;
}

.sten-bar-track {
  display: flex;
  gap: 3px;
  margin-bottom: 6px;
}

.sten-seg {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sten-seg-fill {
  height: 8px;
  width: 100%;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  transition: background 0.4s;
}

.sten-seg.sten-active .sten-seg-fill {
  background: var(--sc);
  box-shadow: 0 0 8px rgba(from var(--sc) r g b / 0.5);
}

.sten-seg span {
  font-size: 0.65rem;
  color: var(--text3);
  font-weight: 500;
}

.sten-seg.sten-active span {
  color: var(--sc);
  font-weight: 700;
}

.sten-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text3);
  margin-top: 4px;
}

/* results actions */
.results-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
}

.results-actions .btn {
  min-width: 180px;
}

/* ── ANIMATIONS ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease both;
}

.shake {
  animation: shake 0.42s ease;
}

.scale-in {
  animation: scaleIn 0.35s ease both;
}

.screen.active>* {
  animation: fadeIn 0.45s ease both;
}

/* ── DIVIDER ──────────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text3);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card {
    padding: 24px 20px;
  }

  .q-text {
    font-size: 1.05rem;
  }

  .answer-options {
    gap: 12px;
  }

  .answer-btn:nth-child(1) .circle,
  .answer-btn:nth-child(4) .circle {
    width: 56px;
    height: 56px;
  }

  .answer-btn:nth-child(2) .circle,
  .answer-btn:nth-child(3) .circle {
    width: 44px;
    height: 44px;
  }

  .q-card {
    padding: 24px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .results-scales {
    grid-template-columns: 1fr;
  }

  .answer-label {
    font-size: 0.65rem;
    max-width: 70px;
  }
}

/* ── SCROLLBAR ────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg2);
}

::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── USERDATA SCREEN ──────────────────────────────────────────── */
#screen-userData .card,
#screen-userdata .card {
  max-width: 580px;
}

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-icon {
  width: 56px;
  height: 56px;
  background: rgba(124, 58, 237, 0.1);
  color: #a78bfa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 1px solid rgba(124, 58, 237, 0.3);
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.modal-message {
  font-size: 0.95rem;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 28px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  flex: 1;
  padding: 12px 16px;
  margin: 0;
}