:root {
  color: var(--tg-theme-text-color, #17212b);
  background: var(--tg-theme-bg-color, #f4f6f8);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: var(--tg-viewport-stable-height, 100dvh);
  margin: 0;
  padding: 16px;
  background:
    radial-gradient(circle at 100% 0, rgb(36 129 204 / 14%), transparent 38%),
    var(--tg-theme-bg-color, #f4f6f8);
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--tg-theme-button-color, #2481cc);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-name {
  margin: 0;
  color: var(--tg-theme-hint-color, #708499);
  font-size: 14px;
}

.build {
  flex: none;
  padding: 5px 9px;
  border: 1px solid rgb(112 132 153 / 22%);
  border-radius: 999px;
  color: var(--tg-theme-hint-color, #708499);
  font-size: 11px;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
  color: var(--tg-theme-hint-color, #708499);
  font-size: 14px;
}

.quiz-meta strong {
  color: var(--tg-theme-text-color, #17212b);
}

.progress {
  height: 7px;
  overflow: hidden;
  margin-bottom: 20px;
  border-radius: 999px;
  background: rgb(112 132 153 / 18%);
}

.progress span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--tg-theme-button-color, #2481cc);
  transition: width 180ms ease;
}

.question-card,
.status-screen,
.finish-screen {
  border: 1px solid rgb(112 132 153 / 15%);
  border-radius: 24px;
  background: var(--tg-theme-secondary-bg-color, #ffffff);
  box-shadow: 0 16px 42px rgb(0 0 0 / 8%);
}

.question-card {
  min-height: 180px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.question-label,
.category {
  margin: 0;
  color: var(--tg-theme-hint-color, #708499);
  font-size: 13px;
}

.spanish-word {
  margin: 14px 0 6px;
  overflow-wrap: anywhere;
  font-size: clamp(34px, 10vw, 52px);
  line-height: 1.08;
}

.ipa {
  margin: 0 0 16px;
  color: var(--tg-theme-hint-color, #708499);
  font-family: "Noto Sans", "DejaVu Sans", sans-serif;
  font-size: 16px;
  line-height: 1.35;
}

.category {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgb(36 129 204 / 9%);
  color: var(--tg-theme-button-color, #2481cc);
  font-weight: 700;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.option-button {
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 12px;
  border: 1px solid rgb(112 132 153 / 22%);
  border-radius: 16px;
  color: var(--tg-theme-text-color, #17212b);
  background: var(--tg-theme-secondary-bg-color, #ffffff);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: transform 100ms ease, border-color 100ms ease, background 100ms ease;
}

.option-button:active:not(:disabled) {
  transform: scale(0.985);
}

.option-number {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--tg-theme-hint-color, #708499);
  background: rgb(112 132 153 / 11%);
  font-size: 13px;
}

.option-button:disabled {
  cursor: default;
}

.option-button.is-correct {
  border-color: #2cab63;
  background: rgb(44 171 99 / 13%);
}

.option-button.is-correct .option-number {
  color: #ffffff;
  background: #2cab63;
}

.option-button.is-wrong {
  border-color: #e34d59;
  background: rgb(227 77 89 / 12%);
}

.option-button.is-wrong .option-number {
  color: #ffffff;
  background: #e34d59;
}

.feedback {
  min-height: 21px;
  margin: 14px 2px 0;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.feedback.is-correct {
  color: #209350;
}

.feedback.is-wrong {
  color: #d73b47;
}

.next-button,
.restart-button {
  width: 100%;
  min-height: 54px;
  margin-top: 12px;
  border: 0;
  border-radius: 16px;
  color: var(--tg-theme-button-text-color, #ffffff);
  background: var(--tg-theme-button-color, #2481cc);
  font-weight: 800;
  cursor: pointer;
}

#quiz-screen.has-next-action {
  padding-bottom: calc(76px + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom)));
}

.next-button:not([hidden]) {
  position: fixed;
  z-index: 20;
  right: auto;
  bottom: calc(12px + var(--tg-content-safe-area-inset-bottom, env(safe-area-inset-bottom)));
  left: 50%;
  width: min(calc(100% - 32px), 488px);
  margin: 0;
  transform: translateX(-50%);
  box-shadow: 0 10px 28px rgb(0 0 0 / 20%);
}

.next-button:active {
  transform: translate(-50%, 1px);
}

.restart-button:active {
  transform: translateY(1px);
}

.status-screen,
.finish-screen {
  padding: 42px 24px;
  text-align: center;
}

.status-screen h1,
.finish-screen h1 {
  margin: 12px 0 8px;
  font-size: 30px;
}

.status-screen p,
.accuracy {
  margin: 0;
  color: var(--tg-theme-hint-color, #708499);
  line-height: 1.5;
}

.loader {
  width: 36px;
  height: 36px;
  margin: 0 auto 18px;
  border: 4px solid rgb(112 132 153 / 20%);
  border-top-color: var(--tg-theme-button-color, #2481cc);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.finish-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #2cab63;
  font-size: 34px;
  font-weight: 800;
}

.result {
  margin: 26px 0 8px;
}

.result strong {
  display: block;
  font-size: 72px;
  line-height: 0.95;
}

.result span {
  color: var(--tg-theme-hint-color, #708499);
  font-size: 15px;
}

.restart-button {
  margin-top: 28px;
}

.data-credit {
  margin: 18px 8px 0;
  color: var(--tg-theme-hint-color, #708499);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.data-credit a {
  color: inherit;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 560px) {
  body {
    padding: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }
}
