/* 말씀 놀이터 — base styles (mobile-first). Game-specific styles live in css/games/<id>.css, scoped under .game-<id>. */
:root {
  --bg: #e9f5fb; --bg2: #d3ecf7; --ink: #10273a; --ink2: #44607a; --card: #ffffff; --line: #c9dde9;
  --primary: #0b6e99; --primary-ink: #fff; --accent: #ffb703; --good: #2a9d8f; --bad: #e63946;
  --radius: 18px; --shadow: 0 6px 18px rgba(16, 39, 58, .12);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --gutter: 16px; --maxw: 560px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1c29; --bg2: #12293b; --ink: #eaf4fb; --ink2: #a9c2d6; --card: #163246; --line: #24465f; --primary: #3fb3e3; --primary-ink: #04202f; --shadow: 0 6px 18px rgba(0, 0, 0, .35); }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg2); min-height: 100%; }
body { background: linear-gradient(180deg, var(--bg) 0, var(--bg2) 900px, var(--bg2) 100%); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; -webkit-tap-highlight-color: transparent; word-break: keep-all; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app { max-width: var(--maxw); margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.screen { padding: 0 var(--gutter) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; min-height: 100vh; min-height: 100dvh; }
.center { text-align: center; margin: 40vh 0 0; color: var(--ink2); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 0 8px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.topbar-title { margin: 0; font-size: 17px; font-weight: 800; text-align: center; overflow-wrap: anywhere; line-height: 1.3; }
.btn-icon { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 22px; display: grid; place-items: center; padding: 0; }
.btn-icon { color: #0b3954; } .btn-icon svg { display: block; } .btn-icon.is-off { color: var(--ink2); }
.btn-icon.ghost { background: none; box-shadow: none; }

/* hero */
.hero { text-align: center; padding: 6px 0 4px; }
.hero-art { width: 150px; height: 110px; margin: 0 auto; }
.hero-scene { height: 120px; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 6px; } .hero-scene svg { width: 100%; height: 100%; display: block; }
.hero-art svg { width: 100%; height: 100%; }
.hero-kicker { margin: 4px 0 0; color: var(--ink2); font-weight: 700; font-size: 16px; }
.hero-title { margin: 2px 0 0; font-size: 24px; line-height: 1.3; font-weight: 900; overflow-wrap: anywhere; }
.hero-sub { margin: 4px 0 0; color: var(--ink2); }

/* cards */
.list { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { text-align: left; border: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; transition: transform .12s; }
.card:active { transform: scale(.98); }
.card-kicker { font-size: 16px; color: var(--ink2); font-weight: 700; }
.card-title { font-size: 19px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { font-size: 16px; color: var(--ink2); overflow-wrap: anywhere; }
.card-week { flex-direction: row; align-items: center; gap: 14px; }
.week-no { flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: var(--primary-ink); display: flex; align-items: baseline; justify-content: center; padding-top: 10px; font-weight: 900; }
.week-no b { font-size: 26px; line-height: 1; } .week-no small { font-size: 16px; margin-left: 1px; }
.card-week .card-body { flex: 1; }
.chev { flex: none; color: var(--ink2); display: grid; place-items: center; }
.mini-stars { flex: none; font-size: 16px; letter-spacing: 1px; white-space: nowrap; } .mini-stars .star { color: var(--line); } .mini-stars .star.on { color: var(--accent); }
.card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-truth { font-size: 16px; color: var(--ink); opacity: .85; overflow-wrap: anywhere; }
.card-game { align-items: center; text-align: center; padding: 18px 10px 14px; position: relative; overflow: hidden; }
.card-game::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--game, var(--accent)); }
.card-game .card-title { font-size: 17px; }
.card-game .card-meta { font-size: 16px; line-height: 1.35; }
.game-icon { width: 72px; height: 72px; display: block; border-radius: 20px; overflow: hidden; flex: none; }
.game-icon svg { width: 100%; height: 100%; }
.game-icon.big { width: 96px; height: 96px; margin: 0 auto; }
.card-level { flex-direction: row; align-items: center; gap: 14px; padding: 18px 16px; min-height: 96px; box-shadow: inset 8px 0 0 var(--good), var(--shadow); }
.card-level.level-adult { box-shadow: inset 8px 0 0 var(--primary), var(--shadow); }
.card-level .card-body { flex: 1; } .card-level .card-title { font-size: 21px; }
.level-badge { flex: none; width: 56px; height: 56px; margin-left: 4px; } .level-badge svg { width: 100%; height: 100%; display: block; }
.level-head { text-align: center; }
.level-how { margin: 8px 0 0; color: var(--ink2); overflow-wrap: anywhere; }
.section-title { margin: 6px 0 0; font-size: 18px; font-weight: 800; }

/* truth card */
.truth-card { background: linear-gradient(135deg, #0b6e99, #0b3d5c); color: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.truth-kicker { font-size: 16px; font-weight: 800; opacity: .85; letter-spacing: .02em; }
.truth-text { margin: 4px 0; font-size: 19px; font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.truth-title { display: block; font-size: 16px; opacity: .9; }
.truth-title::before { content: '이번 주 제목 · '; opacity: .8; }
.truth-text, .hero-title, .card-title, .card-truth, .card-meta, .level-how, .end-line, .review-q, .title-month, .reflect-q p { text-wrap: balance; }

/* Bible quote — the only element that shows Bible text */
.bq { margin: 0; background: #fff8e6; color: #3b2a05; border-left: 5px solid var(--accent); border-radius: 12px; padding: 10px 14px; overflow-wrap: anywhere; }
.bq-text { display: block; font-size: 17px; font-weight: 600; line-height: 1.6; }
.bq-text::before { content: "“"; } .bq-text::after { content: "”"; }
.bq-ref { display: block; margin-top: 4px; font-style: normal; font-size: 16px; font-weight: 700; color: #8a5a00; }
.bq-small .bq-text { font-size: 16px; }

/* buttons */
/* one button family: primary = warm orange with a lip (same as the title's 시작하기), secondary = white */
.btn { border: 0; border-radius: 16px; padding: 14px 18px; background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line), var(--shadow); font-weight: 800; font-size: 17px; min-height: 56px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn-primary { background: linear-gradient(180deg, #ffc93c, #fb8500); color: #3b1d00; box-shadow: 0 4px 0 #b85d00, var(--shadow); }
.btn-primary:active { box-shadow: 0 1px 0 #b85d00; }
.btn-more { background: transparent; box-shadow: none; color: var(--primary); text-decoration: underline; min-height: 44px; }

/* end screen */
.end-head { text-align: center; padding-top: 6px; }
.stars { font-size: 52px; letter-spacing: 6px; line-height: 1; }
.star { color: var(--line); } .star.on { color: var(--accent); text-shadow: 0 2px 0 #c77d00; }
.end-title { margin: 8px 0 0; font-size: 26px; font-weight: 900; }
.end-score { margin: 2px 0 0; font-size: 20px; font-weight: 800; color: var(--primary); }
.end-line { margin: 2px 0 0; color: var(--ink2); overflow-wrap: anywhere; }
.review { display: flex; flex-direction: column; gap: 10px; }
.review-item { display: flex; flex-direction: column; gap: 6px; background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.review-item.is-hidden { display: none; }
.review-q { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.review-a { margin: 0; font-weight: 800; color: var(--good); overflow-wrap: anywhere; }
.review-chip { display: inline-block; font-size: 16px; font-weight: 800; color: #fff; background: var(--good); border-radius: 999px; padding: 2px 8px; margin-right: 8px; vertical-align: 2px; }
.reflect-card { background: linear-gradient(135deg, #0b6e99, #0b3d5c); color: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.reflect-card .truth-text { margin: 0; }
.reflect-q { background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px 14px; }
.reflect-q p { margin: 4px 0 0; font-size: 17px; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.reflect-kicker { font-size: 16px; font-weight: 800; color: #ffd166; }
.end-trophy { width: 84px; height: 84px; margin: 0 auto; animation: bg-star .6s cubic-bezier(.3,1.7,.5,1) both; } .end-trophy svg { width: 100%; height: 100%; }
.key-verse { display: flex; flex-direction: column; gap: 8px; }
.review-label { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.end-actions .btn-primary { grid-column: 1 / -1; }

/* play */
.stage { position: relative; flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.screen { position: relative; z-index: 1; }

@media (min-width: 900px) {
  :root { --maxw: 760px; }
  body { font-size: 19px; }
  .card-title { font-size: 21px; } .card-meta { font-size: 16px; } .truth-text { font-size: 22px; }
  .grid-games { grid-template-columns: repeat(4, 1fr); } .grid-games .card-meta { font-size: 16px; }
  .game-icon { width: 88px; height: 88px; }
  .hero-scene { height: 180px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- title screen ---------- */
.screen-title { justify-content: flex-start; padding-bottom: calc(18px + env(safe-area-inset-bottom)); align-items: center; text-align: center; gap: 10px; padding-top: env(safe-area-inset-top); }
.title-top { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: var(--gutter); z-index: 3; }
.screen-title > .title-top { animation: none; }
.title-block { margin-top: auto !important; }
.title-scene { width: calc(100% + 2 * var(--gutter)); margin: 0 calc(-1 * var(--gutter)); height: min(48vh, 420px); overflow: hidden; border-radius: 0 0 36px 36px; box-shadow: var(--shadow); }
.title-scene svg { width: 100%; height: 100%; display: block; }
.ts-wave { animation: ts-wave 6s linear infinite; } .ts-wave.w2 { animation-duration: 4.5s; animation-direction: reverse; } .ts-wave.w1 { animation-duration: 3.4s; }
@keyframes ts-wave { from { transform: translateX(0); } to { transform: translateX(-100px); } }
.ts-boat { transform-origin: 176px 160px; animation: ts-bob 3.2s ease-in-out infinite; }
@keyframes ts-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(5px) rotate(3deg); } }
.ts-sun { transform-origin: 290px 58px; animation: ts-spin 30s linear infinite; } @keyframes ts-spin { to { transform: rotate(360deg); } }
.ts-cloud { animation: ts-drift 22s linear infinite; } .ts-cloud.c2 { animation-duration: 30s; animation-delay: -10s; }
@keyframes ts-drift { from { transform: translateX(-120px); } to { transform: translateX(380px); } }
.ts-bird { animation: ts-bird 9s ease-in-out infinite; } @keyframes ts-bird { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(40px, -10px); } }
.ts-fish { animation: ts-jump 4.6s ease-in-out infinite; transform-origin: 76px 190px; }
@keyframes ts-jump { 0%, 55%, 100% { transform: translate(0, 40px) rotate(0); opacity: 0; } 62% { opacity: 1; } 70% { transform: translate(40px, -28px) rotate(-25deg); opacity: 1; } 82% { transform: translate(80px, 30px) rotate(35deg); opacity: 1; } 88% { opacity: 0; } }
.title-block { margin-top: 6px; }
.title-kicker { margin: 0; font-weight: 800; color: var(--primary); letter-spacing: .08em; font-size: 16px; }
.title-logo { margin: 4px 0 0; font-size: clamp(42px, 13vw, 64px); line-height: 1.1; font-weight: 900; color: var(--ink); letter-spacing: -.02em; white-space: nowrap; }
.title-ch { display: inline-block; white-space: pre; animation: ts-pop .55s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 70ms); text-shadow: 0 4px 0 color-mix(in srgb, var(--primary) 35%, transparent); }
@keyframes ts-pop { from { transform: translateY(24px) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.title-month { margin: 6px 0 0; color: var(--ink2); font-weight: 700; overflow-wrap: anywhere; }
.btn-start { margin-top: 10px; width: min(100%, 320px); min-height: 64px; font-size: 22px; border-radius: 999px; background: linear-gradient(180deg, #ffc93c, #fb8500); color: #3b1d00; box-shadow: 0 6px 0 #b85d00, var(--shadow); animation: ts-breathe 2.2s ease-in-out infinite; }
.btn-start:active { transform: translateY(4px); box-shadow: 0 2px 0 #b85d00; }
@keyframes ts-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.04; } }
.title-foot { margin: auto 0 0; font-size: 16px; color: var(--ink2); }
.btn-start { margin-bottom: 4px; }

/* ---------- screen transitions & feedback ---------- */
.screen:not(.screen-play) > *:not(.topbar) { animation: bg-rise .38s ease-out both; }
.screen > *:nth-child(3) { animation-delay: .05s; } .screen > *:nth-child(4) { animation-delay: .1s; } .screen > *:nth-child(5) { animation-delay: .15s; }
@keyframes bg-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.list > .card, .grid > .card { animation: bg-rise .4s ease-out both; }
.list > .card:nth-child(2), .grid > .card:nth-child(2) { animation-delay: .06s; } .list > .card:nth-child(3), .grid > .card:nth-child(3) { animation-delay: .12s; }
.list > .card:nth-child(4), .grid > .card:nth-child(4) { animation-delay: .18s; } .list > .card:nth-child(n+5), .grid > .card:nth-child(n+5) { animation-delay: .24s; }
.btn, .btn-icon { transition: transform .12s, box-shadow .12s; } .btn:active, .btn-icon:active { transform: scale(.95); }
@media (hover: hover) { .card:not(:disabled):hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16, 39, 58, .18); } .card { transition: transform .15s, box-shadow .15s; } }
.star.on { animation: bg-star .5s cubic-bezier(.3, 1.7, .5, 1) both; } .star:nth-child(2) { animation-delay: .15s; } .star:nth-child(3) { animation-delay: .3s; }
@keyframes bg-star { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.card-game .game-icon { transition: transform .2s; } .card-game:hover .game-icon, .card-game:active .game-icon { transform: rotate(-6deg) scale(1.08); }

/* ---------- closing truth question ---------- */
.screen-truthq .topbar .back { visibility: hidden; }
.tq-card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 20px 18px; display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.tq-kicker { align-self: center; font-size: 16px; font-weight: 800; color: #8a5a00; background: #fff1c7; border-radius: 999px; padding: 4px 12px; }
.tq-q { margin: 0; font-size: 21px; line-height: 1.45; font-weight: 900; text-align: center; text-wrap: balance; overflow-wrap: anywhere; }
.tq-choices { display: flex; flex-direction: column; gap: 10px; }
.tq-choice { text-align: left; font-size: 17px; line-height: 1.4; min-height: 56px; overflow-wrap: anywhere; transition: transform .15s, background .2s; }
.tq-choice.is-right { background: var(--good); color: #fff; box-shadow: 0 4px 0 #1d6f65; animation: bg-star .45s cubic-bezier(.3, 1.6, .5, 1); }
.tq-choice.is-wrong { background: #e9eef3; color: var(--ink2); animation: tq-shake .35s; }
.tq-choice:disabled { opacity: 1; }
@keyframes tq-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tq-feedback:empty { display: none; }
.tq-feedback { display: flex; flex-direction: column; gap: 10px; animation: bg-rise .35s ease-out both; }
.tq-say { margin: 0; font-weight: 800; font-size: 18px; color: var(--primary); text-align: center; }
.tq-explain, .review-explain { margin: 0; font-size: 16px; color: var(--ink2); overflow-wrap: anywhere; }
.truth-note { margin: 0; font-size: 16px; line-height: 1.5; opacity: .92; overflow-wrap: anywhere; text-wrap: balance; }
.christ-link { background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.christ-link p { margin: 0; font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; text-wrap: balance; }

/* BG-FIX-1 (2026-11-19): closing question fits the viewport; the card scrolls inside itself */
.screen-truthq { height: 100vh; height: 100svh; height: 100dvh; min-height: 0; overflow: hidden; }
.screen-truthq .tq-card { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

/* BG-FIX-1: phone held sideways -> friendly notice (owner decision: notice, not landscape support).
   Only short landscape screens (phones); tablets and desktop are taller than 500px. */
.rotate-note { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-note { display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--bg); color: var(--ink); }
  .rotate-note-icon { width: 64px; height: 64px; animation: rotate-hint 2.4s ease-in-out infinite; }
  .rotate-note-icon svg { display: block; width: 100%; height: 100%; }
  .rotate-note-title { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.35; }
  .rotate-note-sub { margin: 0; font-size: 17px; color: var(--ink2); line-height: 1.5; }
  .app { display: none; }
  body { min-height: 0; }
}
@keyframes rotate-hint { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }

.card-game.is-closed { opacity: .55; filter: grayscale(.6); cursor: default; }
