/*
  앱 전체 스타일. 색은 :root의 토큰으로만 두고, 화면 코드는 토큰 이름만 쓴다.

  아이폰에서 홈 화면 앱으로 쓰는 것을 전제로 한 규칙이 세 가지 들어 있다.
  ① 입력창 글자는 16px 이상 — 그보다 작으면 iOS가 탭할 때마다 화면을 멋대로
     확대하고, 시험 중에 이게 일어나면 흐름이 끊긴다.
  ② 버튼은 44px 이상 — 문제를 빠르게 풀 때는 정확히 겨누지 않고 누른다.
  ③ safe-area-inset — 처리하지 않으면 하단 버튼이 홈바에 가린다.

  그리고 "동작 줄이기"를 켠 사람에게는 깜빡임 애니메이션을 돌리지 않는다. 깜빡이는
  화면은 일부 사람에게 실제로 위험하다.
*/

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1f2544;
  --muted: #6b7280;
  --line: #e4e7ef;
  --accent: #1f2544;
  --accent-text: #ffffff;
  --correct: #0f7b3f;
  --wrong: #c01c28;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11152b;
    --surface: #1b2140;
    --text: #eef0f8;
    --muted: #a0a7c0;
    --line: #2b3257;
    --accent: #eef0f8;
    --accent-text: #11152b;
    --correct: #4ade80;
    --wrong: #ff8a8a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Apple SD Gothic Neo", sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding:
    calc(env(safe-area-inset-top) + 20px)
    calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 20px)
    calc(env(safe-area-inset-left) + 16px);
}

h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 15px; }

input, textarea, select, button {
  font-family: inherit;
  font-size: 16px;            /* 16px 미만이면 iOS가 화면을 확대한다 */
}

input, textarea, select {
  width: 100%;
  padding: 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

textarea { min-height: 180px; resize: vertical; }

button {
  min-height: 44px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

button.big { min-height: 56px; font-size: 18px; }
button:disabled { opacity: 0.45; cursor: default; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.row > button { flex: 1; }

/* 눈에 덜 띄어야 하는 버튼 — 시험 중의 "中断する"처럼, 있지만 권하지는 않는 것. */
button.quiet {
  background: none;
  border-color: transparent;
  color: var(--muted);
  font-size: 15px;
}
.spacer { flex: 1; }
.notice { padding: 24px; }

.choice { text-align: left; width: 100%; }
.choice.correct { border-color: var(--correct); color: var(--correct); font-weight: 600; }
.choice.wrong { border-color: var(--wrong); color: var(--wrong); }

/* 오답 경고. 기본은 깜빡임이고, 동작 줄이기에서는 테두리 색만 바뀐다. */
.flash { animation: flash 180ms steps(1) 3; }

@keyframes flash {
  0%, 100% { background: var(--bg); }
  50% { background: var(--wrong); }
}

@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; outline: 3px solid var(--wrong); }
  * { transition: none !important; }
}
