/* 퀘스트보드7 Blue Studio 색과 글꼴을 따른다. 신문 지면만 종이 질감과 명조 제목.
   글꼴: Pretendard(CDN), Paperlogy(public/fonts, SIL OFL), Noto Serif KR(Google Fonts) */
@font-face { font-family: 'Paperlogy'; font-weight: 500; font-display: swap; src: url('fonts/Paperlogy-5Medium.woff2') format('woff2'); }
@font-face { font-family: 'Paperlogy'; font-weight: 600; font-display: swap; src: url('fonts/Paperlogy-6SemiBold.woff2') format('woff2'); }

:root {
  --font: 'Pretendard Variable', Pretendard, 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
  --title: 'Paperlogy', var(--font);
  --serif: 'Noto Serif KR', 'Nanum Myeongjo', 'Batang', serif;
  --bg: #f6f8fc;
  --surface: #fff;
  --sunk: #f5f7fa;
  --ink: #292b35;
  --ink-2: #60636f;
  --ink-3: #8a8e9b;
  --line: #e3e8ef;
  --line-2: #d6deea;
  --brand: #346bdd;
  --brand-2: #2757b5;
  --brand-soft: #edf3ff;
  --gold: #936d22;
  --gold-soft: #faf4e7;
  --done: #42846d;
  --done-soft: #edf6f1;
  --bad: #b86461;
  --bad-soft: #fcf0ef;
  --paper: #fbf9f3;
  --paper-ink: #22201b;
  --paper-line: #d9d3c4;
  --r-m: 12px;
  --r-l: 16px;
  --shadow: 0 5px 20px #292d4210;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 17px; line-height: 1.55; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; word-break: keep-all; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #346bdd55; outline-offset: 2px; }
#app { max-width: 1280px; margin: 0 auto; padding: 16px 18px 28px; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
svg { display: block; }

/* 단추 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 650; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--sunk); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn:disabled { background: #e9edf3; border-color: #e9edf3; color: #a3a9b5; cursor: not-allowed; transform: none; }
.btn.block { display: flex; width: 100%; min-height: 56px; font-size: 18px; }
.btn.block + .btn.block { margin-top: 8px; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 14px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 삐빅 */
.bot { width: 56px; height: 56px; flex: 0 0 auto; }
.bot svg { width: 100%; height: 100%; }
.bot.big { width: 104px; height: 104px; }
.bot-lamp { animation: blink 1.8s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.kicker { font-size: 13px; font-weight: 650; color: var(--brand); }
h1 { font-family: var(--title); font-weight: 600; font-size: 34px; letter-spacing: -.03em; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: -.02em; }

/* 시작 */
.start { max-width: 780px; margin: 24px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; }
.start-hero { display: flex; gap: 24px; align-items: center; }
.lead { margin-top: 10px; color: var(--ink-2); font-size: 17px; }
.lead b { color: var(--ink); }
.steps { list-style: none; padding: 0; margin: 26px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.steps li { background: var(--sunk); border-radius: var(--r-l); padding: 14px; }
.steps .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 800; margin-right: 6px; }
.steps b { font-size: 15px; }
.steps p { margin-top: 6px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.start-form { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin: 24px 0 16px; }
.field { display: grid; gap: 8px; }
.field > span { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.field em { font-style: normal; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.field input { height: 52px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: var(--r-m); font-size: 18px; background: #fff; }
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--sunk); border-radius: var(--r-m); height: 52px; }
.mode-btn { flex: 1; border: 0; border-radius: 9px; background: transparent; color: var(--ink-3); font-weight: 650; cursor: pointer; }
.mode-btn.selected { background: #fff; color: var(--brand); box-shadow: 0 1px 4px #292d4218; }
.shake { animation: shake .4s; border-color: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* 위쪽 계기판 */
.hud { display: flex; align-items: center; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--title); font-weight: 600; font-size: 17px; white-space: nowrap; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='5'/%3E%3Cpath d='M15 15l4.5 4.5'/%3E%3C/svg%3E") center/18px no-repeat; }
.hud-item { display: grid; gap: 5px; }
.hud-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.hud-label b { color: var(--ink); font-size: 14px; }
.hud-label i { font-style: normal; }
.progress { flex: 1; min-width: 120px; }
.progress-bar { height: 5px; border-radius: 3px; background: #eef2fa; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: #729be4; transition: width .4s; }
.dots { display: flex; gap: 5px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c9d8f5; background: #fff; }
.dots i.on { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hearts { display: flex; gap: 2px; }
.heart svg { width: 24px; height: 24px; fill: #e5707f; stroke: #c9505f; stroke-width: 1.4; }
.heart.lost svg { fill: #eceef2; stroke: #d3d7de; }
.hearts.hurt { animation: shake .4s; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; }
.pill b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pill.time { background: var(--brand-soft); color: var(--brand); }
.pill.time.hurry { background: var(--bad-soft); color: var(--bad); }
.pill.score { background: var(--gold-soft); color: var(--gold); }
.timer-line { height: 4px; margin: 6px 4px 0; background: var(--line); border-radius: 4px; overflow: hidden; }
.timer-line i { display: block; height: 100%; width: 100%; background: var(--brand); transition: width 1s linear; }
.timer-line i.hurry { background: var(--bad); }
.task { margin: 12px 4px; padding: 12px 16px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-2); font-size: 16px; }
.view-switch { display: none; }

.play-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); gap: 16px; align-items: start; }

/* 신문 지면 */
.paper { background: var(--paper); color: var(--paper-ink); border: 1px solid var(--paper-line); border-radius: 6px; box-shadow: 0 1px 0 #fff inset, 0 10px 30px #3a321f14; padding: 26px 32px 30px; background-image: radial-gradient(#00000005 1px, transparent 1px); background-size: 4px 4px; }
.mast { text-align: center; border-bottom: 3px double var(--paper-ink); padding-bottom: 8px; margin-bottom: 18px; }
.mast-name { font-family: var(--serif); font-weight: 900; font-size: 34px; letter-spacing: .12em; }
.mast-meta { display: flex; justify-content: center; gap: 16px; margin-top: 4px; font-size: 13px; color: #6b6556; border-top: 1px solid var(--paper-line); padding-top: 6px; }
.headline { font-family: var(--serif); font-weight: 900; font-size: 31px; line-height: 1.35; color: var(--paper-ink); letter-spacing: -.02em; }
.subhead { margin-top: 8px; font-family: var(--serif); font-weight: 500; font-size: 18px; color: #4b463b; padding-bottom: 14px; border-bottom: 1px solid var(--paper-line); }
.photo { margin: 16px 0 14px; }
.photo-box { position: relative; aspect-ratio: 16 / 9; background: #e9e4d6; border-radius: 3px; overflow: hidden; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.92); }
.photo-ph { position: absolute; inset: 0; display: none; place-items: center; color: #b4ab95; }
.photo-ph svg { width: 48px; height: 48px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.photo-box.noimg .photo-ph { display: grid; }
.photo figcaption { margin-top: 6px; font-size: 14px; color: #6b6556; }
.body p { font-family: var(--serif); font-weight: 500; font-size: 18.5px; line-height: 1.9; margin: 0 0 12px; text-indent: .6em; }

/* 누를 수 있는 구절 */
.seg { cursor: pointer; border-radius: 4px; padding: 1px 0; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background .12s; }
.seg:hover { background: #f1e9cf; }
.seg.sel { background: #dbe7ff; box-shadow: 0 0 0 2px #346bdd66; }
.seg.found { background: #ffe1df; box-shadow: inset 0 -3px 0 #d35b57; cursor: default; }
.seg.found::after { content: attr(data-n); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 4px; border-radius: 50%; background: #c24b47; color: #fff; font: 800 12px var(--font); vertical-align: 3px; text-indent: 0; }
.seg.ok { color: #7c7769; text-decoration: underline dotted #9ab89f 2px; text-underline-offset: 5px; cursor: default; }
.seg.missed { background: #fff3c4; box-shadow: inset 0 -3px 0 #e0b23a; }
.headline .seg.found::after { width: 24px; height: 24px; font-size: 14px; vertical-align: 6px; }
.paper-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; color: var(--ink-3); }

/* 오른쪽: 고발 상자, 자료실, 노트 */
.side { position: sticky; top: 12px; display: grid; gap: 12px; }
.judge { background: var(--surface); border: 2px solid var(--brand); border-radius: var(--r-l); box-shadow: var(--shadow); padding: 16px; }
.judge.idle { border: 1px dashed var(--line-2); box-shadow: none; display: flex; gap: 12px; align-items: center; color: var(--ink-2); font-size: 15px; }
.judge.idle b { color: var(--ink); }
.judge-ico { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.judge-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.judge-label { font-size: 13px; font-weight: 700; color: var(--ink-3); margin-bottom: 6px; }
.judge blockquote { margin: 0 0 12px; padding: 10px 12px; border-left: 4px solid var(--brand); background: #f6f9ff; font-family: var(--serif); font-size: 16px; border-radius: 0 8px 8px 0; }
.reasons { display: grid; gap: 6px; }
.reason { text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font-size: 15.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.reason:hover { border-color: #b9cbec; }
.reason.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); box-shadow: 0 0 0 3px #346bdd1f; }
.judge-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 12px; }
.judge-note { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); text-align: center; }

.desk { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.desk-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 16px 8px; }
.desk-head span { font-size: 13px; color: var(--ink-3); }
.desk-tabs { display: flex; gap: 6px; padding: 0 12px 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.dtab { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk); color: var(--ink-2); font-size: 14px; font-weight: 650; cursor: pointer; }
.dtab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dtab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.desk-body { padding: 14px 16px 16px; max-height: 46vh; overflow: auto; }
.src-title { font-weight: 750; font-size: 16px; }
.src-from { font-size: 13px; color: var(--ink-3); margin: 2px 0 10px; }
.src-lines { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.src-lines li { font-size: 15.5px; }
.src-line { font-size: 15.5px; margin: 0 0 6px; }
.reg-search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; font-weight: 650; color: var(--brand); }
.reg-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.src-registry .src-from { margin-top: 8px; }
.reg-row { padding: 10px 12px; border-radius: 10px; background: var(--sunk); margin-bottom: 6px; font-size: 15.5px; }
.src-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.src-table th, .src-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.src-table th { color: var(--ink-2); font-weight: 650; width: 45%; background: #fafbfd; }
.qa { display: grid; gap: 2px; padding: 9px 12px; border-radius: 10px; background: var(--sunk); margin-bottom: 6px; font-size: 15.5px; }
.qa b { font-size: 12.5px; color: var(--ink-3); }
.qa.q { background: var(--brand-soft); }
.press-head { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .1em; color: #fff; background: var(--ink); padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; }
.clip { background: var(--paper); border: 1px solid var(--paper-line); padding: 12px 14px; border-radius: 4px; font-family: var(--serif); }
.clip-title { font-weight: 900; font-size: 17px; }

.notes { display: grid; gap: 6px; }
.notes-head { font-size: 13px; font-weight: 700; color: var(--ink-3); margin: 4px 2px 0; }
.note { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface); border: 1px solid #f0d2d0; border-radius: var(--r-m); font-size: 14.5px; }
.note.half { border-color: #efdfb8; }
.note.new { animation: pop .3s ease-out; }
.note-n { flex: 0 0 22px; height: 22px; border-radius: 50%; background: #c24b47; color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.note.half .note-n { background: #c9973a; }
.note em { font-style: normal; font-size: 12px; font-weight: 800; color: var(--gold); }
.note p { margin-top: 2px; color: var(--ink-2); }

/* 기사 끝 */
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: #1d233466; backdrop-filter: blur(3px); }
.sheet-card { width: min(680px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 20px; box-shadow: 0 20px 60px #1d233440; animation: pop .25s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.sheet-head.win { background: var(--done-soft); }
.sheet-head.miss { background: var(--gold-soft); }
.grow { flex: 1; min-width: 0; }
.verdict { font-family: var(--title); font-weight: 600; font-size: 24px; }
.win .verdict { color: var(--done); }
.miss .verdict { color: var(--gold); }
.sheet-sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.sheet-points { text-align: right; }
.sheet-points span { display: block; font-size: 28px; font-weight: 800; color: var(--done); }
.sheet-points small { font-size: 13px; color: var(--ink-3); }
.sheet-body { padding: 18px 22px 22px; display: grid; gap: 10px; }
.sheet-label { font-weight: 700; color: var(--ink-2); font-size: 15px; }
.miss { border: 1px solid #efdfb8; background: #fffbef; border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 6px; }
.miss-q { font-family: var(--serif); font-size: 16.5px; }
.miss-why { font-size: 15px; }
.miss-why b { color: var(--gold); margin-right: 4px; }
.miss-src { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); }
.miss-src svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.sheet-bonus span { display: inline-block; font-size: 14px; color: var(--ink-2); background: var(--sunk); border-radius: 999px; padding: 4px 12px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 6px; }
.sheet-actions .btn { min-height: 54px; font-size: 17px; }

/* 결과 */
.end { max-width: 660px; margin: 24px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; }
.end .bot { margin: 0 auto 10px; }
.end-rank { display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 750; }
.end-score { margin: 8px 0 4px; font-size: 52px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.end-score span { font-size: 22px; margin-left: 4px; }
.end-sum { color: var(--ink-2); }
.end-label { font-size: 13px; font-weight: 700; color: var(--ink-3); margin-bottom: 2px; }
.end-types { margin: 22px 0 12px; display: grid; gap: 8px; text-align: left; }
.type-row { display: grid; grid-template-columns: 170px 1fr 44px; gap: 12px; align-items: center; padding: 10px 14px; border-radius: var(--r-m); background: var(--sunk); font-size: 15px; }
.type-row .bar { height: 6px; border-radius: 3px; background: #e4e9f1; overflow: hidden; }
.type-row .bar i { display: block; height: 100%; background: #729be4; }
.type-row.perfect .bar i { background: var(--done); }
.type-row b { text-align: right; font-variant-numeric: tabular-nums; }
.end-tip { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--r-m); background: var(--brand-soft); color: var(--brand-2); font-size: 15px; text-align: left; }
.end-list { display: grid; gap: 6px; margin-bottom: 18px; text-align: left; }
.end-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-m); font-family: var(--serif); font-size: 15px; }
.end-item b { font-family: var(--font); color: var(--brand); }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: var(--r-m); font-weight: 650; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
.toast.good { background: var(--done); }
.toast.half { background: #a87b24; }
.toast.bad { background: var(--bad); }
.pop { position: absolute; z-index: 30; transform: translate(-50%, -100%); font-weight: 900; font-size: 22px; color: var(--done); pointer-events: none; animation: rise .9s ease-out forwards; }
@keyframes rise { to { transform: translate(-50%, -220%); opacity: 0; } }

/* 좁은 화면: 기사와 자료실을 바꿔 보기 */
@media (max-width: 900px) {
  .play-grid { grid-template-columns: 1fr; }
  .side { position: static; }
  .view-switch { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 10px; position: sticky; top: 6px; z-index: 5; }
  .view-btn { flex: 1; height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--ink-3); cursor: pointer; }
  .view-btn.on { background: var(--brand); color: #fff; }
  #screen-play[data-view="paper"] .desk { display: none; }
  #screen-play[data-view="desk"] .paper-wrap { display: none; }
  .judge { position: sticky; bottom: 8px; z-index: 6; }
  .desk-body { max-height: none; }
  .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  #app { padding: 10px; }
  .start, .end { padding: 22px; margin: 8px auto; }
  .start-hero { flex-direction: column; text-align: center; }
  .start-form { grid-template-columns: 1fr; }
  .brand, .progress { display: none; }
  .hud { gap: 12px; padding: 8px 12px; justify-content: space-between; }
  .paper { padding: 18px 16px; }
  .mast-name { font-size: 26px; }
  .headline { font-size: 24px; }
  .body p { font-size: 17px; }
  h1 { font-size: 28px; }
  .type-row { grid-template-columns: 120px 1fr 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
