/* 악보 연주기 공통 스타일 (배경 지우개·MD HTML 변환기와 같은 틀)
   색상은 모두 토큰으로 정의하고 다크 모드에서 다시 지정한다. 악보 종이는 다크 모드에서도 흰색이다. */
:root {
  color-scheme: light dark;
  --bg: #f5f6fa; --card: #ffffff; --foreground: #1a1a2e; --muted: #5b6075;
  --border: #d6d9e3; --border-strong: #b8bdcf;
  --accent: #0f766e; --accent-hover: #0b5f58; --accent-text: #0f766e; --accent-soft: #0f766e1f;
  --right: #0f766e; --left: #d9480f;
  --danger: #b91c1c;
  --warn-bg: #d9770614; --warn-border: #d9770650; --warn-mark: #f59e0b33;
  --paper: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117; --card: #181b24; --foreground: #e6e8ef; --muted: #a0a6b8;
    --border: #2c3140; --border-strong: #3c4254;
    --accent-text: #5eead4; --accent-soft: #2dd4bf26;
    --right: #2dd4bf; --left: #fb923c;
    --danger: #f87171;
    --warn-bg: #f59e0b14; --warn-border: #f59e0b45;
  }
}
* { box-sizing: border-box; }
body { font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif; background: var(--bg); color: var(--foreground); margin: 0; line-height: 1.55; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
.wrap { max-width: 1060px; margin: 0 auto; padding: 24px 20px 0; }
.wrap-wide { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* ---- 헤더·푸터 ---- */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.site-header .inner { max-width: 1060px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 6px 20px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.2rem; color: var(--foreground); text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { padding: 8px 14px; border-radius: 8px; font-size: 1rem; font-weight: 500; color: var(--foreground); text-decoration: none; }
.site-nav a:hover { background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; }
.site-footer .inner { max-width: 1060px; margin: 0 auto; padding: 20px 20px 40px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
body.playing-view .site-footer { margin-bottom: 120px; }

/* ---- 버튼 ---- */
.btn { display: inline-block; padding: 8px 15px; font: inherit; font-size: 0.9rem; font-weight: 600; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--foreground); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.ghost[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn.small { padding: 6px 11px; font-size: 0.82rem; }
.btn.huge { font-size: 1.45rem; padding: 18px 56px; border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 118, 110, 0.3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, .linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.btnrow.center { justify-content: center; }
.linkbtn { border: 0; background: none; padding: 0 2px; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }

/* ---- 첫 화면 ---- */
.hero { text-align: center; padding: 52px 16px 56px; border-radius: 18px; }
.hero h1 { font-size: 2.6rem; line-height: 1.22; letter-spacing: -0.01em; margin: 0 0 14px; }
.hero .sub { font-size: 1.12rem; line-height: 1.65; color: var(--muted); max-width: 640px; margin: 0 auto 30px; }
.hero .alt { margin: 16px 0 0; font-size: 0.95rem; color: var(--muted); }
.hero .trust { display: inline-flex; align-items: center; gap: 7px; margin: 26px 0 0; padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 0.85rem; color: var(--muted); }
.hero .trust svg { width: 15px; height: 15px; flex: none; }
.hero.over { outline: 3px dashed var(--accent); outline-offset: -10px; background: var(--accent-soft); }
@media (max-width: 600px) {
  .hero { padding: 32px 4px 40px; }
  .hero h1 { font-size: 1.9rem; }
  .hero .sub { font-size: 1rem; }
  .btn.huge { width: 100%; max-width: 420px; font-size: 1.2rem; padding: 16px 20px; }
}
.facts { list-style: none; padding: 0; margin: 8px auto 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.facts li { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; font-size: 0.9rem; color: var(--muted); }
.facts b { display: block; color: var(--foreground); margin-bottom: 4px; }
.recent { margin: 0 0 24px; }
.recent h2 { font-size: 1rem; margin: 0 0 8px; }
.recent ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.recent li { display: flex; align-items: center; border: 1px solid var(--border); background: var(--card); border-radius: 10px; }
.recent li button { border: 0; background: none; font: inherit; color: var(--foreground); cursor: pointer; padding: 8px 6px 8px 12px; text-align: left; }
.recent li button small { display: block; color: var(--muted); font-size: 0.75rem; }
.recent li .del { padding: 8px 10px; color: var(--muted); }

/* ---- 진행 ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 28px; max-width: 560px; margin: 40px auto 0; text-align: center; }
.card h2 { margin: 0 0 18px; font-size: 1.3rem; }
.stages { list-style: none; padding: 0; margin: 0 auto 18px; display: inline-flex; flex-direction: column; gap: 6px; text-align: left; }
.stages li { color: var(--muted); padding-left: 28px; position: relative; }
.stages li::before { content: ""; position: absolute; left: 4px; top: 0.45em; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-strong); }
.stages li.active { color: var(--foreground); font-weight: 600; }
.stages li.active::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.9s linear infinite; }
.stages li.done { color: var(--foreground); }
.stages li.done::before { background: var(--accent); border-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.error-card p { color: var(--muted); }

/* ---- 연습 화면 ---- */
.toolbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--border); padding: 10px 20px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.tb-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.88rem; }
.tb-group.right { margin-left: auto; }
.tb-label { color: var(--muted); }
.btn.play { min-width: 92px; }
.tempo input[type=range] { width: 120px; accent-color: var(--accent); }
.tempo output { min-width: 4.5em; font-variant-numeric: tabular-nums; }
.tempo output::after { content: " BPM"; color: var(--muted); font-size: 0.8em; }
.loop input[type=number] { width: 3.6em; padding: 4px 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); color: var(--foreground); font: inherit; }
.check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); }
.hand { display: inline-flex; align-items: center; gap: 6px; }
.hand .dot { width: 10px; height: 10px; border-radius: 50%; }
@media (max-width: 700px) {
  .toolbar { position: static; padding: 8px 12px; gap: 8px 12px; }
  .tb-group.right { margin-left: 0; }
  .tempo input[type=range] { width: 90px; }
}
.score-head { padding-top: 16px; }
.score-head h1 { font-size: 1.35rem; margin: 0; }
.warn { margin: 10px 0 0; padding: 9px 12px; border-radius: 9px; background: var(--warn-bg); border: 1px solid var(--warn-border); font-size: 0.88rem; }
.panes { display: flex; gap: 16px; align-items: flex-start; margin-top: 14px; }
.paper { flex: 1; min-width: 0; background: var(--paper); border-radius: 12px; border: 1px solid var(--border); padding: 8px 4px; color: #000; }
#osmd { position: relative; cursor: pointer; }
#osmd .mark { position: absolute; background: var(--warn-mark); border-radius: 4px; pointer-events: none; }
#osmd .startmark { position: absolute; width: 3px; background: var(--accent); border-radius: 2px; pointer-events: none; }
.orig { flex: 0 0 42%; position: sticky; top: 70px; max-height: calc(100vh - 200px); overflow: auto; border-radius: 12px; border: 1px solid var(--border); background: var(--paper); }
.orig img { display: block; width: 100%; }
@media (max-width: 900px) {
  .panes { flex-direction: column-reverse; align-items: stretch; }
  .paper { flex: none; }
  .orig { position: static; flex: none; width: 100%; max-height: 50vh; }
}

/* ---- 건반 ---- */
.keyboard { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; height: 92px; background: var(--card); border-top: 1px solid var(--border); padding: 8px 12px 10px; display: flex; gap: 10px; }
.kplay { flex: none; width: 56px; font-size: 1.2rem; padding: 0; }
.keys-wrap { flex: 1; min-width: 0; max-width: 1400px; margin: 0 auto; }
.keys { position: relative; height: 100%; display: flex; }
.keys .w { flex: 1; border: 1px solid #9aa0b0; border-radius: 0 0 5px 5px; background: #fff; margin-right: -1px; position: relative; }
.keys .w span { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 9px; color: #8a90a0; }
.keys .b { position: absolute; top: 0; height: 60%; background: #23242b; border-radius: 0 0 4px 4px; z-index: 2; }
.keys .on-0 { background: var(--right) !important; }
.keys .on-1 { background: var(--left) !important; }
.keys .on-2 { background: #6d28d9 !important; }
.keys .on-3 { background: #be185d !important; }

/* ---- 기능 소개 카드 ---- */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 40px 0 0; padding: 0; list-style: none; }
.features li { padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.features b { display: block; margin-bottom: 4px; }
.features span { display: block; font-size: 0.88rem; line-height: 1.6; color: var(--muted); }

/* ---- 설명 글(가이드·정책·도구 아래 안내) ---- */
.content { margin-top: 44px; }
.prose { max-width: 760px; }
.prose h1 { font-size: 1.6rem; line-height: 1.35; margin: 0 0 8px; }
.prose h2 { font-size: 1.2rem; line-height: 1.4; margin: 36px 0 10px; }
.prose h3 { font-size: 1.02rem; margin: 24px 0 6px; }
.prose p, .prose li { font-size: 1rem; line-height: 1.8; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 4px; }
.prose .meta { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }
.prose .lead { font-size: 1.05rem; color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.92rem; margin: 12px 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--card); }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }
.prose pre { margin: 12px 0; padding: 14px 16px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-size: 0.9rem; line-height: 1.6; }
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose .note { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 10px; padding: 10px 14px; font-size: 0.92rem; }
.table-scroll { overflow-x: auto; }
.faq details { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 10px 14px; }
.faq details + details { margin-top: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; }
.cardlinks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 0; margin: 12px 0 0; list-style: none; }
.cardlinks li + li { margin-top: 0; }
.cardlinks a { display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--foreground); text-decoration: none; }
.cardlinks a:hover { border-color: var(--accent); }
.cardlinks b { display: block; margin-bottom: 4px; }
.cardlinks span { display: block; font-size: 0.85rem; line-height: 1.6; color: var(--muted); }

/* ---- 광고 자리: assets/ads.js가 채운다. 설정 전에는 HTML의 hidden으로 숨겨져 있다 ---- */
.ad-slot { margin: 36px 0; min-height: 100px; }
.ad-slot .ad-label { display: block; font-size: 0.7rem; color: var(--muted); margin-bottom: 4px; }
.ad-slot.preview { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--border-strong); border-radius: 10px; color: var(--muted); font-size: 0.85rem; }
.warnings { margin: 16px 0 0; text-align: left; }
.warnings summary { cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.warnings ul { margin: 8px 0 0; padding-left: 1.2em; font-size: 0.85rem; color: var(--muted); max-height: 220px; overflow: auto; }
.warnings li + li { margin-top: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

