:root {
  --red: #8f1d2c;
  --red-dark: #6e1521;
  --gold: #e0a329;
  --gold-soft: #f6e6b4;
  --cream: #fff9ed;
  --ink: #1f2430;
  --muted: #6f6a63;
  --surface: #ffffff;
  --line: #eadfcf;
  --success: #2d7554;
  --success-bg: #edf8f2;
  --error: #a43c3c;
  --error-bg: #fff0ee;
  --shadow: 0 22px 55px rgba(88, 45, 24, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(224, 163, 41, 0.13), transparent 28%),
    radial-gradient(circle at 90% 20%, rgba(143, 29, 44, 0.08), transparent 24%),
    var(--cream);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid rgba(143, 29, 44, 0.08);
}

.header-inner {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 800;
  box-shadow: 0 9px 20px rgba(143, 29, 44, 0.18);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--red-dark);
  font-size: clamp(1.15rem, 3vw, 1.55rem);
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.header-badge {
  border: 1px solid rgba(143, 29, 44, 0.18);
  border-radius: 999px;
  padding: 8px 13px;
  color: var(--red-dark);
  background: #fff8f3;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.heritage-stripe {
  height: 7px;
  background: linear-gradient(to right, var(--red) 0 38%, var(--gold) 38% 62%, var(--red) 62% 100%);
}

.app {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 58px 0 36px;
}

.hidden {
  display: none !important;
}

.hero-copy {
  max-width: 780px;
  margin-bottom: 34px;
}

.eyebrow,
.category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before,
.category::before {
  content: "";
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--gold);
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--red-dark);
  line-height: 1.08;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.25rem, 6vw, 4.35rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.65rem, 4vw, 2.55rem);
}

.hero-text {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.75;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.level-card {
  min-width: 0;
  min-height: 270px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 35px rgba(70, 40, 20, 0.06);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.level-card::after {
  content: "Ñ";
  position: absolute;
  right: -8px;
  bottom: -40px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9rem;
  font-weight: 900;
  color: rgba(143, 29, 44, 0.045);
  pointer-events: none;
}

.level-card:hover,
.level-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: rgba(143, 29, 44, 0.30);
  outline: none;
}

.level-card.intermediate {
  background: linear-gradient(150deg, #fff 0%, #fffaf0 100%);
}

.level-card.advanced {
  background: linear-gradient(150deg, #fff 0%, #fff5f2 100%);
}

.level-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.level-icon {
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 700;
}

.cefr-tag,
.level-pill,
.result-level {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6b4a0d;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.cefr-tag {
  padding: 6px 10px;
  font-size: 0.76rem;
}

.level-card > strong {
  color: var(--red-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  margin-bottom: 10px;
}

.level-card > span:not(.level-topline):not(.level-cta) {
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.level-cta {
  margin-top: auto;
  padding-top: 24px;
  color: var(--red);
  font-weight: 900;
}

.note {
  margin-top: 24px;
  border: 1px dashed rgba(143, 29, 44, 0.20);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
}

.note span {
  color: var(--gold);
  font-size: 1.1rem;
}

.note p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.quiz-screen {
  max-width: 880px;
  margin: 0 auto;
}

.quiz-toolbar,
.progress-meta,
.question-meta,
.quiz-status,
.question-actions,
.result-actions {
  display: flex;
  align-items: center;
}

.quiz-toolbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.quiz-status {
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.level-pill {
  padding: 7px 11px;
  font-size: 0.78rem;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 8px 0;
  color: var(--red);
  font-weight: 800;
  cursor: pointer;
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--red-dark);
  text-decoration: underline;
  outline: none;
}

.progress-meta {
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 9px;
}

.progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #eadfcf;
  margin-bottom: 24px;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.28s ease;
}

.question-card,
.result-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.question-card {
  padding: clamp(24px, 5vw, 44px);
}

.question-meta {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.question-number {
  color: #ccb996;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  font-weight: 800;
}

.question-card h2 {
  color: var(--ink);
  margin-bottom: 28px;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.answer-button {
  min-width: 0;
  min-height: 72px;
  border: 1px solid #e2d6c6;
  border-radius: 16px;
  background: #fffdfa;
  color: var(--ink);
  padding: 15px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.answer-key {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f4ecdf;
  color: var(--red-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.answer-button:hover:not(:disabled),
.answer-button:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(143, 29, 44, 0.45);
  outline: none;
}

.answer-button.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.answer-button.correct .answer-key {
  background: var(--success);
  color: white;
}

.answer-button.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
}

.answer-button.incorrect .answer-key {
  background: var(--error);
  color: white;
}

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

.feedback {
  margin-top: 20px;
  border-radius: 16px;
  border-left: 4px solid var(--gold);
  background: #fff8e7;
  padding: 16px 18px;
}

.feedback.success {
  border-left-color: var(--success);
  background: var(--success-bg);
}

.feedback.error {
  border-left-color: var(--error);
  background: var(--error-bg);
}

.feedback strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.feedback p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.question-actions {
  justify-content: flex-end;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 14px;
  padding: 13px 19px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-button {
  border: 0;
  margin-top: 20px;
  background: var(--red);
  color: white;
  box-shadow: 0 9px 20px rgba(143, 29, 44, 0.17);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--red-dark);
  transform: translateY(-1px);
  outline: none;
}

.secondary-button {
  border: 1px solid rgba(143, 29, 44, 0.30);
  background: white;
  color: var(--red);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: var(--red);
  background: #fff8f3;
  outline: none;
}

.result-screen {
  max-width: 720px;
  margin: 0 auto;
}

.result-card {
  padding: clamp(30px, 6vw, 56px);
  text-align: center;
}

.result-level {
  padding: 7px 12px;
  font-size: 0.78rem;
  margin-bottom: 18px;
}

.result-card h2 {
  margin-bottom: 26px;
}

.score-ring {
  width: 150px;
  height: 150px;
  margin: 0 auto 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, white 54%, transparent 56%),
    conic-gradient(var(--gold), var(--red));
  box-shadow: inset 0 0 0 1px rgba(143, 29, 44, 0.06);
}

.score-ring span {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--red-dark);
  font-size: 2.1rem;
  font-weight: 900;
}

.result-message {
  margin: 0 auto 8px;
  max-width: 540px;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
  font-weight: 700;
}

.result-detail {
  margin: 0 auto;
  max-width: 540px;
  color: var(--muted);
  line-height: 1.6;
}

.result-actions {
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.result-actions .primary-button {
  margin-top: 0;
}

footer {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 34px;
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
}

footer p {
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
}

footer a {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 820px) {
  .level-grid {
    grid-template-columns: 1fr;
  }

  .level-card {
    min-height: 220px;
  }

  .answers {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-inner,
  .app,
  footer {
    width: min(100% - 22px, 1120px);
  }

  .header-inner {
    min-height: 76px;
  }

  .header-badge {
    display: none;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .brand-copy small {
    display: none;
  }

  .app {
    padding-top: 34px;
  }

  .quiz-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-status {
    width: 100%;
    justify-content: space-between;
  }

  .question-card {
    border-radius: 20px;
  }

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

  .result-actions button {
    width: 100%;
  }
}

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