/* 큰글씨 초성퀴즈. 글씨는 크게, 버튼은 넓게, 색 대비는 뚜렷하게. */
:root {
  --bg: #FFF8EA; --card: #FFFFFF; --ink: #1B1B1B; --muted: #5B5B5B; --line: #D9CDB4;
  --main: #1F4FBF; --main-ink: #FFFFFF; --soft: #E8EEFC;
  --ok: #18794E; --ok-bg: #DDF3E6; --bad: #C62828; --bad-bg: #FBE3E1; --gold: #F2A900;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --fs: 1; /* 글씨 배율: 크게 1, 아주 크게 1.15 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif; }
body { font-size: calc(20px * var(--fs)); line-height: 1.4; -webkit-user-select: none; user-select: none; }
#app { max-width: 480px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column;
  padding: calc(var(--sat) + 8px) 16px calc(var(--sab) + 8px); }
.hidden { display: none !important; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.muted { color: var(--muted); }

/* 버튼 */
button { font: inherit; color: inherit; }
.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%;
  min-height: 60px; padding: 10px 14px; border: 3px solid var(--main); border-radius: 16px; background: var(--card);
  color: var(--main); font-weight: 700; font-size: calc(22px * var(--fs)); }
.btn small { font-weight: 500; font-size: calc(16px * var(--fs)); opacity: .9; }
.btn.primary { background: var(--main); color: var(--main-ink); }
.btn.big { min-height: 84px; margin-top: 12px; font-size: calc(26px * var(--fs)); }
.btn.small { min-height: 54px; font-size: calc(19px * var(--fs)); border-width: 2px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; }
.chip { min-height: 44px; padding: 6px 14px; border: 2px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: calc(17px * var(--fs)); font-weight: 600; color: var(--muted); }

/* 첫 화면 */
.home-top { text-align: center; padding-top: 12px; }
.logo { display: inline-flex; gap: 6px; }
.logo span { width: 60px; height: 60px; border-radius: 14px; background: var(--main); color: #fff; font-size: 38px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; }
.logo span:last-child { background: var(--gold); color: #3A2A00; }
h1 { margin: 10px 0 2px; font-size: calc(32px * var(--fs)); }
.sub { margin: 0; color: var(--muted); }
.stat-row { display: flex; gap: 8px; margin-top: 14px; }
.stat { flex: 1; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; }
.stat b { display: block; font-size: calc(26px * var(--fs)); }
.stat span { font-size: calc(15px * var(--fs)); color: var(--muted); }
.ad-wrap { margin-top: auto; padding-top: 12px; min-height: 0; }

/* 문제 화면 */
.play-top { display: flex; align-items: center; justify-content: space-between; }
.progress, .score-now { font-size: calc(20px * var(--fs)); color: var(--muted); }
.progress b, .score-now b { color: var(--ink); font-size: calc(24px * var(--fs)); }
.dots { display: flex; gap: 6px; margin: 8px 0 4px; }
.dots i { flex: 1; height: 8px; border-radius: 4px; background: var(--line); }
.dots i.done { background: var(--ok); }
.dots i.now { background: var(--main); }
.quiz { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; padding: 4px 0; }
.cat { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--soft); color: var(--main); font-weight: 700;
  font-size: calc(18px * var(--fs)); }
.hint-text { margin: 10px 0 14px; font-size: calc(27px * var(--fs)); font-weight: 700; line-height: 1.35; word-break: keep-all; }
.slots { display: flex; gap: 6px; justify-content: center; }
.slot { --s: 64px; width: var(--s); height: var(--s); border: 3px solid var(--main); border-radius: 12px; background: var(--card);
  display: flex; align-items: center; justify-content: center; font-size: calc(var(--s) * .56); font-weight: 800; color: var(--main); }
.slots.n5 .slot { --s: 56px; } .slots.n6 .slot { --s: 48px; } .slots.n7 .slot { --s: 42px; }
.slot.now { background: var(--soft); box-shadow: 0 0 0 3px rgba(31, 79, 191, .25); }
.slot.filled { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.slot.hinted { border-color: var(--gold); background: #FFF3CF; color: #7A5300; }
.cheer { min-height: 1.5em; margin: 10px 0 0; font-weight: 800; color: var(--ok); font-size: calc(24px * var(--fs)); }
.cheer.bad { color: var(--bad); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tiles.c3 { grid-template-columns: repeat(3, 1fr); }
.tile { min-height: 64px; border: 3px solid #2B2B2B; border-radius: 14px; background: var(--card); font-size: 34px; font-weight: 800; color: var(--ink); }
.tiles.c3 .tile { min-height: 76px; font-size: 40px; }
.tile:active { transform: scale(.96); }
.tile.used { visibility: hidden; }
.tile.wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.play-bottom { margin-top: 10px; }
.btn.hint { flex-direction: row; gap: 10px; min-height: 56px; border-color: var(--gold); color: #7A5300; background: #FFF3CF; }

/* 결과 화면 */
#scResult { text-align: center; }
h2 { margin: 12px 0 0; font-size: calc(30px * var(--fs)); }
.stars { font-size: 40px; line-height: 1.1; letter-spacing: 6px; color: var(--gold); min-height: 44px; }
.stars .off { color: var(--line); }
.res-score { font-size: calc(22px * var(--fs)); color: var(--muted); }
.res-score b { font-size: calc(46px * var(--fs)); color: var(--ink); }
.res-sub { margin: 4px 0 8px; color: var(--muted); }
.review { list-style: none; margin: 0; padding: 0; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; }
.review li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: calc(20px * var(--fs)); }
.review li:last-child { border-bottom: 0; }
.review b { font-weight: 800; }
.review span { color: var(--muted); white-space: nowrap; }
.review .skip b { color: var(--muted); }

/* 덮개 */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 480px; background: var(--bg); border-radius: 22px 22px 0 0; padding: 20px 18px calc(var(--sab) + 18px);
  display: flex; flex-direction: column; gap: 10px; }
.sheet h3 { margin: 0; font-size: calc(26px * var(--fs)); }
.sheet p { margin: 0; }
.how { margin: 0; padding-left: 1.3em; font-size: calc(21px * var(--fs)); }
.how li { margin: 6px 0; }
.btn.toggle { flex-direction: row; justify-content: space-between; }
.rank-line { font-size: calc(22px * var(--fs)); display: flex; justify-content: space-between; }
.toast { position: fixed; left: 50%; top: calc(var(--sat) + 64px); transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: calc(18px * var(--fs)); opacity: 0; pointer-events: none; transition: opacity .2s;
  width: max-content; max-width: 92%; text-align: center; word-break: keep-all; z-index: 20; }
.toast.on { opacity: .95; }

/* 낮은 화면(작은 폰)에서는 조금씩 줄인다 */
@media (max-height: 640px) {
  .hint-text { font-size: calc(23px * var(--fs)); margin: 6px 0 10px; }
  .tile { min-height: 54px; font-size: 30px; }
  .tiles.c3 .tile { min-height: 60px; font-size: 34px; }
  .btn.big { min-height: 72px; }
  .logo span { width: 48px; height: 48px; font-size: 30px; }
}
