/* 법정 속기왕 · 2026-09-20 (옛 «한글 타자연습» 전면 개편)
   재미 앱 표준 «법정 웹툰» 톤(헌법 §7) · 포인트 노랑 + 법정 남색. */
:root {
    --cream: #FFF6E5;
    --paper: #FFFFFF;
    --ink: #1A1A1A;
    --ink-soft: #4A4A4A;
    --mute: #7A7266;
    --red: #E8332A;
    --yellow: #FFD13F;
    --yellow-soft: #FFF1B8;
    --navy: #2E4374;
    --navy-soft: #E4E9F4;
    --green: #2F9E6E;
    --gray-soft: #EEEDEA;
    --line: 3px solid var(--ink);
    --shadow: 5px 5px 0 var(--ink);
    --shadow-s: 3px 3px 0 var(--ink);
    --display: 'Black Han Sans', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --body: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
    --mono: 'Malgun Gothic', 'Apple SD Gothic Neo', monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--body); color: var(--ink); word-break: keep-all; line-height: 1.55; min-height: 100vh; -webkit-tap-highlight-color: transparent;
       background-color: var(--cream); background-image: repeating-linear-gradient(135deg, rgba(26,26,26,.028) 0 14px, transparent 14px 28px); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px; }

/* 머리 (헌법 §5) */
.shin-header { position: sticky; top: 0; z-index: 40; height: 56px; display: flex; align-items: center; background: var(--cream); border-bottom: var(--line); }
.shin-header-inner { width: 100%; max-width: 620px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 32px; height: 32px; flex: none; display: grid; place-items: center; background: var(--navy); color: #fff; border: 2px solid var(--ink); border-radius: 8px; font-family: serif; font-weight: 700; font-size: 18px; }
.brand-name { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.head-tools { display: flex; gap: 6px; flex: none; }
.tool-btn { width: 38px; height: 38px; display: grid; place-items: center; font-size: 18px; line-height: 1; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); text-decoration: none; transition: transform .1s, box-shadow .1s; }
.tool-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.tool-btn.off { background: #EDE6D8; opacity: .75; }

/* 공통 */
.card { background: var(--paper); border: var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 10px 16px; border: var(--line); border-radius: 14px; background: var(--paper); font-weight: 800; box-shadow: var(--shadow-s); text-decoration: none; color: var(--ink); text-align: center; transition: transform .1s, box-shadow .1s; }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.yellow { background: var(--yellow); }
.btn.ghost { box-shadow: none; border-width: 2px; }
.btn.big { min-height: 60px; font-family: var(--display); font-weight: 400; font-size: 1.35rem; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .86rem; box-shadow: 2px 2px 0 var(--ink); }
.btn.wide { width: 100%; }
.btn:focus-visible, .tool-btn:focus-visible, .linkbtn:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.screen { padding: 16px 0 34px; }
.kicker { display: inline-block; font-size: .78rem; font-weight: 800; background: var(--yellow); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; box-shadow: 2px 2px 0 var(--ink); }
.home-row { display: flex; gap: 8px; margin-top: 10px; }
.home-row .btn { flex: 1; min-height: 44px; font-size: .9rem; padding: 8px 10px; }
.linkbtn { background: none; border: none; font-size: .86rem; font-weight: 800; color: var(--ink-soft); padding: 4px; }

/* 첫 화면 */
.title-block { text-align: center; }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(2.4rem, 12vw, 3.2rem); line-height: 1.06; margin-top: 10px; }
.logo span { color: var(--yellow); -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.sub { font-size: .92rem; font-weight: 700; color: var(--ink-soft); margin-top: 8px; }
.hero { position: relative; height: 230px; margin: 16px 0 14px; overflow: hidden; background: var(--navy-soft); cursor: pointer; }
/* 🚨 그림을 카드 바닥에 붙이고 높이를 100% 넘게 주면 머리가 카드 밖으로 잘린다(2026-09-21 조변 지적).
      캐릭터 컷은 머리 위 여백이 거의 없게 잘려 있어 조금만 넘겨도 티가 난다. 위에서 띄우고 바닥까지 채운다. */
.hero-jo { position: absolute; left: 4px; top: 6px; bottom: auto; height: calc(100% - 6px); width: auto; }
.bubble { position: absolute; right: 12px; top: 16px; max-width: 52%; background: var(--paper); border: var(--line); border-radius: 14px; padding: 9px 12px; box-shadow: var(--shadow-s); font-weight: 800; font-size: .86rem; line-height: 1.4; }
.bubble small { display: block; margin-top: 3px; font-size: .72rem; font-weight: 700; color: var(--mute); }
.mobile-toggle { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 13px; cursor: pointer; box-shadow: var(--shadow-s); }
.mobile-toggle input { width: 22px; height: 22px; flex: none; accent-color: var(--navy); }
.mobile-toggle b { display: block; font-size: .95rem; }
.mobile-toggle small { display: block; font-size: .78rem; color: var(--mute); font-weight: 700; margin-top: 2px; }
.tip { margin-top: 14px; font-size: .84rem; font-weight: 700; color: var(--ink-soft); background: var(--yellow-soft); border: 2px solid var(--ink); border-radius: 12px; padding: 9px 12px; }
.notice-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; background: rgba(0,0,0,.035); border: 1px solid rgba(0,0,0,.09); border-radius: 10px; padding: 9px 12px; font-size: .82rem; line-height: 1.55; }
.notice-line svg { flex: none; margin-top: 3px; opacity: .5; }

/* 재판(게임) */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-round { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-round b { font-family: var(--display); font-weight: 400; font-size: 1rem; }
.hud-round i { font-style: normal; font-size: .78rem; font-weight: 800; color: var(--mute); margin-left: 6px; }
.hud-miss { font-size: .82rem; letter-spacing: .04em; flex: none; }
.hud .linkbtn { flex: none; }
.hud-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 10px; text-align: center; }
.hud-stats div { position: relative; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 5px 2px; }
.hud-stats div.pulse { animation: cellPulse .5s ease-out; }
@keyframes cellPulse { 0% { background: var(--yellow); transform: scale(1); } 40% { transform: scale(1.1); } 100% { background: var(--paper); transform: scale(1); } }
.hud-stats b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.15rem; }
.hud-stats span { font-size: .68rem; font-weight: 800; color: var(--mute); }
.timebar { height: 12px; background: var(--gray-soft); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--green); transition: width .1s linear; }
.timebar.low i { background: var(--red); }
.timebar.low { animation: barBeat .6s ease-in-out infinite; }
@keyframes barBeat { 0%, 100% { transform: none; } 50% { transform: scaleY(1.28); } }
.timebar.off { opacity: .25; }
.court { position: relative; padding: 16px 14px 14px; overflow: hidden; }
.court-label { display: inline-block; font-size: .74rem; font-weight: 800; background: var(--ink); color: var(--yellow); border-radius: 6px; padding: 3px 9px; }
.line { font-size: clamp(1.15rem, 5.2vw, 1.5rem); font-weight: 700; line-height: 1.75; letter-spacing: .01em; margin: 12px 0 14px; word-break: keep-all; }
.line span { color: var(--mute); }
.line span.ok { color: var(--ink); background: rgba(47,158,110,.16); border-radius: 3px; }
.line span.just { display: inline-block; animation: hit .22s ease-out; }
@keyframes hit { 0% { transform: scale(1.5); } 100% { transform: none; } }
.line span.no { color: #fff; background: var(--red); border-radius: 3px; }
.line span.cur { color: var(--ink); border-bottom: 3px solid var(--navy); background: var(--yellow-soft); border-radius: 3px 3px 0 0; }
.answer input { width: 100%; min-height: 54px; padding: 10px 14px; font-size: 1.1rem; font-weight: 700; background: var(--paper);
                border: var(--line); border-radius: 12px; box-shadow: inset 2px 2px 0 rgba(26,26,26,.06); }
.answer input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(46,67,116,.18); }
.hint { margin-top: 8px; font-size: .78rem; color: var(--mute); font-weight: 700; text-align: center; }
.react-slot { min-height: 86px; display: flex; align-items: flex-end; justify-content: flex-end; margin-top: 6px; }
.react { display: flex; align-items: flex-end; gap: 6px; max-width: 100%; pointer-events: none; }
.react[hidden] { display: flex !important; visibility: hidden; }
.react img { width: 82px; height: auto; filter: drop-shadow(2px 2px 0 rgba(26,26,26,.2)); }
.react b { background: var(--paper); border: var(--line); border-radius: 12px; padding: 7px 10px; font-size: .84rem; box-shadow: var(--shadow-s); margin-bottom: 16px; }
.react.bad b { background: #FBE3E1; color: var(--red); }
.react.good b { background: #E4F3EC; }
.react.miss b { background: var(--gray-soft); }
.gain { position: absolute; left: 50%; top: -2px; z-index: 3; font-family: var(--display); font-size: 1.25rem; color: var(--green); white-space: nowrap;
        text-shadow: 2px 2px 0 var(--cream), -2px -2px 0 var(--cream), 2px -2px 0 var(--cream), -2px 2px 0 var(--cream);
        pointer-events: none; animation: rise 1.25s ease-out forwards; }
@keyframes rise { 0% { transform: translate(-50%, 8px); opacity: 0; } 18% { opacity: 1; } 100% { transform: translate(-50%, -22px); opacity: 0; } }

/* 심급 컷인 — 아래쪽 알림 알약을 대신한다(알약은 두 줄로 부풀고 결과 화면까지 남았다) */
.roundcut { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; }
.rc-in { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 30px; text-align: center;
         background: var(--navy); color: #fff; border: var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.rc-in b { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 9vw, 2.6rem); line-height: 1.12; color: var(--yellow);
           -webkit-text-stroke: 1.4px var(--ink); paint-order: stroke fill; }
.rc-in span { font-size: .88rem; font-weight: 800; }
.roundcut.go .rc-in { animation: rcIn 1.15s cubic-bezier(.2,1.15,.3,1) both; }
@keyframes rcIn { 0% { transform: translateX(-130%) skewX(-12deg); opacity: 0; } 14%, 70% { transform: none; opacity: 1; }
                  100% { transform: translateX(130%) skewX(12deg); opacity: 0; } }

/* 놓쳤을 때 붉은 섬광 */
.flash { position: fixed; inset: 0; z-index: 75; pointer-events: none; background: var(--red); opacity: 0; }
.flash.on { animation: fl .34s ease-out; }
@keyframes fl { 0% { opacity: .3; } 100% { opacity: 0; } }

/* 결과 */
.rcard { position: relative; text-align: center; padding: 16px 16px 18px; overflow: hidden; }
.stamp { position: absolute; top: 172px; right: 12px; z-index: 3; transform: rotate(11deg); font-family: var(--display); font-size: 1rem; color: var(--red); border: 3px solid var(--red); border-radius: 8px; padding: 2px 8px; background: rgba(255,255,255,.85); }
.r-kicker { font-weight: 800; color: var(--mute); font-size: .86rem; }
.r-pic { position: relative; height: 230px; margin: 6px -16px 0; overflow: hidden; border-bottom: var(--line); }
.r-sun { position: absolute; left: 50%; bottom: -110px; width: 300px; height: 300px; transform: translateX(-50%); border-radius: 50%; background: var(--yellow); border: var(--line); }
.r-pic img { position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; transform: translateX(-50%); }
.r-grade { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 8vw, 2.3rem); margin-top: 14px; outline: none; }
.r-line { font-weight: 800; color: var(--ink-soft); margin-top: 6px; }
.r-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 16px; }
.r-stats div { background: var(--yellow-soft); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 2px; }
.r-stats b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.25rem; }
.r-stats span { font-size: .68rem; font-weight: 800; color: var(--mute); }
.r-best { margin-top: 12px; font-size: .86rem; font-weight: 800; color: var(--navy); }
.actions { display: grid; gap: 9px; margin-top: 16px; }
.jo-cta { display: flex; gap: 12px; align-items: flex-end; margin-top: 18px; padding: 14px 14px 14px 4px; overflow: hidden; background: var(--navy-soft); }
.jo-cta img { width: 92px; height: auto; flex: none; margin-bottom: -14px; }
.jo-cta b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.05rem; line-height: 1.3; }
.jo-cta p { font-size: .85rem; color: var(--ink-soft); margin: 5px 0 10px; }
.foot { text-align: center; font-size: .76rem; color: var(--mute); padding: 6px 0 28px; }
.foot a { color: var(--mute); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 85; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translate(-50%, 12px); max-width: min(88vw, 420px); background: var(--ink); color: #fff; font-weight: 700; font-size: .86rem; text-align: center; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 움직임 (헌법 §7) */
.hero-jo { animation: sway 5s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes sway { 0%, 100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg); } }
.bubble.pop, .react.pop { animation: pop .3s cubic-bezier(.3,1.7,.5,1); }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
.line.in { animation: lineIn .3s cubic-bezier(.2,.9,.3,1.2); }
@keyframes lineIn { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.line.shake { animation: shake .3s linear; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.rcard.reveal .r-pic img { animation: rise2 .55s cubic-bezier(.2,.9,.3,1.1) both; }
@keyframes rise2 { 0% { transform: translate(-50%, 70%); } 100% { transform: translate(-50%, 0); } }
.rcard.reveal .r-sun { animation: sun .5s cubic-bezier(.2,.9,.3,1.15) both; }
@keyframes sun { 0% { transform: translateX(-50%) scale(0); } 100% { transform: translateX(-50%) scale(1); } }
.rcard .stamp { opacity: 0; }
.rcard.stamped .stamp { opacity: 1; animation: slam .36s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes slam { 0% { transform: rotate(11deg) scale(2.8); opacity: 0; } 70% { transform: rotate(11deg) scale(.94); opacity: 1; } 100% { transform: rotate(11deg) scale(1); opacity: 1; } }

@media (max-width: 360px) {
    .hud-stats b { font-size: 1rem; }
    .bubble { max-width: 56%; font-size: .8rem; }
    .react img { width: 58px; }
}
@media (min-width: 620px) {
    .hero { height: 260px; }
    .line { line-height: 1.8; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-jo, .line.shake, .timebar.low, .flash.on, .line span.just { animation: none !important; }
    .roundcut.go .rc-in { animation: rcFade .55s both; }
    @keyframes rcFade { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }
    .gain { animation-duration: .8s; }
    .rcard.reveal .r-pic img { animation-duration: .3s; }
    .rcard.stamped .stamp { animation-duration: .2s; }
    .line.in { animation: none; }
}
