/* 법정 공방 · 2026-09-20 전면 개편
   헌법 §7 재미 앱 표준(크림 줄무늬 · 검정 테두리 카드 · Black Han Sans · 빨강/노랑/남색).
   전투 무대만 짙은 법정 색을 써서 긴장을 준다. */
:root {
  --cream: #FFF6E5;
  --cream-2: #FCEFD6;
  --ink: #1B1B1F;
  --ink-2: #3A3530;
  --mute: #6E6456;
  --red: #E8332A;
  --yellow: #FFD13F;
  --navy: #2E4374;
  --wood: #6B4A2F;
  --green: #2E8B57;
}
* { 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); }
.red { color: var(--red); } .navy { color: var(--navy); }

/* ── 머리 ── */
.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; }
.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); }
.sec-label { font-size: .8rem; font-weight: 900; letter-spacing: .07em; color: var(--mute); margin: 16px 0 8px; }

/* ── 히어로 ── */
.hero { display: grid; grid-template-columns: 1fr 104px; 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(2rem, 8.4vw, 2.6rem); line-height: 1.12; margin: 0; text-shadow: 3px 3px 0 var(--yellow); }
.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; }
.hero-jo img { display: block; width: 100%; height: auto; filter: drop-shadow(3px 3px 0 rgba(27,27,31,.14)); }

/* ── 기록 · 설정 ── */
.record { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; padding: 12px 10px; }
.record b { display: block; font-family: 'Black Han Sans', sans-serif; font-size: 1.5rem; font-weight: 400; }
.record span { font-size: .72rem; color: var(--mute); font-weight: 700; }
.opt-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.opt {
  font: inherit; font-weight: 800; font-size: .82rem; cursor: pointer; padding: 7px 13px;
  border: 2.5px solid var(--ink); border-radius: 99px; background: #fff; color: var(--ink);
}
.opt[aria-pressed="true"] { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.opt-note { font-size: .74rem; color: var(--mute); }

/* ── 사건 카드 ── */
.cases { display: grid; gap: 9px; margin-bottom: 14px; }
.case-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left;
  font: inherit; cursor: pointer; padding: 12px 14px; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}
.case-btn:active { transform: translate(4px,4px); box-shadow: none; }
.case-btn b { display: block; font-size: .96rem; font-weight: 900; }
.case-btn .sub { display: block; font-size: .78rem; color: var(--mute); margin-top: 2px; }
.case-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.diff { font-size: .7rem; font-weight: 900; padding: 3px 9px; border-radius: 99px; border: 2px solid var(--ink); white-space: nowrap; }
.diff.d1 { background: #C7E8D4; } .diff.d2 { background: var(--yellow); } .diff.d3 { background: #FFB3AE; }
.case-star { font-size: .82rem; letter-spacing: .04em; }

.how h3 { margin: 0 0 6px; font-size: .95rem; }
.how ol { margin: 0; padding-left: 18px; font-size: .84rem; color: var(--ink-2); }
.how li { margin: 3px 0; }

/* ── 전투 무대 ── */
.stage { background: #21304F; border-color: var(--ink); color: #F4EEE2; padding: 12px; }
.fighters { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; }
.fighter { margin: 0; text-align: center; position: relative; }
.fighter img { display: block; width: 100%; max-width: 128px; height: auto; margin: 0 auto; }
.fighter figcaption { font-size: .74rem; font-weight: 800; color: #D9CFBB; margin-top: 2px; }
.fighter.hit img { animation: hitShake .4s; }
@keyframes hitShake { 25% { transform: translateX(-7px) rotate(-3deg); } 50% { transform: translateX(7px) rotate(3deg); } 75% { transform: translateX(-4px); } }
.vs { font-family: 'Black Han Sans', sans-serif; font-size: 1.2rem; color: var(--yellow); padding-bottom: 20px; }
.gauges { display: grid; gap: 7px; margin-top: 10px; }
.gauge-box { background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25); border-radius: 10px; padding: 6px 10px; }
.gauge-box.flash { animation: gFlash .45s; }
@keyframes gFlash { 50% { background: rgba(255,209,63,.35); } }
.gauge-top { display: flex; justify-content: space-between; font-size: .76rem; font-weight: 800; }
.gauge-bar { height: 12px; border-radius: 99px; background: rgba(0,0,0,.3); overflow: hidden; margin-top: 4px; }
.gauge-bar i { display: block; height: 100%; transition: width .45s cubic-bezier(.2,.9,.3,1); }
.gauge-bar i.foe { background: linear-gradient(90deg, #FF8A7A, #E8332A); }
.gauge-bar i.me { background: linear-gradient(90deg, #8ED1B4, #2E8B57); }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 9px; font-size: .78rem; font-weight: 800; color: #E6DDC9; }
.score-row b { color: #fff; font-variant-numeric: tabular-nums; }
#comboTxt { color: var(--yellow); }
.timer-bar { height: 8px; border-radius: 99px; background: rgba(0,0,0,.3); overflow: hidden; margin-top: 6px; }
.timer-bar i { display: block; height: 100%; width: 100%; background: var(--yellow); }
.timer-bar.warn i { background: var(--red); }

.dmg {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%); font-family: 'Black Han Sans', sans-serif;
  font-size: 1.6rem; color: var(--red); text-shadow: 0 2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 -2px 0 #fff;
  animation: dmgUp .9s ease-out forwards; pointer-events: none;
}
.dmg.me { color: #2E8B57; }
@keyframes dmgUp { to { transform: translate(-50%, -40px); opacity: 0; } }
.spark { position: absolute; left: 50%; top: 40%; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; }

/* ── 주장 · 손패 ── */
.claim { position: relative; animation: claimIn .32s; }
@keyframes claimIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.claim .txt { margin: 0; font-size: 1.02rem; font-weight: 800; line-height: 1.5; }
.claim .round { margin: 6px 0 0; font-size: .76rem; color: var(--mute); font-weight: 700; }
.hand-label { font-size: .76rem; font-weight: 900; letter-spacing: .04em; color: var(--mute); margin: 0 0 7px; }
.hand { display: grid; gap: 8px; margin-bottom: 12px; }
.hand button {
  display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; padding: 11px 13px; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); border-radius: 13px; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.hand button:active { transform: translate(4px,4px); box-shadow: none; }
.hand .kind { display: inline-block; font-size: .68rem; font-weight: 900; padding: 2px 8px; border-radius: 99px; border: 2px solid var(--ink); margin-bottom: 4px; }
.hand .kind.증거 { background: #9CC9FF; } .hand .kind.법리 { background: var(--yellow); } .hand .kind.절차 { background: #D9CFBB; }
.hand .nm { display: block; font-size: .98rem; font-weight: 900; }
.hand .desc { display: block; font-size: .8rem; color: var(--mute); }
.hand button.dim { opacity: .38; }
.hand button.picked-right { background: #DFF3E7; border-color: var(--green); }
.hand button.picked-wrong { background: #FFE2E0; border-color: var(--red); }
.hand button:disabled { cursor: default; }

.verdict { margin-bottom: 12px; }
.vbox { border: 3px solid var(--ink); border-radius: 14px; padding: 12px 14px; background: #fff; box-shadow: 4px 4px 0 var(--ink); animation: claimIn .3s; }
.vbox.ok { background: #DFF3E7; }
.vbox.no { background: #FFE9E7; }
.vbox .vt { font-family: 'Black Han Sans', sans-serif; font-size: 1.1rem; margin-bottom: 3px; }
.vbox .vd { font-size: .85rem; color: var(--ink-2); }
.vbox .vnext { margin-top: 9px; }
.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.small { font-size: .8rem; padding: 7px 14px; box-shadow: 3px 3px 0 var(--ink); }

/* ── 재판장 컷인 ── */
.cutin {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(27,27,31,.5); pointer-events: none; padding: 20px;
}
.cutin[hidden] { display: none; }
.cutin img { width: 130px; height: auto; animation: cutIn .3s cubic-bezier(.2,1.5,.5,1); filter: drop-shadow(4px 4px 0 rgba(0,0,0,.25)); }
.cutin p {
  margin: 0; max-width: 250px; background: #fff; border: 3px solid var(--ink); border-radius: 14px;
  padding: 10px 14px; font-weight: 900; font-size: .92rem; box-shadow: 4px 4px 0 var(--ink); animation: cutIn .34s .05s backwards;
}
@keyframes cutIn { from { opacity: 0; transform: translateX(30px) scale(.9); } to { opacity: 1; transform: none; } }

/* ── 결과 ── */
.end-card { text-align: center; padding-top: 0; }
.end-jo { display: block; width: 130px; height: auto; margin: -46px auto 0; filter: drop-shadow(3px 3px 0 rgba(27,27,31,.15)); }
.stamp {
  display: inline-block; margin: 2px 0 6px; padding: 7px 20px; border: 5px solid var(--red); border-radius: 12px;
  color: var(--red); font-family: 'Black Han Sans', sans-serif; font-size: 1.6rem; letter-spacing: .1em; transform: rotate(-4deg);
  animation: stampIn .5s cubic-bezier(.2,1.6,.5,1);
}
.stamp.lose { border-color: var(--mute); color: var(--mute); }
.stamp.perfect { border-color: var(--navy); color: var(--navy); }
@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.7rem; letter-spacing: .1em; min-height: 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; } }
.end-line { font-size: .88rem; font-weight: 700; color: var(--ink-2); margin: 6px 0 10px; }
.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.end-stats b { display: block; font-family: 'Black Han Sans', sans-serif; font-size: 1.25rem; font-weight: 400; }
.end-stats span { font-size: .68rem; color: var(--mute); font-weight: 700; }
.end-best { margin: 10px 0 0; font-size: .82rem; font-weight: 800; color: var(--red); }
.end-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); }

.review h3 { margin: 0 0 8px; font-size: .95rem; }
.review .rv { border-left: 6px solid var(--green); padding: 6px 0 6px 10px; margin-bottom: 8px; }
.review .rv.no { border-left-color: var(--red); }
.review .rq { font-size: .82rem; font-weight: 800; }
.review .ra { font-size: .8rem; color: var(--mute); }

/* ── 공통 ── */
.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); }
.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); }

body.shake-s { animation: shakeS .22s; }
body.shake-l { animation: shakeL .4s; }
@keyframes shakeS { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes shakeL { 20% { transform: translate(-8px, 3px) rotate(-.6deg); } 45% { transform: translate(8px, -3px) rotate(.6deg); } 70% { transform: translate(-5px, 2px) rotate(-.3deg); } }

@media (min-width: 600px) {
  .hero { grid-template-columns: 1fr 150px; }
  .fighter img { max-width: 170px; }
  .hand { grid-template-columns: 1fr 1fr; }
}

/* ── 폰에서는 «고르는 화면»이 한 눈에 들어와야 한다 (2026-09-20 조변 지적) ──
   무대·주장·손패 네 장이 스크롤 없이 첫 화면에 들어오도록 세로를 줄인다. */
@media (max-width: 599px) {
  .wrap { padding: 10px 12px 34px; }
  #battleScreen .card { margin-bottom: 8px; }
  .stage { padding: 9px 10px; }
  /* ⚠️ 세로가 비싸다: max-width 로 줄이면 3:4 그림이라 높이가 1.7배로 남는다 → 높이를 직접 정한다 */
  .fighter img { height: 78px; width: auto; max-width: 100%; }
  .fighter figcaption { font-size: .66rem; margin-top: 0; line-height: 1.3; }
  .vs { font-size: .95rem; padding-bottom: 12px; }
  .gauges { grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
  .gauge-box { padding: 5px 8px; }
  .gauge-top { font-size: .7rem; }
  .gauge-bar { height: 9px; margin-top: 3px; }
  .score-row { margin-top: 5px; font-size: .7rem; }
  .timer-bar { height: 6px; margin-top: 4px; }
  .claim { padding: 10px 12px; }
  .claim .label { font-size: .68rem; margin-bottom: 2px; }
  .claim .txt { font-size: .9rem; line-height: 1.38; }
  .claim .round { font-size: .7rem; margin-top: 4px; }
  .hand-label { display: none; }   /* 카드가 곧 손패다 — 폰에서는 한 줄을 아낀다 */
  .hand { gap: 6px; margin-bottom: 8px; }
  .hand button { padding: 6px 10px; border-radius: 11px; box-shadow: 3px 3px 0 var(--ink); }
  .hand .kind { font-size: .62rem; padding: 1px 7px; margin-bottom: 1px; }
  .hand .nm { font-size: .85rem; line-height: 1.3; }
  .hand .desc { font-size: .7rem; line-height: 1.3; }
  .dmg { font-size: 1.2rem; }
}
/* 세로가 짧은 폰(아이폰 SE 등)은 한 번 더 줄인다 */
@media (max-width: 599px) and (max-height: 720px) {
  .fighter img { height: 62px; }
  .stage { padding: 7px 9px; }
  .gauge-bar { height: 8px; }
  .claim { padding: 8px 11px; }
  .claim .txt { font-size: .86rem; }
  .hand { gap: 5px; }
  .hand button { padding: 5px 9px; }
  .hand .nm { font-size: .82rem; }
  .hand .desc { font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  body.shake-s, body.shake-l, .fighter.hit img, .dmg, .stamp, .stars span, .claim, .vbox, .cutin img, .cutin p, .gauge-box.flash { animation: none; }
  .confetti { display: none; }
  .gauge-bar i { transition: none; }
}
