:root {
  --bg: #f7f7fb;
  --card-bg: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #3b82f6;
  --correct: #16a34a;
  --wrong: #dc2626;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  max-width: 480px;
  margin-inline: auto;
}

h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; margin: 0 0 4px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

button {
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.secondary {
  background: var(--card-bg);
  color: var(--accent);
  border: 1px solid var(--accent);
}

input[type="password"], input[type="text"] {
  font-size: 1.1rem;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  width: 100%;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.choice-btn {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 8px;
  flex: 1 1 auto;
  min-width: 60px;
}

.choice-btn.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.question-block {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.question-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.result-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.result-row .mark.correct { color: var(--correct); font-weight: bold; }
.result-row .mark.wrong { color: var(--wrong); font-weight: bold; }

.error { color: var(--wrong); margin-top: 8px; }

.progress { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }

.nav-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.reorder-built {
  min-height: 20px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  color: var(--text);
  background: var(--bg);
}

.reference-text {
  background: #fff7e6;
  border: 1px solid #f0d9a0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  margin: 8px 0 0;
}
