@font-face {
  font-family: "Vazir UI";
  src: url("./fonts/vazir/Vazir-Regular-UI.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir UI";
  src: url("./fonts/vazir/Vazir-Medium-UI.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazir UI";
  src: url("./fonts/vazir/Vazir-Bold-UI.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #e9e9e9;
  --red: #c8102e;
  --red-soft: #fbeff1;
  --text: #161616;
  --text-muted: #6a6a6a;
  --font-en: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-fa: "Vazir UI", Tahoma, "Segoe UI", sans-serif;
  --radius: 16px;
  --transition: 180ms ease;
}

html.dark-mode {
  --bg: #1a1a1a;
  --surface: #252525;
  --border: #3a3a3a;
  --text: #f5ede0;
  --text-muted: #d4c9bd;
  --red-soft: #4a1820;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-en);
  background:
    radial-gradient(1100px 500px at 100% -5%, #fff3f5 0%, transparent 60%),
    linear-gradient(to bottom, #ffffff 0%, #fdfdfd 100%);
  min-height: 100vh;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  transition: background-color var(--transition), color var(--transition);
}

html.dark-mode body {
  background:
    radial-gradient(1100px 500px at 100% -5%, #3a1a25 0%, transparent 60%),
    linear-gradient(to bottom, #1a1a1a 0%, #222222 100%);
}

html[lang="fa"] body {
  font-family: var(--font-fa);
}

.controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  grid-template-columns: 88px 70px;
  align-items: center;
  direction: ltr;
  gap: 0.5rem;
  z-index: 100;
}

#lang-toggle,
#theme-toggle {
  background: #ffffff;
  border: 1px solid var(--border);
  color: #222;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition), transform var(--transition), background-color var(--transition);
  white-space: nowrap;
  text-align: center;
  flex-shrink: 0;
}

#lang-toggle {
  width: 88px;
}

#lang-toggle.is-fa-label {
  font-family: var(--font-fa);
}

#theme-toggle {
  width: 70px;
}

html.dark-mode #lang-toggle,
html.dark-mode #theme-toggle {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

[dir="rtl"] #theme-toggle {
  font-family: var(--font-fa);
}

#lang-toggle:hover,
#theme-toggle:hover {
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-1px);
}

.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 16px 40px rgba(25, 22, 22, 0.06);
  animation: slide-up 260ms ease both;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

#welcome-title {
  text-align: center;
  font-size: clamp(1.85rem, 4.2vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

#welcome-description {
  text-align: center;
  color: var(--text-muted);
  line-height: 1.85;
  font-size: 1rem;
  max-width: 62ch;
  margin: 0 auto 2rem;
}

.sets-info {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.set-badge {
  background: var(--red-soft);
  border: 1px solid #f4d7dc;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: #8f1027;
}

html.dark-mode .set-badge {
  background: #3a322b;
  border-color: #5c4f43;
  color: #f7efe4;
}

.welcome-reference {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#reference-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
  text-align: center;
}

#reference-text a {
  color: var(--red);
  text-decoration: underline;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

#reference-text a:hover {
  opacity: 0.8;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.85rem 1.2rem;
  background: #ffffff;
  color: #333;
  border: 1px solid var(--red);
  border-radius: 12px;
  font-size: 0.98rem;
  font-weight: 500;
  font-family: var(--font-en);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

[dir="rtl"] .btn-primary {
  font-family: var(--font-fa);
}

.btn-primary:hover {
  background: #fff7f8;
  border-color: #a1142c;
  color: #a1142c;
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

html.dark-mode .btn-primary {
  background: #3a322b;
  color: #f5ede0;
  border-color: var(--red);
}

html.dark-mode .btn-primary:hover {
  background: #4a3f37;
  border-color: #ff4757;
  color: #ff4757;
}

.question-actions {
  display: flex;
  gap: 0.75rem;
}

.question-actions .btn-primary {
  flex: 1;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #f2f2f2;
  border-radius: 2px;
  margin-bottom: 1.4rem;
  overflow: hidden;
}

.set-indicator {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.set-step {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.set-step.active {
  border-color: #f4d7dc;
  background: var(--red-soft);
  color: #8f1027;
}

html.dark-mode .set-step {
  background: #2e2a26;
  border-color: #4a433c;
  color: #f0e5d8;
}

html.dark-mode .set-step.active {
  background: #8f1027;
  border-color: #c44a60;
  color: #fff4f6;
}

#progress-bar {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width 240ms ease;
}

#question-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  text-align: center;
}

#question-counter {
  font-size: 0.8rem;
  color: var(--red);
  letter-spacing: 0.04em;
  margin-bottom: 0.95rem;
  text-align: center;
}

[dir="rtl"] #question-label {
  text-transform: none;
  letter-spacing: 0;
}

[dir="rtl"] #question-counter {
  letter-spacing: 0;
}

#question-text {
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.95;
  text-align: center;
  color: var(--text);
  min-height: 6.2rem;
  margin-bottom: 2rem;
}

#question-text.fade-in {
  animation: fade-in 220ms ease both;
}

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

.finish-icon {
  font-size: 2.1rem;
  text-align: center;
  margin-bottom: 0.8rem;
}

#finish-title {
  text-align: center;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

#finish-description {
  text-align: center;
  color: var(--text-muted);
  line-height: 1.85;
  font-size: 1rem;
  margin-bottom: 2rem;
}

[dir="rtl"] #welcome-title,
[dir="rtl"] #welcome-description,
[dir="rtl"] #question-text,
[dir="rtl"] #finish-title,
[dir="rtl"] #finish-description {
  font-family: var(--font-fa);
}
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.footer p {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.footer a {
  color: var(--red);
  text-decoration: none;
  transition: color var(--transition);
  font-weight: 500;
}

.footer a:hover {
  color: #a1142c;
  text-decoration: underline;
}

html.dark-mode .footer {
  background: rgba(37, 37, 37, 0.95);
  border-top-color: var(--border);
  color: var(--text-muted);
}

html.dark-mode .footer a {
  color: #ff6b7a;
}

html.dark-mode .footer a:hover {
  color: #ff9199;
}

body {
  padding-bottom: 4rem;
}
@media (max-width: 700px) {
  .screen {
    padding: 1.5rem 1rem;
    border-radius: 14px;
  }

  #question-text {
    min-height: 8rem;
  }

  .question-actions {
    flex-direction: column;
  }

  .question-actions #next-btn {
    order: -1;
  }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 480px) {
  .screen {
    padding: 2rem 1.4rem;
  }

  .sets-info {
    gap: 0.6rem;
  }
}
