:root {
  --bg: #f3f6ff;
  --card: #ffffff;
  --ink: #1d2340;
  --sub: #5b6385;
  --brand: #4f7cff;
  --brand-dark: #3a63e0;
  --line: #dde3f5;
  --ok: #b5e8c4;
  --ok-ink: #12663a;
  --bad: #f5b5b5;
  --bad-ink: #9b1c1c;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  padding: calc(16px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}
h1 { font-size: 28px; margin: 18px 0 6px; text-align: center; }
.sub { text-align: center; color: var(--sub); font-size: 17px; margin: 0 0 22px; line-height: 1.5; }

.list { display: flex; flex-direction: column; gap: 12px; }
button { font: inherit; color: inherit; cursor: pointer; }
.btn {
  width: 100%;
  min-height: 58px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: transform .06s, border-color .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { border-color: var(--brand); }
.btn .meta { font-size: 14px; font-weight: 600; color: var(--sub); white-space: nowrap; }
.btn .desc { display: block; font-size: 14px; font-weight: 500; color: var(--sub); margin-top: 2px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; justify-content: center; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; border-style: dashed; justify-content: center; color: var(--sub); }

/* 문제 화면 */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; }
.back { border: none; background: none; color: var(--brand); font-weight: 700; padding: 8px 0; font-size: 16px; }
.stat { color: var(--sub); font-weight: 600; text-align: right; }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 12px; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .25s; }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 220px;
}
.pic {
  max-width: min(100%, 300px);
  max-height: 34vh;
  width: auto;
  height: auto;
  image-rendering: auto;
}
.pic.flag { border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 10px rgba(30,40,90,.12); width: min(100%, 300px); }
.pic.fruit { width: min(60vw, 200px); }
.big { font-size: clamp(40px, 13vw, 60px); font-weight: 800; letter-spacing: 1px; text-align: center; }
.prompt { font-size: 19px; font-weight: 600; text-align: center; line-height: 1.45; min-height: 2.9em; }
.prompt b { color: var(--brand); }
.prompt.ok { color: var(--ok-ink); }
.prompt.bad { color: var(--bad-ink); }

.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.opt { justify-content: center; text-align: center; font-size: 20px; }
.opt.ok { background: var(--ok); border-color: #6fc68d; }
.opt.bad { background: var(--bad); border-color: #e27b7b; }
.opt:disabled { cursor: default; opacity: 1; color: var(--ink); }
.opt:disabled:not(.ok):not(.bad) { opacity: .55; }
.next { visibility: hidden; }
.next.show { visibility: visible; }

/* 결과 */
.score { font-size: 72px; font-weight: 800; text-align: center; margin: 6px 0; }
.best { text-align: center; color: var(--sub); font-size: 18px; margin-bottom: 26px; }
.newbest { display: inline-block; margin-left: 6px; color: #d97706; font-weight: 800; }

@media (min-width: 600px) {
  #app { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
