:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #243035;
  --muted: #66757b;
  --line: #dce5df;
  --accent: #2f8f83;
  --accent-soft: #dff3ef;
  --sun: #f0b85a;
  --sun-soft: #fff0d5;
  --wrong: #cf5c47;
  --wrong-soft: #ffe2dc;
  --correct: #24866f;
  --correct-soft: #dff5ea;
  --shadow: 0 18px 42px rgba(50, 72, 68, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: 'M PLUS Rounded 1c', sans-serif;
  background:
    linear-gradient(145deg, rgba(47, 143, 131, 0.14), transparent 36%),
    linear-gradient(315deg, rgba(240, 184, 90, 0.18), transparent 34%),
    var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  width: min(720px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  align-content: center;
  gap: 18px;
}

.hero {
  text-align: center;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 9vw, 3.7rem);
  line-height: 1.02;
}

.subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-size: clamp(1rem, 3.8vw, 1.2rem);
}

.language-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px auto 0;
}

.language-button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.language-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #1f665e;
}

.language-button:hover {
  transform: translateY(-1px);
}

.quiz-card {
  display: grid;
  gap: 18px;
  min-height: 620px;
  padding: clamp(18px, 5vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: var(--shadow);
}

.start-card {
  min-height: 480px;
  align-content: center;
}

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

.start-visual span {
  min-height: 78px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(47, 143, 131, 0.12), transparent),
    #fbfdfb;
  color: var(--accent);
  font-size: clamp(1.1rem, 5vw, 1.65rem);
  font-weight: 900;
}

.start-copy {
  display: grid;
  gap: 10px;
  text-align: center;
}

.start-lead {
  font-size: clamp(1.18rem, 5vw, 1.55rem);
  font-weight: 900;
  line-height: 1.45;
}

.start-body {
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.howto-card {
  min-height: 620px;
  align-content: center;
}

.howto-card h2 {
  text-align: center;
  font-size: clamp(1.8rem, 7vw, 2.6rem);
}

.howto-list {
  display: grid;
  gap: 16px;
  margin: 0;
}

.howto-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.howto-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f4f1ea;
  box-shadow: inset 0 0 0 1px rgba(220, 229, 223, 0.75);
  font-size: 1.35rem;
}

.howto-item h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  line-height: 1.35;
}

.howto-item p {
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.status-bar,
.meta-row,
.result-grid {
  display: grid;
  gap: 10px;
}

.status-bar {
  grid-template-columns: 1fr 1fr;
}

.status-bar > div,
.result-grid > div {
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.label,
.info-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-bar strong,
.result-grid strong {
  font-size: 1.35rem;
}

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

.badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #1f665e;
  font-weight: 800;
  text-transform: capitalize;
}

.badge.level {
  background: var(--sun-soft);
  color: #8c5c13;
}

.question-box {
  min-height: 164px;
  display: grid;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 240, 213, 0.72), transparent),
    #f9fbf8;
  border: 1px solid var(--line);
}

.question-text {
  white-space: pre-line;
  overflow-wrap: anywhere;
  line-height: 1.75;
  font-size: clamp(1.05rem, 4.3vw, 1.32rem);
  font-weight: 700;
}

.choices {
  display: grid;
  gap: 10px;
}

.choice-button,
.primary-button,
.secondary-button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.choice-button {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 2px solid var(--line);
  background: #ffffff;
  color: var(--text);
  text-align: left;
  line-height: 1.5;
  overflow-wrap: anywhere;
  hyphens: auto;
  white-space: normal;
}

.choice-button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.choice-button.correct {
  border-color: var(--correct);
  background: var(--correct-soft);
}

.choice-button.wrong {
  border-color: var(--wrong);
  background: var(--wrong-soft);
}

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

.feedback-panel {
  display: grid;
  gap: 12px;
  min-height: 196px;
}

.feedback-text {
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

.feedback-text.good {
  background: var(--correct-soft);
  color: var(--correct);
}

.feedback-text.bad {
  background: var(--wrong-soft);
  color: var(--wrong);
}

.info-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.info-block p {
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.tip-block {
  border-color: #edd8ad;
  background: #fffaf0;
}

.primary-button {
  width: 100%;
  align-self: end;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  font-size: 1.04rem;
  box-shadow: 0 10px 20px rgba(47, 143, 131, 0.22);
}

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

.danger-button {
  background: #d52f3d;
  box-shadow: 0 10px 20px rgba(213, 47, 61, 0.24);
}

.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.secondary-button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.result-card {
  min-height: auto;
  text-align: center;
}

.result-card h2 {
  font-size: clamp(1.8rem, 8vw, 3rem);
}

.result-grid {
  grid-template-columns: repeat(3, 1fr);
}

.result-message {
  color: var(--muted);
  line-height: 1.7;
}

.hidden {
  display: none;
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 18px 0;
    align-content: start;
  }

  .quiz-card {
    min-height: 660px;
  }

  .language-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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