/* 큰글씨 스도쿠 — 화면 모양(색·크기·배치·움직임) 전부
   휴대폰 세로 화면 전용 규칙은 @media (max-width:899px) and (orientation:portrait) 안에만 넣어요. */
:root{
  /* 밝은 화면: 따뜻한 크림·베이지·갈색 (판 위의 파란 숫자·선택색은 그대로) */
  --bg:#f6eedf; --surface:#fffaf1; --surface-2:#efe3cf;
  --text:#2b1f16; --muted:#6b5643;
  --line:#d3c09f; --line-strong:#3a2a1d;
  --given:#2b1f16; --user:#1546c4; --wrong:#c4150f; --wrong-bg:#ffd9d6;
  --sel:#1546c4; --sel-text:#ffffff; --sel-note:#dce6ff; --rel:#f2e7d4; --same:#b9cdf7; --note:#2b2b2b; --note-hl-bg:#3f6fd1; --note-hl:#ffffff; --memo-cell:#e6eefc;
  --accent:#1546c4; --accent-text:#ffffff; --accent-soft:#dbe5fb; --memo-pick-bg:#d6eaff; --memo-pick-border:#6aa8ec;
  --ok:#137a34; --shadow:0 2px 10px rgba(90,60,30,.10);
  --cta:#f6c64a; --cta-border:#e2a92a; --cta-text:#3a2712;   /* 주 버튼(새 게임·이어서 하기·확인): 따뜻한 노랑 */
  --hint-bg:#dcf1e2; --block:#d97200; --block-bg:#ffe4bd; --block-text:#7a4200;
  --fs:19px; --val:0.52; --notefs:0.24;
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#15171b; --surface:#1f2228; --surface-2:#2a2e36;
    --text:#f3f3f3; --muted:#c2c2c2;
    --line:#4b505a; --line-strong:#e6e6e6;
    --given:#f3f3f3; --user:#7fb0ff; --wrong:#ff7b73; --wrong-bg:#5a1e1b;
    --sel:#2f63d6; --sel-text:#ffffff; --sel-note:#dce6ff; --rel:#2b2e34; --same:#2f4a7d; --note:#e0e0e0; --note-hl-bg:#4a7bd4; --note-hl:#ffffff; --memo-cell:#22324a;
    --accent:#6ea4ff; --accent-text:#0b1220; --accent-soft:#24375a; --memo-pick-bg:#1f3a5c; --memo-pick-border:#5e95d6;
    --ok:#5fd17f; --shadow:0 2px 10px rgba(0,0,0,.4);
  --hint-bg:#1d3826; --block:#ffb04a; --block-bg:#4a3212; --block-text:#ffd59a;
  --cta:#e9b949; --cta-border:#e9b949; --cta-text:#2a1c0c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"]{
  --bg:#15171b; --surface:#1f2228; --surface-2:#2a2e36;
  --text:#f3f3f3; --muted:#c2c2c2;
  --line:#4b505a; --line-strong:#e6e6e6;
  --given:#f3f3f3; --user:#7fb0ff; --wrong:#ff7b73; --wrong-bg:#5a1e1b;
  --sel:#2f63d6; --sel-text:#ffffff; --sel-note:#dce6ff; --rel:#2b2e34; --same:#2f4a7d; --note:#e0e0e0; --note-hl-bg:#4a7bd4; --note-hl:#ffffff; --memo-cell:#22324a;
  --accent:#6ea4ff; --accent-text:#0b1220; --accent-soft:#24375a; --memo-pick-bg:#1f3a5c; --memo-pick-border:#5e95d6;
  --ok:#5fd17f; --shadow:0 2px 10px rgba(0,0,0,.4);
  --hint-bg:#1d3826; --block:#ffb04a; --block-bg:#4a3212; --block-text:#ffd59a;
  --cta:#e9b949; --cta-border:#e9b949; --cta-text:#2a1c0c;
  color-scheme: dark;
}
:root[data-size="large"]{ --fs:22px; --val:0.62; --notefs:0.285; }
:root[data-size="xlarge"]{ --fs:25px; --val:0.72; --notefs:0.32; }

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--text);
  font-family:"Pretendard","Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",system-ui,-apple-system,sans-serif;
  font-size:var(--fs); line-height:1.4;
  -webkit-tap-highlight-color:transparent;
  min-height:100vh;
}
:root{--vh:100vh}
@supports (height:100dvh){ :root{--vh:100dvh} }
button{font:inherit;color:inherit;cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation}
button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

.app{max-width:1200px;margin:0 auto;padding:14px 16px 32px}
@media (max-width:480px){ .app{padding:10px max(8px, env(safe-area-inset-right, 0px)) 12px max(8px, env(safe-area-inset-left, 0px))} }
/* 제목 바로 옆에 작은 아이콘 버튼(아이콘 + 작은 글자) */
header{display:flex;align-items:center;gap:12px;margin-bottom:10px}
h1{font-size:1.4em;margin:0;letter-spacing:-.02em;white-space:nowrap}
.head-btns{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:6px}   /* 버튼 너비를 가장 긴 글자(고급풀이)에 맞춰 모두 똑같이 */
.head-btns .icon-btn{white-space:nowrap}
.icon-btn{
  display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;
  min-width:50px;height:48px;padding:3px 6px;
  background:var(--surface);border:2px solid var(--line);border-radius:12px;
  font-size:.58em;font-weight:700;color:var(--muted);line-height:1.1;
}
.icon-btn svg{width:20px;height:20px;color:var(--text)}

/* 난이도 버튼: 누르면 난이도 고르기 창 */
.diff-btn{
  display:inline-flex;align-items:center;gap:6px;
  background:var(--accent-soft);color:var(--accent);border:2px solid var(--accent);border-radius:12px;
  padding:4px 10px 4px 12px;min-height:44px;font-weight:800;
}
.diff-btn .lbl{color:var(--accent);font-weight:600;margin:0}
.diff-btn svg{width:16px;height:16px}
.diff-list{display:grid;gap:8px}
.diff-opt{
  display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;
  padding:12px 16px;border:2px solid var(--line);border-radius:14px;background:var(--surface);min-height:66px;
}
.diff-opt b{font-size:1.1em}
.diff-opt small{color:var(--muted);font-size:.78em;font-weight:600}
.diff-opt.active{border-color:var(--accent);background:var(--accent-soft)}
.diff-opt.active b::after{content:"  ✓ 지금 난이도";font-size:.72em;color:var(--accent)}

.main{display:grid;grid-template-columns:1fr;gap:10px;align-items:start}
/* 화면에 맞춘 자동 배치 — 어떤 화면이든 스크롤 없이 한 화면에 들어오도록
   - 세로 화면: [윗줄: 난이도·실수·시간·메뉴] → 판 → 숫자 → 도구 → [일괄 채우기 | 다시 하기 | 새 게임]
   - 넓은 화면·가로 화면: 왼쪽 판, 오른쪽 버튼 묶음 (버튼 묶음 높이 = 판 높이) */
@media (max-width:899px) and (orientation:portrait){
  .board-col{width:100%;max-width:max(260px, calc(var(--vh) - 299px));margin:0 auto}
}
@media (min-width:900px), (orientation:landscape) and (min-width:600px){
  :root{--bw:clamp(280px, min(calc(var(--vh) - 96px), calc(100vw - 400px)), 760px)}
  .app{max-width:calc(var(--bw) + 400px);padding-bottom:14px}
  .main{grid-template-columns:var(--bw) minmax(300px,1fr);gap:16px}
  .board-col{width:100%}
}

/* 윗줄: 제목·아이콘 + 난이도·실수·시간 */
.status{display:flex;align-items:center;gap:14px;margin-left:auto;font-weight:700;font-size:.95em;white-space:nowrap}
.status .lbl{color:var(--muted);font-weight:600;margin-right:4px}
.status .mist.bad{color:var(--wrong)}
.timer-wrap{display:flex;align-items:center;gap:6px}
.timer{font-variant-numeric:tabular-nums;min-width:4ch;text-align:right}
.pause-btn{
  background:var(--surface);border:2px solid var(--line);border-radius:10px;
  width:40px;height:40px;display:inline-flex;align-items:center;justify-content:center;padding:0;
}
.pause-btn svg{width:20px;height:20px}
.menu-btn{display:none}
@media (max-width:899px) and (orientation:portrait){
  h1{display:none}
  header{gap:8px;margin-bottom:8px}
  .status{order:-1;margin-left:0;gap:10px;font-size:.85em}
  .head-btns{margin-left:auto}
  .diff-btn{min-height:40px;padding:2px 8px 2px 10px}
  .diff-btn .lbl{display:none}
  .timer{font-size:.9em}
  .pause-btn{width:36px;height:36px}
  .pause-btn svg{width:18px;height:18px}
}
@media (max-width:599px) and (orientation:portrait){
  #btnHelp,#btnSound,#btnStats,#btnSettings{display:none}
  .menu-btn{display:inline-flex}
}

.board-box{position:relative;width:100%;margin:0 auto}
.board{
  /* 가로·세로 9칸을 모두 같은 크기로 고정 (숫자가 하나도 없는 줄이 납작해지지 않게) */
  display:grid;grid-template-columns:repeat(9,minmax(0,1fr));grid-template-rows:repeat(9,minmax(0,1fr));
  width:100%;aspect-ratio:1/1;
  border:3px solid var(--line-strong);border-radius:6px;overflow:hidden;
  background:var(--surface);box-shadow:var(--shadow);
  container-type:inline-size;
}
.cell{
  position:relative;display:flex;align-items:center;justify-content:center;
  border-right:1px solid var(--line);border-bottom:1px solid var(--line);
  background:var(--surface);cursor:pointer;-webkit-user-select:none;user-select:none;touch-action:manipulation;
  font-size:calc(100cqw / 9 * var(--val));
  font-weight:500;line-height:1;
}
.cell:nth-child(9n){border-right:none}
.cell:nth-child(9n+3),.cell:nth-child(9n+6){border-right:3px solid var(--line-strong)}
.cell.rb{border-bottom:3px solid var(--line-strong)}
.cell.lastrow{border-bottom:none}
.cell.rel{background:var(--rel)}
.cell.same{background:var(--same)}
.cell.memo-hit{background:var(--memo-cell)}
.cell.sel{background:var(--sel)}
.cell.wrong{background:var(--wrong-bg)}
.cell.wrong.sel{background:var(--sel)}
.cell .val{display:none}
.cell.has-val .val{display:block}
.cell.given .val{color:var(--given);font-weight:500}
.cell.user .val{color:var(--user);font-weight:500}
.cell.wrong .val{color:var(--wrong);text-decoration:underline;text-decoration-thickness:.07em;text-underline-offset:.08em}
.cell.pop .val{animation:pop .22s ease-out}
@keyframes pop{0%{transform:scale(.6)}70%{transform:scale(1.12)}100%{transform:scale(1)}}
.cell.flash{animation:flash .6s ease-out}
@keyframes flash{0%{box-shadow:inset 0 0 0 100px rgba(19,122,52,.35)}100%{box-shadow:inset 0 0 0 100px rgba(19,122,52,0)}}
.notes{
  position:absolute;inset:2px;display:none;
  grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);
}
.cell:not(.has-val) .notes{display:grid}
.notes span{
  display:flex;align-items:center;justify-content:center;
  font-size:calc(100cqw / 9 * var(--notefs));font-weight:500;color:var(--note);
  line-height:1;border-radius:4px;
}
.notes span.hl{background:var(--note-hl-bg);color:var(--note-hl);font-weight:800;border-radius:6px;transform:scale(1.12);box-shadow:0 1px 2px rgba(0,0,0,.2)}
.cell.sel .val,.cell.sel.wrong .val{color:var(--sel-text)}
.cell.sel .notes span{color:var(--sel-note)}
.cell.sel .notes span.hl{background:var(--sel-text);color:var(--sel)}
/* 힌트: 초록 = 답이 들어갈 칸과 살펴볼 줄, 주황 = 이유가 되는 숫자, ✕ = 안 되는 칸 */
.cell.h-unit{background:var(--hint-bg)}
.cell.h-block{background:var(--block-bg);box-shadow:inset 0 0 0 3px var(--block);animation:blockPulse .7s ease-out}
@keyframes blockPulse{0%{box-shadow:inset 0 0 0 10px var(--block)}100%{box-shadow:inset 0 0 0 3px var(--block)}}
.cell.h-block .val{color:var(--block-text);font-weight:700}
.cell.h-x::after{
  content:"✕";position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  color:var(--wrong);font-size:calc(100cqw / 9 * .5);font-weight:700;opacity:.8;animation:hintIn .45s ease-out;
}
.cell.h-x .notes{opacity:.25}
.cell.h-target{background:var(--ok);z-index:1;animation:hintPop .6s ease-out}
.cell.h-target .val{color:#fff;font-weight:700}
@keyframes hintPop{0%{transform:scale(1.35);box-shadow:0 0 0 0 rgba(19,122,52,.6)}60%{transform:scale(.95)}100%{transform:scale(1);box-shadow:0 0 0 10px rgba(19,122,52,0)}}
@keyframes hintIn{from{opacity:0}to{opacity:1}}
@media (prefers-reduced-motion:reduce){ .cell.h-target,.cell.h-block,.cell.h-x::after{animation:none} }
.hc-chip,.hc-left,.hc-ok{white-space:nowrap}
@media (max-width:899px) and (orientation:portrait){
  /* 휴대폰: 카드 크기는 버튼 묶음 자리 그대로, 설명 글만 안에서 넘기고 ◀ ▶ 버튼은 항상 보이게 */
  .hint-card{padding:8px 12px;gap:4px;border-width:2px;overflow:hidden}
  .hc-text{flex:1 1 auto;min-height:0;overflow:auto}
  .hc-nav{flex:none;padding-top:4px}
  /* 설명을 보는 동안만, 화면이 낮은 휴대폰에서는 판을 조금 줄여 설명 칸을 넓힘 */
  .app.hinting .board-col{max-width:max(250px, calc(var(--vh) - 380px))}
}
@media (max-width:899px) and (orientation:portrait) and (max-height:700px){
  /* 낮은 휴대폰(예: 360×640)에서만 설명 글씨를 조금 작게 */
  .hint-card .hc-title{font-size:.92em}
  .hint-card .hc-text{font-size:.76em;line-height:1.45}
  .hint-card .hc-ok{min-height:36px;padding:4px 14px}
}

/* 힌트 설명 카드 (버튼 묶음 위에 덮어서 판은 그대로 보이게) */
.controls{position:relative}
.hint-card{
  position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;gap:6px;overflow:auto;
  background:var(--surface);border:3px solid var(--ok);border-radius:16px;padding:10px 14px;box-shadow:var(--shadow);
}
.hint-card[hidden]{display:none}
.hc-head{display:flex;align-items:center;gap:8px;min-width:0}
.hc-chip{overflow:hidden;text-overflow:ellipsis;min-width:0}
.hc-ok{flex:none}
.hc-chip{background:var(--ok);color:#fff;border-radius:8px;padding:2px 8px;font-size:.72em;font-weight:800}
.hc-left{color:var(--muted);font-size:.72em;font-weight:700}
.hc-ok{margin-left:auto;background:var(--accent);color:var(--accent-text);border:none;border-radius:10px;padding:6px 16px;font-weight:800;font-size:.85em;min-height:40px}
.hc-title{font-weight:800;font-size:1.05em;line-height:1.3}
.hc-text{font-size:.86em;line-height:1.5;color:var(--text)}
.hc-g{color:var(--ok);font-weight:800}
.hc-o{color:var(--block);font-weight:800}
.hc-x{color:var(--wrong);font-weight:800}
.tool.used{opacity:.45}
@media (min-width:900px){ .hint-card{padding:16px 18px;gap:10px} .hc-title{font-size:1.3em} .hc-text{font-size:1em;line-height:1.6} }
.board.paused .cell .val,.board.paused .cell .notes{visibility:hidden}

.overlay{
  position:absolute;inset:0;display:none;align-items:center;justify-content:center;flex-direction:column;gap:14px;
  background:color-mix(in srgb,var(--bg) 70%,transparent);border-radius:6px;text-align:center;padding:16px;
}
.overlay.show{display:flex}
.overlay .big{font-size:1.3em;font-weight:800}
.spinner{width:48px;height:48px;border:5px solid var(--surface-2);border-top-color:var(--accent);border-radius:50%;animation:spin .9s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.controls{display:flex;flex-direction:column;gap:12px;max-width:600px;width:100%;margin:0 auto}
.tools{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.tool{
  position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  background:var(--surface);border:2px solid var(--line);border-radius:14px;
  padding:10px 4px;min-height:76px;font-size:.82em;font-weight:700;
}
.tool svg{width:1.7em;height:1.7em}
.tool .badge{
  position:absolute;top:5px;right:6px;font-size:.72em;font-weight:800;
  padding:1px 6px;border-radius:8px;background:var(--surface-2);color:var(--muted);
}
.tool.on{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.tool.on .badge{background:var(--accent);color:var(--accent-text)}
.tool:disabled{opacity:.4;cursor:default}
@media (max-width:899px){
  .num .unit{display:none}
  .tools{grid-template-columns:repeat(6,1fr);gap:6px}
  .tool{min-height:64px;font-size:.66em;padding:6px 2px;line-height:1.15;text-align:center;word-break:keep-all}
  .tool svg{width:1.9em;height:1.9em}
  .tool .badge{top:2px;right:2px;font-size:.78em;padding:0 4px}
}

.bulk{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  width:100%;min-height:64px;border-radius:14px;border:2px solid var(--line);
  background:var(--surface);font-weight:800;font-size:1em;padding:8px;
}
.bulk small{font-weight:600;font-size:.72em;color:var(--muted)}
.bulk.ready{background:var(--ok);border-color:var(--ok);color:#fff;animation:pulse 1.6s ease-in-out infinite}
.bulk.ready small{color:#eaffef}
.bulk:disabled{cursor:default}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(19,122,52,.5)}50%{box-shadow:0 0 0 8px rgba(19,122,52,0)}}

/* 빠른 입력이 켜져 있을 때: 윗줄의 파란 표시 + 판 파란 테두리 (버튼 배치는 그대로) */
.quick-chip{
  display:inline-flex;align-items:center;gap:5px;min-height:36px;
  background:var(--accent);color:var(--accent-text);border-radius:999px;padding:3px 6px 3px 9px;
  font-weight:800;font-size:.9em;
}
.quick-chip[hidden]{display:none}
.quick-chip svg{width:18px;height:18px;flex:none}
.quick-chip b{background:var(--accent-text);color:var(--accent);border-radius:999px;padding:1px 9px;min-width:1.7em;text-align:center}
.board.quick{border-color:var(--accent);box-shadow:0 0 0 4px var(--accent-soft), var(--shadow)}
@media (max-width:899px) and (orientation:portrait){
  .quick-chip{min-height:32px;padding:2px 4px 2px 6px;font-size:.85em;gap:3px}
  .quick-chip .qc-label{display:none}
  .quick-chip svg{width:16px;height:16px}
}

.numpad{display:grid;grid-template-columns:repeat(9,1fr);gap:5px}
@media (min-width:900px){ .numpad{grid-template-columns:repeat(3,1fr);gap:8px} }
.num{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:var(--surface);border:2px solid var(--line);border-radius:12px;
  min-height:72px;padding:4px 0;
}
.num b{font-size:1.65em;line-height:1;color:var(--user);font-weight:700}
.num small{font-size:.65em;color:var(--muted);font-weight:700;margin-top:4px}
@media (min-width:900px){ .num{min-height:84px} .num b{font-size:2em} }
.num.picked{background:var(--accent);border-color:var(--accent)}
.num.picked b,.num.picked small{color:var(--accent-text)}
.num.done{opacity:.3}
.num.memo b{color:var(--muted)}
.num.memo.picked{background:var(--memo-pick-bg);border-color:var(--memo-pick-border)}
.num.memo.picked b,.num.memo.picked small{color:var(--muted)}

/* 맨 아래 줄: 일괄 채우기 + 다시 하기 + 새 게임 */
.end-row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.end-row .bulk{grid-column:1 / -1}
.bottom-btns{display:contents}
@media (max-width:899px) and (orientation:portrait), (orientation:landscape) and (max-height:560px){
  .end-row{grid-template-columns:2fr 1fr 1fr}
  .end-row .bulk{grid-column:auto;min-height:52px;padding:4px}
  .bulk small{display:none}
  .end-row .wide-btn{min-height:52px;font-size:.8em;padding:0 4px}
}
.wide-btn{
  background:var(--surface);border:2px solid var(--line);border-radius:12px;
  min-height:56px;font-weight:700;font-size:.92em;
}
.wide-btn.primary{background:var(--cta);border-color:var(--cta-border);color:var(--cta-text)}

.toast{
  position:fixed;left:50%;top:16px;transform:translateX(-50%) translateY(-20px);width:max-content;
  background:var(--text);color:var(--bg);padding:12px 20px;border-radius:12px;
  font-weight:700;font-size:.92em;opacity:0;pointer-events:none;transition:.2s;max-width:calc(100vw - 32px);text-align:center;z-index:50;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.5);display:none;align-items:center;justify-content:center;padding:16px;z-index:40}
.modal-bg.show{display:flex}
.modal{
  background:var(--surface);border-radius:18px;padding:22px 20px;width:100%;max-width:440px;
  max-height:calc(100vh - 32px);overflow:auto;box-shadow:0 10px 40px rgba(0,0,0,.3);
}
.modal h2{margin:0 0 12px;font-size:1.25em}
.modal p{margin:0 0 14px;color:var(--muted)}
.modal .btns{display:flex;gap:8px;margin-top:16px}
.modal .btns button{flex:1}
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.stat{background:var(--surface-2);border-radius:12px;padding:10px 12px}
.stat .k{font-size:.75em;color:var(--muted);font-weight:700}
.stat .v{font-size:1.2em;font-weight:800}
.setting{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid var(--line)}
.setting:last-child{border-bottom:none}
.setting .t{font-weight:700}
.setting .d{font-size:.75em;color:var(--muted)}
.switch{position:relative;width:62px;height:36px;flex:none;border-radius:18px;border:2px solid var(--line);background:var(--surface-2);padding:0}
.switch::after{content:"";position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:var(--muted);transition:.15s}
.switch.on{background:var(--accent);border-color:var(--accent)}
.switch.on::after{left:29px;background:var(--accent-text)}
.seg{display:flex;gap:4px;flex:none}
.seg button{border:2px solid var(--line);background:var(--surface);border-radius:10px;padding:6px 10px;font-weight:700;font-size:.8em;min-height:42px}
.seg button.active{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}
table.stats{width:100%;border-collapse:collapse;font-size:.85em}
table.stats th,table.stats td{padding:8px 4px;text-align:center;border-bottom:1px solid var(--line)}
table.stats th{color:var(--muted)}
table.stats td:first-child,table.stats th:first-child{text-align:left;font-weight:700}
.help-list{margin:0;padding-left:1.1em}
.help-list li{margin-bottom:8px}
.help-list b{color:var(--accent)}
kbd{background:var(--surface-2);border-radius:6px;padding:1px 6px;font-family:inherit;font-weight:700;font-size:.85em}
/* 버튼 묶음 크기 (다른 규칙보다 뒤에 둬야 적용됨) */
@media (min-width:900px), (orientation:landscape) and (min-width:600px){
  .controls{
    height:var(--bw);max-width:none;margin:0;display:grid;gap:10px;
    grid-template-rows:minmax(0,3fr) minmax(0,2fr) auto;
  }
  .numpad{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,minmax(0,1fr));gap:8px}
  .num{min-height:0}
  .tools{grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(2,minmax(0,1fr))}
  .tool{min-height:0}
}
@media (max-width:899px) and (orientation:portrait){
  .app{padding-bottom:12px}
  .controls{gap:8px}
  .num{min-height:58px}
  /* 도구 버튼은 작게 (숫자 버튼 크기는 그대로) */
  .tool{min-height:48px;padding:3px 1px;font-size:.58em;gap:2px;white-space:nowrap;word-spacing:-.2em;letter-spacing:-.03em}
  .tool svg{width:1.6em;height:1.6em}
  .end-row .bulk,.end-row .wide-btn{min-height:46px}
  /* 판 선은 얇게 */
  .board{border-width:2px}
  .cell{border-right-width:.5px;border-bottom-width:.5px}
  .cell:nth-child(9n+3),.cell:nth-child(9n+6){border-right-width:2px}
  .cell.rb{border-bottom-width:2px}
  /* 메모는 PC보다 크게 */
  .notes{inset:1px}
  :root{--notefs:.28}
  :root[data-size="large"]{--notefs:.32}
  :root[data-size="xlarge"]{--notefs:.34}
}
/* 가로로 눕힌 휴대폰 (맨 끝에 둬서 다른 규칙보다 우선) */
@media (orientation:landscape) and (max-height:560px) and (min-width:600px){
  :root{--bw:clamp(220px, min(calc(var(--vh) - 66px), calc(100vw - 380px)), 760px)}
  .app{padding-top:8px;padding-bottom:8px;max-width:calc(var(--bw) + 440px)}
  header{margin-bottom:6px;gap:8px}
  h1{font-size:1.1em}
  .icon-btn{height:38px;min-width:42px}
  .icon-btn svg{width:17px;height:17px}
  .status{font-size:.82em;gap:10px}
  .diff-btn{min-height:36px;padding:2px 8px}
  .diff-btn .lbl{display:none}
  .pause-btn{width:34px;height:34px}
  .controls{gap:6px;grid-template-rows:minmax(0,1fr) minmax(0,1fr) auto}
  .numpad{grid-template-columns:repeat(9,1fr);grid-template-rows:minmax(0,1fr);gap:4px}
  .num b{font-size:1.45em}
  .num .unit{display:none}
  .tools{grid-template-columns:repeat(6,1fr);grid-template-rows:minmax(0,1fr);gap:6px}
  .tool{font-size:.68em;padding:4px 2px}
  .tool svg{width:1.4em;height:1.4em}
}
/* 가로로 눕힌 휴대폰: 창(난이도·도움·기록)이 한 화면에 들어가도록 두 줄 배치 */
@media (orientation:landscape) and (max-height:560px){
  .modal{max-width:min(760px, calc(100vw - 32px));padding:14px 18px}
  .picker-note{display:none}
  .modal h2{margin-bottom:8px}
  .modal p{margin-bottom:8px}
  .modal .btns{margin-top:10px}
  .diff-list{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}
  .diff-opt{min-height:0;padding:8px 12px}
  .diff-opt small{font-size:.72em}
  table.stats{font-size:.78em}
  table.stats th,table.stats td{padding:3px 4px}
  table.stats th br{display:none}
  .stats-note{display:none}
}
/* 휴대폰: 숫자 모양을 기기 글꼴과 상관없이 똑같이 (휴대폰 글꼴에 따라 9 꼬리가 잘려 보이는 문제) */
@media (max-width:899px), (orientation:landscape) and (max-height:560px){
  .board,.numpad,.status{font-family:"Inter","Pretendard","Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",system-ui,-apple-system,sans-serif}
}
/* 소리 조절 창 */
.snd-block{display:flex;flex-direction:column;gap:10px;padding:14px 0;border-bottom:1px solid var(--line)}
.snd-block:last-of-type{border-bottom:none}
.snd-head{display:flex;align-items:center;justify-content:space-between;gap:12px}
.snd-head b{font-size:1.05em}
.snd-head small{display:block;color:var(--muted);font-size:.72em;font-weight:600}
.snd-slider{display:flex;align-items:center;gap:10px}
.snd-slider svg{width:22px;height:22px;flex:none;color:var(--muted)}
.snd-val{min-width:3.2em;text-align:right;font-weight:800;font-variant-numeric:tabular-nums}
.snd-range{
  -webkit-appearance:none;appearance:none;flex:1;min-width:0;height:12px;border-radius:6px;margin:10px 0;
  background:linear-gradient(to right,var(--accent) var(--p,50%),var(--surface-2) var(--p,50%));outline:none;cursor:pointer;
}
.snd-range:disabled{opacity:.4;cursor:default}
.snd-range::-webkit-slider-thumb{-webkit-appearance:none;width:32px;height:32px;border-radius:50%;background:var(--accent);border:4px solid var(--surface);box-shadow:0 1px 5px rgba(0,0,0,.35)}
.snd-range::-moz-range-thumb{width:26px;height:26px;border-radius:50%;background:var(--accent);border:4px solid var(--surface);box-shadow:0 1px 5px rgba(0,0,0,.35)}
.snd-range:focus-visible{outline:3px solid var(--accent);outline-offset:4px}
.snd-mute{
  flex:none;width:44px;height:44px;padding:0;display:inline-flex;align-items:center;justify-content:center;
  border:2px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);
}
.snd-slider .snd-mute svg{width:24px;height:24px;color:inherit}
.snd-mute.off{color:var(--wrong);border-color:var(--wrong);background:var(--wrong-bg)}
.snd-test{align-self:flex-start;border:2px solid var(--line);background:var(--surface);border-radius:10px;padding:6px 14px;font-weight:700;font-size:.8em;min-height:40px}
/* 완성 축하: 판 물결 + 폭죽 + 트로피 */
.cell.win-wave{animation:winWave .7s ease-out var(--d,0ms) both}
@keyframes winWave{
  0%{transform:scale(1);background:var(--surface)}
  35%{transform:scale(1.18);background:#ffe08a;z-index:2}
  70%{transform:scale(.96);background:#fff3c4}
  100%{transform:scale(1)}
}
.fx-canvas{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:39}
.modal-bg.celebrate{background:rgba(0,0,0,.18)}
.modal.win-pop{animation:winPop .55s cubic-bezier(.2,1.5,.4,1) both}
@keyframes winPop{0%{transform:scale(.6);opacity:0}100%{transform:scale(1);opacity:1}}
.win-badge{position:relative;width:110px;height:110px;margin:0 auto 6px}
.win-badge .rays{position:absolute;inset:0;border-radius:50%;
  background:repeating-conic-gradient(from 0deg,#ffd75e 0 12deg,transparent 12deg 30deg);
  opacity:.55;animation:spin 8s linear infinite;
  -webkit-mask:radial-gradient(circle,transparent 30%,#000 31%,#000 68%,transparent 70%);
          mask:radial-gradient(circle,transparent 30%,#000 31%,#000 68%,transparent 70%)}
.win-badge svg.trophy{position:absolute;inset:18px;width:74px;height:74px;animation:trophyBounce 1.2s ease-in-out .3s infinite}
@keyframes trophyBounce{0%,100%{transform:translateY(0) rotate(0)}25%{transform:translateY(-8px) rotate(-6deg)}50%{transform:translateY(0) rotate(0)}75%{transform:translateY(-4px) rotate(5deg)}}
.win-badge .star{position:absolute;width:18px;height:18px;color:#ffb400;animation:twinkle 1.4s ease-in-out infinite}
.win-badge .star:nth-of-type(2){top:4px;left:2px;animation-delay:.2s}
.win-badge .star:nth-of-type(3){top:10px;right:0;animation-delay:.6s;width:14px;height:14px}
.win-badge .star:nth-of-type(4){bottom:8px;left:-4px;animation-delay:1s;width:12px;height:12px}
.win-badge .star:nth-of-type(5){bottom:2px;right:4px;animation-delay:.4s}
@keyframes twinkle{0%,100%{transform:scale(.5);opacity:.3}50%{transform:scale(1.15);opacity:1}}
.modal h2.win-title{text-align:center;font-size:1.6em;margin-bottom:6px}
.modal p.win-sub{text-align:center}
@media (prefers-reduced-motion:reduce){
  .cell.win-wave,.modal.win-pop,.win-badge .rays,.win-badge svg.trophy,.win-badge .star{animation:none}
}
/* 힌트 단계 설명: 판 위에 후보 숫자를 보여주고, 근거는 주황, 지우는 후보는 빨간 줄 */
.notes span.hp{background:var(--block);color:#fff;font-weight:800;border-radius:5px}
.notes span.hx{color:var(--wrong);font-weight:800;text-decoration:line-through;text-decoration-thickness:2px}
.cell.h-elim{background:var(--wrong-bg)}
.cell.h-show .notes span{color:var(--text)}
/* 지금 이야기하는 칸(파란 테두리) */
.cell.h-focus{box-shadow:inset 0 0 0 3px var(--accent);z-index:1}
.hc-b{color:var(--accent);font-weight:800}
.hc-more{display:block;margin-top:4px;color:var(--muted);font-size:.9em}
/* 달인: 같은 줄·칸에 같은 숫자가 두 번 (규칙 어긋남만 표시) */
.cell.conflict{background:var(--wrong-bg)}
.cell.conflict .val{color:var(--wrong)}
.cell.conflict.sel{background:var(--sel)}
.cell.conflict.sel .val{color:var(--sel-text)}
/* 도움 고르기 창 */
.diff-opt:disabled{opacity:.45;cursor:default}
.help-done{background:var(--hint-bg);color:var(--ok);border-radius:12px;padding:10px 12px;text-align:center;font-weight:800;margin:4px 0 0}
.help-done.got{background:var(--surface-2);color:var(--text)}
/* 오래 쉬고 있을 때 힌트 옆 말풍선 */
.nudge{
  position:fixed;z-index:30;width:max-content;max-width:min(300px,calc(100vw - 24px));
  background:var(--surface);color:var(--text);border:2px solid var(--ok);border-radius:14px;
  padding:10px 14px;font-weight:700;font-size:.85em;line-height:1.45;box-shadow:var(--shadow);
  animation:tutIn .4s ease-out;
}
.nudge[hidden]{display:none}
.nudge::after{
  content:"";position:absolute;left:calc(var(--ax,50%) - 9px);bottom:-10px;width:16px;height:16px;
  background:var(--surface);border-right:2px solid var(--ok);border-bottom:2px solid var(--ok);transform:rotate(45deg);
}
.nudge.below::after{bottom:auto;top:-10px;transform:rotate(225deg)}
.tool.glow{border-color:var(--ok);animation:softGlow 2.2s ease-in-out infinite}
@keyframes softGlow{0%,100%{box-shadow:0 0 0 0 rgba(19,122,52,.35)}50%{box-shadow:0 0 0 7px rgba(19,122,52,.08)}}
@media (prefers-reduced-motion:reduce){ .tool.glow,.nudge{animation:none} }
.hc-nav{display:flex;align-items:center;gap:8px;margin-top:auto;padding-top:6px}
.hc-nav[hidden]{display:none}
.hc-btn{flex:1;min-height:42px;border-radius:10px;border:2px solid var(--line);background:var(--surface);font-weight:800;font-size:.85em}
.hc-btn.primary{background:var(--ok);border-color:var(--ok);color:#fff}
.hc-btn:disabled{opacity:.35}
.hc-step{font-weight:800;color:var(--muted);font-size:.8em;min-width:3em;text-align:center}
@media (max-width:899px) and (orientation:portrait){ .hc-btn{min-height:36px} }
/* 튜토리얼: 어둡게 덮고 볼 곳만 밝게, 노란 테두리 + 손가락, 설명 카드 */
.tut{position:fixed;inset:0;z-index:70;pointer-events:none}
.tut-dim{position:fixed;background:rgba(12,16,28,.6);pointer-events:auto;transition:all .35s ease}
.tut-hole{position:fixed;pointer-events:auto;background:transparent}
.tut-ring{position:fixed;border:3px solid #ffd54a;border-radius:12px;pointer-events:none;transition:all .35s ease;animation:tutPulse 1.6s ease-in-out infinite}
.tut-hand{position:fixed;font-size:40px;line-height:1;pointer-events:none;animation:tutHand 1s ease-in-out infinite;filter:drop-shadow(0 2px 3px rgba(0,0,0,.4))}
.tut-hand[hidden],.tut-ring[hidden],.tut-hole[hidden]{display:none}
.tut-card{
  position:fixed;width:min(440px,calc(100vw - 24px));background:var(--surface);color:var(--text);
  border:3px solid var(--accent);border-radius:18px;padding:14px 16px;box-shadow:0 12px 40px rgba(0,0,0,.35);
  pointer-events:auto;transition:top .35s ease,left .35s ease;animation:tutIn .35s ease-out;
}
.tut-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.tut-count{font-size:.75em;color:var(--muted);font-weight:800}
.tut-bar{flex:1;height:6px;border-radius:3px;background:var(--surface-2);overflow:hidden}
.tut-bar i{display:block;height:100%;background:var(--accent);transition:width .35s}
.tut-exit{border:2px solid var(--line);background:var(--surface);border-radius:10px;padding:2px 12px;font-weight:800;font-size:.8em;min-height:38px}
.tut-title{font-size:1.15em;font-weight:800;margin:10px 0 6px;line-height:1.35}
.tut-text{font-size:.95em;line-height:1.65}
.tut-text b{color:var(--accent)}
.tut-text small{display:block;margin-top:6px;color:var(--muted);font-size:.85em}
.tut-msg{margin-top:8px;padding:8px 10px;border-radius:10px;font-weight:800;font-size:.88em}
.tut-msg[hidden]{display:none}
.tut-msg.ok{background:var(--hint-bg);color:var(--ok)}
.tut-msg.retry{background:var(--wrong-bg);color:var(--wrong)}
.tut-btns{display:flex;gap:8px;margin-top:12px}
.tut-btns button{flex:1;min-height:48px;border-radius:12px;font-weight:800;border:2px solid var(--line);background:var(--surface)}
.tut-btns .tut-next{background:var(--cta);border-color:var(--cta-border);color:var(--cta-text)}
.tut-btns button[hidden]{display:none}
.tut-wait{flex:1;text-align:center;align-self:center;color:var(--muted);font-weight:700;font-size:.85em}
.tut-wait[hidden]{display:none}
.tut-card.compact .tut-btns{margin-top:6px}   /* 숫자 고르는 단계: 카드는 작게, ◀ 이전은 그대로 */
.tut-card.compact .tut-btns button{min-height:40px}
.cell.tut-hl{animation:tutSweep .55s ease-out var(--d,0ms) both}
.cell.tut-hl .val{color:#111}
.cell.sel.tut-hl{animation:none;background:var(--sel)}
.cell.sel.tut-hl .val{color:var(--sel-text)}
@keyframes tutSweep{0%{background:var(--surface)}50%{background:#ffe08a;transform:scale(1.07)}100%{background:#fff1bd}}
@keyframes tutPulse{0%,100%{box-shadow:0 0 0 3px rgba(255,213,74,.35)}50%{box-shadow:0 0 0 10px rgba(255,213,74,.12)}}
@keyframes tutHand{0%,100%{transform:translateY(0)}50%{transform:translateY(-10px)}}
@keyframes tutIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){ .tut-ring,.tut-hand,.cell.tut-hl,.tut-card{animation:none} }
@media (max-width:899px){
  .tut-card{padding:10px 12px;border-width:2px}
  .tut-title{font-size:1.02em;margin:6px 0 4px}
  .tut-text{font-size:.88em;line-height:1.55}
  .tut-btns{margin-top:8px}
  .tut-btns button{min-height:44px}
  .tut-exit{min-height:34px}
}
/* ---------- 칭호(업적) ---------- */
:root{--t-b:#b9875a;--t-s:#8f9bab;--t-g:#d4a72c;--t-p:#7a8fd0;--t-r:conic-gradient(#e9a0a0,#ecc98a,#b9d98f,#8fc7d9,#a9a0e0,#e9a0a0)}
/* 기록 창 위쪽 [기록] [칭호] 고르기 */
.tabs{display:flex;gap:6px;margin:0 0 12px;background:var(--surface-2);border-radius:12px;padding:4px}
.tabs button{flex:1;border:none;background:transparent;border-radius:9px;min-height:44px;font-weight:800;font-size:.9em;color:var(--muted)}
.tabs button small{font-size:.75em;font-weight:700}
.tabs button.active{background:var(--surface);color:var(--accent);box-shadow:0 1px 4px rgba(0,0,0,.12)}
/* 새 칭호 축하 창 */
.achv-pop{text-align:center}
.achv-big{position:relative;width:104px;height:104px;margin:0 auto 4px;display:flex;align-items:center;justify-content:center}
.achv-big .rays{position:absolute;inset:0;border-radius:50%;
  background:repeating-conic-gradient(from 0deg,#ffd75e 0 12deg,transparent 12deg 30deg);opacity:.5;animation:spin 9s linear infinite;
  -webkit-mask:radial-gradient(circle,transparent 34%,#000 35%,#000 68%,transparent 70%);mask:radial-gradient(circle,transparent 34%,#000 35%,#000 68%,transparent 70%)}
.achv-big span{position:relative;width:66px;height:66px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:36px;
  background:var(--surface);box-shadow:0 0 0 5px var(--tc,var(--t-g)),0 4px 14px rgba(0,0,0,.2);animation:achvPop .7s cubic-bezier(.2,1.6,.4,1) .15s both}
.achv-big.t-r span{box-shadow:0 0 0 5px #d9b56a,0 0 0 9px #a9c7e0,0 4px 14px rgba(0,0,0,.2)}
@keyframes achvPop{0%{transform:scale(.3) rotate(-25deg);opacity:0}100%{transform:scale(1) rotate(0);opacity:1}}
.achv-kicker{margin:0 0 2px!important;color:var(--ok)!important;font-weight:800;font-size:.9em}
.modal h2.achv-name{margin:0 0 4px;font-size:1.45em}
.achv-desc{margin:0 0 10px!important;font-size:.85em}
.achv-more{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;margin:0 0 10px}
.achv-chip{display:inline-flex;align-items:center;gap:4px;background:var(--surface-2);border-radius:999px;padding:3px 10px 3px 4px;font-weight:800;font-size:.78em;border:2px solid var(--tc,var(--line))}
.achv-chip i{font-style:normal;font-size:1.15em}
.achv-count{font-weight:700;font-size:.85em;color:var(--muted);display:flex;align-items:center;justify-content:center;gap:8px;flex-wrap:wrap}
.achv-count b{color:var(--text);font-size:1.15em}
.achv-bar{display:inline-block;width:130px;height:10px;border-radius:5px;background:var(--surface-2);overflow:hidden;vertical-align:middle}
.achv-bar i{display:block;height:100%;background:var(--ok);border-radius:5px}
/* 칭호 목록 */
.achv-head{background:var(--surface-2);border-radius:12px;padding:10px 12px;margin-bottom:4px;text-align:center}
.achv-latest{margin:6px 0 0!important;font-size:.82em}
.achv-latest b{color:var(--text)}
.achv-group{font-size:.9em;margin:14px 0 6px;color:var(--muted)}
.achv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:8px}
.achv-card{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:12px;border:2px solid var(--line);background:var(--surface);text-align:left}
.achv-card.got{border-color:var(--tc,var(--line));background:color-mix(in srgb,var(--tc,var(--surface)) 12%,var(--surface))}
.achv-medal{flex:none;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:24px;background:var(--surface);box-shadow:0 0 0 3px var(--tc,var(--line))}
.achv-card.t-r .achv-medal{box-shadow:0 0 0 3px #d9b56a,0 0 0 6px #a9c7e0}
.achv-card.locked .achv-medal{filter:grayscale(1);opacity:.45;box-shadow:0 0 0 3px var(--line)}
.achv-card.locked b{color:var(--muted)}
.achv-txt{min-width:0;display:flex;flex-direction:column;gap:1px;line-height:1.3;word-break:keep-all}
.achv-txt b{font-size:.88em}
.achv-txt small{font-size:.72em;color:var(--muted);font-weight:600}
.achv-txt .achv-day{font-weight:800}
.achv-prog{display:block;height:7px;border-radius:4px;background:var(--surface-2);overflow:hidden;margin-top:3px}
.achv-prog i{display:block;height:100%;background:var(--accent);border-radius:4px}
.t-b{--tc:var(--t-b)} .t-s{--tc:var(--t-s)} .t-g{--tc:var(--t-g)} .t-p{--tc:var(--t-p)} .t-r{--tc:#c9a85e}
@media (prefers-reduced-motion:reduce){ .achv-big .rays,.achv-big span{animation:none} }
/* 가로로 눕힌 휴대폰: 축하 창을 작게 */
@media (orientation:landscape) and (max-height:560px){
  .achv-big{width:70px;height:70px;margin-bottom:0}
  .achv-big span{width:46px;height:46px;font-size:24px}
  .modal h2.achv-name{font-size:1.2em;margin-bottom:2px}
  .achv-desc{margin-bottom:6px!important}
  .tabs{margin-bottom:6px;padding:3px}
  .tabs button{min-height:34px}
  .modal h2.stats-title{display:none}   /* 위 [기록] [칭호] 칸이 제목 역할 */
}
.modal.wide{max-width:min(660px, calc(100vw - 32px))}
/* 칭호와 함께 받는 물건 (나중에 집에 놓을 수 있어요) */
.achv-gift{margin:0 auto 10px!important;max-width:30em;background:color-mix(in srgb,var(--t-g) 14%,var(--surface));border:2px dashed color-mix(in srgb,var(--t-g) 60%,var(--surface));border-radius:12px;padding:6px 10px;font-size:.82em;color:var(--text)!important;font-weight:700;word-break:keep-all}
.achv-gift b{color:var(--text)}
.achv-gift small{display:block;font-size:.85em;color:var(--muted);font-weight:600}
.achv-txt .achv-giftline{color:var(--text);font-weight:700;margin-top:2px}
.achv-card.locked .achv-giftline{color:var(--muted);font-weight:600}
@media (orientation:landscape) and (max-height:560px){
  .achv-gift{margin-bottom:6px!important;padding:3px 8px}
  .achv-gift small{display:none}
  .achv-pop .achv-desc,.achv-pop .achv-more{display:none}   /* 위 제목에 "N개 얻었어요"가 이미 있음 */
}
/* 튜토리얼 (휴대폰 세로): 카드가 볼 곳을 피해 좁은 자리에 들어가면 설명 글만 안에서 넘김 */
@media (max-width:899px) and (orientation:portrait){
  .tut-card{display:flex;flex-direction:column;overflow:hidden}
  .tut-card > *{flex:none}
  .tut-card > .tut-text{flex:0 1 auto;min-height:2.6em;overflow:auto}
  .tut-title{margin:4px 0 2px}
  .tut-msg{margin-top:4px;padding:5px 8px}
}
.tut-more{font-size:.75em;font-weight:800;color:var(--accent);text-align:center;padding-top:2px}
.tut-more[hidden]{display:none}
/* 낮은 휴대폰(세로 760px 이하): 튜토리얼 카드를 조금 촘촘하게 */
@media (max-width:899px) and (orientation:portrait) and (max-height:760px){
  .tut-card{padding:8px 10px}
  .tut-title{font-size:.95em}
  .tut-text{font-size:.82em;line-height:1.5}
  .tut-btns{margin-top:6px}
  .tut-btns button{min-height:40px}
  .tut-exit{min-height:30px}
}
/* 튜토리얼 (가로로 눕힌 휴대폰): 카드가 좁은 자리에 들어가면 설명 글만 안에서 넘김 */
@media (orientation:landscape) and (max-height:560px){
  .tut-card{display:flex;flex-direction:column;overflow:hidden;padding:8px 12px}
  .tut-card > *{flex:none}
  .tut-card > .tut-text{flex:0 1 auto;min-height:2.6em;overflow:auto;font-size:.84em;line-height:1.45}
  .tut-title{font-size:.98em;margin:4px 0 2px}
  .tut-btns{margin-top:6px}
  .tut-btns button{min-height:38px}
  .tut-exit{min-height:30px}
}
.tut-card.waiting .tut-prev{flex:0 0 auto;padding:0 16px}
.tut-card.waiting .tut-wait{flex:1 1 auto}
/* ---------- 튜토리얼 (새로 쓴 판): 장 이름, 고정 상자, 파란 표시, 그 자리에서 바뀌는 안내 ---------- */
.tut-head .tut-count{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:.8em}
.tut-card > .tut-bar{display:block;flex:none;height:5px;margin:6px 0 2px}
.tut-fb{font-weight:800}
.tut-fb.ok{color:var(--ok)}
.tut-fb.retry{color:var(--wrong)}
.tut-fb.retry b{color:var(--accent)}
/* 파란 테두리: 규칙 설명의 기준 칸, 두 번 틀렸을 때 "이미 있는 숫자" */
.cell.tut-mark{box-shadow:inset 0 0 0 3px var(--accent);z-index:1;animation:markPulse 1.4s ease-in-out infinite}
@keyframes markPulse{50%{box-shadow:inset 0 0 0 5px var(--accent)}}
@media (prefers-reduced-motion:reduce){ .cell.tut-mark{animation:none} }
.tut-on .fx-canvas{z-index:75}   /* 튜토리얼 연습 판 완성 때 폭죽이 어두운 막 위로 보이게 */
.modal .tut-resume{background:var(--hint-bg);color:var(--ok);border-radius:10px;padding:8px 10px;font-weight:700}
.tut-ask-more{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
@media (max-width:899px) and (orientation:portrait){
  /* 튜토리얼 동안만 판을 작게 → 아래에 설명 상자 자리 */
  .app.tutoring .board-col{max-width:var(--tutboard,100%)}
  /* 설명 상자는 늘 같은 자리·같은 크기. 위로 갈 때는 천천히 미끄러져 시선이 따라가게 */
  .tut-card.dock{transition:top .6s cubic-bezier(.3,.8,.3,1);animation:none}
  .tut-card.dock.tight .tut-text{font-size:.78em}
  .tut-card.dock.tight .tut-title{font-size:.9em}
}
@media (max-width:899px) and (orientation:portrait){
  .tut-card.dock.tighter{padding:6px 10px}
  .tut-card.dock.tighter .tut-text{font-size:.72em;line-height:1.4}
  .tut-card.dock.tighter .tut-title{font-size:.84em;margin:2px 0 1px}
  .tut-card.dock.tighter .tut-head .tut-count{font-size:.7em}
  .tut-card.dock.tighter .tut-exit{min-height:28px;font-size:.7em}
  .tut-card.dock.tighter .tut-btns{margin-top:4px}
  .tut-card.dock.tighter .tut-btns button{min-height:36px;font-size:.85em}
}
/* 기록 보관 창 */
.modal .bk-sum{color:var(--text);background:var(--surface-2);border-radius:12px;padding:10px 12px}
.modal .bk-sum small{color:var(--muted);font-size:.78em}
.modal .bk-intro,.modal .bk-why{font-size:.85em}
.bk-text{display:block;width:100%;height:6.5em;resize:none;border:2px solid var(--line);border-radius:12px;padding:8px 10px;
  background:var(--surface-2);color:var(--text);font:600 .72em/1.4 ui-monospace,Consolas,monospace;word-break:break-all}
.modal .btns.bk-row{margin-top:10px}
.modal .btns.bk-row + .btns{margin-top:8px}
/* 기록 창 아래 버튼 3개가 좁은 휴대폰에서도 한 줄에 들어가도록 */
.modal .btns button[data-x=backup],.modal .btns button[data-x=reset]{white-space:nowrap}
@media (max-width:420px){
  .modal .btns:has([data-x=backup]) button{font-size:.82em;padding:0 4px}
}
.diff-list.bk .diff-opt{min-height:0;padding:10px 14px}
@media (max-width:420px){ .diff-list.bk b{font-size:1em} .diff-list.bk .diff-opt{padding:8px 12px} }
/* 기록 보관 창 (가로로 눕힌 휴대폰): 두 줄로 나란히, 글자 칸은 낮게 */
@media (orientation:landscape) and (max-height:560px){
  .diff-list.bk{grid-template-columns:1fr 1fr}
  .diff-list.bk b{font-size:.95em}
  .modal .bk-intro,.modal .bk-why{font-size:.78em;line-height:1.45}
  .bk-text{height:3.4em}
  .modal .btns:has(.bk-text),.modal .bk-row ~ .btns,.modal .btns.bk-row{margin-top:6px}
  .modal .btns.bk-row button,.modal .bk-row ~ .btns button{min-height:42px}
}
/* 튜토리얼 노란 칸: 칸 사이 얇은 선이 노란색에 묻히지 않게 조금 진하게 (굵은 네모 선은 그대로) */
.cell.tut-hl:not(:nth-child(9n+3)):not(:nth-child(9n+6)):not(:nth-child(9n)){border-right:1px solid #7f7667}
.cell.tut-hl:not(.rb):not(.lastrow){border-bottom:1px solid #7f7667}
/* 튜토리얼에서 틀린 숫자는 고른 칸이어도 빨갛게 (파란 고른 칸 표시는 테두리로) */
.tut-on .cell.wrong.sel{background:var(--wrong-bg);box-shadow:inset 0 0 0 3px var(--sel)}
.tut-on .cell.wrong.sel .val{color:var(--wrong)}
/* ---------- 고급 풀이 ---------- */
@media (max-width:599px) and (orientation:portrait){ #btnAdv{display:none} }   /* 휴대폰은 메뉴 안에 */
.modal .lesson-note{font-size:.85em}
.modal .lesson-lv{display:inline-block;background:var(--accent-soft);color:var(--accent);border-radius:999px;padding:2px 10px;font-size:.78em;font-weight:800;margin:-4px 0 10px}
.modal .lesson-desc{color:var(--text);line-height:1.6}
.modal .lesson-desc b{color:var(--accent)}
.diff-list.lesson-list .diff-opt{min-height:0;padding:9px 14px}
/* 연습 판을 보는 동안: 난이도·시간·일시정지는 쓰지 않음 */
.app.lessoning .diff-btn{pointer-events:none}
.app.lessoning .diff-btn svg,.app.lessoning .timer-wrap,.app.lessoning .quick-chip{visibility:hidden}
@media (max-width:420px){ .diff-list.lesson-list b{font-size:1em} .diff-list.lesson-list .diff-opt{padding:7px 12px} }
@media (orientation:landscape) and (max-height:560px){
  .diff-list.lesson-list{grid-template-columns:1fr 1fr}
  .diff-list.lesson-list .diff-opt{padding:6px 10px}
  .diff-list.lesson-list b{font-size:.95em}
}
/* 고급 풀이 목록: 넓은 화면은 두 줄, 좁은 휴대폰은 작은 설명을 빼고 한 화면에 */
@media (min-width:600px){ .diff-list.lesson-list{grid-template-columns:1fr 1fr} }
@media (max-width:599px), (max-height:700px){
  .diff-list.lesson-list .diff-opt small{display:none}
  .diff-list.lesson-list .diff-opt{padding:8px 12px}
  .modal .lesson-desc{font-size:.88em;line-height:1.5}
}
@media (orientation:landscape) and (max-height:560px){
  .modal .lesson-note{display:none}
  .modal .lesson-lv{margin-bottom:4px}
}
@media (max-height:700px){ .modal .lesson-note.list-note{display:none} }
@media (orientation:landscape) and (max-height:560px){ .diff-list.lesson-list{grid-template-columns:repeat(auto-fit,minmax(185px,1fr))} }
/* 메뉴 (휴대폰): 항목이 5개라 낮은 화면에서는 촘촘하게 */
@media (max-height:700px){
  .diff-list.menu-list{gap:6px}
  .diff-list.menu-list .diff-opt{min-height:0;padding:7px 14px;gap:0}
}
@media (max-height:700px){
  .modal:has(.menu-list) h2{margin-bottom:6px}
  .modal:has(.menu-list) .btns{margin-top:10px}
  .modal:has(.menu-list) .btns button{min-height:50px}
}
/* ---------- 힌트·고급 풀이: 자세한 설명용 판 표시 ---------- */
.hint-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:4;overflow:visible}
.hint-lines line{stroke-width:3;stroke-linecap:round;opacity:.8}
.hint-lines line.hl-block{stroke:var(--block)}
.hint-lines line.hl-link{stroke:var(--accent);stroke-width:3.5;opacity:.65}
.hint-lines line.hl-see{stroke:var(--wrong);stroke-dasharray:6 5;opacity:.7}
.hint-lines circle.hl-block{fill:var(--block)}
.hint-lines circle.hl-see{fill:var(--wrong);opacity:.7}
/* "만약에" 연필 숫자: 흐리고 기울어진 숫자 + 점선 테두리 (진짜 숫자와 헷갈리지 않게) */
.cell.h-assume .val{color:var(--accent);opacity:.7;font-style:italic;font-weight:500}
.cell.h-assume{outline:2px dashed var(--accent);outline-offset:-5px}
/* 지금 이야기와 상관없는 칸의 작은 숫자는 흐리게 */
.cell.h-dim .notes{opacity:.22}
/* 이 부분이에요! — 부드럽게 커졌다 작아지는 파란 테두리 */
.cell.h-pulse{z-index:2;animation:hPulse 1.6s ease-in-out infinite}
@keyframes hPulse{0%,100%{box-shadow:inset 0 0 0 3px rgba(21,70,196,.55)}50%{box-shadow:inset 0 0 0 6px rgba(21,70,196,.25)}}
.cell.h-block.h-pulse{animation:hPulseO 1.6s ease-in-out infinite}
@keyframes hPulseO{0%,100%{box-shadow:inset 0 0 0 3px var(--block)}50%{box-shadow:inset 0 0 0 6px color-mix(in srgb,var(--block) 45%,transparent)}}
@media (prefers-reduced-motion:reduce){ .cell.h-pulse,.cell.h-block.h-pulse{animation:none} }
/* ---------- 튜토리얼 다듬기 (31버전) ---------- */
.tut-guard{position:fixed;pointer-events:auto;background:transparent}
.tut-title .tut-big{font-size:1.45em;color:var(--wrong);line-height:1;vertical-align:-.05em;margin-right:1px}
/* 일괄 채우기를 누르면 상자·어두운 막을 잠깐 숨겨서 채워지는 모습을 보여줌 */
.tut-card{transition:top .35s ease,left .35s ease,opacity .35s ease}
@media (max-width:899px) and (orientation:portrait){ .tut-card.dock{transition:top .6s cubic-bezier(.3,.8,.3,1),opacity .35s ease} }
.tut.watch .tut-card,.tut.watch .tut-ring,.tut.watch .tut-hand,.tut.watch .tut-dim{opacity:0;pointer-events:none}
.tut-ring,.tut-hand{transition-property:all}

/* ---------- 앱(Capacitor) 전용: html.native 일 때만 ---------- */
/* 상태 표시줄(시계·배터리)과 아래 시스템 버튼 줄 자리를 비움 */
:root.native{--sa-t:var(--safe-area-inset-top,env(safe-area-inset-top,0px));--sa-b:var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px));--vh:calc(100dvh - var(--sa-t) - var(--sa-b))}
:root.native body{padding-top:var(--sa-t);padding-bottom:var(--sa-b);min-height:100dvh;box-sizing:border-box}
/* 휴대폰 세로: 판과 버튼 묶음을 머리줄 아래 남은 공간의 가운데로 (위로 쏠리지 않게) */
@media (max-width:899px) and (orientation:portrait){
  :root.native .app{min-height:var(--vh);display:flex;flex-direction:column}
  :root.native .app > .main{margin:auto 0}
  :root.native .app.tutoring > .main{margin:0}   /* 스도쿠 배우기 중에는 설명 상자 자리를 계산하므로 원래 배치 */
}

/* ---------- 앱 시작 브랜드 로고 (앱 전용) ---------- */
.brand{position:fixed;inset:0;z-index:300;background:#f6eedf;display:flex;align-items:center;justify-content:center;
  transition:opacity .8s ease;-webkit-tap-highlight-color:transparent}
.brand img{width:min(64vw,340px);height:auto;opacity:0;transform:scale(.9);filter:blur(3px);
  animation:brandIn 1s cubic-bezier(.2,.8,.3,1) .2s forwards;transition:transform .8s ease}
@keyframes brandIn{to{opacity:1;transform:scale(1);filter:blur(0)}}
.brand.hide{opacity:0}   /* 사라지는 동안에도 눌림을 막아서, 건너뛰려고 누른 손가락이 판을 누르지 않게 */
.brand.hide img{transform:scale(1.05)}
@media (prefers-reduced-motion:reduce){ .brand img{animation:none;opacity:1;transform:none;filter:none} }

/* ---------- 메인 화면 (앱 전용) ---------- */
.home{position:fixed;inset:0;z-index:35;background:var(--bg);overflow:auto;
  padding:calc(var(--sa-t, 0px) + 12px) 16px calc(var(--sa-b, 0px) + 12px);display:flex;align-items:center;justify-content:center}
.home[hidden]{display:none}
.home{word-break:keep-all}   /* 한국어 낱말이 중간에서 끊기지 않게 */
.home-in{width:100%;max-width:460px;display:flex;flex-direction:column;align-items:stretch;gap:16px}
/* 제목: 숫자 칸 같은 입체 글씨 (아래쪽으로 몇 겹 그림자를 쌓아 두께를 줌) */
.home-logo{display:flex;flex-direction:column;align-items:center;gap:6px;margin:4px 0 10px}
.home-title{margin:0;display:flex;flex-direction:column;align-items:center;line-height:1;letter-spacing:-.03em;font-weight:900}
.home-title .ht-sm{font-size:1.25em;color:var(--title-sub);margin-bottom:.12em;letter-spacing:.06em}
.home-title .ht-big{font-size:3.3em;color:var(--title-face);
  text-shadow:0 1px 0 var(--title-side),0 2px 0 var(--title-side),0 3px 0 var(--title-side),0 4px 0 var(--title-side),0 5px 0 var(--title-side),
    0 6px 0 var(--title-deep),0 10px 14px rgba(0,0,0,.18)}
/* 제목 아래 노란 붓 밑줄 */
.home-title .ht-big::after{content:"";display:block;height:.13em;margin:-.12em 8% 0;border-radius:99px;background:var(--cta);transform:rotate(-1.2deg);box-shadow:none}
.home-tag{margin:6px 0 0;font-size:.85em;font-weight:700;color:var(--muted)}
:root{--title-face:#4a2f1c;--title-side:#2e1c10;--title-deep:#1f130a;--title-sub:#8a5a2e}
:root[data-theme="dark"]{--title-face:#f3e2c7;--title-side:#9c7a52;--title-deep:#5e4529;--title-sub:#e9b949}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){--title-face:#f3e2c7;--title-side:#9c7a52;--title-deep:#5e4529;--title-sub:#e9b949} }
/* 처음 오신 분 안내: 글은 왼쪽, 버튼은 오른쪽 (좁으면 버튼이 아래로) */
.home-first{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--hint-bg);border-radius:16px;padding:12px 14px}
.home-first[hidden]{display:none}
.hf-txt{flex:1 1 150px;display:flex;flex-direction:column;gap:2px;min-width:0}
.hf-txt b{font-size:1em;color:var(--ok)}
.hf-txt small{font-size:.78em;color:var(--muted);font-weight:600}
.home-first button{flex:0 0 auto;border:none;background:var(--ok);color:var(--surface);border-radius:12px;padding:10px 16px;min-height:48px;font-weight:800;font-size:.95em;margin-left:auto}
.home-main{display:flex;flex-direction:column;gap:12px}
.home-btn{display:flex;flex-direction:column;align-items:flex-start;gap:2px;text-align:left;min-height:68px;padding:10px 18px;
  border:2px solid var(--line);border-radius:18px;background:var(--surface)}
.home-btn[hidden]{display:none}
.home-btn b{font-size:1.2em}
.home-btn small{font-size:.78em;color:var(--muted);font-weight:600}
.home-btn.primary{background:var(--cta);border-color:var(--cta-border);color:var(--cta-text);box-shadow:0 3px 0 var(--cta-border)}
.home-btn.primary small{color:var(--cta-text);opacity:.8}
.home-btn.house{border-style:dashed}
.home-row{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.home-sm{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-height:72px;border:2px solid var(--line);
  border-radius:14px;background:var(--surface);font-size:.82em;font-weight:700;color:var(--text)}
.home-sm svg{width:30px;height:30px}
@media (max-height:700px){ .home-in{gap:8px} .home-btn{min-height:58px;padding:8px 16px} .home-sm{min-height:56px} }

.home h1.home-title{display:flex}   /* 휴대폰에서 위쪽 제목(h1)을 숨기는 규칙에 걸리지 않게 */
/* 메인 화면: 낮은 휴대폰에서도 한 화면에 (제목을 화면 높이에 맞춰 줄임) */
@media (max-height:860px){ .home-in{gap:9px} .home-btn{min-height:60px;padding:8px 16px} .home-title .ht-big{font-size:2.9em} .home-sm{min-height:58px} .home-first{padding:9px 12px} }
@media (max-height:700px){ .home-in{gap:7px} .home-btn{min-height:52px;padding:6px 14px} .home-btn b{font-size:1.08em} .home-title .ht-big{font-size:2.4em} .home-logo{margin:0 0 4px} .home-tag{display:none} .home-sm{min-height:50px} .home-first{font-size:.86em} }
@media (max-height:800px){ :root[data-size="xlarge"] .home-btn small{display:none} }
:root[data-size="xlarge"] .home-sm span{font-size:.9em;white-space:nowrap}   /* 아주 크게: "고급풀이"가 두 줄로 끊기지 않게 */

/* ---------- 나만의 집 (앱 전용, 시제품) ---------- */
#house{position:fixed;inset:0;z-index:36;background:#e8dfcf;display:flex;flex-direction:column;gap:8px;
  padding:calc(var(--sa-t, 0px) + 8px) 12px calc(var(--sa-b, 0px) + 10px)}
#house[hidden]{display:none}
.house-top{display:flex;align-items:center;gap:10px;min-height:50px}
.house-back{border:2px solid var(--line);background:var(--surface);color:var(--text);border-radius:14px;padding:8px 14px;font-weight:800;font-size:1em;min-height:48px}
.house-title{font-size:1.25em;flex:1;text-align:center;margin-right:clamp(0px, calc(100vw - 340px), 58px);color:#5a3a22;white-space:nowrap}
.house-wrap{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center}
.house-stage{position:relative;border-radius:18px;overflow:hidden;box-shadow:0 6px 22px rgba(70,40,20,.22);background:#f3e6cf;
  -webkit-user-select:none;user-select:none;touch-action:manipulation}
.hs-room{position:absolute;inset:0;width:100%;height:100%;display:block}
.hs-item{position:absolute;display:block;height:auto;pointer-events:none}
.hs-item[hidden]{display:none}
.hs-item.tap{pointer-events:auto;cursor:pointer}
.hs-item.trophy.locked{filter:brightness(0);opacity:.22}
.hs-canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.hs-tint{mix-blend-mode:multiply}
.hs-light{mix-blend-mode:screen}
.hs-cat{transform-origin:50% 100%;animation:catBreath 3.6s ease-in-out infinite}
.hs-cat.pet{animation:catPet .65s ease-out}
@keyframes catBreath{0%,100%{transform:scale(1,1)}50%{transform:scale(1.012,1.04)}}
@keyframes catPet{0%{transform:scale(1,1)}30%{transform:scale(1.06,.9)}60%{transform:scale(.98,1.06)}100%{transform:scale(1,1)}}
.hs-heart{position:absolute;color:#ff6f8e;font-size:clamp(16px,6vw,30px);pointer-events:none;text-shadow:0 1px 0 #fff;
  animation:heartUp 1.6s ease-out forwards;opacity:0}
@keyframes heartUp{0%{opacity:0;transform:translateY(0) scale(.6)}15%{opacity:1;transform:translateY(-6px) scale(1)}100%{opacity:0;transform:translateY(-70px) scale(1.15)}}
.house-bubble{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);background:#fffaf0;color:#5a3a22;border:2px solid #e2c9a6;
  border-radius:16px;padding:8px 16px;font-weight:800;font-size:1.05em;box-shadow:0 3px 10px rgba(0,0,0,.12);pointer-events:none;white-space:nowrap}
.house-bubble[hidden]{display:none}
.house-bar{display:flex;flex-direction:column;gap:8px}
.house-deco{align-items:center;text-align:center;min-height:60px}
.house-time{display:flex;align-items:center;gap:6px;flex-wrap:nowrap}
.house-time span{font-size:.72em;font-weight:700;color:var(--muted);white-space:nowrap}
.house-time button{flex:1;min-height:40px;border:2px solid var(--line);background:var(--surface);color:var(--text);border-radius:12px;font-weight:700;font-size:.85em;padding:0}
.house-time button.on{background:#5a3a22;border-color:#5a3a22;color:#fff}
@media (prefers-reduced-motion:reduce){ .hs-cat{animation:none} }
/* 꾸미기 창 */
.deco-list{display:flex;flex-direction:column;gap:12px;max-height:min(60vh,520px);overflow:auto}
.deco-slot h3{margin:0 0 6px;font-size:1.05em}
.deco-opts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.deco-opt{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:96px;padding:6px;border:3px solid var(--line);
  border-radius:14px;background:var(--surface);color:var(--text);font-weight:700;font-size:.8em}
.deco-opt img{height:56px;max-width:100%;object-fit:contain}
.deco-opt span{word-break:keep-all;line-height:1.25}
.deco-opt i{font-style:normal;font-size:28px;line-height:56px;color:var(--muted)}
.deco-opt.on{border-color:var(--accent);background:var(--hint-bg)}
.trophy-big{display:flex;justify-content:center;padding:8px 0}
.trophy-big img{height:120px}
.trophy-big.locked img{filter:brightness(0);opacity:.22}
/* 나만의 집: 옮기기 */
.house-bar[hidden],.house-edit[hidden]{display:none}
.house-btns{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.house-btns .house-deco{min-height:62px;padding:8px 10px}
.house-edit{display:flex;flex-direction:column;gap:8px}
.he-tip{margin:0;text-align:center;font-weight:700;font-size:.92em;color:#5a3a22;min-height:1.4em}
.he-pad{display:grid;grid-template-columns:repeat(4,1fr) 1.5fr;gap:6px}
.he-pad button,.he-row button{min-height:54px;border:2px solid var(--line);background:var(--surface);color:var(--text);border-radius:14px;font-weight:800;font-size:1.2em;
  touch-action:none;-webkit-user-select:none;user-select:none}
.he-pad button.he-flip{font-size:.88em;white-space:nowrap;padding:0 4px}
.he-pad button:disabled{opacity:.4}
.he-row{display:grid;grid-template-columns:1fr 1.4fr;gap:8px}
.he-row button{font-size:1em}
.he-row button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-text)}
#house.editing .hs-cat{animation:none}
#house.editing .house-stage{touch-action:none}
#house.editing .hs-item.tap{cursor:grab}
/* 나만의 집: 제목(고양이 이름) · 일기 · 자물쇠 물건 */
button.house-title{border:none;background:none;padding:6px 4px;font-weight:800;color:#5a3a22}
.hs-diary{position:absolute;left:3%;top:2.4%;z-index:9500;display:flex;align-items:center;gap:4px;padding:6px 12px 6px 9px;border-radius:14px;
  border:2px solid #c89b6a;background:#fff8ec;color:#5a3a22;font-weight:800;font-size:clamp(13px,3.8vw,17px);box-shadow:0 2px 8px rgba(70,40,20,.18)}
#house.editing .hs-diary{display:none}
.deco-opt.lock{opacity:.6;filter:grayscale(.6)}
.deco-opt.lock span{font-size:.9em;color:var(--muted)}
.cat-name-in,.diary-in{width:100%;box-sizing:border-box;font:inherit;font-size:1.15em;padding:10px 12px;border:2px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text)}
.diary-in{resize:none;line-height:1.45}
.cat-ideas{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 4px}
.cat-ideas button{border:2px solid var(--line);background:var(--surface-2);color:var(--text);border-radius:999px;padding:6px 14px;font-weight:700}
.diary-day{margin:0 0 6px;font-weight:800;color:#5a3a22}
.diary-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:8px 0}
.diary-row .wide-btn{flex:0 0 auto;min-width:130px}
.diary-list{max-height:min(30vh,260px);overflow:auto;display:flex;flex-direction:column;gap:8px;margin:4px 0}
.diary-item{border:1px solid var(--line);border-radius:12px;padding:8px 10px;background:var(--surface-2)}
.diary-item b{font-size:.85em;color:var(--muted)}
.diary-item p{margin:4px 0;word-break:keep-all;overflow-wrap:anywhere}
.diary-acts{display:flex;gap:6px;justify-content:flex-end}
.diary-acts button{border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:10px;padding:4px 10px;font-weight:700;font-size:.85em}
.diary-acts button.warn{background:#c0392b;border-color:#c0392b;color:#fff}
.diary-note{font-size:.8em;color:var(--muted);margin:6px 0 0}
.linkish{border:none;background:none;color:var(--accent);font-weight:800;text-decoration:underline;padding:0;font:inherit}
/* 비스듬한 방: 방 바깥은 비어 있으니 판 배경·그림자 없이 */
.house-stage{background:transparent;box-shadow:none;border-radius:0;overflow:visible}
.he-pad button{font-size:1.5em}

/* ---------- 제목·큰 버튼 글꼴 (Jua). 설명 글과 판의 숫자는 또렷한 기본 글꼴 그대로 ---------- */
.home-title,.home-btn b,.hf-txt b,.home-first button,.home-sm span,.modal h2,.wide-btn{font-family:'Jua',"Pretendard","Noto Sans KR",system-ui,sans-serif;font-weight:400}
.home-title .ht-big{letter-spacing:0}

/* 이어서 하기 안의 진행 막대 */
.home-prog{align-self:stretch;height:9px;margin-top:6px;border-radius:99px;background:rgba(58,39,18,.16);overflow:hidden}
.home-prog i{display:block;height:100%;width:0;border-radius:99px;background:var(--cta-text);opacity:.75}
/* 새 게임: 왼쪽 둥근 ＋ 아이콘, 조금 더 무게감 있게 */
.home-btn.new{flex-direction:row;align-items:center;gap:14px;border-width:2.5px;border-color:var(--title-sub);box-shadow:0 3px 0 var(--line)}
.home-btn .hb-ic{flex:0 0 auto;width:44px;height:44px;border-radius:50%;display:grid;place-items:center;background:var(--title-sub);color:var(--surface);font-size:1.3em;font-weight:800;line-height:1}
.home-btn .hb-ic svg{width:58%;height:58%;display:block}
.home-btn .hb-tx{display:flex;flex-direction:column;gap:2px;min-width:0}
/* 처음이세요? → 이미 알아요 */
/* 처음이세요? 오른쪽 위 ✕ (오른쪽에 자리를 비워 둬서 배우기 버튼과 겹치지 않게) */
.home-first{position:relative;padding-right:46px}
.home-first .hf-x{position:absolute;top:4px;right:4px;width:38px;height:38px;min-height:0;margin:0;padding:0;border:none;border-radius:50%;
  background:transparent;color:var(--muted);font-family:inherit;font-size:1.05em;font-weight:700;display:grid;place-items:center}
@media (max-height:700px){ .home-btn .hb-ic{width:36px;height:36px} .home-sm svg{width:26px;height:26px} }

/* ---------- 코인 · 테마 상점 (앱 전용, shop.js) ---------- */
.coin-ic{width:1.15em;height:1.15em;vertical-align:-.2em;flex:0 0 auto}
.home-top{display:flex;justify-content:space-between;align-items:center;gap:10px}
.coin-chip,.theme-chip{display:flex;align-items:center;gap:6px;min-height:44px;padding:6px 14px;border-radius:999px;border:2px solid var(--line);
  background:var(--surface);color:var(--text);font-family:'Jua',system-ui,sans-serif;font-size:.95em}
.coin-chip b{font-weight:400}
.coin-got{margin:8px 0 0;text-align:center;font-family:'Jua',system-ui,sans-serif;font-size:1.05em;color:var(--text);display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap}
.coin-got small{font-family:inherit;font-size:.72em;color:var(--muted)}
.coin-got.none{font-family:inherit;font-size:.8em;color:var(--muted)}
.shop-title{margin-bottom:4px}
.shop-coins{margin:0;font-family:'Jua',system-ui,sans-serif;font-size:1.1em;display:flex;align-items:center;gap:6px}
.shop-coins b{font-weight:400;font-size:1.15em}
.shop-note{margin:4px 0 10px;font-size:.78em;color:var(--muted)}
.shop-list{display:flex;flex-direction:column;gap:10px;max-height:calc(var(--vh, 100dvh) - 330px);min-height:180px;overflow:auto;padding:2px}
.shop-card{display:flex;gap:12px;align-items:center;padding:10px;border:2px solid var(--line);border-radius:16px;background:var(--surface)}
.shop-card.on{border-color:var(--cta-border);box-shadow:0 0 0 3px var(--cta) inset}
.sh-prev{flex:0 0 auto;border:none;background:none;padding:0;display:flex;flex-direction:column;align-items:center;gap:3px;color:var(--muted);font-size:.68em;font-weight:700}
.sh-zoom{text-decoration:underline}
.sh-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px;word-break:keep-all}
.sh-info b{font-family:'Jua',system-ui,sans-serif;font-weight:400;font-size:1.15em}
.sh-info small{font-size:.76em;color:var(--muted)}
.sh-tag{align-self:flex-start;font-style:normal;font-size:.66em;font-weight:800;border-radius:999px;padding:1px 8px}
.sh-tag.free{background:var(--hint-bg);color:var(--ok)}
.sh-tag.title{background:var(--accent-soft);color:var(--accent)}
.sh-tag.coin{background:#fbe8b8;color:#7a5410}
.sh-act{margin-top:6px}
.sh-btn{min-height:44px;padding:6px 16px;border-radius:12px;border:2px solid var(--line);background:var(--surface-2);color:var(--text);font-family:'Jua',system-ui,sans-serif;font-size:1em;display:inline-flex;align-items:center;gap:6px}
.sh-btn.use{background:var(--cta);border-color:var(--cta-border);color:var(--cta-text)}
.sh-btn.buy{background:var(--surface);border-color:#d9a83a}
.sh-btn.buy.short{opacity:.6}
.sh-badge{display:inline-block;font-family:'Jua',system-ui,sans-serif;font-size:.95em;color:var(--ok)}
.sh-badge::before{content:"✓ "}
.sh-lock{display:block;font-size:.74em;color:var(--muted);font-weight:700;line-height:1.35}
/* 작은 미리보기 판: 그 테마의 색으로 */
.skin-prev{width:92px;padding:7px;border-radius:12px;background:var(--bg);background-image:var(--skin-bg, none);background-size:120px;border:1px solid rgba(0,0,0,.08);display:flex;flex-direction:column;gap:6px;align-items:stretch}
.sp-board{display:grid;grid-template-columns:repeat(3,1fr);border:2px solid var(--line-strong);background:var(--surface);border-radius:3px;overflow:hidden}
.sp-c{aspect-ratio:1/1;display:grid;place-items:center;font-family:'Inter',system-ui,sans-serif;font-weight:500;font-size:15px;color:var(--given);border-right:1px solid var(--line);border-bottom:1px solid var(--line);line-height:1}
.sp-c:nth-child(3n){border-right:none}.sp-c:nth-child(n+7){border-bottom:none}
.sp-c.u{color:var(--user)}
.sp-c.s{background:var(--sel);color:var(--sel-text)}
.sp-c.h{background:var(--same)}
.sp-c.m{display:grid;grid-template-columns:repeat(2,1fr);font-size:8px;color:var(--note);padding:2px}
.sp-c.m i{font-style:normal;text-align:center}
.sp-cta{height:12px;border-radius:99px;background:var(--cta);border:1px solid var(--cta-border)}
/* 크게 미리 보기 띠 (화면 아래) */
.skin-bar{position:fixed;left:12px;right:12px;bottom:calc(var(--sa-b, 0px) + 12px);z-index:400;display:flex;flex-direction:column;gap:8px;
  padding:12px 14px;border-radius:18px;background:var(--surface);color:var(--text);border:2px solid var(--cta-border);box-shadow:0 8px 30px rgba(0,0,0,.25)}
.skin-bar[hidden]{display:none}
.sb-t{font-size:.9em}
.sb-btns{display:flex;gap:8px}
.sb-btns button{flex:1;min-height:48px;border-radius:12px;border:2px solid var(--line);background:var(--surface-2);color:var(--text);font-family:'Jua',system-ui,sans-serif;font-size:1em;display:flex;align-items:center;justify-content:center;gap:6px}
.sb-btns .sb-go{background:var(--cta);border-color:var(--cta-border);color:var(--cta-text)}
.sb-lock{display:block;font-size:.85em;color:var(--muted);margin-top:2px}
/* 잠긴 칭호 테마: 미리보기 대신 자물쇠 */
.sh-prev.locked{cursor:default}
.sp-lock{width:92px;height:118px;border-radius:12px;border:2px dashed var(--line);background:var(--surface-2);display:grid;place-items:center;font-size:30px;opacity:.85}
.sh-zoom.off{text-decoration:none;text-align:center;line-height:1.25}

/* 줄 그림 아이콘(그림 글자 대신) */
.ui-ic{width:1.15em;height:1.15em;vertical-align:-.2em;flex:0 0 auto}
.sh-lock .ui-ic{width:1em;height:1em;margin-right:3px}
.sp-lock .ui-ic{width:30px;height:30px;color:var(--muted)}

/* 칭호 선 아이콘: 등급마다 색 (동 · 은 · 금 · 무지개 · 특별) */
.ai-ic{width:1em;height:1em;display:block}
.achv-medal .ai-ic{width:28px;height:28px}
.achv-big span .ai-ic{width:38px;height:38px}
.achv-chip i .ai-ic{width:1.1em;height:1.1em}
.achv-latest .ai-ic{display:inline-block;vertical-align:-.15em}
.t-b .achv-medal,.achv-big.t-b span,.achv-chip.t-b i{color:#a0602e;color:color-mix(in srgb,var(--tc) 62%,var(--text))}
.t-s .achv-medal,.achv-big.t-s span,.achv-chip.t-s i{color:#5f6b78;color:color-mix(in srgb,var(--tc) 62%,var(--text))}
.t-g .achv-medal,.achv-big.t-g span,.achv-chip.t-g i{color:#a87812;color:color-mix(in srgb,var(--tc) 62%,var(--text))}
.t-r .achv-medal,.achv-big.t-r span,.achv-chip.t-r i{color:#5b49a6;color:color-mix(in srgb,var(--tc) 62%,var(--text))}
.t-p .achv-medal,.achv-big.t-p span,.achv-chip.t-p i{color:#2d7a74;color:color-mix(in srgb,var(--tc) 62%,var(--text))}
.achv-card.locked .achv-medal{color:var(--muted)}

/* ---------- 글자 크기 고르기 (맨 처음 한 번) ---------- */
.sz-opts{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:6px 0 12px}
.sz-opt{display:flex;flex-direction:column;align-items:center;gap:2px;min-height:72px;padding:8px 4px;border:2px solid var(--line);border-radius:14px;background:var(--surface);color:var(--text);font-weight:800;font-size:.85em;word-break:keep-all}
.sz-opt.active{border-color:var(--cta-border);background:var(--cta);color:var(--cta-text)}
.sz-a{font-weight:800;line-height:1.1}
.sz-a.sz-normal{font-size:19px}.sz-a.sz-large{font-size:23px}.sz-a.sz-xlarge{font-size:28px}
.sz-prev{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 8px;border-radius:14px;background:var(--surface-2)}
.szp-board{--cell:40px;display:grid;grid-template-columns:repeat(4,var(--cell));border:3px solid var(--line-strong);background:var(--surface);border-radius:4px;overflow:hidden}
.szp-c{width:var(--cell);height:var(--cell);display:grid;place-items:center;font-family:"Inter","Pretendard",system-ui,sans-serif;font-weight:500;line-height:1;
  font-size:calc(var(--cell) * var(--val));color:var(--given);border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.szp-c:nth-child(4n){border-right:none}.szp-c:nth-child(n+5){border-bottom:none}
.szp-c.u{color:var(--user)}
.szp-c.s{background:var(--sel);color:var(--sel-text)}
.szp-c.m{grid-template-columns:repeat(3,1fr);font-size:calc(var(--cell) * var(--notefs));color:var(--note);padding:2px;align-content:start}
.szp-c.m i{font-style:normal;text-align:center}
.szp-text{margin:0;font-size:1em;font-weight:700;color:var(--text)}
.sz-later{margin:8px 0 0;font-size:.78em}

/* 숫자 놓을 자리 보기: 고른 숫자가 들어갈 수 없는 빈칸 — 색을 더하지 않고 옅은 빗금만 */
.cell.blocked{background-image:repeating-linear-gradient(135deg, rgba(60,45,30,.11) 0 2px, transparent 2px 7px)}
.cell.blocked{background-image:repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 12%, transparent) 0 2px, transparent 2px 7px)}

/* 로고를 두 번 눌러 넘기거나 화면을 길게 누를 때 제목·버튼 글자가 "선택"되어 회색 네모가 생기지 않게 */
.brand,.app,.home{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
