/* 주식 타임머신 · 2026-09-21 신설
   재미 앱 표준 «법정 웹툰» 톤(헌법 §7) · 오름 초록 · 내림 빨강 · 포인트 노랑. */
:root {
    --cream: #FFF6E5;
    --paper: #FFFFFF;
    --ink: #1A1A1A;
    --ink-soft: #4A4A4A;
    --mute: #7A7266;
    --red: #E8332A;
    --red-soft: #FBE3E1;
    --yellow: #FFD13F;
    --yellow-soft: #FFF1B8;
    --navy: #2E4374;
    --navy-soft: #E4E9F4;
    --green: #2F9E6E;
    --green-soft: #E4F3EC;
    --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;
}
* { 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%; }
canvas { 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:disabled { opacity: .5; }
.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.32rem; }
.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, .tab:focus-visible, .chip: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); }
.linkbtn { background: none; border: none; font-size: .88rem; font-weight: 800; color: var(--ink-soft); padding: 4px 6px; }
.sec-title { display: block; font-family: var(--display); font-weight: 400; font-size: 1.05rem; margin-bottom: 10px; }
.hint { margin-top: 8px; font-size: .78rem; font-weight: 700; color: var(--mute); line-height: 1.5; }
.notice-line { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; background: rgba(0,0,0,.035); border: 1px solid rgba(0,0,0,.09); border-radius: 10px; padding: 9px 12px; font-size: .8rem; line-height: 1.55; }
.notice-line svg { flex: none; margin-top: 3px; opacity: .5; }
.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; }
.foot { text-align: center; font-size: .76rem; color: var(--mute); padding: 6px 0 28px; }
.foot a { color: var(--mute); }

/* ① 고르기 */
.title-block { text-align: center; }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 11vw, 3rem); 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); }
.hero { position: relative; height: 200px; margin: 14px 0; overflow: hidden; background: var(--navy-soft); }
/* 🚨 그림을 카드 바닥에 붙이고 높이를 100% 넘게 주면 머리가 카드 밖으로 잘린다(2026-09-21 조변 지적).
      캐릭터 컷은 머리 위 여백이 거의 없게 잘려 있어 조금만 넘겨도 티가 난다. 위에서 띄우고 바닥까지 채운다. */
.hero-jo { position: absolute; left: 2px; top: 6px; bottom: auto; height: calc(100% - 6px); width: auto; }
.bubble { position: absolute; right: 12px; top: 18px; max-width: 56%; background: var(--paper); border: var(--line); border-radius: 14px; padding: 9px 12px; box-shadow: var(--shadow-s); font-weight: 800; font-size: .84rem; line-height: 1.4; }
.bubble small { display: block; margin-top: 3px; font-size: .72rem; font-weight: 700; color: var(--mute); }
.step { padding: 14px 14px 16px; margin-bottom: 12px; }
.step-title { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 400; font-size: 1.1rem; margin-bottom: 10px; }
.step-title i { display: grid; place-items: center; width: 26px; height: 26px; flex: none; font-style: normal; font-size: .9rem; background: var(--navy); color: #fff; border: 2px solid var(--ink); border-radius: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; min-height: 40px; padding: 6px 8px; font-size: .88rem; font-weight: 800; background: var(--gray-soft); border: 2px solid var(--ink); border-radius: 10px; }
.tab.on { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.tabs.small .tab { min-height: 36px; font-size: .84rem; }
.search { width: 100%; min-height: 44px; padding: 8px 12px; font-size: .95rem; font-weight: 700; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; margin-bottom: 10px; }
.search:focus, .dateInput:focus, .unitbox input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(46,67,116,.18); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 214px; overflow-y: auto; }
.chips.tight { max-height: none; margin-bottom: 10px; }
.chip { padding: 7px 11px; font-size: .84rem; font-weight: 800; background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; white-space: nowrap; }
.chip small { font-weight: 700; color: var(--mute); font-size: .74rem; margin-left: 4px; }
.chip.on { background: var(--navy); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.chip.on small { color: rgba(255,255,255,.75); }
.chip.pop { animation: chipPop .3s cubic-bezier(.3,1.7,.5,1); }
@keyframes chipPop { 0% { transform: scale(.82); } 100% { transform: none; } }
.picked { margin-top: 10px; font-size: .84rem; font-weight: 800; color: var(--navy); background: var(--navy-soft); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 11px; }
.dateInput { width: 100%; min-height: 48px; padding: 8px 12px; font-size: 1rem; font-weight: 800; background: var(--paper); border: var(--line); border-radius: 12px; }
.unitbox { display: flex; align-items: center; gap: 8px; }
.unitbox input { flex: 1; min-width: 0; min-height: 50px; padding: 8px 12px; font-size: 1.15rem; font-weight: 800; text-align: right; background: var(--paper); border: var(--line); border-radius: 12px; }
.unitbox b { flex: none; font-size: .95rem; font-weight: 800; color: var(--ink-soft); }
#quickAmounts { margin-top: 10px; }

/* ② 타임머신 */
.tunnel { padding-top: 12px; }
.tn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tn-name { font-size: .82rem; font-weight: 800; background: var(--ink); color: var(--yellow); border-radius: 6px; padding: 4px 10px; }
.tn-year { font-family: var(--display); font-weight: 400; font-size: clamp(3.4rem, 17vw, 5rem); line-height: 1; text-align: center; margin-top: 6px;
           color: var(--yellow); -webkit-text-stroke: 2.4px var(--ink); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--ink); }
.tn-date { text-align: center; font-size: .84rem; font-weight: 800; color: var(--mute); margin-top: 2px; }
.tn-chart { position: relative; margin-top: 12px; padding: 10px; overflow: hidden; }
.tn-chart canvas { width: 100%; height: auto; }
.tn-badge { position: absolute; right: 14px; top: 14px; font-family: var(--display); font-size: 1.4rem; color: var(--red);
            border: 3px solid var(--red); border-radius: 10px; padding: 2px 10px; background: rgba(255,255,255,.9); transform: rotate(9deg); }
.tn-badge.up { color: var(--green); border-color: var(--green); }
.tn-badge.arrive { color: var(--navy); border-color: var(--navy); font-size: 1.7rem; }
.tn-badge.show { animation: slam .34s cubic-bezier(.2,1.4,.4,1) both; }
.tn-money { display: flex; align-items: baseline; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.tn-label { font-size: .78rem; font-weight: 800; color: var(--mute); width: 100%; text-align: center; }
.tn-value { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 9vw, 2.8rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tn-value.up { color: var(--green); }
.tn-value.down { color: var(--red); }
.tn-value.pop { animation: valPop .45s cubic-bezier(.3,1.7,.5,1); }
@keyframes valPop { 0% { transform: scale(1.35); } 100% { transform: none; } }
/* 달리는 동안 뒤로 흘러가는 속도선 — 시간 여행 느낌 */
.tunnel.run { background-image: repeating-linear-gradient(90deg, transparent 0 46px, rgba(46,67,116,.07) 46px 50px); background-size: 200px 100%; animation: speed .35s linear infinite; }
@keyframes speed { 0% { background-position: 0 0; } 100% { background-position: -200px 0; } }
.tn-delta { font-size: .95rem; font-weight: 800; color: var(--mute); font-variant-numeric: tabular-nums; }
.bar { height: 12px; background: var(--gray-soft); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--navy); }
.tn-log { list-style: none; display: flex; flex-direction: column; gap: 5px; min-height: 150px; }
.tn-log li { display: flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 800; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 7px 10px;
             animation: logIn .3s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes logIn { 0% { transform: translateX(-18px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.tn-log li em { font-style: normal; color: var(--mute); font-weight: 700; font-size: .78rem; margin-left: auto; white-space: nowrap; }
.tn-log li.good { background: var(--green-soft); }
.tn-log li.bad { background: var(--red-soft); color: var(--red); }

/* ③ 판결문 */
.vcard { position: relative; text-align: center; padding: 16px 16px 18px; overflow: hidden; }
.stamp { position: absolute; top: 170px; 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,.88); }
.v-kicker { font-weight: 800; color: var(--mute); font-size: .84rem; }
.v-pic { position: relative; height: 224px; margin: 6px -16px 0; overflow: hidden; border-bottom: var(--line); }
.v-sun { position: absolute; left: 50%; bottom: -110px; width: 300px; height: 300px; transform: translateX(-50%); border-radius: 50%; background: var(--yellow); border: var(--line); }
.v-pic img { position: absolute; left: 50%; bottom: 0; height: 100%; width: auto; transform: translateX(-50%); }
.v-grade { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 8vw, 2.3rem); margin-top: 14px; outline: none; }
.v-order { font-weight: 800; color: var(--ink); margin-top: 10px; font-size: .92rem; line-height: 1.6; background: var(--yellow-soft); border: 2px solid var(--ink); border-radius: 12px; padding: 10px 12px; }
.v-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 14px; }
.v-stats div { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 2px; }
.v-stats b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.05rem; line-height: 1.2; }
.v-stats span { font-size: .66rem; font-weight: 800; color: var(--mute); white-space: nowrap; }
.v-asof { margin-top: 10px; font-size: .72rem; font-weight: 700; color: var(--mute); line-height: 1.45; }
.hint.asof { margin-top: 12px; }
.v-fx { margin-top: 12px; font-size: .84rem; font-weight: 800; color: var(--navy); background: var(--navy-soft); border: 2px dashed var(--navy); border-radius: 10px; padding: 8px 10px; }
.v-line { margin-top: 12px; font-size: .88rem; font-weight: 800; color: var(--ink-soft); }
.mdd, .cmp, .div { margin-top: 14px; padding: 14px; }
.mdd { background: #FFF9F8; }
.mdd-big { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 11vw, 3rem); color: var(--red); line-height: 1.05; }
.mdd-when { font-size: .86rem; font-weight: 800; color: var(--ink-soft); margin-top: 4px; }
.mdd canvas { width: 100%; height: auto; margin-top: 10px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); }
.mdd-say { margin-top: 10px; font-size: .88rem; font-weight: 800; color: var(--red); }
.cmp-rows { display: grid; gap: 7px; }
.cmp-row { display: flex; align-items: center; gap: 9px; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 11px; }
.cmp-row span { font-size: .86rem; font-weight: 800; flex: none; width: 92px; }
.cmp-row i { flex: 1; height: 12px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.cmp-row i u { display: block; height: 100%; background: var(--navy); text-decoration: none; }
.cmp-row.me i u { background: var(--yellow); }
.cmp-row.me { background: var(--yellow-soft); }
.cmp-row b { font-size: .88rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.div-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; }
.div-row span { font-size: .86rem; font-weight: 800; }
.div-row b { font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.div-row.on { background: var(--green-soft); }
.div-row.on b { color: var(--green); }
.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: .84rem; color: var(--ink-soft); margin: 5px 0 10px; }

/* 연출 */
.flash { position: fixed; inset: 0; z-index: 86; pointer-events: none; opacity: 0; background: var(--red); }
.flash.on { animation: fl .4s ease-out; }
.flash.green { background: var(--green); }
@keyframes fl { 0% { opacity: .3; } 100% { opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 85; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 92; 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: 16px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.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 { animation: pop .3s cubic-bezier(.3,1.7,.5,1); }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
.tn-year.tick { animation: yearPop .28s cubic-bezier(.3,1.6,.5,1); }
@keyframes yearPop { 0% { transform: scale(1.22); } 100% { transform: none; } }
.vcard.reveal .v-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); } }
.vcard.reveal .v-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); } }
.vcard .stamp { opacity: 0; }
.vcard.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; } }
.tn-chart.shake { animation: shake .34s linear; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

@media (max-width: 360px) {
    .bubble { max-width: 60%; font-size: .78rem; }
    .v-stats b { font-size: .92rem; }
    .cmp-row span { width: 78px; font-size: .8rem; }
}
@media (min-width: 560px) {
    .hero { height: 228px; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-jo, .tn-chart.shake, .flash.on, .tunnel.run { animation: none !important; }
    .tn-year.tick, .tn-log li, .chip.pop { animation-duration: .01s; }
    .vcard.reveal .v-pic img { animation-duration: .3s; }
    .vcard.stamped .stamp, .tn-badge.show { animation-duration: .2s; }
}
