/* ChordTool Game — 모바일 퍼스트. play.css 공통부에서 출발, 게임 화면은 어두운 무대 */
:root {
  --bg: #f6f5fa; --surface: #ffffff; --surface-2: #eeecf5; --text: #19152a; --muted: #625c78; --line: #dfdbea;
  --accent: #6d4bd8; --accent-ink: #ffffff; --accent-soft: #ece6ff; --link: #5a3cc4; --amber: #ffcf5a;
  --stage: #1b1430; --stage-2: #261c42; --stage-line: #3a2d5e; --stage-text: #efe9ff; --stage-muted: #a99fc9;
  --radius: 16px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0f0c18; --surface: #171223; --surface-2: #211a33; --text: #eeeaf8; --muted: #a59dbd; --line: #2d2542; --accent: #9b7dff; --accent-ink: #120c22; --accent-soft: #2a2047; --link: #b39dff; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0f0c18; --surface: #171223; --surface-2: #211a33; --text: #eeeaf8; --muted: #a59dbd; --line: #2d2542; --accent: #9b7dff; --accent-ink: #120c22; --accent-soft: #2a2047; --link: #b39dff; color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.08rem; }
h2 small { font-size: .78rem; color: var(--muted); font-weight: 600; }
p { margin: 0 0 .8em; }
ul, ol { padding-left: 20px; margin: 0 0 .8em; }
li { margin-bottom: 4px; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 16px; }
.lead { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-bar { display: flex; align-items: center; gap: 10px; height: 50px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 32px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 1.02rem; letter-spacing: -.02em; }
.brand-text small { font-size: .68rem; color: var(--accent); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.header-nav { display: none; margin-left: auto; gap: 4px; }
.header-nav a { padding: 8px 12px; border-radius: 10px; color: var(--text); font-weight: 600; font-size: .95rem; }
.header-nav a[aria-current] { background: var(--accent-soft); color: var(--link); }
.icon-btn { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text); border-radius: 10px; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.header-menu { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }
.header-menu a { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: .92rem; }
@media (min-width: 760px) { .header-nav { display: flex; } .icon-btn { margin-left: 4px; } }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; font-size: .8rem; color: var(--muted); padding: 6px 0 0; }
.breadcrumb a { color: var(--muted); }
main.wrap { padding-top: 6px; padding-bottom: 32px; }
.tool-h1 { font-size: 1.05rem; margin: 2px 0 8px; }
.tool-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 2px 0 8px; }
.tool-head .tool-h1 { margin: 0; }
.tool-sub { font-size: .78rem; color: var(--muted); font-weight: 600; }
.tool-h1 small { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: 4px; }

/* 공통 카드 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.prose li { margin-bottom: 6px; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }


/* ===== 홈 ===== */
.hero { padding: 14px 0 4px; }
.eyebrow { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .14em; color: var(--accent); }
.game-grid { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 700px) { .game-grid { grid-template-columns: repeat(3, 1fr); } }
.game-card { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 18px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.game-card.on { background: linear-gradient(160deg, #2a1c58, #14102b); border-color: transparent; color: #f1ecff; box-shadow: 0 10px 24px rgba(40, 20, 90, .25); }
.game-card.on:hover { text-decoration: none; transform: translateY(-1px); }
.game-card.off { opacity: .6; }
.game-card .ic { font-size: 2.2rem; }
.game-card b { font-size: 1.15rem; }
.game-card .ds { font-size: .85rem; opacity: .85; }
.game-card .go { margin-top: auto; padding-top: 8px; font-weight: 800; color: var(--amber); }
.game-card.off .go { color: var(--muted); }

/* ===== 게임 ===== */
.game { margin: 0 auto 14px; max-width: 640px; }
.sel { background: linear-gradient(180deg, #1d1540, #120d26); color: #efe9ff; border-radius: 20px; padding: 12px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.07); margin-bottom: 10px; }
.tabs button { min-height: 44px; border: 0; border-radius: 10px; background: none; color: #b9b0d8; font-weight: 800; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--amber); color: #1b1430; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pick { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06); color: inherit; text-align: left; cursor: pointer; }
.pick:hover { background: rgba(255,255,255,.1); }
.pick.locked { opacity: .45; cursor: not-allowed; }
.pick .no { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #e8473c; font-weight: 900; }
.pick .tt, .song .tt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick .tt small, .song .tt small { color: #a99fc9; font-size: .78rem; }
.pick .st { display: flex; flex-direction: column; align-items: flex-end; font-size: .8rem; color: #cfc6ee; }
.stars { font-style: normal; color: #ffd84a; letter-spacing: 1px; }
.song { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.diffs { display: flex; gap: 6px; }
.diff { min-width: 64px; min-height: 44px; padding: 2px 10px; border: 0; border-radius: 12px; font-weight: 800; cursor: pointer; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.diff .stars { font-size: .65rem; }
.d-easy { background: #2f9e5b; } .d-normal { background: #2f7be8; } .d-hard { background: #e8473c; }
.sel .hint { color: #a99fc9; margin: 10px 2px 0; }

/* 플레이 화면: 화면 전체를 쓴다 */
.playfield { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: radial-gradient(120% 80% at 50% 0%, #2a1c58, #0d0a1d 70%); color: #fff; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); touch-action: none; user-select: none; -webkit-user-select: none; }
html.in-game, html.in-game body { overflow: hidden; }
.hud { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px; }
.hbtn { min-width: 44px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-weight: 800; cursor: pointer; }
.hud-title { flex: 1; min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-score { font-weight: 900; font-variant-numeric: tabular-nums; color: #ffd84a; }
.hud-bar { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.12); overflow: hidden; }
.hud-bar i { display: block; height: 100%; width: 0; background: #ffd84a; }
#cv { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; }
.lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 8px 12px; }
.lane-btn { min-height: 86px; border: 0; border-radius: 18px; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); -webkit-touch-callout: none; }
.lane-btn b { font-size: 1.6rem; }
.lane-btn small { font-size: .7rem; opacity: .7; display: none; }
@media (hover: hover) and (pointer: fine) { .lane-btn small { display: block; } }
.lane-btn.l0 { background: radial-gradient(circle at 50% 40%, #ff7a6e, #c8322a); }
.lane-btn.l1 { background: radial-gradient(circle at 50% 40%, #6aa6ff, #1f5fc8); }
.lane-btn.l2 { background: radial-gradient(circle at 50% 40%, #ffd76a, #c7911a); color: #2a1a00; }
.lane-btn.hit { animation: lhit .12s ease-out; }
@keyframes lhit { 0% { transform: scale(.93); filter: brightness(1.4); } 100% { transform: scale(1); filter: none; } }

/* 결과 */
.result { text-align: center; background: linear-gradient(180deg, #1d1540, #120d26); color: #efe9ff; border: 0; }
.big-stars { font-size: 2.6rem; color: #ffd84a; letter-spacing: 4px; margin: 4px 0; }
.res-msg { font-weight: 800; }
.res { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.res div { background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px; }
.res div:last-child { grid-column: 1 / -1; }
.res dt { font-size: .75rem; color: #a99fc9; }
.res dd { margin: 0; font-size: 1.15rem; font-weight: 900; }
.res em { font-style: normal; font-size: .7rem; color: #ffd84a; }
.res-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1b1430; }
.btn.sm { min-height: 36px; font-size: .85rem; }
.result .hint { color: #a99fc9; margin-top: 10px; }
.settings { margin-top: 12px; }
.settings summary { font-weight: 800; cursor: pointer; }
.srow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 0; font-size: .92rem; }
.srow input[type=range] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 12px 0; }
@media (prefers-reduced-motion: reduce) { .lane-btn.hit { animation: none; } }

/* ads · footer */
.ad-slot { margin: 18px 0; min-height: 100px; text-align: center; overflow: hidden; }
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 36px; color: var(--muted); font-size: .8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.footer-links a { color: var(--text); font-weight: 600; }


/* 넓은 화면: 레인을 가운데 760px 로 모아 눈 이동을 줄임 */
@media (min-width: 900px) {
  #cv, .lanes { width: 100%; max-width: 760px; margin: 0 auto; }
  .hud { width: 100%; max-width: 980px; margin: 0 auto; }
}

/* 홈 곡 목록 */
.song-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.song-tags span { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; }
