@font-face {
  font-family: system-ui;
  src: local("Arial");
}

:root {
  --bg: #f8f1e8;
  --card: #fffdf9;
  --text: #2b211a;
  --muted: #7a6a5f;
  --primary: #8c5a37;
  --primary-dark: #6f4328;
  --line: #eadfD4;
  --soft: #fbf6f0;
  --correct-bg: #e9f8ef;
  --correct: #197847;
  --wrong-bg: #fdecee;
  --wrong: #c8374a;
  --focus: rgba(140, 90, 55, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #fff7ec 0%, var(--bg) 42%, #f3e2d2 100%);
  color: var(--text);
}

button, select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: min(100%, 780px);
  background: rgba(255, 253, 249, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: 0 18px 60px rgba(64, 42, 24, 0.14);
  padding: 32px;
  backdrop-filter: blur(10px);
}

.home-card {
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff1df;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 14px;
}

h1, h2, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 6vw, 48px);
  letter-spacing: -0.04em;
}

.home-description {
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.home-controls {
  display: grid;
  gap: 14px;
  margin: 0 auto 18px;
  max-width: 440px;
}

.field {
  text-align: left;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 14px 16px;
  color: var(--text);
  outline: none;
}

select:focus, button:focus-visible {
  box-shadow: 0 0 0 4px var(--focus);
}

.primary-button, .secondary-button, .ghost-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  min-height: 52px;
  padding: 14px 22px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}

.primary-button {
  width: 100%;
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: #efe1d2;
  color: var(--primary-dark);
}

.ghost-button {
  background: transparent;
  color: var(--primary-dark);
  text-decoration: underline;
  min-height: auto;
  padding: 8px 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.meta-box {
  padding: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.meta-value {
  display: block;
  font-size: 22px;
  font-weight: 900;
}

.meta-label {
  color: var(--muted);
  font-size: 13px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.progress-text {
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 900;
}

.round-text {
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe1d2;
  margin: 8px 0 24px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.25s ease;
}

.question-title {
  font-size: clamp(21px, 4vw, 28px);
  line-height: 1.55;
  letter-spacing: -0.025em;
  margin-bottom: 22px;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-button {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  padding: 16px;
  cursor: pointer;
  line-height: 1.55;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.choice-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #d1ad8f;
  background: #fffaf4;
}

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

.choice-number {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f1e2d4;
  color: var(--primary-dark);
  font-weight: 900;
}

.choice-button.correct {
  border-color: rgba(25, 120, 71, 0.55);
  background: var(--correct-bg);
}

.choice-button.correct .choice-number {
  background: var(--correct);
  color: #fff;
}

.choice-button.wrong {
  border-color: rgba(200, 55, 74, 0.55);
  background: var(--wrong-bg);
}

.choice-button.wrong .choice-number {
  background: var(--wrong);
  color: #fff;
}

.feedback {
  margin-top: 20px;
  border-radius: 18px;
  padding: 18px;
  line-height: 1.6;
}

.feedback.correct {
  background: var(--correct-bg);
  color: var(--correct);
}

.feedback.wrong {
  background: var(--wrong-bg);
  color: var(--wrong);
}

.feedback strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.warning-box {
  margin: 18px 0;
  padding: 14px;
  border-radius: 16px;
  background: #fff6d9;
  border: 1px solid #f3d58d;
  color: #705018;
  line-height: 1.6;
}

.bottom-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.result-score {
  margin: 22px 0;
  padding: 24px;
  border-radius: 22px;
  background: var(--soft);
  border: 1px solid var(--line);
  text-align: center;
}

.score-number {
  display: block;
  font-size: clamp(42px, 9vw, 72px);
  font-weight: 950;
  color: var(--primary-dark);
  letter-spacing: -0.05em;
}

.result-actions {
  display: grid;
  gap: 10px;
}

.loading, .error {
  text-align: center;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
    align-items: stretch;
  }

  .card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .top-bar {
    display: block;
  }

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