:root {
  --background: #f5f5f5;
  --surface: #ffffff;
  --text: #171717;
  --muted: #737373;
  --border: #dedede;
  --green: #16784b;
  --green-soft: #e7f5ed;
  --red: #bd3434;
  --red-soft: #fbeaea;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scrollbar-gutter: stable;
}

body {
  min-height: 100svh;
  margin: 0;
  padding: clamp(24px, 6vw, 56px) clamp(16px, 5vw, 32px);
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  width: min(100%, 520px);
  margin: 0 auto;
}

h1 {
  margin: 0 0 14px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.level-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.level-button {
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.level-button:not(:disabled):not([aria-pressed="true"]):hover {
  color: var(--text);
  background: var(--background);
}

.level-button[aria-pressed="true"] {
  color: var(--text);
  background: var(--background);
}

.level-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.card {
  height: 600px;
  padding: clamp(18px, 5vw, 28px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.meta {
  height: 20px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

h2 {
  height: 96px;
  margin: 0 0 20px;
  overflow: auto;
  font-size: clamp(1.3rem, 4.5vw, 1.75rem);
  line-height: 1.3;
}

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

.option,
.next {
  width: 100%;
  height: 70px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.option:not(:disabled):hover {
  border-color: var(--text);
}

.option.correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.option.wrong {
  border-color: var(--red);
  background: var(--red-soft);
}

.option:disabled {
  color: var(--text);
  cursor: default;
}

.next {
  height: 52px;
  margin-top: 14px;
  border-color: var(--text);
  color: #fff;
  background: var(--text);
  text-align: center;
  visibility: hidden;
  pointer-events: none;
}

.next.visible {
  visibility: visible;
  pointer-events: auto;
}

.next:hover {
  background: #333;
}

button:focus-visible {
  outline: 3px solid #6aa9ff;
  outline-offset: 2px;
}

.error {
  margin: 0;
  color: var(--red);
}

[hidden] {
  display: none !important;
}
