:root {
  --bg: #0d1117;
  --card: #161b22;
  --card2: #1c232c;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --primary: #1f6feb;
  --primary-d: #1858c4;
  --correct: #2ea043;
  --wrong: #da3633;
  --tag: #388bfd1a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  min-height: 100vh;
}

.screen { animation: fade .25s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h1 { font-size: 1.5rem; line-height: 1.35; margin: 8px 0 4px; }
h2 { font-size: 1.4rem; margin: 0 0 16px; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: .95rem; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
select {
  width: 100%; padding: 12px; font-size: 1rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
}

.checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; font-size: .95rem; }
.checkbox input { width: 18px; height: 18px; }

.btn {
  display: block; width: 100%; padding: 14px;
  font-size: 1.05rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text);
  cursor: pointer; margin-top: 10px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-d); }
.note { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 20px; }

/* quiz */
.quiz-head { margin-bottom: 20px; }
.progress { height: 6px; background: var(--card); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .3s ease; }
.meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.tag { background: var(--tag); color: #58a6ff; padding: 3px 10px; border-radius: 99px; font-size: .75rem; }

.q-text { font-size: 1.1rem; font-weight: 500; margin: 0 0 20px; white-space: pre-wrap; }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  text-align: left; padding: 14px 16px; font-size: 1rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: border-color .15s;
  display: flex; gap: 10px; align-items: flex-start;
}
.choice:active { border-color: var(--primary); }
.choice .label { font-weight: 700; color: var(--muted); flex: 0 0 auto; }
.choice.correct { border-color: var(--correct); background: #2ea04322; }
.choice.wrong { border-color: var(--wrong); background: #da363322; }
.choice.correct .label { color: var(--correct); }
.choice.wrong .label { color: var(--wrong); }
.choice:disabled { cursor: default; opacity: 1; }

.feedback { margin-top: 22px; }
.verdict { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
.verdict.ok { color: var(--correct); }
.verdict.ng { color: var(--wrong); }
.explanation {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; font-size: .95rem;
  margin: 0 0 16px; white-space: pre-wrap;
}

/* result */
.score { text-align: center; margin: 10px 0; }
#scoreNum { font-size: 3.5rem; font-weight: 800; color: var(--primary); }
.score-total { font-size: 1.5rem; color: var(--muted); }
.rate { text-align: center; font-size: 1.1rem; margin-bottom: 24px; }
.review { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.review-item {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--wrong); border-radius: 10px;
  padding: 12px 14px; font-size: .9rem;
}
.review-item.ok { border-left-color: var(--correct); }
.review-item .ri-q { font-weight: 600; margin-bottom: 4px; }
.review-item .ri-a { color: var(--muted); font-size: .85rem; }
