/* 법률 낱말 찾기 · 2026-09-19~20 전면 개편
   헌법 §7 재미 앱 표준(크림 줄무늬 · 검정 테두리 카드 · Black Han Sans · 빨강/노랑/남색)에
   원고지 격자를 얹었다. 격자만 종이 느낌(크림빛 칸 + 붉은 줄)을 지킨다. */
:root {
  --cream: #FFF6E5;
  --cream-2: #FCEFD6;
  --paper: #FFFCF4;
  --ink: #1B1B1F;
  --ink-2: #3A3530;
  --mute: #6E6456;
  --red: #E8332A;
  --yellow: #FFD13F;
  --navy: #2E4374;
  --green: #2E8B57;
  --rule: #E3B8B2;          /* 원고지 붉은 줄 */
  --line: rgba(27,27,31,.12);
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0; color: var(--ink); word-break: keep-all; line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--cream) repeating-linear-gradient(135deg, transparent 0 24px, rgba(233,196,128,.20) 24px 48px);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── 머리 ── */
.shin-header { display: block; padding: 9px 0; background: rgba(255,255,255,.55); border-bottom: 2px solid var(--ink); }
.shin-header-inner { max-width: 720px; margin: 0 auto; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 7px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border: 2.5px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--cream); font-family: serif; font-weight: 700; font-size: 1.05rem; }
.brand-name { font-weight: 900; font-size: .92rem; letter-spacing: -.01em; }
.head-tools { display: flex; align-items: center; gap: 7px; flex: none; }
.tool-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: inherit;
  font: inherit; font-size: 1rem; line-height: 1; cursor: pointer; text-decoration: none;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.tool-btn:active { transform: translate(2px,2px); box-shadow: none; }

.wrap { max-width: 720px; margin: 0 auto; padding: 14px 14px 40px; }

/* ── 히어로 ── */
.hero { display: grid; grid-template-columns: 1fr 108px; gap: 6px; align-items: end; margin-bottom: 12px; }
.kicker { display: inline-block; margin: 0 0 6px; padding: 4px 11px; border: 2.5px solid var(--ink); border-radius: 99px; background: var(--yellow); font-weight: 900; font-size: .72rem; }
.logo { font-family: 'Black Han Sans', sans-serif; font-weight: 400; font-size: clamp(1.9rem, 8vw, 2.5rem); line-height: 1.12; margin: 0; text-shadow: 3px 3px 0 var(--yellow); }
.logo .red { color: var(--red); }
.tagline { margin: 7px 0 0; font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.tagline b { background: linear-gradient(transparent 58%, var(--yellow) 58%); }
.hero-jo { margin: 0; align-self: end; }
.hero-jo img { display: block; width: 100%; height: auto; filter: drop-shadow(3px 3px 0 rgba(27,27,31,.14)); }

/* ── 탭 ── */
.tabs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.tabs button {
  font: inherit; font-weight: 800; font-size: .84rem; cursor: pointer; padding: 9px 4px;
  border: 2.5px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink); transition: transform .12s, box-shadow .12s, background .12s;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--cream); }
.tabs button:active { transform: translate(3px,3px); box-shadow: none; }

/* ── 카드 공통 ── */
.card { background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 5px 5px 0 var(--ink); padding: 14px; margin-bottom: 12px; }
.label { margin: 0 0 4px; font-size: .74rem; font-weight: 900; letter-spacing: .06em; color: var(--mute); }

/* ── 설정 ── */
.setbar { margin-bottom: 10px; }
.set-sum {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: inherit; font-weight: 800; font-size: .84rem; cursor: pointer; padding: 9px 13px;
  border: 2.5px dashed var(--ink); border-radius: 12px; background: rgba(255,255,255,.7); color: var(--ink);
}
.set-go { font-size: .76rem; color: var(--mute); flex: none; }
.set-panel { margin-top: 8px; }
.set-row { margin-bottom: 11px; }
.set-lab { margin: 0 0 5px; font-size: .74rem; font-weight: 900; letter-spacing: .05em; color: var(--mute); }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg button {
  font: inherit; cursor: pointer; padding: 7px 4px; border: 2px solid var(--ink); border-radius: 10px;
  background: #fff; color: var(--ink); line-height: 1.25; text-align: center;
}
.seg button b { display: block; font-size: .86rem; }
.seg button small { font-size: .66rem; color: var(--mute); }
.seg button[aria-pressed="true"] { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.seg button[aria-pressed="true"] small { color: var(--ink-2); }
.chips-scroll { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; -webkit-overflow-scrolling: touch; }
.chips-scroll button {
  font: inherit; font-size: .8rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  padding: 6px 12px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; color: var(--ink);
}
.chips-scroll button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.set-note { margin: 4px 0 0; font-size: .74rem; color: var(--mute); }

/* ── 오늘의 퍼즐 완료 카드 ── */
.daily-done .dd-line { margin: 4px 0 0; font-size: .88rem; font-weight: 700; }
.daily-done .dd-stars { font-size: 1.3rem; letter-spacing: .1em; }
.daily-done .dd-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── 상태줄 ── */
.status {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 12px; margin-bottom: 9px; font-size: .8rem; color: var(--mute); font-weight: 700;
}
.status b { color: var(--ink); font-variant-numeric: tabular-nums; }
.status .best { color: var(--red); font-weight: 800; }

/* ── 코치(작은 조변) ── */
.coach { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; position: relative; }
.coach img {
  width: 46px; height: 46px; flex: none; border-radius: 50%; border: 2.5px solid var(--ink);
  background: #fff; object-fit: cover; object-position: 50% 6%;
}
.bubble {
  margin: 0; flex: 1; position: relative; padding: 8px 12px; font-size: .82rem; font-weight: 700;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
}
.bubble::before {
  content: ''; position: absolute; left: -9px; top: 50%; margin-top: -7px;
  border: 7px solid transparent; border-right-color: var(--ink);
}
.combo {
  position: absolute; right: 6px; top: -14px; padding: 3px 10px; border-radius: 99px;
  background: var(--red); color: #fff; font-weight: 900; font-size: .78rem; border: 2px solid var(--ink);
  animation: comboPop .4s cubic-bezier(.2,1.6,.5,1);
}
@keyframes comboPop { 0% { transform: scale(.4) rotate(-8deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ── 격자(원고지) ── */
.board-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.board {
  position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px;
  box-shadow: 5px 5px 0 var(--ink); padding: 5px; width: max-content;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.board.shake { animation: boardShake .3s; }
@keyframes boardShake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.grid { display: grid; position: relative; z-index: 1; border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); }
.cell {
  display: grid; place-items: center; width: var(--cs); height: var(--cs);
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: calc(var(--cs) * .52); font-weight: 800; color: var(--ink-2); cursor: pointer;
}
.cell.pop { animation: cellPop .45s; }
@keyframes cellPop {
  0% { transform: scale(1); } 40% { transform: scale(1.3); color: var(--red); } 100% { transform: scale(1); }
}
.cell.anchor { outline: 3px solid var(--red); outline-offset: -3px; border-radius: 6px; }
.cell.hint { animation: hintBlink 1.4s 2; }
@keyframes hintBlink { 0%,100% { background: transparent; } 50% { background: var(--yellow); } }
.marks { position: absolute; left: 5px; top: 5px; z-index: 2; pointer-events: none; mix-blend-mode: multiply; }
.marks line { stroke-linecap: round; }
.marks line.draw { animation: markDraw .38s ease-out; }
@keyframes markDraw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.marks line.bad { animation: markBad .45s forwards; }
@keyframes markBad { 0% { opacity: .55; } 70% { opacity: .55; } 100% { opacity: 0; } }
.fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
.spark { position: absolute; font-size: 13px; animation: sparkFly .7s ease-out forwards; }
@keyframes sparkFly { to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }
.float {
  position: absolute; transform: translate(-50%,-50%); font-weight: 900; font-size: 1.05rem; color: var(--red);
  text-shadow: 0 2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 -2px 0 #fff; animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp { to { transform: translate(-50%,-190%); opacity: 0; } }

.how { margin: 0 0 14px; font-size: .76rem; color: var(--mute); text-align: center; }

/* ── 찾을 낱말 ── */
.hunt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.hunt-label { font-size: .74rem; font-weight: 900; letter-spacing: .07em; color: var(--mute); }
.hunt-sub { font-size: .72rem; color: var(--mute); }
.hunt { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  font-size: .84rem; font-weight: 700; padding: 5px 11px; border-radius: 99px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink); line-height: 1.3;
}
.chip .cd { display: block; font-size: .7rem; font-weight: 600; color: var(--mute); }
.chip.done { text-decoration: line-through; text-decoration-thickness: 2px; }
.chip.hintd { background: var(--cream-2); }

/* ── 버튼 ── */
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.btn {
  font: inherit; font-weight: 900; font-size: .88rem; cursor: pointer; padding: 10px 18px;
  border: 2.5px solid var(--ink); border-radius: 12px; background: var(--red); color: #fff;
  box-shadow: 4px 4px 0 var(--ink); transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: translate(4px,4px); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.blue { background: var(--navy); color: #fff; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ── 뜻풀이 ── */
.glossary { display: grid; gap: 8px; margin-bottom: 14px; }
.gloss {
  background: #fff; border: 2.5px solid var(--ink); border-left-width: 9px; border-radius: 12px;
  padding: 10px 13px; animation: slideIn .3s;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.gloss .t { font-weight: 900; font-size: .96rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.gloss .tag { font-size: .66rem; font-weight: 900; padding: 2px 7px; border-radius: 99px; border: 2px solid var(--ink); }
.gloss .tag.new { background: var(--yellow); }
.gloss .tag.bonus { background: var(--navy); color: #fff; }
.gloss .d { font-size: .86rem; color: var(--ink-2); }
.gloss .x { font-size: .79rem; color: var(--mute); margin-top: 3px; }

/* ── 도감 ── */
.dex-top { text-align: center; }
.dex-big { font-family: 'Black Han Sans', sans-serif; font-size: 2rem; margin: 2px 0 8px; }
.dex-big b { color: var(--red); }
.bar { height: 12px; border-radius: 99px; background: var(--cream-2); border: 2px solid var(--ink); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--navy); width: 0; transition: width .5s; }
.dex-note { margin: 8px 0 0; font-size: .76rem; color: var(--mute); }
.dex-cat { margin-bottom: 12px; }
.dex-cat h3 { margin: 0 0 6px; font-size: .95rem; display: flex; align-items: center; gap: 6px; }
.dex-cat h3 span { margin-left: auto; font-size: .78rem; color: var(--mute); font-weight: 700; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.dex-tile {
  font: inherit; font-size: .8rem; font-weight: 800; padding: 8px 4px; cursor: pointer; text-align: center;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; color: var(--ink);
}
.dex-tile.off { background: rgba(27,27,31,.06); color: rgba(27,27,31,.32); border-style: dashed; cursor: default; }

/* ── 안내·바닥 ── */
.fine { margin-top: 6px; }
.notice-line {
  display: flex; align-items: flex-start; gap: 7px; margin: 0 0 8px;
  background: rgba(0,0,0,.035); border: 1px solid rgba(0,0,0,.09); border-radius: 10px;
  padding: 9px 12px; font-size: .78rem; line-height: 1.55; color: var(--ink-2);
}
.notice-line span:first-child { opacity: .5; flex: none; }
.foot { text-align: center; padding: 16px 14px 28px; font-size: .76rem; color: var(--mute); }
.foot nav { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 5px; }
.foot a { color: var(--mute); }

/* ── 완료 · 낱말 상세 ── */
.modal, .sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgba(27,27,31,.55); }
/* ⚠️ display 를 정해 두면 hidden 속성이 무시된다 — 창이 안 닫힌다(2026-09-20 실측) */
.modal[hidden], .sheet[hidden] { display: none; }
.sheet { align-items: end; }
.modal-card, .sheet-card {
  position: relative; width: 100%; max-width: 420px; background: #fff; border: 3px solid var(--ink);
  border-radius: 18px; box-shadow: 6px 6px 0 var(--ink); padding: 16px; text-align: center;
  max-height: 88vh; overflow-y: auto; animation: cardIn .34s cubic-bezier(.2,1.4,.5,1);
}
.sheet-card { text-align: left; max-width: 480px; }
@keyframes cardIn { from { transform: scale(.85) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.done-jo { display: block; width: 116px; height: auto; margin: -58px auto 0; filter: drop-shadow(3px 3px 0 rgba(27,27,31,.15)); }
.stamp {
  display: inline-block; margin: 2px 0 6px; padding: 7px 18px; border: 4px solid var(--red); border-radius: 99px;
  color: var(--red); font-family: 'Black Han Sans', sans-serif; font-size: 1.5rem; transform: rotate(-4deg);
  animation: stampIn .5s cubic-bezier(.2,1.6,.5,1);
}
@keyframes stampIn { 0% { opacity: 0; transform: scale(2.2) rotate(-14deg); } 70% { opacity: 1; transform: scale(.94) rotate(3deg); } 100% { transform: rotate(-4deg); } }
.stars { font-size: 1.9rem; letter-spacing: .12em; min-height: 2.2rem; }
.stars span { display: inline-block; animation: starPop .4s cubic-bezier(.2,1.7,.5,1); }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); } to { transform: none; } }
.done-lines { font-size: .88rem; font-weight: 700; color: var(--ink-2); }
.done-lines p { margin: 3px 0; }
.done-lines .big { font-family: 'Black Han Sans', sans-serif; font-size: 1.5rem; color: var(--ink); font-weight: 400; }
.done-lines .rec { color: var(--red); font-weight: 900; }
.modal-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.cta { margin: 12px 0 0; font-size: .8rem; color: var(--mute); }
.cta a { color: var(--red); font-weight: 900; text-decoration: none; border-bottom: 2px solid var(--yellow); }
.sheet-card h3 { margin: 2px 0 6px; font-size: 1.15rem; }
.sheet-card .x { color: var(--mute); font-size: .84rem; }

.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; width: 9px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(10px); z-index: 80;
  max-width: min(86vw, 420px); text-align: center; background: rgba(27,27,31,.93); color: #fff;
  font-size: .84rem; font-weight: 700; line-height: 1.5; padding: 10px 20px; border-radius: 99px;
  pointer-events: none; opacity: 0; transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 600px) {
  .hero { grid-template-columns: 1fr 150px; }
  .coach img { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  .cell.pop, .gloss, .stamp, .stars span, .modal-card, .sheet-card, .combo, .marks line.draw, .spark, .float, .board.shake { animation: none; }
  .confetti { display: none; }
}
