/* 음식퀴즈 화면 스타일: 청자빛 배경, 사진 중심 배치, 정답·오답 도장 */
:root {
  --bg: #E4EEE8;
  --ink: #1C2B27;
  --ink-soft: #52635D;
  --yolk: #FFB627;
  --right: #2C8A57;
  --wrong: #D23A2F;
  --paper: #FFFFFF;
  --vvh: 100dvh;
  --vvtop: 0px;
  --display: 'Black Han Sans', 'Gothic A1', sans-serif;
  --body: 'Gothic A1', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--body); }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
[hidden] { display: none !important; }

#app {
  position: fixed;
  left: 0; right: 0;
  top: var(--vvtop);
  height: var(--vvh);
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
}

.screen { height: 100%; display: flex; flex-direction: column; }

/* 버튼 */
.btn { border: 0; cursor: pointer; border-radius: 14px; padding: 16px 20px; font-size: 18px; font-weight: 700; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:active { transform: translateY(1px); }
.btn.link { background: none; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; font-weight: 400; font-size: 15px; }
.btn:focus-visible { outline: 3px solid var(--yolk); outline-offset: 3px; }

/* 타이틀 */
.title-screen { justify-content: center; gap: 12px; }
.logo { margin: 0 0 8px; font-family: var(--display); font-weight: 400; line-height: 0.92; font-size: clamp(88px, 30vw, 150px); letter-spacing: -0.02em; }
.logo span { display: block; }
.logo span + span { color: var(--wrong); }
.lede { margin: 0 0 28px; font-size: 19px; line-height: 1.5; color: var(--ink-soft); }
.title-screen .btn.primary { font-size: 20px; padding: 18px; }
.title-screen .btn.link { align-self: flex-start; padding-left: 0; }

/* 퀴즈 */
.quiz-screen { gap: 10px; }
.quiz-top { display: flex; justify-content: space-between; font-family: var(--display); font-size: 20px; }
#live-score { color: var(--right); }
.photo-frame { position: relative; flex: 1 1 auto; min-height: 120px; border-radius: 18px; overflow: hidden; background: var(--ink); }
#photo { width: 100%; height: 100%; object-fit: cover; display: block; }
#photo:not([src]) { visibility: hidden; }

.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: min(40vw, 30vh); color: var(--paper); background: var(--ink); pointer-events: none; }
.countdown:empty { display: none; }

.stamp {
  position: absolute; top: 50%; left: 50%;
  translate: -50% -50%; rotate: -12deg;
  padding: 6px 22px;
  border: 6px solid currentColor; border-radius: 12px;
  font-family: var(--display); font-size: clamp(44px, 16vw, 76px); line-height: 1.1;
  background: rgba(255, 255, 255, 0.82);
  animation: stamp 260ms cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp.right { color: var(--right); }
.stamp.wrong { color: var(--wrong); }
@keyframes stamp { from { scale: 1.8; opacity: 0; } to { scale: 1; opacity: 1; } }

.reveal {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0;
  padding: 28px 16px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: var(--paper); font-size: 20px; font-weight: 700; text-align: center;
}

.timer { height: 10px; border-radius: 5px; background: rgba(28, 43, 39, 0.12); overflow: hidden; flex: none; }
.timer-bar { height: 100%; width: 100%; background: var(--yolk); transform-origin: left; }
.timer-bar.low { background: var(--wrong); }

.answer {
  flex: none; width: 100%;
  padding: 14px 16px;
  font-family: var(--body); font-size: 22px; font-weight: 700; /* 16px 미만이면 iOS가 화면을 확대함 */
  color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); border-radius: 14px;
  outline: none;
}
.answer:focus { border-color: var(--yolk); }
.answer.shake { animation: shake 280ms; border-color: var(--wrong); }
@keyframes shake { 25% { translate: -8px 0; } 50% { translate: 7px 0; } 75% { translate: -4px 0; } }

/* 결과 */
.result-screen { gap: 8px; }
.result-score { margin: 8px 0 0; font-family: var(--display); line-height: 1; }
.result-score strong { font-weight: 400; font-size: 96px; color: var(--right); }
.result-score span { font-size: 40px; color: var(--ink-soft); }
.result-comment { margin: 0 0 8px; font-size: 18px; color: var(--ink-soft); }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.result-list li { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 6px; background: var(--paper); border-radius: 12px; }
.result-list img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; display: block; }
.result-list .name { font-weight: 700; font-size: 17px; }
.result-list .mark { font-size: 15px; padding-right: 8px; }
.result-list .mark.right { color: var(--right); }
.result-list .mark.wrong { color: var(--wrong); }
.result-actions { display: grid; gap: 4px; padding-top: 4px; flex: none; }

/* 사진 출처 */
.credits-screen { gap: 10px; }
.credits-screen h2 { margin: 8px 0 0; font-family: var(--display); font-weight: 400; font-size: 36px; }
.credits-note { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.credits-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.credits-list li { padding: 10px 12px; background: var(--paper); border-radius: 12px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.credits-list strong { font-size: 16px; }
.credits-list a { color: var(--ink); }
.credits-screen .btn.primary { margin-top: 8px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .stamp, .answer.shake { animation: none; }
}
