* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #F5F6FA;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #16181D;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(99, 102, 241, 0.14), transparent 40%),
    radial-gradient(circle at 88% 92%, rgba(20, 184, 166, 0.12), transparent 42%);
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.08);
  border: 1px solid rgba(16, 24, 40, 0.04);
}

.lang-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  display: inline-flex;
  border: 1.5px solid #4F46E5;
  border-radius: 999px;
  overflow: hidden;
}
.lang-btn {
  border: none;
  background: transparent;
  color: #4F46E5;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.lang-btn:hover { background: #EEF0FF; }
.lang-btn.active {
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  color: #fff;
}
.lang-btn.active:hover { background: linear-gradient(135deg, #6366F1, #4F46E5); }

.screen { display: none; animation: fadeIn 0.35s ease; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand-logo {
  display: block;
  height: 36px;
  width: auto;
  margin-bottom: 20px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6366F1;
  margin-bottom: 10px;
}

h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.3;
}

.lead {
  color: #5B616E;
  font-size: 15px;
  line-height: 1.55;
  margin: 0 0 28px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: #3A3F4B; }

input[type="email"], input[type="text"], textarea {
  border: 1.5px solid #E4E6EC;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  font-family: inherit;
  background: #FBFBFD;
  transition: border-color 0.15s ease, background 0.15s ease;
  outline: none;
}
input:focus, textarea:focus {
  border-color: #6366F1;
  background: #fff;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: #EEF0FF;
  color: #4F46E5;
}
.btn-secondary:hover { background: #E4E7FF; }

.error-text {
  color: #DC2626;
  font-size: 13px;
  font-weight: 600;
}

/* Quiz screen */
.quiz-top { margin-bottom: 22px; }
.progress-track {
  height: 6px;
  background: #EEF0F5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366F1, #14B8A6);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #8A8F99;
}

.question-text {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0 0 6px;
}
.question-hint {
  font-size: 13px;
  color: #8A8F99;
  margin-bottom: 18px;
  min-height: 4px;
}

.answer-area { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }

.tile {
  border: 1.5px solid #E4E6EC;
  background: #FBFBFD;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tile:hover { border-color: #C7C9F5; background: #F5F5FE; }
.tile.selected {
  border-color: #6366F1;
  background: #EEF0FF;
  box-shadow: inset 0 0 0 1px #6366F1;
}
.tile-marker {
  width: 20px; height: 20px;
  border-radius: 6px;
  border: 1.5px solid #D0D3DC;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: transparent;
  transition: all 0.15s ease;
}
.tile.selected .tile-marker {
  background: #6366F1;
  border-color: #6366F1;
  color: #fff;
}
.tile[data-shape="round"] .tile-marker { border-radius: 999px; }

.tile.correct {
  border-color: #16A34A;
  background: #ECFDF3;
  box-shadow: inset 0 0 0 1px #16A34A;
}
.tile.correct .tile-marker { background: #16A34A; border-color: #16A34A; color: #fff; }
.tile.wrong {
  border-color: #DC2626;
  background: #FEF2F2;
  box-shadow: inset 0 0 0 1px #DC2626;
}
.tile.wrong .tile-marker { background: #DC2626; border-color: #DC2626; color: #fff; }
.tile.disabled { cursor: default; }

/* Sequence tiles */
.seq-tile {
  border: 1.5px solid #E4E6EC;
  background: #FBFBFD;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  touch-action: none;
}
.seq-tile.dragging { opacity: 0.5; }
.seq-tile.correct { border-color: #16A34A; background: #ECFDF3; }
.seq-tile.wrong { border-color: #DC2626; background: #FEF2F2; }
.seq-handle {
  cursor: grab;
  color: #B4B7C2;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  flex-shrink: 0;
}
.seq-index {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: #E4E6EC;
  color: #5B616E;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.seq-order-btns { margin-left: auto; display: flex; gap: 4px; }
.seq-order-btns button {
  border: none;
  background: #EEF0F5;
  border-radius: 8px;
  width: 26px; height: 26px;
  cursor: pointer;
  font-size: 13px;
  color: #5B616E;
}
.seq-order-btns button:hover { background: #E4E6EC; }

textarea.text-answer {
  min-height: 90px;
  resize: vertical;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auto-advance {
  font-size: 13px;
  font-weight: 600;
  color: #6366F1;
}

.feedback {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #F5F5FE;
  font-size: 14px;
  line-height: 1.5;
  color: #3A3F4B;
}
.feedback.is-wrong { background: #FEF2F2; color: #7F1D1D; }
.feedback.is-right { background: #ECFDF3; color: #14532D; }
.feedback p { margin: 0; }
.feedback p + p { margin-top: 8px; }
.feedback-answer { font-weight: 600; }
.feedback-comment { opacity: 0.85; }

/* Result screen */
.result-score { text-align: center; margin: 12px 0 4px; }
.result-percent {
  font-size: 56px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366F1, #14B8A6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result-sub { color: #8A8F99; font-size: 14px; font-weight: 600; margin-top: -6px; }
.result-count { text-align: center; color: #5B616E; font-size: 14px; margin: 12px 0 20px; }
.result-message {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #3A3F4B;
  margin: 0 0 24px;
}
.result-actions { display: flex; flex-direction: column; gap: 12px; }
.result-actions[hidden] { display: none; }
#screen-result .btn { width: 100%; }
.btn-stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 20px;
}
.btn-main { font-size: 15px; font-weight: 700; }
.btn-sub { font-size: 12px; font-weight: 500; opacity: 0.75; }

@media (max-width: 480px) {
  .card { padding: 26px 22px; border-radius: 18px; }
  h1 { font-size: 21px; }
}
