/* ChordTool Tuner — 모바일 퍼스트. 테마: 튜너 그린 · 딥 네이비. 상태색은 항상 기호·문구와 함께 */
:root {
  --bg: #f5f8f6; --surface: #ffffff; --surface-2: #edf2ef; --text: #13201a; --muted: #5a6a62; --line: #d9e3dd;
  --accent: #14a44d; --accent-ink: #ffffff; --accent-soft: #e2f6ea; --link: #0f7a3b;
  --lcd: #0b1511; --lcd-2: #13221b; --lcd-line: #24392e; --lcd-text: #eafff2; --lcd-muted: #86a494;
  --low: #3b8bff; --ok: #2fdc6b; --close: #b6e84a; --high: #ff8a2a; --err: #d9363e;
  --radius: 16px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b110e; --surface: #121a16; --surface-2: #1a251f; --text: #e8f1ec; --muted: #93a79c; --line: #26352d;
    --accent: #2fdc6b; --accent-ink: #06200f; --accent-soft: #14301f; --link: #5fe894; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b110e; --surface: #121a16; --surface-2: #1a251f; --text: #e8f1ec; --muted: #93a79c; --line: #26352d;
  --accent: #2fdc6b; --accent-ink: #06200f; --accent-soft: #14301f; --link: #5fe894; 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, h4 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.3rem; }
h1 small { font-size: .85rem; color: var(--muted); font-weight: 600; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; margin-top: 1.1em; }
h4 { font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
p { margin: 0 0 .8em; }
ul, ol { padding-left: 20px; margin: 0 0 .8em; }
li { margin-bottom: 4px; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.lead { color: var(--muted); }
.lead.short { font-size: .92rem; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: .85rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

/* 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: 52px; }
.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: .7rem; color: var(--accent); font-weight: 800; letter-spacing: .08em; 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: 8px 0 0; }
.breadcrumb a { color: var(--muted); }
main.wrap { padding-top: 8px; padding-bottom: 32px; }

/* ===== 튜너 카드 (항상 어두운 LCD 느낌) ===== */
.tuner { background: var(--lcd); color: var(--lcd-text); border-radius: 20px; padding: 12px 14px 14px; margin: 6px 0 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-width: 560px; margin-left: auto; margin-right: auto; }
.tn-top { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.tn-title { font-weight: 700; font-size: .95rem; color: var(--lcd-muted); }
.tn-title .tn-pname { color: var(--lcd-text); }
.tn-set { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--lcd-line); background: var(--lcd-2); color: var(--lcd-text); font-size: .82rem; font-weight: 700; cursor: pointer; }
.tn-set svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tn-display { text-align: center; padding: 4px 0 2px; --c: var(--lcd-muted); }
.tn-display[data-state="perfect"] { --c: var(--ok); }
.tn-display[data-state="close"] { --c: var(--close); }
.tn-display[data-state="low"] { --c: var(--low); }
.tn-display[data-state="high"] { --c: var(--high); }
.tn-note { display: flex; justify-content: center; align-items: baseline; gap: 2px; height: 96px; line-height: 96px; font-weight: 800; color: var(--c); transition: color .15s; font-variant-numeric: tabular-nums; }
.tn-name { font-size: 5.2rem; letter-spacing: -.03em; }
.tn-oct { font-size: 1.8rem; color: var(--lcd-muted); }
.tn-display[data-state="idle"] .tn-note, .tn-display[data-state="listen"] .tn-note { opacity: .45; }
.tn-hz { font-size: .9rem; color: var(--lcd-muted); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.tn-meter { position: relative; margin: 6px auto 0; padding-top: 18px; max-width: 420px; }
.tn-meter svg { display: block; width: 100%; height: auto; }
.tn-meter .tick { stroke: var(--lcd-line); stroke-width: 2; }
.tn-meter .tick.big { stroke: var(--lcd-muted); }
.tn-meter .zone-close { fill: color-mix(in srgb, var(--close) 16%, transparent); }
.tn-meter .zone-ok { fill: color-mix(in srgb, var(--ok) 30%, transparent); }
.tn-meter text { fill: var(--lcd-muted); font-size: 11px; font-family: inherit; }
.tn-meter .needle { transition: transform .09s linear; }
.tn-meter .needle line { stroke: var(--c); stroke-width: 4; stroke-linecap: round; }
.tn-meter .needle circle { fill: var(--c); }
.tn-display[data-state="idle"] .needle, .tn-display[data-state="listen"] .needle { opacity: .35; }
.tn-flat, .tn-sharp { position: absolute; top: 0; font-size: .75rem; font-weight: 800; color: var(--low); line-height: 1; }
.tn-flat { left: 0; }
.tn-sharp { right: 0; color: var(--high); }
.tn-cents { font-size: 1.35rem; font-weight: 800; color: var(--c); min-height: 1.5em; font-variant-numeric: tabular-nums; }
.tn-status { min-height: 3em; display: flex; align-items: center; justify-content: center; flex-direction: column; font-weight: 700; font-size: 1.02rem; color: var(--lcd-text); padding: 0 6px; }
.tn-status.perfect { color: var(--ok); }
.tn-status.low { color: var(--low); }
.tn-status.high { color: var(--high); }
.tn-status.close { color: var(--close); }
.tn-status.error, .tn-status.warn { font-size: .9rem; font-weight: 600; color: #ffd1d3; background: rgba(217,54,62,.18); border-radius: 12px; padding: 10px 12px; }
.tn-status.warn { color: #ffe7b8; background: rgba(255,170,0,.14); }
.tn-status small { color: inherit; opacity: .85; }
.tn-status .link-btn { color: #ffffff; }

.tn-strings { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); gap: 5px; margin: 6px 0 4px; }
.tn-str { position: relative; display: flex; flex-direction: column; align-items: center; min-height: 64px; padding: 5px 2px 6px; border-radius: 12px; border: 1.5px solid var(--lcd-line); background: var(--lcd-2); color: var(--lcd-text); cursor: pointer; line-height: 1.15; }
.tn-str small { font-size: .62rem; color: var(--lcd-muted); }
.tn-str b { font-size: 1.25rem; }
.tn-str i { font-style: normal; font-size: .66rem; color: var(--lcd-muted); }
.tn-str .ok { position: absolute; top: 2px; right: 5px; font-size: .75rem; color: var(--ok); font-weight: 900; }
.tn-str.cur { border-color: var(--lcd-text); background: #1c3327; }
.tn-str.done { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.tn-str[aria-pressed="true"] { border-color: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 40%, transparent); }
.tn-modeline { text-align: center; font-size: .78rem; color: var(--lcd-muted); margin: 2px 0 6px; min-height: 1.4em; }
.tn-level { display: flex; justify-content: center; align-items: flex-end; gap: 3px; height: 16px; margin: 4px 0 10px; }
.tn-level i { width: 6px; border-radius: 2px; background: var(--lcd-line); }
.tn-level i:nth-child(1) { height: 5px; } .tn-level i:nth-child(2) { height: 7px; } .tn-level i:nth-child(3) { height: 9px; }
.tn-level i:nth-child(4) { height: 11px; } .tn-level i:nth-child(5) { height: 13px; } .tn-level i:nth-child(6) { height: 16px; }
.tn-level i.on { background: var(--ok); }
.tn-start { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; border: 0; border-radius: 16px; background: var(--ok); color: #05210f; font-size: 1.1rem; font-weight: 800; cursor: pointer; }
.tn-start svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tn-start.on { background: var(--lcd-2); color: var(--lcd-text); border: 1.5px solid var(--lcd-line); }
.tn-privacy { text-align: center; font-size: .75rem; color: var(--lcd-muted); margin: 8px 0 4px; }
.tn-presets { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 8px 0 2px; }
.tuner .chip { min-height: 36px; padding: 0 12px; font-size: .82rem; background: var(--lcd-2); border-color: var(--lcd-line); color: var(--lcd-text); }
.tuner .chip.on { background: var(--ok); border-color: var(--ok); color: #05210f; }
.tn-ref { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--lcd-line); }
.tn-ref-t { display: block; font-size: .75rem; color: var(--lcd-muted); font-weight: 700; margin-bottom: 6px; text-align: center; }
.tn-ref-btns { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.ref-btn { min-height: 40px; min-width: 56px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--lcd-line); background: var(--lcd-2); color: var(--lcd-text); font-weight: 700; font-size: .85rem; cursor: pointer; }
.ref-btn.on { background: var(--low); border-color: var(--low); color: #fff; }
.tn-done { margin-top: 12px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--ok) 14%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent); text-align: center; }
.tn-done-t { font-size: 1.2rem; font-weight: 800; color: var(--ok); margin-bottom: 8px; }
.tn-done .chips { justify-content: center; }
.tn-done .link-btn { margin-top: 8px; color: var(--lcd-muted); }

/* 공통 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; text-decoration: none; }
.link-btn { border: 0; background: none; padding: 0 4px; color: var(--link); font-weight: 700; cursor: pointer; text-decoration: underline; min-height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.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: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips.sm .chip { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.more-link { margin: 10px 0 0; }
.st-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.st-table th, .st-table td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
.st-table thead th { font-size: .8rem; color: var(--muted); }
.st-table .num { text-align: right; }
.st-table thead th:last-child { text-align: right; }
.dir-list { list-style: none; padding: 0; }
.dir-list li { margin-bottom: 8px; }
.dir-list span { display: inline-block; min-width: 64px; font-weight: 800; }
.dir-list .lo { color: var(--low); } .dir-list .hi { color: var(--high); } .dir-list .okc { color: var(--accent); }
.tune-list, .inst-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
@media (min-width: 620px) { .tune-list, .inst-grid { grid-template-columns: 1fr 1fr; } }
.tune-list a, .inst-grid a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.tune-list a:hover, .inst-grid a:hover { text-decoration: none; border-color: var(--accent); }
.tune-list a[aria-current] { border-color: var(--accent); background: var(--accent-soft); }
.tune-list small, .inst-grid small { color: var(--muted); font-size: .8rem; }
.tune-list .mono, .inst-grid .mono { font-size: .88rem; color: var(--link); font-weight: 700; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.faq details p { color: var(--muted); }

/* 설정 시트 */
.a4-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.a4-v { min-width: 90px; text-align: center; font-size: 1.3rem; font-weight: 800; }
.sq { min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 1.2rem; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 42px; padding: 0 14px; border: 0; background: var(--surface); cursor: pointer; font-weight: 700; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.custom-rows { display: grid; gap: 8px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.field select { height: 44px; min-width: 110px; padding: 0 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); }

/* Share / sheet / toast / ads (drum ui.js 공용) */
.share-bar { display: flex; gap: 8px; margin: 4px 0 10px; justify-content: center; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: .9rem; cursor: pointer; }
.share-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.share-btn.kakao { background: #fee500; border-color: #fee500; color: #191919; }
.share-btn.kakao svg { fill: #191919; stroke: none; }
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; width: 100%; max-width: 520px; max-height: 86vh; overflow: auto; overscroll-behavior: contain; background: var(--surface); color: var(--text); border-radius: 18px 18px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
@media (min-width: 600px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; } }
.sheet-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; }
.sheet-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.chip-btn { min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.chip-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .9rem; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.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: .82rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; }
.footer-links a { color: var(--text); font-weight: 600; }
