/* 리뷰탐정 — 디자인 시스템. 수사 서류 라이트 테마 + 광고성 마젠타 / 진짜 틸 */
:root {
  --bg: #f4f2ee;          /* 서류 종이 */
  --paper: #ffffff;
  --paper-2: #faf8f4;
  --line: #ded9d0;
  --line-2: #c9c3b8;
  --ink: #1d1c1a;
  --ink-dim: #6f6b64;
  --ad: #c9256e;          /* 광고성 = 마젠타 */
  --ad-soft: #fbe8f1;
  --real: #12776e;        /* 진짜 = 틸 */
  --real-soft: #e2f2f0;
  --unsure: #8a8579;
  --mark: #ffe9a3;        /* 형광펜 */
  --radius: 8px;
  --tab-h: 58px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  max-width: 600px; margin: 0 auto; min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; cursor: pointer; background: none; color: inherit; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 11px 13px; width: 100%;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--ink); border-color: transparent; }
.num { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* 상단 헤더 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px;
       position: sticky; top: 0; z-index: 30; background: linear-gradient(var(--bg) 84%, transparent); }
.logo { font-size: 19px; font-weight: 900; letter-spacing: -0.6px; }
.logo em { font-style: normal; background: var(--mark); padding: 0 3px; box-decoration-break: clone; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px;
            background: var(--paper); border: 1px solid var(--line); }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--ink-dim); fill: none; stroke-width: 1.8; }
.acc-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--paper); border: 1px solid var(--line);
            border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 800; }

/* 하단 탭바 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 600px;
          height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
          background: rgba(255,255,255,0.97); border-top: 1px solid var(--line-2); display: flex; z-index: 40; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
       font-size: 10.5px; color: var(--ink-dim); font-weight: 700; }
.tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.tab.active { color: var(--ink); }
.tab.active svg { stroke: var(--ad); }

/* 섹션/카드 */
.section-title { font-size: 15px; font-weight: 800; padding: 16px 16px 10px;
                 display: flex; justify-content: space-between; align-items: baseline; }
.section-title small { font-weight: 600; color: var(--ink-dim); font-size: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
        margin: 0 16px 10px; padding: 14px; }
.seg { display: flex; gap: 7px; padding: 4px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg .s { flex-shrink: 0; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 700;
          background: var(--paper); color: var(--ink-dim); border: 1px solid var(--line-2); }
.seg .s.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* 리뷰 문장 카드 — 서류 느낌 */
.doc { display: block; background: var(--paper); border: 1px solid var(--line-2); border-left: 4px solid var(--line-2);
       border-radius: 4px; margin: 0 16px 10px; padding: 15px 16px; }
.doc .meta-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.doc .body { font-size: 14.5px; line-height: 1.68; word-break: break-word; white-space: pre-wrap; }
.doc .body.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.doc .foot { display: flex; align-items: center; gap: 13px; margin-top: 12px; font-size: 12.5px;
             color: var(--ink-dim); font-weight: 700; }
.doc.verdict-ad { border-left-color: var(--ad); }
.doc.verdict-real { border-left-color: var(--real); }
.doc.verdict-split { border-left-color: var(--unsure); }

/* 태그/뱃지 */
.tag { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 4px;
       background: var(--paper-2); color: var(--ink-dim); border: 1px solid var(--line); }
.tag.src { background: transparent; }
.tag.ad { background: var(--ad-soft); color: var(--ad); border-color: transparent; }
.tag.real { background: var(--real-soft); color: var(--real); border-color: transparent; }
.tag.split { background: #efece6; color: var(--unsure); border-color: transparent; }
.tag.live { background: var(--mark); color: #6b4e00; border-color: transparent; }
.countdown { font-size: 12px; font-weight: 800; color: var(--ad); }

/* 투표 바 */
.vbar { display: flex; height: 26px; border-radius: 4px; overflow: hidden; margin-top: 11px;
        background: #ece8e1; font-size: 11.5px; font-weight: 800; }
.vbar > div { display: flex; align-items: center; padding: 0 8px; transition: width 0.6s cubic-bezier(0.2,0.8,0.2,1);
              white-space: nowrap; overflow: hidden; }
.vbar .va { background: var(--ad); color: #fff; }
.vbar .vr { background: var(--real); color: #fff; justify-content: flex-end; }
.vote-row { display: flex; gap: 8px; padding: 12px 16px 4px; }
.vote-btn { flex: 1; padding: 14px 10px; border-radius: 6px; font-weight: 900; font-size: 14.5px;
            border: 2px solid var(--line-2); background: var(--paper); text-align: center; }
.vote-btn.ad { color: var(--ad); border-color: var(--ad); }
.vote-btn.real { color: var(--real); border-color: var(--real); }
.vote-btn.unsure { color: var(--unsure); font-size: 13px; flex: 0.7; }
.vote-btn.picked { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.vote-btn:disabled { opacity: 0.45; }

/* AI 분석 박스 */
.ai-box { margin: 10px 16px; padding: 13px 15px; border-radius: 6px; background: var(--paper-2);
          border: 1px dashed var(--line-2); }
.ai-box .hd { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.ai-box .hd b { font-size: 11px; letter-spacing: 1px; color: var(--ink-dim); }
.ai-box .score { font-size: 22px; font-weight: 900; }
.ai-box .score small { font-size: 11px; color: var(--ink-dim); font-weight: 700; }
.ai-box .signals { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ai-box .reason { font-size: 13px; color: var(--ink-dim); line-height: 1.55; }
.ai-note { font-size: 11.5px; color: var(--ink-dim); padding: 2px 16px 10px; line-height: 1.5; }

/* 퀴즈 */
.quiz-stage { padding: 6px 16px 16px; }
.quiz-progress { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px;
                 font-weight: 800; color: var(--ink-dim); padding: 4px 0 10px; }
.quiz-progress .bar { flex: 1; height: 5px; background: #e6e2da; border-radius: 3px; margin: 0 10px; overflow: hidden; }
.quiz-progress .bar span { display: block; height: 100%; background: var(--ink); transition: width 0.3s; }
.quiz-card { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius);
             padding: 20px 18px; min-height: 180px; display: flex; align-items: center; }
.quiz-card .q { font-size: 16px; line-height: 1.7; word-break: break-word; }
.quiz-result { margin-top: 12px; padding: 14px; border-radius: 6px; }
.quiz-result.ok { background: var(--real-soft); border-left: 4px solid var(--real); }
.quiz-result.no { background: var(--ad-soft); border-left: 4px solid var(--ad); }
.quiz-result .verdict-line { font-weight: 900; font-size: 15px; margin-bottom: 6px; }
.quiz-result .exp { font-size: 13.5px; line-height: 1.6; }
.quiz-result .ptags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }

/* 결과 공유 카드 */
.share-stage { padding: 22px 16px; }
.share-card { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px;
              padding: 28px 22px; text-align: center; }
.share-card .sc-label { font-size: 11px; font-weight: 900; letter-spacing: 3px; color: var(--ink-dim); }
.share-card .sc-score { font-size: 54px; font-weight: 900; line-height: 1.05; margin: 8px 0 2px; }
.share-card .sc-score small { font-size: 22px; color: var(--ink-dim); }
.share-card .sc-rank { display: inline-block; background: var(--mark); font-weight: 900; font-size: 17px;
                       padding: 5px 14px; border-radius: 4px; margin: 10px 0 6px; }
.share-card .sc-sub { font-size: 13px; color: var(--ink-dim); }
.share-card .sc-foot { font-size: 11px; color: var(--ink-dim); letter-spacing: 1.5px; margin-top: 16px; }

/* 랭킹 */
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.rank-row .no { font-size: 15px; font-weight: 900; min-width: 22px; color: var(--ink-dim); }
.rank-row.top3 .no { color: var(--ad); }
.rank-row .name { flex: 1; font-weight: 800; font-size: 14px; }
.rank-row .val { font-weight: 900; font-size: 14.5px; }
.rank-row .sub { font-size: 11.5px; color: var(--ink-dim); font-weight: 600; }

/* 패턴 사전 */
.pat { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pat .n { font-size: 14.5px; font-weight: 800; }
.pat .d { font-size: 13px; color: var(--ink-dim); margin-top: 5px; line-height: 1.55; }
.pat .ex { font-size: 13px; margin-top: 8px; padding: 9px 11px; background: var(--paper-2);
           border-left: 3px solid var(--mark); border-radius: 3px; line-height: 1.55; }

/* 댓글 */
.cmt { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cmt .h { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-dim); }
.cmt .b { font-size: 14px; line-height: 1.55; margin-top: 6px; word-break: break-word; }

/* 버튼/폼/기타 */
.btn { display: block; width: calc(100% - 32px); margin: 0 16px 10px; padding: 14px; border-radius: 7px;
       text-align: center; font-weight: 900; font-size: 15px; background: var(--ink); color: var(--paper); }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1px solid var(--line-2); }
.btn.ad { background: var(--ad); color: #fff; }
.btn:disabled { opacity: 0.4; }
.form-block { padding: 6px 16px; display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-dim); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--ink-dim); margin-top: 5px; line-height: 1.5; }
.counter { font-size: 11.5px; color: var(--ink-dim); text-align: right; }
.counter.over { color: var(--ad); font-weight: 800; }
.empty { text-align: center; color: var(--ink-dim); padding: 44px 20px; font-size: 14px; line-height: 1.6; }
.empty .big { font-size: 28px; font-weight: 900; margin-bottom: 8px; color: var(--ink); }
.warn { margin: 0 16px 12px; padding: 12px 14px; border-radius: 6px; background: var(--ad-soft);
        color: var(--ad); font-size: 13px; font-weight: 700; line-height: 1.5; }
.disclaimer { padding: 20px 16px 8px; font-size: 11.5px; color: var(--ink-dim); line-height: 1.6; text-align: center; }
#toast { position: fixed; bottom: calc(var(--tab-h) + 16px); left: 50%; transform: translateX(-50%);
         background: var(--ink); color: var(--paper); font-size: 13.5px; font-weight: 800; padding: 11px 18px;
         border-radius: 999px; z-index: 60; opacity: 0; transition: opacity 0.25s; pointer-events: none;
         max-width: 88%; text-align: center; }
#toast.show { opacity: 1; }

/* 히어로 */
.hero { margin: 0 16px 14px; border-radius: var(--radius); overflow: hidden; background-color: #e8e4dc;
        background-image: url("../assets/hero.jpg"); background-size: cover; background-position: center;
        padding: 32px 20px 20px; min-height: 148px; display: flex; flex-direction: column; justify-content: flex-end;
        border: 1px solid var(--line); }
.hero h1 { font-size: 27px; font-weight: 900; letter-spacing: -1px; color: #1d1c1a; }
.hero h1 em { font-style: normal; background: var(--mark); padding: 0 4px; }
.hero p { font-size: 13px; margin-top: 5px; color: #3c3831; font-weight: 600; }

@media (min-width: 601px) { body { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
