/* 산성비 타자 */
:root {
  --bg: #050816; --panel: rgba(10, 16, 34, .94); --line: rgba(125, 211, 252, .25);
  --text: #f1f5f9; --mute: #94a3b8; --sky: #7dd3fc; --lime: #bef264; --pink: #f9a8d4; --yellow: #fde047; --red: #fb7185;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); overscroll-behavior: none; }
body { color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
kbd { font: 700 .75rem ui-monospace, monospace; padding: 1px 5px; border-radius: 5px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: var(--text); }

.back-btn { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); z-index: 60; color: var(--sky); text-decoration: none; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 9px; background: rgba(2, 10, 24, .7); border: 1px solid rgba(125, 211, 252, .3); }
.back-btn:hover { background: rgba(125, 211, 252, .18); }
body.playing .back-btn { display: none; }

#app { position: fixed; left: 0; right: 0; top: 0; height: 100%; display: flex; flex-direction: column; }
#cv { flex: 1; min-height: 0; width: 100%; display: block; touch-action: manipulation; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) 8px calc(10px + env(safe-area-inset-left)); background: linear-gradient(rgba(2, 6, 18, .95), rgba(2, 6, 18, .7)); border-bottom: 1px solid rgba(125, 211, 252, .15); }
.hud-l { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.hud-name { font-weight: 800; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
.prog { flex: 1; max-width: 220px; height: 7px; border-radius: 99px; background: rgba(148, 163, 184, .2); overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, #a3e635); transition: width .2s; }
.hud-r { display: flex; align-items: center; gap: 6px; }
.chip { font-size: .85rem; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(15, 23, 42, .85); border: 1px solid rgba(255, 255, 255, .1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.score b { color: var(--lime); }
.chip.combo { color: var(--yellow); border-color: rgba(253, 224, 71, .35); }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; background: rgba(15, 23, 42, .85); border: 1px solid rgba(255, 255, 255, .15); }
.fx-bar { position: absolute; right: 10px; top: calc(56px + env(safe-area-inset-top)); display: flex; gap: 6px; pointer-events: none; z-index: 5; }
.fx { font-size: .8rem; font-weight: 800; padding: 4px 9px; border-radius: 99px; background: rgba(2, 8, 20, .8); border: 1px solid; }

.type-bar { display: flex; gap: 8px; padding: 8px calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left)); background: #0a1124; border-top: 1px solid rgba(125, 211, 252, .2); }
.type-bar input, .pr-form input { flex: 1; min-width: 0; font: 700 1.25rem/1.2 inherit; font-family: inherit; color: #fff; background: #020617; border: 2px solid rgba(125, 211, 252, .45); border-radius: 12px; padding: 10px 14px; outline: none; }
.type-bar input:focus, .pr-form input:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, .2); }
.type-bar input.bad { border-color: var(--red); animation: shake .25s; }
.type-bar input.good { border-color: var(--lime); }
.send { width: 56px; border-radius: 12px; font-size: 1.3rem; font-weight: 800; background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.screen { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 60px 14px 20px; overflow-y: auto; background: radial-gradient(circle at 50% 25%, rgba(30, 58, 138, .55), rgba(5, 8, 22, .95)); }
.screen.dim { background: rgba(3, 6, 16, .72); backdrop-filter: blur(4px); }
.panel { width: min(430px, 100%); margin: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px 18px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .6), 0 0 40px rgba(56, 189, 248, .08); }
.panel.wide { width: min(680px, 100%); }
h2 { font-size: 1.45rem; margin-bottom: 10px; background: linear-gradient(135deg, #7dd3fc, #bef264); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--mute); font-size: .88rem; margin-bottom: 12px; line-height: 1.5; }
.eyebrow { font-size: .75rem; letter-spacing: .15em; color: var(--sky); font-weight: 800; }
.logo span { font-size: 3.4rem; display: inline-block; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 0 16px rgba(125, 211, 252, .6)); }
.logo h1 { font-size: clamp(1.7rem, 7vw, 2.4rem); font-weight: 900; letter-spacing: .08em; background: linear-gradient(135deg, #7dd3fc, #bef264, #fde047); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo p { color: var(--mute); margin-top: 2px; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.menu { display: flex; flex-direction: column; gap: 10px; margin: 18px auto 14px; width: min(360px, 100%); }
.btn { padding: 11px 18px; border-radius: 12px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .15); font-weight: 700; transition: transform .12s, background .2s; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #0ea5e9, #6366f1); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(14, 165, 233, .3); }
.btn.daily { border-color: rgba(253, 224, 71, .4); }
.btn.big { padding: 13px 18px; font-size: 1.05rem; }
.btn.small { padding: 7px 14px; font-size: .85rem; }
.btn small { display: block; font-size: .78rem; font-weight: 600; opacity: .8; margin-top: 2px; }
.btns { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.btns.col { flex-direction: column; width: min(260px, 100%); margin-left: auto; margin-right: auto; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin: 4px 0 14px; font-size: .88rem; color: var(--mute); }
.tog { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tog input { width: 17px; height: 17px; accent-color: #38bdf8; }
.tog small { font-size: .75rem; }
.how { text-align: left; font-size: .85rem; color: var(--mute); line-height: 1.6; background: rgba(0, 0, 0, .25); border-radius: 12px; padding: 10px 12px; margin: 8px 0 4px; }
.how p + p { margin-top: 6px; }
.how b { color: var(--text); margin-right: 6px; }

.zone { margin: 14px 0 4px; text-align: left; }
.zone-h { font-weight: 800; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
.zone-h small { color: var(--mute); font-weight: 600; }
.stage-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.st { aspect-ratio: 1; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 800; font-size: .95rem; }
.st small { font-size: .62rem; color: var(--yellow); letter-spacing: -.05em; }
.st:not(:disabled):hover { background: rgba(56, 189, 248, .18); }
.st.done { border-color: rgba(190, 242, 100, .45); }
.st.next { border-color: #38bdf8; box-shadow: 0 0 12px rgba(56, 189, 248, .35); }
@media (max-width: 420px) { .stage-grid { grid-template-columns: repeat(3, 1fr); } .st { aspect-ratio: auto; padding: 10px 0; } }

.pack-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pack { text-align: left; padding: 11px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); font-weight: 800; }
.pack small { display: block; font-weight: 600; font-size: .75rem; color: var(--mute); margin-top: 3px; }
.pack:hover { background: rgba(56, 189, 248, .16); }

.stars { font-size: 2.2rem; letter-spacing: .1em; color: #334155; margin: 4px 0; }
.stars .on { color: var(--yellow); text-shadow: 0 0 14px rgba(253, 224, 71, .6); }
.res-score { font-size: 2.2rem; font-weight: 900; color: var(--lime); font-variant-numeric: tabular-nums; }
.res-note { color: var(--yellow); font-weight: 700; font-size: .9rem; min-height: 1.2em; margin: 2px 0 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid div { background: rgba(0, 0, 0, .28); border-radius: 10px; padding: 8px 4px; }
.stat-grid small { display: block; color: var(--mute); font-size: .72rem; }
.stat-grid b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.kind-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; text-align: left; font-size: .82rem; }
.kind-list div { background: rgba(0, 0, 0, .25); border-radius: 10px; padding: 7px 10px; border-left: 3px solid; }
.kind-list b { display: block; }
.kind-list span { color: var(--mute); }

.practice { align-items: flex-start; }
.pr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-head h2 { margin: 0; }
.seg { display: inline-flex; background: rgba(0, 0, 0, .35); border-radius: 10px; padding: 3px; }
.seg button { padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: .85rem; color: var(--mute); }
.seg button.on { background: #0ea5e9; color: #fff; }
.pr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0; }
.pr-stats div { background: rgba(0, 0, 0, .28); border-radius: 10px; padding: 7px 4px; }
.pr-stats small { display: block; color: var(--mute); font-size: .72rem; }
.pr-stats b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.pr-target { font-size: clamp(1.1rem, 4.6vw, 1.55rem); font-weight: 700; line-height: 1.6; text-align: left; padding: 14px; border-radius: 14px; background: rgba(2, 6, 23, .7); border: 1px solid rgba(125, 211, 252, .2); word-break: keep-all; white-space: pre-wrap; }
.pr-target span { border-bottom: 2px solid transparent; }
.pr-target .ok { color: #a7f3d0; }
.pr-target .bad { color: #fff; background: rgba(244, 63, 94, .55); border-radius: 3px; }
.pr-target .cur { color: var(--yellow); border-bottom-color: var(--yellow); }
.pr-target .caret { border-bottom-color: #38bdf8; }
.pr-next { text-align: left; color: #475569; font-size: .9rem; margin: 6px 4px 10px; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-form { display: flex; }
.pr-done { margin-top: 12px; text-align: left; background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 12px; font-size: .88rem; }
.pr-done h3 { font-size: 1.05rem; margin-bottom: 8px; color: var(--lime); }
.pr-done table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pr-done td { padding: 3px 4px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pr-done td:not(:first-child) { text-align: right; white-space: nowrap; }
.pr-done td:first-child { color: var(--mute); max-width: 0; width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 70; background: rgba(15, 23, 42, .95); border: 1px solid rgba(253, 224, 71, .5); color: var(--yellow); font-weight: 800; padding: 8px 16px; border-radius: 99px; pointer-events: none; animation: toast 1.8s forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 12%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* 업적 */
.btns.tight { margin-top: 0; }
h2 small { font-size: .85rem; color: var(--mute); -webkit-text-fill-color: var(--mute); margin-left: 6px; }
.ach-bar { height: 8px; border-radius: 99px; background: rgba(148, 163, 184, .2); overflow: hidden; margin: 4px 0 8px; }
.ach-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, #a3e635); }
.ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; text-align: left; }
.ach { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid rgba(255, 255, 255, .06); opacity: .55; position: relative; }
.ach.on { opacity: 1; border-color: rgba(190, 242, 100, .35); }
.ach > span { font-size: 1.4rem; width: 1.8rem; text-align: center; flex-shrink: 0; }
.ach b { display: block; font-size: .88rem; }
.ach small { display: block; color: var(--mute); font-size: .74rem; line-height: 1.35; }
.ach i { position: absolute; right: 8px; top: 6px; font-style: normal; font-size: .62rem; color: #64748b; }
@media (max-width: 520px) { .ach-list { grid-template-columns: 1fr; } }
.ach-new:empty { display: none; }
.ach-new { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; }
.ach-new div { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 10px; background: rgba(253, 224, 71, .1); border: 1px solid rgba(253, 224, 71, .4); animation: achIn .5s both; }
.ach-new span { font-size: 1.3rem; }
.ach-new b { color: var(--yellow); font-size: .88rem; }
.ach-new small { color: var(--mute); font-size: .75rem; margin-left: auto; }
@keyframes achIn { from { opacity: 0; transform: scale(.9); } }

/* 자리 연습 */
.segs { display: flex; gap: 6px; flex-wrap: wrap; }
.pr-lessons { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: thin; }
.pr-lessons button { flex-shrink: 0; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); font-weight: 700; font-size: .82rem; text-align: left; }
.pr-lessons button small { display: block; font-size: .7rem; color: var(--mute); font-weight: 600; margin-top: 1px; }
.pr-lessons button.done { border-color: rgba(190, 242, 100, .45); }
.pr-lessons button.done small { color: var(--lime); }
.pr-lessons button.on { background: rgba(14, 165, 233, .3); border-color: #38bdf8; }
.pr-tip { text-align: left; color: var(--mute); font-size: .8rem; margin: 2px 2px 0; }
.pr-target.drill { font-size: clamp(1.3rem, 5.4vw, 1.9rem); letter-spacing: .04em; word-spacing: .3em; text-align: center; }
.kbd-wrap { margin: 0 0 10px; }
.kbd { display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 12px; background: rgba(0, 0, 0, .3); user-select: none; }
.kr { display: flex; gap: 4px; justify-content: center; }
.kr.r1 { padding-left: 3%; } .kr.r2 { padding-right: 2%; }
.key { position: relative; flex: 0 1 44px; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 7px; font-weight: 700; font-size: .95rem; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-bottom: 3px solid var(--fc, #475569); color: #cbd5e1; transition: transform .08s, background .12s; }
.key sup { position: absolute; left: 4px; top: 1px; font-size: .58rem; color: #64748b; }
.key.wide { flex-basis: 60px; font-size: .85rem; }
.key.space { flex: 0 1 260px; font-size: .75rem; color: #64748b; }
.key.bump::after { content: ""; position: absolute; bottom: 4px; width: 10px; height: 2px; border-radius: 2px; background: #94a3b8; }
.key.fresh { color: #fff; background: rgba(255, 255, 255, .13); }
.key.next { background: var(--fc, #38bdf8); color: #020617; transform: translateY(1px); box-shadow: 0 0 14px var(--fc, #38bdf8); }
.key.next sup { color: #0f172a; }
.f0, .f7 { --fc: #f472b6; } .f1, .f6 { --fc: #c084fc; } .f2, .f5 { --fc: #38bdf8; } .f3, .f4 { --fc: #a3e635; } .f8 { --fc: #fde047; }
.kbd-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: .82rem; color: var(--mute); }
.pr-finger { font-weight: 800; color: var(--yellow); text-align: left; }
@media (max-width: 520px) { .key { height: 30px; font-size: .8rem; border-radius: 5px; } .kr, .kbd { gap: 3px; } .kbd { padding: 5px; } .key.wide { flex-basis: 40px; } }
