  :root{
    --line:#4a3428; --ink:#3b2a1a; --soft:#7a6656;
    --paper:#f3e9d6; --cream:#fbf7ee; --panel:#ffffff;
    --must:#e8b25c; --must-d:#c9924a; --teal:#3f7c86; --brick:#b34a3a; --olive:#7d8f5c;
    --brown:#7a5233;   /* 세 군데서 쓰면서 정의가 빠져 있었다 — 망고 돋보기 손잡이 색 */
    --cork:#d5b184; --cork-d:#8b6a44;
    --sh:2px 3px 0 var(--line);
  }
  *{box-sizing:border-box}
  html,body{height:100%;margin:0}
  body{
    background:var(--paper);color:var(--ink);
    font-family:"Gowun Dodum","Apple SD Gothic Neo",system-ui,sans-serif;
    font-size:14px;line-height:1.55;-webkit-tap-highlight-color:transparent;
    overscroll-behavior:none;overflow:hidden;
    /* ★ 한글은 기본값이 「아무 글자에서나 끊기」다. 그래서 연결판 핀에 「오려진 「광
       장」」처럼 낱말 가운데가 잘려 나왔다. keep-all 로 낱말 단위로 끊고, 한 낱말이
       칸보다 길 때만 break-word 로 넘긴다. 몇 군데만 따로 주다 빠뜨리기 쉬워
       여기서 한 번에 준다. */
    word-break:keep-all;overflow-wrap:break-word;
  }
  img{max-width:100%} [hidden]{display:none!important}
  h1,h2,h3{font-family:"Gaegu","Gowun Dodum",cursive;font-weight:700;margin:0;letter-spacing:.01em}
  button{font:inherit;color:inherit;cursor:pointer;background:none;border:0;padding:0}
  button:focus-visible{outline:3px solid var(--brick);outline-offset:2px}

  /* ---------- 앱 골격 (가로) ---------- */
  .app{height:100%;display:grid;grid-template-rows:auto 1fr auto;background:var(--cream);
    padding-top:env(safe-area-inset-top,0px)}
  .bar{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 12px;border-bottom:2px solid var(--line);
    padding-left:calc(12px + env(safe-area-inset-left,0px));padding-right:calc(12px + env(safe-area-inset-right,0px))}
  .chip{background:var(--panel);border:2px solid var(--line);border-radius:999px;padding:1px 9px;font-size:11.5px;font-weight:700;white-space:nowrap;font-variant-numeric:tabular-nums}
  /* 칩 안의 아이콘은 12px 면 선이 뭉개져 무슨 그림인지 안 보인다. */
  .chip .bi{width:16px;height:16px;display:block}
  #t-full{padding:1px 7px;display:flex;align-items:center}
  #t-home{background:var(--must);border-color:var(--brown)}
  .body{display:grid;grid-template-columns:3fr 2fr;min-height:0;
    padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
  .left{position:relative;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#efe6d3;padding:8px}
  .right{position:relative;overflow:hidden;border-left:2px solid var(--line);background:var(--cream)}
  .right .scroll{position:absolute;inset:0;overflow-y:auto;padding:10px 12px;scrollbar-width:thin}
  .foot{display:flex;gap:6px;align-items:stretch;padding:6px 10px;border-top:2px solid var(--line);
    padding-bottom:calc(6px + env(safe-area-inset-bottom,0px));
    padding-left:calc(10px + env(safe-area-inset-left,0px));padding-right:calc(10px + env(safe-area-inset-right,0px))}
  .tab{flex:1;background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:7px 4px;font-family:"Gaegu",cursive;font-weight:700;font-size:15px;box-shadow:var(--sh);position:relative}
  .tab[aria-selected="true"]{background:var(--must)}
  .tab .dot{position:absolute;top:-6px;right:-6px;width:16px;height:16px;border-radius:50%;background:var(--brick);color:#fff;font-size:10px;line-height:16px;text-align:center;font-family:"Gowun Dodum",sans-serif}
  .act{flex:1.6;background:var(--teal);color:#fff;border:2.5px solid var(--line);border-radius:10px;padding:7px 8px;font-family:"Gaegu",cursive;font-weight:700;font-size:16px;box-shadow:var(--sh);transition:transform .08s,box-shadow .08s}
  .act:active{transform:translate(2px,3px);box-shadow:0 0 0 var(--line)}
  .act:disabled{opacity:.38;transform:none;box-shadow:var(--sh);cursor:default}
  .act.warm{background:var(--must);color:var(--ink)}

  /* ---------- 공통 조각 ---------- */
  .card{background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:10px 12px;box-shadow:var(--sh)}
  .who{font-family:"Gaegu",cursive;font-weight:700;font-size:16px;display:flex;gap:6px;align-items:baseline;margin-bottom:2px}
  .who small{font-family:"Gowun Dodum",sans-serif;font-weight:400;font-size:11px;color:var(--soft)}
  .muted{color:var(--soft);font-size:12px}
  .say{background:#fff8e7;border:2px solid var(--must-d);border-radius:10px;padding:8px 11px;font-size:13px;line-height:1.6;margin-top:8px}
  .say b{color:var(--brick)}
  .note{background:#fff3ea;border:2px dashed var(--brick);border-radius:10px;padding:8px 11px;font-size:13px;line-height:1.6;margin-top:8px}
  .note b{color:var(--brick)}
  .stack{display:grid;gap:8px}
  .btn{background:var(--must);border:2.5px solid var(--line);border-radius:10px;padding:10px;font-family:"Gaegu",cursive;font-weight:700;font-size:15px;box-shadow:var(--sh);text-align:center;width:100%}
  .btn.ghost{background:var(--panel)}
  .btn:active{transform:translate(2px,3px);box-shadow:0 0 0 var(--line)}

  /* ---------- 현장 ---------- */
  .scenewrap{width:100%;max-height:100%;aspect-ratio:2/1;border:2.5px solid var(--line);border-radius:10px;overflow:hidden;box-shadow:var(--sh);touch-action:none;background:#e7eee0;position:relative}
  .scenewrap svg{display:block;width:100%;height:100%}
  .lenslabel{position:absolute;left:50%;top:8px;transform:translateX(-50%);background:var(--line);color:#fff8ea;border-radius:999px;padding:2px 10px;font-size:12px;font-weight:700;pointer-events:none;opacity:0;transition:opacity .15s}
  .lenslabel.on{opacity:1}

  /* ---------- 심문 ---------- */
  .tabs{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:8px}
  .tabs button{background:var(--panel);border:2px solid var(--line);border-radius:999px;padding:2px 9px;font-size:12px;font-weight:700;font-family:"Gaegu",cursive}
  .tabs button[aria-selected="true"]{background:var(--must)}
  .tabs button.witness{border-style:dashed}
  .stmt{display:flex;gap:6px;align-items:flex-start;padding:3px 0}
  .stmt .n{flex:0 0 18px;height:18px;border-radius:50%;background:var(--brick);color:#fff;font-size:10.5px;font-weight:700;text-align:center;line-height:18px;margin-top:3px}
  .tap{text-align:left;padding:1px 2px;border-radius:4px;line-height:1.55}
  .sus-on{background:linear-gradient(transparent 62%,#ffe08a 62%);border-bottom:2px dashed var(--must-d)}
  /* 반박이 끝난 말 — 글은 그대로 두고 앞에 표시만 붙인다. 지우면 되짚을 수 없다 */
  .tap .mk{display:inline-block;font-size:10px;font-weight:700;padding:1px 5px;margin-right:5px;
    border-radius:99px;background:#e6e0d4;color:#6b6152;vertical-align:1px;white-space:nowrap}
  .tap .mk.ok{background:#e4efdb;color:#4c6b33;border:1px solid #b9cfa4}
  .tap.ok{color:#4a4135}
  .tap.ok:hover,.tap.checked:hover{background:#f3efe4}
  .tap.checked{color:#6b6152}
  .picked{background:linear-gradient(transparent 55%,#ffcf6a 55%);border-bottom:2px solid var(--brick)}
  .portrait{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
  .portrait svg{height:92%;width:auto;max-width:100%}

  /* ---------- 수첩 / 카드 ---------- */
  .clues{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:5px}
  .clue{background:var(--panel);border:2px solid var(--line);border-radius:9px;padding:6px 5px;text-align:center;font-size:10.5px;line-height:1.3;box-shadow:2px 2px 0 var(--line);min-height:56px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px}
  .clue svg{width:20px;height:20px}
  .clue.testi{background:#fff8e7;border-style:double;border-width:3px}
  .clue.locked{opacity:.5;border-style:dashed;box-shadow:none}
  .clue[aria-pressed="true"]{background:var(--must);transform:translateY(-3px)}
  .clue.wrong{animation:shake .35s}
  @keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}

  /* ---------- 트레이 (오른쪽 패널을 덮는 시트) ---------- */
  .sheet{position:absolute;inset:0;background:var(--cream);z-index:10;display:flex;flex-direction:column}
  .sheet .hd{display:flex;justify-content:space-between;align-items:center;padding:8px 12px;border-bottom:2px solid var(--line);font-family:"Gaegu",cursive;font-weight:700;font-size:15px}
  .sheet .hd button{font-size:13px;border:2px solid var(--line);border-radius:999px;padding:1px 9px;background:var(--panel)}
  .sheet .list{overflow-y:auto;padding:8px 12px 12px}
  /* 단서를 들이대기 전에 **무슨 내용이었는지** 읽는 자리. 수첩과 같은 모양으로 보여 준다. */
  .sheet .ctx .quo{display:inline-block;margin:3px 0;padding:3px 9px;background:#fff8e7;
    border:2px solid var(--line);border-radius:9px;color:var(--ink);font-size:13px}
  .sheet .ctx.bad{color:var(--brick)}
  .traydet{margin-top:10px}
  .sheet.reading .list{padding-bottom:4px}
  .traydet .detcard{margin:0}
  .traydet .detcard{text-align:left}
  .traydet .detcard.testi{background:#fff8e7;border-style:double;border-width:3px}
  .traydet .detcard .who{margin-bottom:6px;display:flex;align-items:baseline;gap:7px}
  .traydet .detcard .kind{font-family:system-ui,sans-serif;font-weight:400;font-size:10.5px;
    color:var(--soft);border:1.5px solid var(--line);border-radius:999px;padding:0 7px;flex:none}
  .traydet .dett{margin:0;font-size:13px;line-height:1.75;word-break:keep-all;overflow-wrap:break-word}
  .traydet .cluephoto{display:block;margin:0 auto 7px;max-height:118px;width:auto;
    border:2px solid var(--line);border-radius:9px;background:#fff}
  .traydet .taway{margin:0;font-size:12px;line-height:1.7;word-break:keep-all;text-align:center;padding:10px 4px}
  /* 단서를 고르면 목록을 감추고 읽기에 집중한다 — 둘을 쌓으면 작은 화면에서 글이 가린다 */
  .sheet.reading .clues{display:none}
  .sheet.reading .traydet{margin-top:0}
  .sheet .list{flex:1 1 auto;min-height:0}
  .trayfoot{flex:0 0 auto;display:flex;gap:7px;padding:8px 12px 10px;
    border-top:2px solid var(--line);background:var(--cream)}
  .trayfoot .act{flex:1;margin:0}
  /* .act 는 흰 글씨가 기본이라, 배경만 바꾸면 글자가 사라진다 */
  .trayfoot .ghost{flex:0 0 auto;padding-left:13px;padding-right:13px;
    background:var(--panel);color:var(--ink);font-size:14px}
  /* 읽는 중에는 안내 문장을 접는다 — 짧은 화면에서 본문 자리를 벌어야 한다 */
  .sheet.reading .ctx .lead{display:none}
  .sheet.reading .ctx{padding-bottom:2px}
  @media (max-height:430px){
    .sheet .ctx{font-size:11.5px;line-height:1.5;padding-top:6px}
    .sheet .ctx .quo{font-size:12px;padding:2px 7px}
    .trayfoot .ghost{font-size:12px;padding-left:10px;padding-right:10px}
    .trayfoot .act.warm{font-size:14px;padding:6px 6px}
  }
  /* 트레이 안의 글은 낱말 단위로 끊어 읽기 좋게 */
  .sheet .ctx{word-break:keep-all;overflow-wrap:break-word}
  .clue{word-break:keep-all;overflow-wrap:break-word;hyphens:none}
  @media (max-height:520px){
    .traydet .dett{font-size:12px;line-height:1.6}
    .traydet .cluephoto{max-height:84px}
  }

  /* ---------- 추리 ---------- */
  .link{background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:8px 10px;font-size:13px;line-height:1.7;position:relative}
  .link .no{position:absolute;left:-9px;top:-9px;width:22px;height:22px;border-radius:50%;background:var(--brick);color:#fff;font-size:12px;font-weight:700;text-align:center;line-height:22px}
  .link.done{border-color:var(--olive);background:#f4f7ef}
  .blank{display:inline-block;min-width:96px;border:2px dashed var(--must-d);border-radius:7px;padding:0 8px;background:#fff8e7;font-weight:700;color:var(--must-d);vertical-align:baseline;line-height:1.5}
  .blank.filled{border-style:solid;border-color:var(--olive);color:var(--ink);background:#eef3e8}
  .blank.active{border-color:var(--brick);color:var(--brick);animation:pulse 1s infinite}
  @keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(179,74,58,.3)}50%{box-shadow:0 0 0 5px rgba(179,74,58,0)}}
  .concl{background:#fff3ea;border:2.5px solid var(--brick);border-radius:10px;padding:10px 12px;font-family:"Gaegu",cursive;font-size:17px;font-weight:700;text-align:center;color:var(--brick)}

  /* ---------- 전체 화면 장면(표지/의뢰/해결/연결판) ---------- */
  .full{grid-row:1/-1;grid-column:1/-1;display:grid;grid-template-columns:1fr 1.2fr;gap:14px;padding:14px 18px;overflow:hidden;
    padding-left:calc(18px + env(safe-area-inset-left,0px));padding-right:calc(18px + env(safe-area-inset-right,0px))}
  .full .art{display:flex;align-items:center;justify-content:center;min-height:0}
  .full .art svg{height:100%;max-height:100%;width:auto;max-width:100%}
  /* 연결판 화면의 왼쪽 기둥은 핀·말·추론 단추가 쌓여 낮은 화면에서 넘친다 — 스크롤되게 둔다 */
  #s-board .art{overflow-y:auto;justify-content:flex-start;scrollbar-width:thin}
  #s-board .art>:first-child{margin-top:auto} #s-board .art>:last-child{margin-bottom:auto}
  .full .txt{overflow-y:auto;min-height:0;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin}
  .full .txt>:first-child{margin-top:auto} .full .txt>:last-child{margin-bottom:auto}
  .eyebrow{font-size:11px;letter-spacing:.22em;color:var(--brick);font-weight:700}
  .title h1{font-size:30px;line-height:1.2}
  .title h1 em{font-style:normal;color:var(--brick)}
  .modepick{display:grid;gap:8px}
  .modepick button{background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:9px 12px;box-shadow:var(--sh);text-align:left}
  .modepick button b{font-family:"Gaegu",cursive;font-size:16px;display:block}
  .modepick button span{font-size:12px;color:var(--soft)}
  .stars{font-size:26px;letter-spacing:4px;color:var(--must-d);text-align:center}
  .reward{display:flex;gap:6px;justify-content:center;flex-wrap:wrap}
  .board{background:var(--cork);border:6px solid var(--cork-d);border-radius:8px;padding:12px 10px;display:grid;grid-template-columns:repeat(5,1fr);gap:6px;align-items:start;box-shadow:inset 0 0 30px rgba(90,60,30,.25)}
  /* 핀은 글자 수가 제각각이라 그냥 두면 카드 높이가 들쭉날쭉해진다. 빈 자리(.slot)와
     같은 높이로 못 박고 가운데 정렬해, 한 줄이든 두 줄이든 나란히 서게 한다. */
  .pinned{width:auto;min-width:0;height:78px;box-sizing:border-box;display:flex;flex-direction:column;
    align-items:center;justify-content:center;gap:1px;
    background:#fffaf0;border:1.5px solid #cbb590;padding:5px 3px;text-align:center;font-size:9.5px;line-height:1.25;
    box-shadow:2px 3px 0 rgba(70,45,20,.3);transform:rotate(-3deg);position:relative;animation:fly .7s cubic-bezier(.3,1.1,.4,1)}
  .pinned .pn{display:block;max-height:2.5em;overflow:hidden}
  .pinned small{display:block;color:var(--soft);font-size:8.5px;margin-top:1px}
  .pinned svg,.pinned img{width:26px;height:26px;max-width:26px;max-height:26px;object-fit:contain;display:block;margin:0 auto 1px;flex:0 0 26px;overflow:hidden}
  .pinned:after{content:"";position:absolute;top:-6px;left:50%;margin-left:-5px;width:10px;height:10px;border-radius:50%;background:var(--brick);border:1px solid #8a2f25}
  .slot{width:auto;height:78px;border:1.5px dashed var(--cork-d);opacity:.55}
  @keyframes fly{0%{transform:translateY(-120px) rotate(14deg) scale(1.3);opacity:0}100%{transform:rotate(-3deg)}}

  /* ---------- 토스트 / 세로 안내 ---------- */
  .toast{position:fixed;left:50%;bottom:76px;transform:translate(-50%,8px);z-index:50;background:var(--line);color:#fff8ea;border-radius:10px;padding:8px 14px;font-size:13px;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none;max-width:80vw;text-align:center}
  .toast.on{opacity:1;transform:translate(-50%,0)}
  #rotate{position:fixed;inset:0;z-index:100;background:var(--paper);display:none;flex-direction:column;align-items:center;justify-content:center;gap:14px;text-align:center;padding:24px}
  #rotate h2{font-size:26px}
  #rotate .ph{width:54px;height:96px;border:4px solid var(--line);border-radius:10px;animation:rot 1.6s ease-in-out infinite}
  @keyframes rot{0%,20%{transform:rotate(0)}60%,100%{transform:rotate(90deg)}}
  /* ---------- 추리 단계 카드 ---------- */
  .logicwrap{width:100%;height:100%;overflow-y:auto;padding:12px 8px 8px 14px;scrollbar-width:thin}
  .chain{display:grid;gap:6px}
  .link.step{position:relative;display:block;width:100%;text-align:left;background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:7px 10px 7px 16px;box-shadow:var(--sh)}
  .link.step b{font-family:"Gaegu",cursive;font-size:15px}
  .link.step.done{border-color:var(--olive);background:#f4f7ef}
  .link.step.bad{border-color:var(--brick);background:#fff1ec;animation:shake .35s}
  .link.step.open{outline:3px solid var(--must);outline-offset:1px}
  .mini{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
  .tag{display:inline-block;font-size:10.5px;background:#efe7d6;border:1.5px solid var(--cork-d);border-radius:999px;padding:1px 8px;line-height:1.5}
  .tag.opt{background:#eef3e8;border-color:var(--olive)}
  .tag.empty{background:transparent;border-style:dashed;color:var(--soft)}
  .tag.slotbtn{background:#fff8e7;border-color:var(--must-d);font-weight:700;padding:3px 10px;font-size:11px}
  .concl.small{font-size:12.5px;font-family:"Gowun Dodum",sans-serif;font-weight:400;line-height:1.6;text-align:left;color:var(--ink);background:#fff8e7;border-color:var(--must-d)}
  /* ---------- 추리: 코르크판 ----------
     단서 카드가 핀으로 꽂혀 있고, 누르면 빨간 실이 「그래서?」 매듭에 모인다. */
  .corkwrap{width:100%;height:100%;overflow-y:auto;overflow-x:hidden;padding:6px 6px 8px;scrollbar-width:thin;position:relative}
  .cork{position:relative;width:100%;border:3px solid #6b4a2a;border-radius:8px;
    background:url(../img/cork.png) repeat;background-size:200px 200px;
    box-shadow:inset 0 0 0 4px #8b6a44,inset 0 0 28px rgba(60,35,10,.35),2px 3px 0 var(--line)}
  .strings{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:2}
  .thread{fill:none;stroke:#b3342a;stroke-width:3;stroke-linecap:round}
  .thread-sh{fill:none;stroke:rgba(60,30,10,.35);stroke-width:5;stroke-linecap:round;transform:translate(1px,2px)}
  .pcard{position:absolute;width:19%;max-width:132px;min-height:84px;background:#fffaf0;border:2px solid var(--line);
    border-radius:6px;padding:16px 5px 7px;text-align:center;font-size:10.5px;line-height:1.25;color:var(--ink);
    box-shadow:2px 3px 0 rgba(60,35,10,.55);cursor:pointer;z-index:1;
    display:flex;flex-direction:column;align-items:center;gap:3px;transition:transform .12s,box-shadow .12s}
  .pcard.testi{background:#fff8e7;border-style:double;border-width:3px}
  .pcard svg{width:22px;height:22px}
  .pcard .cicon{width:30px;height:30px}
  /* 줄을 고르게 나눈다 — 「뒷문의 크림색 / 끈」처럼 마지막 줄에 한 글자만 떨어지는
     것을 브라우저가 알아서 막아 준다. 못 알아듣는 브라우저는 그냥 지금처럼 나온다. */
  .pcard .pn{display:block;text-wrap:balance}
  .pinned .pn,.cutt,.clue .cn,.schip{text-wrap:balance}
  .pcard .pin{position:absolute;top:-7px;left:50%;transform:translateX(-50%);width:14px;height:14px;border-radius:50%;
    background:radial-gradient(circle at 35% 35%,#e8756a,#b3342a 60%,#7a1f18);border:1.5px solid #4a2018;
    box-shadow:1px 2px 0 rgba(60,35,10,.5);z-index:3}
  .pcard.on{background:#ffe9b3;border-color:var(--brown);z-index:4;
    box-shadow:0 0 0 3px var(--must),3px 6px 0 rgba(60,35,10,.55)}
  .pcard .usedno{position:absolute;top:-6px;right:-5px;background:var(--teal);color:#fff8ea;border:2px solid var(--line);
    border-radius:999px;font-size:9.5px;padding:0 5px;line-height:15px;z-index:5}
  .knot{position:sticky;bottom:6px;width:max-content;margin:-46px auto 0;transform:none;z-index:3;
    background:#fff8e7;border:2.5px solid var(--line);border-radius:999px;padding:5px 16px;text-align:center;
    box-shadow:2px 3px 0 rgba(60,35,10,.55);min-width:150px}
  .knot b{display:block;font-family:"Gaegu",cursive;font-size:15px;line-height:1.1}
  .knot small{display:block;font-size:10.5px;color:var(--soft)}
  .knot.full{background:var(--must);border-color:var(--brown)}
  .knot.full small{color:var(--ink)}

  /* ---------- 추리: 빈칸 문장 ---------- */
  .fillbox{background:#fff8e7;border:2.5px solid var(--must-d);border-radius:10px;padding:9px 11px;
    font-size:14px;line-height:2.05;box-shadow:2px 3px 0 var(--line)}
  .blank{display:inline-block;min-width:54px;padding:0 6px;margin:0 2px;vertical-align:baseline;
    border:0;border-bottom:2.5px solid var(--line);border-radius:0;background:none;
    font:inherit;font-weight:700;color:var(--brick);line-height:1.5;cursor:pointer}
  .blank.empty{border-bottom-style:dashed;background:rgba(232,178,92,.18);border-radius:6px 6px 0 0}
  .blank.sel{background:rgba(232,178,92,.55);border-radius:6px 6px 0 0;outline:2px solid var(--must-d);outline-offset:1px}
  .bank{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
  .word{background:var(--panel);border:2px solid var(--line);border-radius:999px;padding:3px 11px;
    font-size:13px;font-weight:700;box-shadow:1px 2px 0 var(--line);color:var(--ink)}
  .word:active{transform:translate(1px,2px);box-shadow:0 0 0 var(--line)}
  .word.gone{opacity:.3;box-shadow:none;text-decoration:line-through}

  /* ---------- 추리: 시간표 판 ---------- */
  /* 판이 칸보다 길면 **놓아야 할 카드**가 아래로 잘려 나간다. 스크롤은 되지만 아이는
     그런 게 있는 줄 모른다 — 사건 3 2단계에서 도토·콩순이 카드를 못 찾는 일이 있었다.
     그래서 세로로 쌓되, 시간 띠만 줄어들고 **쟁반과 안내는 절대 안 줄어들게** 한다. */
  .tlwrap{width:100%;height:100%;overflow-y:auto;padding:8px 10px;scrollbar-width:thin;
    display:flex;flex-direction:column;--laneh:38px;--lanetop:10px}
  .tlhd{display:flex;align-items:baseline;gap:8px;margin-bottom:6px;flex-wrap:wrap}
  .tlhd b{font-family:"Gaegu",cursive;font-size:16px}
  .rail{position:relative;flex:1 1 auto;min-height:150px;max-height:230px;
    background:#fffaf0;border:2.5px solid var(--line);border-radius:10px;
    box-shadow:2px 3px 0 var(--line);overflow:hidden;touch-action:none}
  .rail .night{position:absolute;left:0;top:0;bottom:0;background:linear-gradient(90deg,#3b3a55 0,#5d5678 70%,rgba(93,86,120,0));pointer-events:none}
  .rail .sunmark{position:absolute;top:0;bottom:0;border-left:2px solid #d9a441;pointer-events:none}
  .rail .sunmark i{position:absolute;top:6px;left:-11px;width:22px;height:22px;border-radius:50%;background:#f0c35a;border:2px solid var(--line)}
  .rail .sunmark span{position:absolute;bottom:4px;left:4px;font-size:10.5px;color:#a4813f;white-space:nowrap}
  .rail .tick{position:absolute;top:0;bottom:0;border-left:1.5px dashed #b9a894;pointer-events:none}
  .rail .tick span{position:absolute;bottom:4px;left:4px;font-size:11px;color:var(--soft);white-space:nowrap}
  .ev{position:absolute;transform:translateX(-50%);background:var(--panel);border:2px solid var(--line);border-radius:8px;
    padding:4px 9px;font-size:11.5px;font-weight:700;box-shadow:2px 2px 0 var(--line);white-space:nowrap;color:var(--ink);
    display:inline-flex;align-items:center;gap:5px;line-height:1.3;user-select:none}
  .ev small{font-weight:400;color:var(--soft);font-size:10px;margin-left:2px}
  .ev.fix{background:#f4f7ef;border-color:var(--olive);cursor:default}
  .ev.mov{cursor:grab}
  .ev.lift{z-index:6;box-shadow:4px 6px 0 var(--line);cursor:grabbing}
  .ev.bad{background:#fff1ec;border-color:var(--brick);animation:shake .35s}
  .ev.slide{transition:transform .8s cubic-bezier(.5,-.3,.6,1.3),opacity .8s;transform:translate(-50%,120px);opacity:0}
  .ev .who{width:14px;height:14px;border-radius:50%;border:1.5px solid var(--line);background:#c98a3c;flex:0 0 auto}
  .ev .w-owl{background:#a99e88}.ev .w-bell{background:#6d7f88}.ev .w-mori{background:#8b6a44}
  .ev .w-doto{background:#c98a3c}.ev .w-kongsun{background:#9aa27a}
  .tlhd,.tray,#tl-tip{flex:0 0 auto}
  .tray{margin-top:8px;display:flex;gap:6px;flex-wrap:wrap;min-height:34px}
  /* 쟁반이 「여기서 꺼내 놓는 곳」으로 읽히게 — 빈 칸처럼 테를 두른다 */
  .tray:not(:empty){border:2px dashed var(--line);border-radius:10px;background:#fbf6ea;padding:6px;gap:7px}
  .tray .ev{position:static;transform:none}
  .tray .ev.sel{background:#ffe9b3;outline:3px solid var(--must-d);outline-offset:1px}
  #tl-tip{margin:6px 0 0}
  /* 낮은 화면: 줄 간격과 글자를 줄여 다섯 줄이 들어가게 한다 */
  @media (max-height:430px){
    .tlwrap{--laneh:30px;--lanetop:7px;padding:6px 8px}
    .tlhd{margin-bottom:4px}
    .tlhd b{font-size:14px}
    .tlhd .muted{font-size:10.5px}
    .rail{min-height:132px}
    .ev{font-size:10.5px;padding:3px 7px}
    .ev .who{width:11px;height:11px}
    .tray{margin-top:6px;min-height:30px;padding:5px}
    #tl-tip{font-size:11px;margin-top:4px}
  }

  /* ---------- 평면도 판 (사건 1) / 바람 판 (사건 2) ---------- */
  /* 그림 파일을 쓰지 않는다 — 평면도는 선 몇 개면 되고, 그러면 화면 크기에 맞춰 늘어난다 */
  .plan,.wind{position:relative;flex:1 1 auto;min-height:140px;
    background:#fffaf0;border:2.5px solid var(--line);border-radius:10px;
    box-shadow:2px 3px 0 var(--line);overflow:hidden}
  .plan svg,.wind svg{position:absolute;inset:0;width:100%;height:100%}
  .pl-room{fill:#f6efe0;stroke:var(--line);stroke-width:2.5;stroke-dasharray:0}
  .pl-note{font-size:11px;fill:var(--soft);font-family:inherit}
  .pl-ground{stroke:var(--line);stroke-width:2.5;stroke-linecap:round}
  .pl-pin rect{fill:#b07f44;stroke:var(--line);stroke-width:1.6}
  .pl-pin ellipse{fill:#3a2b1c;opacity:.3}
  .pl-mark{font-size:9.5px;fill:var(--soft);font-family:inherit}
  /* ---- 자국 판 (사건 5) — 젖은 자국을 큰 것부터 눌러 길을 잇는다 ---- */
  .tr-wall{fill:#e6dcc5;stroke:var(--line);stroke-width:1.8}
  .tr-door{fill:#d9c39a;stroke:var(--line);stroke-width:1.8}
  .tr-mark{cursor:pointer}
  .tr-hit{fill:transparent}
  .tr-wet{fill:#8fb7c9;fill-opacity:.55;stroke:#4f7f96;stroke-width:1.4}
  .tr-toe{fill:none;stroke:#2f5a6e;stroke-width:1.3;stroke-linecap:round;opacity:.75}
  .tr-mark:hover .tr-wet{fill-opacity:.85}
  .tr-mark.on .tr-wet{fill:#f2c94c;fill-opacity:.85;stroke:var(--line)}
  .tr-mark.bad .tr-wet{fill:var(--brick);fill-opacity:.7}
  .tr-boot{fill:#a8865a;fill-opacity:.5;stroke:#6b4f2e}
  .tr-no{fill:var(--line)} .tr-not{font-size:8.5px;font-weight:700;fill:#fff8ea;font-family:"Gaegu",cursive}
  .tr-path{fill:none;stroke:var(--brick);stroke-width:2.2;stroke-dasharray:4 3;stroke-linejoin:round;pointer-events:none}
  .trailwrap .plan svg{width:100%;height:auto;max-height:100%}
  /* 막을 자리 */
  .pslot{position:absolute;transform:translate(-50%,-50%);min-width:84px;max-width:132px;
    background:var(--panel);border:2px dashed var(--line);border-radius:9px;padding:4px 7px;
    text-align:center;line-height:1.25;cursor:pointer;box-shadow:2px 2px 0 var(--line)}
  .pslot b{display:block;font-size:11px;color:var(--ink)}
  .pslot .pput{display:block;font-size:10px;color:var(--soft);margin-top:1px;word-break:keep-all}
  .pslot.on{border-style:solid;background:#eef3e8;border-color:var(--olive)}
  .pslot.on .pput{color:var(--ink);font-weight:700}
  .pslot.bad{background:#fff1ec;border-color:var(--brick);animation:shake .35s}
  /* 바람 */
  .wd-board{fill:#e8dcc4;stroke:var(--line);stroke-width:2}
  .wd-pile circle{fill:#e6cf9a;stroke:#b9a06a;stroke-width:1.5;opacity:.85}
  .wd-arrow line{stroke:var(--teal);stroke-width:4;stroke-linecap:round}
  .wd-arrow path{fill:var(--teal)}
  .wdtray{gap:5px}
  .wdbtn{gap:4px}
  .wdbtn .wdi{display:inline-block;font-size:13px;line-height:1;color:var(--teal)}
  .wdbtn.sel{background:#ffe9b3;outline:3px solid var(--must-d);outline-offset:1px}
  @media (max-height:430px){
    .plan,.wind{min-height:124px}
    .pslot{min-width:70px;max-width:108px;padding:3px 5px}
    .pslot b{font-size:10px}
    .pslot .pput{font-size:9px}
    .wdbtn{font-size:10px}
  }

  /* ---------- 재현 (지목을 대신한다) ---------- */
  .replaywrap{width:100%;height:100%;overflow-y:auto;padding:8px 10px;scrollbar-width:thin}
  .rphd{display:flex;align-items:baseline;gap:8px;margin-bottom:7px;flex-wrap:wrap}
  .rphd b{font-family:"Gaegu",cursive;font-size:16px}
  .rphd .mini{margin-left:auto;border:2px solid var(--line);border-radius:999px;background:var(--panel);
    padding:1px 10px;font-size:11.5px;font-weight:700}
  .cuts{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .cutcard{position:relative;background:var(--panel);border:2.5px solid var(--line);border-radius:10px;
    overflow:hidden;box-shadow:var(--sh);text-align:left;color:var(--ink);padding:0;display:block}
  .cutcard.on{border-color:var(--brown);box-shadow:0 0 0 3px var(--must),var(--sh)}
  .cutcard.bad{border-color:var(--brick);animation:shake .35s}
  .cutt{display:block;padding:5px 8px 6px;font-size:11.5px;line-height:1.45}
  .cutno{position:absolute;top:6px;left:6px;z-index:3;width:24px;height:24px;border-radius:50%;
    background:var(--must);border:2.5px solid var(--line);font-family:"Gaegu",cursive;font-weight:700;
    font-size:15px;line-height:20px;text-align:center;box-shadow:1px 2px 0 var(--line)}
  .cutcard:not(.on) .cutno{background:rgba(255,255,255,.75);border-style:dashed;box-shadow:none}
  /* 한 컷 — 배경을 확대해 잘라 쓰고 그 위에 인물·물건을 얹는다. 새 그림을 그리지 않는다. */
  .cutart{position:relative;width:100%;aspect-ratio:16/9;overflow:hidden;background:#e7eee0;
    border-bottom:2.5px solid var(--line)}
  .cutart.sm{aspect-ratio:2/1}
  .cutbg{position:absolute;inset:0;background-repeat:no-repeat}
  .cutbg.plain{background:linear-gradient(160deg,#e7eee0,#cfc7b4)}
  .cutfx{position:absolute;inset:0;pointer-events:none}
  .cutfx.night{background:linear-gradient(180deg,rgba(28,32,66,.62),rgba(28,32,66,.42));mix-blend-mode:multiply}
  .cutfx.dawn{background:linear-gradient(180deg,rgba(255,196,128,.30),rgba(255,150,120,.12))}
  .cutfig{position:absolute;transform:translate(-50%,-50%);width:auto;
    filter:drop-shadow(2px 3px 2px rgba(60,35,10,.4))}
  .bigcut{border:3px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:var(--sh);background:var(--panel)}
  .bigcut .cutart{aspect-ratio:16/7}
  .cutcap{padding:8px 12px;font-size:14px;line-height:1.6;background:#fff8e7}
  .cutcap .n{display:inline-block;width:22px;height:22px;border-radius:50%;background:var(--must);
    border:2px solid var(--line);font-family:"Gaegu",cursive;font-weight:700;font-size:14px;line-height:19px;
    text-align:center;margin-right:7px;vertical-align:-3px}
  .replaywrap.playing{display:flex;align-items:center;justify-content:center;padding:10px}
  .replaywrap.playing .bigcut{width:100%;animation:cutin .5s}
  @keyframes cutin{from{opacity:0;transform:scale(.97)}to{opacity:1;transform:none}}
  /* 작은 화면에서도 네 장면이 **한눈에** 들어와야 순서를 견줄 수 있다 */
  @media (max-height:470px){
    .replaywrap{padding:6px 8px}
    .rphd{margin-bottom:4px}.rphd b{font-size:14px}
    .cuts{gap:5px}
    .cutart.sm{aspect-ratio:12/5}
    .cutt{font-size:10px;padding:3px 6px 4px;line-height:1.35;
      display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
    .cutno{width:20px;height:20px;font-size:12.5px;line-height:16px;top:4px;left:4px}
  }
  @media (max-height:400px){
    .cutart.sm{aspect-ratio:14/5}
    .cutt{-webkit-line-clamp:2}
  }

  /* 사건 목록·연결판의 별점 */
  .cstar,.recstar{font-family:"Gaegu",cursive;letter-spacing:.06em;color:#c9924a}
  .recstar{font-size:22px;line-height:1;margin-right:6px}
  .recrow{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:6px}

  /* ---------- 추리: 왼쪽에 펼쳐 둔 수첩 ---------- */
  .shelfwrap{padding:8px 8px 10px 12px}
  .shelfhd{display:flex;align-items:baseline;gap:8px;margin-bottom:6px;flex-wrap:wrap}
  .shelfhd b{font-family:"Gaegu",cursive;font-size:16px}
  .shelfhd .muted{font-size:11.5px}
  .clues.shelf{grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:6px}
  .clues.shelf .clue{cursor:pointer;position:relative;min-height:62px;font-size:11px}
  .clues.shelf .clue.on{background:var(--must);border-color:var(--brown);transform:translateY(-3px);
    box-shadow:2px 5px 0 var(--line)}
  .clues.shelf .clue .usedno{position:absolute;top:-6px;right:-4px;background:var(--teal);color:#fff8ea;
    border:2px solid var(--line);border-radius:999px;font-size:9.5px;padding:0 5px;line-height:15px}
  /* 단계 번호 칩 — 「목록으로」 왕복을 없앤다 */
  .stepchips{display:flex;gap:5px;margin-bottom:8px}
  .schip{width:30px;height:30px;border:2.5px solid var(--line);border-radius:50%;background:var(--panel);
    font-family:"Gaegu",cursive;font-weight:700;font-size:15px;line-height:1;box-shadow:var(--sh)}
  .schip.done{background:#e4efdb;border-color:var(--olive)}
  .schip.on{background:var(--must);outline:3px solid var(--must-d);outline-offset:1px}
  .schip.bad{background:#fff1ec;border-color:var(--brick)}
  /* 비어 있는 근거 칸 */
  .clues.slots{grid-template-columns:repeat(auto-fill,minmax(92px,1fr))}
  .clue.slot{border-style:dashed;box-shadow:none;color:var(--soft);background:#f6f1e6;font-size:10.5px}
  @media (max-height:470px){
    .clues.shelf{grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:5px}
    .clues.shelf .clue{min-height:54px;font-size:10px}
    .schip{width:26px;height:26px;font-size:14px}
  }
  .pick{margin-top:8px}
  .pl{font-family:"Gaegu",cursive;font-weight:700;font-size:14px;margin-bottom:4px}
  .pl small{font-family:"Gowun Dodum",sans-serif;font-weight:400;color:var(--soft);font-size:11px}
  .opt{display:flex;gap:7px;align-items:flex-start;width:100%;text-align:left;background:var(--panel);border:2.5px solid var(--line);border-radius:10px;padding:8px 10px;margin-bottom:5px;font-size:12.5px;line-height:1.55;box-shadow:var(--sh)}
  .opt .dot{flex:0 0 14px;height:14px;border-radius:50%;border:2.5px solid var(--line);margin-top:2px;background:#fff}
  .opt.on{background:#fff3d6;border-color:var(--must-d)}
  .opt.on .dot{background:var(--brick);box-shadow:inset 0 0 0 2px #fff}
  .opt.acc{font-family:"Gaegu",cursive;font-size:15px}
  .clue.add{border-style:dashed;color:var(--soft);font-size:11px;min-height:56px}
  .clue.picked-c{background:#eef3e8;border-color:var(--olive)}
  .clue .x{font-size:9px;color:var(--brick)}

  /* ---------- 다듬기: 말하기·도장·배지 ---------- */
  .portrait.talking svg{animation:talk .22s ease-in-out infinite alternate;transform-origin:50% 90%}
  @keyframes talk{from{transform:translateY(0) scaleY(1)}to{transform:translateY(-3px) scaleY(1.015)}}
  .blank.stamp{animation:stamp .32s cubic-bezier(.2,1.4,.4,1)}
  @keyframes stamp{0%{transform:scale(1.35) rotate(-4deg)}100%{transform:none}}
  .new{display:inline-block;background:var(--brick);color:#fff;border-radius:999px;font-size:9.5px;padding:0 6px;margin-left:4px;vertical-align:middle;font-family:"Gowun Dodum",sans-serif;font-weight:700;animation:blink 1s 3}
  @keyframes blink{50%{opacity:.35}}
  .sheet{animation:slideup .22s cubic-bezier(.2,.9,.3,1)}
  @keyframes slideup{from{transform:translateY(24px);opacity:0}to{transform:none;opacity:1}}
  .sheet .ctx{padding:8px 12px 0;font-size:12.5px;color:var(--soft);line-height:1.6}
  .sheet .ctx b{color:var(--ink)}
  .stars span{display:inline-block;opacity:0;transform:scale(2.2)}
  .stars span.on{animation:starin .45s cubic-bezier(.2,1.3,.4,1) forwards}
  @keyframes starin{to{opacity:1;transform:none}}
  .cursor{display:inline-block;width:8px;height:14px;background:var(--brick);vertical-align:-2px;margin-left:2px;animation:blink .7s infinite}
  .tap.typing{pointer-events:none}
  .snd{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap}
  /* 폭이 좁으면 단추 안에서 글자가 접혀 「효과 / 음」처럼 갈라진다 */
  .snd button{white-space:nowrap}
  .snd button{border:2px solid var(--line);border-radius:999px;background:var(--panel);padding:2px 10px;font-size:12px;font-weight:700}
  .snd button[aria-pressed="false"]{opacity:.45;text-decoration:line-through}
  .snd button.wide{background:var(--must);border-color:var(--brown);padding-left:12px;padding-right:12px}
  .snd .bi{width:13px;height:13px;vertical-align:-2px;margin-right:1px}
  .lenslabel.new-hot{animation:pop .18s}
  @keyframes pop{from{transform:translateX(-50%) scale(.85)}to{transform:translateX(-50%) scale(1)}}
  @media (orientation:portrait){#rotate{display:flex}}
  @media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* ---------- 표지: 이어하기 · 백업 코드 ---------- */
.resume{background:#fff8e7;border:2.5px solid var(--must-d);border-radius:10px;padding:8px 11px;box-shadow:var(--sh);
  display:flex;flex-direction:column;gap:6px;font-size:12.5px}
.resume small{color:var(--soft);font-size:11px}
.resume .row{display:flex;gap:6px}
.mini{border:2px solid var(--line);border-radius:999px;background:var(--panel);padding:3px 12px;font-size:12px;font-weight:700;
  font-family:"Gaegu",cursive}
.mini.go{background:var(--must)}
.codebox{display:flex;flex-direction:column;gap:5px}
.codebox textarea{width:100%;border:2px solid var(--line);border-radius:8px;padding:6px 8px;font-size:11px;
  font-family:ui-monospace,Menlo,Consolas,monospace;resize:vertical;background:var(--panel);color:var(--ink)}

/* ===== 그림 자산(제미나이) 자리 — 파일이 없으면 이 규칙들은 쓰이지 않는다 ===== */
.portrait .pim{width:100%;height:100%;object-fit:contain;display:block;
  image-rendering:auto;filter:drop-shadow(0 3px 0 rgba(74,52,40,.10))}
.clue img.cicon,.picked-c img.cicon{width:28px;height:28px;object-fit:contain;
  flex:0 0 auto;border-radius:5px}
#s-title.has-cover{background-size:cover;
  background-position:center;background-repeat:no-repeat}
#s-title.has-cover .card,#s-title.has-cover .resume{
  background:rgba(251,247,238,.93);backdrop-filter:blur(2px)}
/* 표지 그림은 오른쪽 절반이 비어 있고 밝게(복잡도 6·밝기 186) 그려져 있어,
   글을 그림 위에 바로 올린다. 막을 씌우지 않는다 — 씌우면 그림이 죽는다.
   바닥 돌은 어둡고 복잡해서 맨 아래 안내줄에만 옅은 안개를 깐다. */
#s-title.has-cover{position:relative}
#s-title.has-cover::after{content:"";position:absolute;left:0;right:0;bottom:0;height:22%;
  pointer-events:none;
  background:linear-gradient(to bottom,rgba(251,247,238,0),rgba(251,247,238,.72))}
#s-title.has-cover>*{position:relative;z-index:1} /* 안내줄이 그림 위 안개와 밝기가 비슷해 묻힌다. 막을 더 씌우면 그림이 죽으니 글자만 진하게 한다. */ #s-title.has-cover .muted{color:#4a3428;font-weight:700}

/* 제목이 나뭇잎 위에 놓이면 잎마다 밝기가 달라(42~222) 어떤 글자는
   배경과 같은 밝기가 된다. 막을 씌우면 그림이 죽으므로, 글자에만
   크림색 테를 둘러 어떤 잎 위에 놓여도 윤곽이 남게 한다. */
#s-title.has-cover .eyebrow,
#s-title.has-cover h1,
#s-title.has-cover .txt>p.muted{
  text-shadow:0 0 5px #fbf7ee, 0 0 10px #fbf7ee, 0 0 18px rgba(251,247,238,.85)}

/* 인트로 — 표지와 같은 그림을 깔되 조금 어둡게 눌러 「이야기가 시작된다」는 느낌을 준다.
   글은 표지처럼 반투명 카드 위에 놓는다. */
#s-intro.has-cover{background-size:cover;background-position:center;background-repeat:no-repeat;position:relative}
#s-intro.has-cover::before{content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(to right,rgba(40,28,20,.05),rgba(40,28,20,.28))}
#s-intro.has-cover>*{position:relative;z-index:1}
#s-intro.has-cover .intro-card{background:rgba(251,247,238,.94);backdrop-filter:blur(2px)}
#s-intro.has-cover .eyebrow{color:#fbf7ee;text-shadow:0 0 6px rgba(40,28,20,.9),0 1px 0 rgba(40,28,20,.8)}
#s-intro.has-cover .muted{color:#fbf7ee;text-shadow:0 0 6px rgba(40,28,20,.9)}
#s-intro .intro-card .who:empty{display:none}
#s-intro .txt{justify-content:center}

/* ---------- 인트로 연출(사건마다 다르게) ----------
   사건 1: 표지 그림 + 인물(위 기본형).
   사건 2: 인물 없이 화면 전체를 배경으로 쓰고, 글은 아래 띠에 눕힌다(cine).
   배경·분위기는 사건 파일이 정한다(introBg / intro[].bg / intro[].fx). */
#s-intro.cine{grid-template-columns:1fr}
#s-intro.cine .art{display:none}
#s-intro.cine .txt{justify-content:flex-end;max-width:none;gap:8px}
#s-intro.cine .txt>:first-child{margin-top:auto}
#s-intro.cine .txt>:last-child{margin-bottom:0}
/* 날짜 띠는 어떤 그림 위에 놓일지 모른다 — 어두운 알약을 깔아 대비를 보장한다 */
#s-intro.cine .eyebrow{align-self:center;background:rgba(26,18,12,.58);padding:3px 11px;border-radius:999px;
  text-shadow:none;backdrop-filter:blur(2px)}
#s-intro.cine #intro-page{text-shadow:0 0 6px rgba(20,14,10,.95),0 1px 2px rgba(20,14,10,.9)}
#s-intro.cine .intro-card{position:relative;max-width:680px;margin:0 auto;width:100%;
  border-radius:4px;padding:14px 16px 12px}
/* 찢어진 종이 — 이번 사건이 찢어진 포스터인 걸 화면이 먼저 말한다 */
#s-intro.cine .intro-card::before{content:"";position:absolute;left:0;right:0;top:-7px;height:8px;
  background:inherit;
  clip-path:polygon(0 100%,0 42%,3% 8%,7% 62%,11% 20%,16% 70%,21% 14%,26% 58%,31% 24%,36% 66%,41% 10%,46% 54%,51% 22%,56% 68%,61% 16%,66% 60%,71% 26%,76% 64%,81% 12%,86% 56%,91% 28%,96% 62%,100% 30%,100% 100%)}
#s-intro.cine .intro-card p{font-size:15px;line-height:1.7}
#s-intro.cine #intro-page{color:#fbf7ee}

/* 밤 — 파랗게 눌러 어둡게. 아침 — 따뜻한 빛이 얇게 깔린다. */
#s-intro.fx-night.has-cover::before{background:
  radial-gradient(120% 90% at 50% 40%,rgba(18,26,54,.52),rgba(8,12,30,.88)),
  linear-gradient(rgba(20,30,64,.55),rgba(10,14,34,.7))}
#s-intro.fx-night.has-cover .intro-card{background:rgba(238,242,252,.93)}
#s-intro.fx-dawn.has-cover::before{background:
  linear-gradient(to bottom,rgba(255,212,140,.3),rgba(78,52,28,.34) 62%,rgba(52,34,20,.5))}

/* 바람에 날리는 잎 */
#s-intro .wind{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:1}
#s-intro .wind[hidden]{display:none}
#s-intro .wind i{position:absolute;left:-8%;width:13px;height:13px;opacity:.75;
  border-radius:0 100% 0 100%;animation:leafgo linear infinite}
@keyframes leafgo{
  0%{transform:translate3d(0,0,0) rotate(0deg) scale(var(--sc,1));opacity:0}
  8%{opacity:.8}
  50%{transform:translate3d(60vw,-26px,0) rotate(220deg) scale(var(--sc,1))}
  92%{opacity:.8}
  100%{transform:translate3d(122vw,18px,0) rotate(460deg) scale(var(--sc,1));opacity:0}}
#s-intro.pgin{animation:pgin .42s ease-out}
@keyframes pgin{from{opacity:.25}to{opacity:1}}
@media (prefers-reduced-motion:reduce){
  #s-intro .wind{display:none}
  #s-intro.pgin{animation:none}}

/* 낮은 가로 화면(폰을 눕힌 경우)에서는 표지 글이 세로로 넘쳐
   위로는 「시험판」 띠가, 아래로는 안내줄이 잘렸다. 넘친 글이 위로 밀리면서
   제목이 나뭇잎 위로 올라가 읽기도 나빠졌다. 높이에 맞춰 줄인다. */
@media (max-height:470px){
  #s-title{padding-top:8px;padding-bottom:8px}
  #s-title .txt{gap:7px}
  #s-title h1{font-size:25px;line-height:1.15}
  #s-title .eyebrow{font-size:10px}
  /* 두 칸을 나란히 놓으면 한 번에 80px 가까이 줄어든다 */
  #s-title .modepick{grid-template-columns:1fr 1fr;gap:7px}
  #s-title .modepick button{padding:7px 10px}
  #s-title .modepick button b{font-size:15px}
  #s-title .modepick button span{font-size:11px;line-height:1.25;display:block}
  #s-title .resume{padding:7px 9px}
}
@media (max-height:400px){
  #s-title h1{font-size:22px}
  #s-title .txt{gap:5px}
  #s-title .txt>p.muted{font-size:11px}
}
/* 폭이 좁으면 소리 단추 넷이 한 줄에 못 들어가 하나만 아래로 떨어진다.
   줄바꿈보다 보기 나쁘므로, 좁을 때는 단추 자체를 줄여 한 줄을 지킨다. */
@media (max-width:760px){
  .snd{gap:4px}
  .snd button{padding:2px 7px;font-size:11px}
  .snd button.wide{padding-left:8px;padding-right:8px}
  .snd .bi{width:12px;height:12px}
}
/* 폭까지 좁으면 두 칸의 설명 줄이 두 줄로 접히며 다시 넘친다 */
@media (max-height:470px) and (max-width:720px){
  #s-title .modepick button b{font-size:14px}
  #s-title .modepick button span{font-size:10px}
  #s-title .modepick button{padding:6px 8px}
  #s-title h1{font-size:21px}
  #s-title .txt{gap:5px}
  #s-title .txt>p.muted{font-size:10.5px;line-height:1.35}
}

/* ===== 망고 그림 ===== */
.art.img{display:grid;place-items:center;padding:0}
.art.img img{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;display:block;
  filter:drop-shadow(0 4px 0 rgba(74,52,40,.10))}
img.mface{width:32px;height:32px;object-fit:cover;object-position:center 42%;
  border-radius:50%;background:#fff6e2;border:1.6px solid var(--brown);
  vertical-align:-9px;margin-right:6px;flex:0 0 auto}
.say img.mface{vertical-align:-8px}
img.mjoy{width:82px;height:82px;object-fit:contain;
  display:block;margin:0 auto -6px}

/* ===== 분석 미니게임 (CASE-4) — 시간제한도 실패도 없다. 별점에만 반영. ===== */
.minigame{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;
  background:rgba(59,42,26,.55);backdrop-filter:blur(2px);
  padding:calc(10px + env(safe-area-inset-top,0px)) calc(10px + env(safe-area-inset-right,0px))
          calc(10px + env(safe-area-inset-bottom,0px)) calc(10px + env(safe-area-inset-left,0px))}
.minigame[hidden]{display:none}
.mg-box{background:var(--paper);border:2.5px solid var(--line);border-radius:12px;box-shadow:var(--sh);
  width:min(100%,760px);max-height:100%;display:flex;flex-direction:column;overflow:hidden}
/* 자물쇠·그림자처럼 그림 아래에 조작 줄이 붙는 미니게임은 높이를 먼저 정해 줘야
   안쪽이 제 몫을 나눠 갖는다. 조각 맞추기는 그림 크기대로 감싸는 게 예뻐서 그대로 둔다. */
.mg-box.tall{height:100%}
.mg-head,.mg-foot{display:flex;align-items:center;gap:8px;padding:6px 10px;background:var(--panel);
  border-bottom:2px solid var(--line);flex:0 0 auto}
.mg-foot{border-bottom:0;border-top:2px solid var(--line)}
.mg-head b{font-family:"Gaegu",cursive;font-size:16px}
.mg-head .muted,.mg-foot .muted{flex:1;font-size:11.5px}
.minigame button.mini{border:2px solid var(--line);border-radius:999px;background:var(--panel);
  padding:2px 9px;font-size:11.5px;font-weight:700;white-space:nowrap}
.mg-stage{position:relative;flex:1 1 auto;min-height:0;background:#efe6d3;touch-action:none;overflow:hidden}
.mg-stage svg{display:block;width:100%;height:100%}
.jig-slot{fill:none;stroke:#b7a894;stroke-width:2;stroke-dasharray:6 5}
.jig-piece{cursor:grab}
.jig-piece.snapped{cursor:default}
.jig-done{font-family:"Gaegu",cursive;font-size:19px;fill:var(--olive)}

/* ---- 번호 자물쇠 ---- */
.lockbox{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:8px}
.lockrow{display:flex;gap:10px}
.dig{display:flex;flex-direction:column;align-items:center;gap:4px}
.dbtn{width:44px;height:30px;border:2.5px solid var(--line);border-radius:8px;background:var(--panel);
  font-size:14px;line-height:1;font-weight:700;color:var(--ink)}
.dbtn:active{transform:translateY(1px)}
.dnum{width:44px;height:46px;display:grid;place-items:center;background:#fffaf0;
  border:2.5px solid var(--line);border-radius:8px;font-family:"Gaegu",cursive;font-size:30px;line-height:1}
.lockmsg{margin:0;font-size:12.5px;text-align:center;color:var(--ink);max-width:90%;flex:0 0 auto}

/* ---- 그림자 도구 ---- */
.shbox{position:absolute;inset:0;display:flex;flex-direction:column;gap:4px;padding:6px 8px;align-items:center}
.shstage{flex:1 1 auto;min-height:0;width:100%;overflow:hidden;
  border:2.5px solid var(--line);border-radius:10px;background:#efe6d3}
.shsvg{width:100%;height:100%;display:block}
.shctl{display:flex;align-items:center;gap:8px;width:min(100%,520px);max-width:100%;flex:0 0 auto}
.shctl input[type=range]{flex:1;height:30px;accent-color:var(--mustard)}
.shtime{font-family:"Gaegu",cursive;font-size:20px;line-height:1;min-width:78px;text-align:right;flex:0 0 auto;white-space:nowrap}

/* ---- 현장이 여럿일 때의 단추 줄 ---- */
/* ---------- 현장 크게 보기 ----------
   휴대폰 가로에서 현장 그림이 화면의 3할밖에 안 된다는 말이 많았다.
   켜면 오른쪽 글 칸을 접고 위아래 띠를 얇게 해서 그림이 화면을 거의 다 쓴다.
   조사한 단서는 그림 아래에 띠로 겹쳐 보여 준다. */
.body{position:relative}
.body.big{grid-template-columns:1fr}
.body.big .right{display:none}
.bigapp .bar{padding-top:2px;padding-bottom:2px}
.bigapp .bar .chip{padding:0 8px;font-size:11px}
.bigapp .foot{padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom,0px));gap:5px}
.bigapp .tab{padding:4px 4px;font-size:14px}
.bigapp .act{padding:4px 8px;font-size:15px}
.bigapp .left{padding:5px}
/* 크게 보기에서는 현장 단추 줄을 그림 위에 얹어 세로 공간을 되찾는다 */
.scenecol{position:relative}
.body.big .scenebar{position:absolute;top:7px;left:8px;right:8px;z-index:4;margin:0}
.body.big .sctab{background:rgba(251,247,238,.93)}
.body.big .sctab.on{background:var(--must)}
.body.big .sctab.grow.on{background:var(--teal);color:#fff8ea}
.body.big .scenecol.hasbar .scenewrap{max-height:100%}
/* 높이가 먼저 정해지게 해서 그림 좌우에 빈 띠가 생기지 않게 한다 */
.body.big .scenewrap{width:auto;height:100%;max-width:100%}
/* 단서 카드 안의 진짜 사진 */
.cluephoto{margin:4px 0 8px;border:2.5px solid var(--line);border-radius:10px;overflow:hidden;
  background:#fffaf0;box-shadow:var(--sh);display:flex;justify-content:center}
.card::after{content:"";display:block;clear:both}
.cluephoto img{display:block;width:100%;max-width:300px;height:auto}
/* 크게 보기의 아래 띠에서는 사진을 글 옆에 붙여 한눈에 들어오게 한다 */
.bigcard .cluephoto{float:right;margin:0 0 6px 10px;width:32%;max-width:150px}
.bigcard .cluephoto img{width:100%;max-width:none}
.bigcard::after{content:"";display:block;clear:both}
@media (max-height:400px){.bigcard .cluephoto{width:26%;max-width:120px}}
.bigcard{position:absolute;left:0;right:0;bottom:0;max-height:48%;overflow-y:auto;
  background:rgba(251,247,238,.965);border-top:2.5px solid var(--line);
  padding:8px 10px 10px;font-size:13px;line-height:1.55;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.bigcard .card{background:none;border:0;box-shadow:none;padding:0}
.bigcard .say,.bigcard .note{margin-top:6px}
.bigx{position:sticky;top:0;float:right;width:26px;height:26px;border:2px solid var(--line);
  border-radius:50%;background:var(--panel);font-size:12px;line-height:1;z-index:2}
.sctab.grow{margin-left:auto;background:var(--cream)}
.sctab.grow.on{background:var(--teal);color:#fff8ea}

.scenecol{display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:100%;height:100%;min-height:0;overflow:hidden}
.scenecol.hasbar .scenewrap{max-height:calc(100% - 34px)}
.scenebar{display:flex;gap:6px;margin-bottom:6px;flex:0 0 auto}
.sctab{border:2.5px solid var(--line);border-radius:999px;background:var(--panel);
  padding:3px 12px;font-size:12.5px;font-weight:700;color:var(--ink);white-space:nowrap}
.sctab.on{background:var(--mustard)}
.sctab.shut{opacity:.55}
@media (max-height:470px){.scenebar{margin-bottom:4px}.sctab{padding:2px 9px;font-size:11.5px}}
@media (max-height:470px){
  .mg-head,.mg-foot{padding:4px 8px}
  .mg-head b{font-size:14px}
  .mg-head .muted,.mg-foot .muted{font-size:10.5px}
}

/* ---------- 사건 목록 ----------
   사건을 다 보여 주고, 잠긴 것은 흐리게만 한다(숨기지 않는다 — 앞으로 뭐가 오는지 보여야 기대가 생긴다) */
#s-cases{grid-template-columns:1fr}
/* 가운데 정렬 + 자동 여백을 쓰면 내용이 많아질 때 위아래로 잘린다(표지에서 겪은 일).
   목록은 위에서부터 채우고, 넘치면 스크롤한다. */
#s-cases .txt{justify-content:flex-start;gap:10px;padding-bottom:2px;overflow:hidden}
/* 목록만 스크롤하고 「표지로」 단추는 늘 보이게 — 아이가 돌아갈 길을 잃으면 안 된다 */
#s-cases .casescroll{flex:1 1 auto;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:9px;scrollbar-width:thin}
#s-cases .txt>:first-child{margin-top:0}
#s-cases .txt>:last-child{margin-bottom:0}
.caselist{display:grid;gap:8px;grid-template-columns:1fr}
@media (min-width:760px){.caselist{grid-template-columns:1fr 1fr}}
.casecard{display:grid;grid-template-columns:auto auto 1fr;grid-template-areas:"no badge ." "t t t" "s s s";
  gap:2px 8px;text-align:left;background:var(--panel);border:2.5px solid var(--line);border-radius:10px;
  padding:8px 11px;box-shadow:var(--sh)}
.casecard .cno{grid-area:no;font-size:11px;letter-spacing:.14em;color:var(--brick);font-weight:700}
.casecard .cs{grid-area:badge;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:99px;justify-self:start}
.casecard .cs.done{background:#e4efdb;color:#4c6b33}
.casecard .cs.open{background:#fdf0cf;color:#8a6a1f}
.casecard .cs.lock,.casecard .cs.soon{background:#e6e0d4;color:#6b6152}
.casecard b{grid-area:t;font-family:"Gaegu",cursive;font-size:17px;line-height:1.25}
.casecard .csub{grid-area:s;font-size:11.5px;color:var(--soft);line-height:1.4}
.casecard.cur{border-color:var(--must-d);background:#fffaf0}
.casecard.dim{opacity:.62}
.casecard:hover{background:#fffaf0}
.keybox input{flex:1 1 130px;min-width:0;font:inherit;font-size:16px;padding:6px 9px;
  border:2px solid var(--line);border-radius:7px;background:#fff}
/* 표지의 「사건 목록」 — 소리 단추들 틈에 끼어 있어 눈에 안 띄었다. 모드 단추 바로 아래로 올린다 */
.caseslink{display:flex;gap:7px;align-items:baseline;flex-wrap:wrap;text-align:left;
  background:#fff8e7;border:2.5px dashed var(--must-d);border-radius:10px;padding:7px 11px;box-shadow:var(--sh)}
.caseslink b{font-family:"Gaegu",cursive;font-size:15px}
.caseslink span{font-size:11.5px;color:var(--soft)}
.caseslink:hover{background:#fff3d6}
/* 열쇠말 창은 화면 위에 띄운다 — 폰에서 자판이 올라오면 아래쪽 입력칸은 가려진다 */
#s-cases .keybox{position:fixed;left:50%;transform:translateX(-50%);
  top:calc(10px + env(safe-area-inset-top,0px));width:min(520px,calc(100vw - 22px));
  z-index:60;margin:0;box-shadow:0 10px 30px rgba(40,28,20,.35)}
.keyback{position:fixed;inset:0;background:rgba(30,22,14,.45);z-index:55}
.keyback[hidden]{display:none}
@media (max-height:430px){
  .casecard{padding:5px 9px} .casecard b{font-size:15px} .casecard .csub{display:none}
  #s-cases .txt{gap:6px}
  #s-cases .keybox{padding:7px 9px;top:6px}
  #s-cases .keybox p.muted:first-of-type{display:none}
  #s-cases .keybox p{font-size:11px}
}

  /* ---------- 연결판 추론 이벤트 ---------- */
  .infbtn{width:100%;margin-top:8px;background:var(--brick);color:#fff8ea;border-color:#8a2f25}
  .infdone{background:#fff8e7;border:2px solid var(--must-d);border-radius:10px;padding:8px 10px;font-size:13px;line-height:1.5;margin-top:8px;display:flex;flex-wrap:wrap;gap:6px 10px;align-items:center}
  .infdone .tool{background:var(--must);border:1.5px solid var(--line);border-radius:999px;padding:1px 9px;font-size:12px}
  #s-board{position:relative}
  .inferwrap{position:absolute;inset:0;background:rgba(40,28,14,.55);display:flex;align-items:center;justify-content:center;z-index:30;padding:10px}
  .infcard{background:var(--cream);border:3px solid var(--line);border-radius:14px;box-shadow:var(--sh);width:min(760px,100%);max-height:100%;overflow:auto;padding:10px 12px;display:flex;flex-direction:column;gap:8px}
  .infhd{display:flex;justify-content:space-between;align-items:center;font-family:"Gaegu",cursive;font-size:18px}
  .infq{margin:0;font-size:14px;line-height:1.5}
  .infpins{display:flex;gap:6px;flex-wrap:wrap}
  .ipin{display:flex;align-items:center;gap:5px;background:#fffaf0;border:1.5px solid #cbb590;border-radius:8px;padding:3px 8px;font-size:11.5px}
  .ipin img,.ipin svg{width:20px;height:20px;object-fit:contain}
  .ipin.blink{animation:ipblink .55s ease-in-out 4;border-color:var(--brick);background:#fff1ea}
  @keyframes ipblink{50%{transform:translateY(-3px);box-shadow:0 0 0 3px rgba(179,74,58,.35)}}
  .infmap svg{width:100%;height:auto;max-height:44vh;border:2px solid var(--line);border-radius:10px;background:#e9e4cf}
  .vm-pl{cursor:pointer}
  .vm-hit{fill:transparent}
  .vm-dot{fill:#fff8ea;stroke:var(--line);stroke-width:2;r:10}
  .vm-pl:hover .vm-dot{fill:var(--must)}
  .vm-pl.on .vm-dot{fill:var(--must)}
  .vm-pl.bad .vm-dot{fill:#e8c4bd;stroke:var(--brick)}
  .vm-pl.ok .vm-dot{fill:#9ec27a;stroke:#3d6b3d;r:11}
  .vm-chk{font-size:11px;font-weight:700;fill:#1e3d1e}
  .vm-t{font-size:10px;fill:var(--ink);font-weight:700;paint-order:stroke;stroke:#e9e4cf;stroke-width:3px}
  .infsay{margin:0}
  .infreward{background:#fff8e7;border:2px dashed var(--must-d);border-radius:10px;padding:8px 10px;font-size:13px}
  @media (max-height:430px){ .infcard{padding:6px 8px;gap:5px} .infmap svg{max-height:30vh} .infq{font-size:12.5px} .ipin{font-size:10.5px;padding:2px 6px} .infsay{font-size:12px} .infhd{font-size:16px} }
