:root {
  --bg: #0d0f14;
  --card: #161a22;
  --card-border: #242a36;
  --text: #e8eaef;
  --muted: #9aa3b2;
  --accent: #f59e0b;
  --accent-strong: #f97316;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --danger: #f87171;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(245, 158, 11, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(249, 115, 22, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: pan-y;
}

.shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 10;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.4s var(--ease);
}

.lang-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
}

.lang {
  position: relative;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
@media (hover: hover) {
  .lang-toggle:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
  }
}
.lang-toggle .chev {
  color: var(--muted);
  font-size: 0.7rem;
}

.flag {
  font-size: 1.15rem;
  line-height: 1;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: #1b2029;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 30;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
}
@media (hover: hover) {
  .lang-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}
.lang-item.active {
  background: var(--accent-soft);
}
.lang-item .check {
  margin-left: auto;
  color: var(--accent);
}

[dir="rtl"] .lang-wrap {
  right: auto;
  left: 16px;
}
[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 56px;
}

.card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px 36px 36px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  position: relative;
}

/* Slide animations */
.slide-in-right {
  animation: slideInRight 0.35s var(--ease) both;
}
.slide-in-left {
  animation: slideInLeft 0.35s var(--ease) both;
}
.slide-out-left {
  animation: slideOutLeft 0.2s var(--ease) both;
}
.slide-out-right {
  animation: slideOutRight 0.2s var(--ease) both;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-40px); }
}
@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  min-height: 32px;
}

.brand {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.counter {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
@media (hover: hover) {
  .back:hover {
    color: var(--text);
    border-color: #3a4150;
    background: rgba(255, 255, 255, 0.04);
  }
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 28px;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.option {
  text-align: left;
  width: 100%;
  padding: 16px 18px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
@media (hover: hover) {
  .option:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
  }
}
.option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.field {
  margin-top: 8px;
}

.input {
  width: 100%;
  padding: 16px 18px;
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input::placeholder {
  color: #5b6472;
}
.input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
}

.primary {
  margin-top: 24px;
  width: 100%;
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1206;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
@media (hover: hover) {
  .primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
  }
}
.primary:active {
  transform: translateY(0);
}
.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.error {
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--danger);
  min-height: 1.2em;
}

.hint {
  margin-top: 12px;
  font-size: 0.82rem;
  color: #6b7482;
}

.combobox {
  position: relative;
}

.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #1b2029;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 30;
}

.combo-option {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
@media (hover: hover) {
  .combo-option:hover {
    background: var(--accent-soft);
  }
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(26, 18, 6, 0.35);
  border-top-color: #1a1206;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.welcome-mark {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a1206;
  margin-bottom: 22px;
}

.done-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a1206;
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 22px;
}

.answer-summary {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
}
.answer-summary strong {
  color: var(--text);
}

@media (max-width: 480px) {
  .card {
    padding: 30px 22px 28px;
  }
  .title {
    font-size: 1.45rem;
  }
}
