@font-face {
  font-family: Vazirmatn;
  src: url('../fonts/vazirmatn-arabic-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: Vazirmatn;
  src: url('../fonts/vazirmatn-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-200B, U+2012-206F, U+20AC, U+2122, U+2212, U+2215;
}

:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --surface: #fffdf9;
  --surface-2: #efebe3;
  --ink: #1b1a17;
  --ink-2: #625e55;
  --ink-3: #8f8a7e;
  --line: #e2dcd0;
  --accent: #e8481c;
  --accent-ink: #ffffff;
  --accent-soft: #fde6dd;
  --good: #0f9d68;
  --good-soft: #d9f3e8;
  --danger: #c5311a;
  --shadow: 0 1px 2px rgb(40 30 10 / 5%), 0 10px 30px -14px rgb(40 30 10 / 16%);
  --radius: 22px;
  --radius-sm: 13px;
  --show-dark: none;
  --show-light: inline-flex;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #12110f;
    --surface: #1c1b18;
    --surface-2: #282622;
    --ink: #f4f1ea;
    --ink-2: #aaa59a;
    --ink-3: #7b766b;
    --line: #32302b;
    --accent: #ff6a3d;
    --accent-ink: #1a0d07;
    --accent-soft: #3a2118;
    --good: #2fd195;
    --good-soft: #143427;
    --danger: #ff7a66;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 14px 34px -18px rgb(0 0 0 / 70%);
    --show-dark: inline-flex;
    --show-light: none;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #12110f;
  --surface: #1c1b18;
  --surface-2: #282622;
  --ink: #f4f1ea;
  --ink-2: #aaa59a;
  --ink-3: #7b766b;
  --line: #32302b;
  --accent: #ff6a3d;
  --accent-ink: #1a0d07;
  --accent-soft: #3a2118;
  --good: #2fd195;
  --good-soft: #143427;
  --danger: #ff7a66;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 14px 34px -18px rgb(0 0 0 / 70%);
  --show-dark: inline-flex;
  --show-light: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: Vazirmatn, system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; opacity: 0.4; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.only-dark { display: var(--show-dark); }
.only-light { display: var(--show-light); }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 10px; }

/* Top bar and navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; text-decoration: none; }
.brand img { border-radius: 8px; display: block; }
.nav-desktop { display: flex; gap: 4px; }
.nav-desktop a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 11px;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  color: var(--ink-2);
}
.nav-desktop a:hover { background: var(--surface-2); color: var(--ink); }
.nav-desktop a[aria-current='page'] { background: var(--accent-soft); color: var(--accent); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.nav-mobile {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-mobile a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 2px 7px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-2);
}
.nav-mobile a .icon { width: 22px; height: 22px; }
.nav-mobile a[aria-current='page'] { color: var(--accent); }

/* Shared controls */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 13px; background: var(--surface-2); }
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 7px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}
.seg-btn[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 14%); }
.seg-sm .seg-btn { padding: 5px 10px; font-size: 13px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-primary.is-on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-xl { flex: 1; padding: 14px 20px; font-size: 18px; border-radius: 16px; }

.icon-btn, .round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  flex: none;
}
.icon-btn:hover:not(:disabled), .round-btn:hover:not(:disabled) { background: var(--surface-2); }
.round-btn { border-radius: 50%; width: 46px; height: 46px; font-weight: 600; font-size: 15px; direction: ltr; }
.round-btn:active { transform: scale(0.94); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); min-width: 0; }
.card-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  min-height: 36px;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-3); }
.status { margin: 0; color: var(--ink-2); font-size: 15px; min-height: 1.7em; text-align: center; }
.status.is-error { color: var(--danger); font-weight: 600; }

.slider {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(to var(--fill-side, right), var(--accent) var(--fill), var(--surface-2) var(--fill));
}
.slider::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-2); }
.slider::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgb(0 0 0 / 25%);
}
.slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
[dir='rtl'] .slider { --fill-side: left; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 15px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle i { position: relative; width: 42px; height: 25px; flex: none; border-radius: 25px; background: var(--surface-2); border: 1px solid var(--line); transition: background 0.15s ease; }
.toggle i::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / 30%); transition: inset-inline-start 0.15s ease; }
.toggle input:checked + i { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + i::after { inset-inline-start: 19px; }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Page structure */
main { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; }
.page-head { padding: 26px 2px 18px; }
.page-head h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.lead { margin: 6px 0 0; color: var(--ink-2); font-size: 16px; max-width: 62ch; }
.tool { min-width: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two-col.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.transport { display: flex; gap: 10px; margin-top: 18px; }

/* Home */
.hero { padding: clamp(34px, 7vw, 72px) 2px 12px; }
.hero h1 { margin: 0; font-size: clamp(30px, 5.6vw, 54px); font-weight: 800; line-height: 1.22; letter-spacing: -0.015em; max-width: 20ch; }
.hero .lead { font-size: clamp(16px, 2.2vw, 19px); margin-top: 14px; }
.hero .btn { margin-top: 20px; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 28px; }
.tool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.tool-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.tool-card-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 20px; margin-bottom: 8px; }
.tool-card-title { font-weight: 700; font-size: 18px; }
.tool-card-text { color: var(--ink-2); font-size: 14.5px; }

/* Article content */
.prose { margin-top: 44px; max-width: 760px; }
.prose-block { margin-bottom: 30px; }
.prose-block h2 { margin: 0 0 10px; font-size: 21px; font-weight: 700; line-height: 1.4; }
.prose-block p { margin: 0; color: var(--ink-2); }
.prose-block ul { margin: 0; padding-inline-start: 20px; color: var(--ink-2); }
.prose-block li { margin-bottom: 6px; }
.related { max-width: none; margin-top: 8px; }
.related .tool-cards { margin-top: 12px; }
.faq-item { border-top: 1px solid var(--line); padding: 12px 0; }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin-top: 8px; }
.footer { border-top: 1px solid var(--line); padding: 22px 16px 28px; text-align: center; color: var(--ink-3); font-size: 14px; }
.footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 12px !important; }
.footer-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.freq-display { text-align: center; margin: 6px 0 14px; }
.tone-main { display: flex; flex-direction: column; gap: 16px; }
.tone-steps { gap: 8px; flex-wrap: nowrap; }
.tone-steps .num-input { max-width: 120px; text-align: center; }
.round-btn.wide { width: auto; min-width: 46px; padding: 0 12px; border-radius: 999px; }
.hint.center { text-align: center; }
.note-chips .chip { min-width: 48px; }
.tap-card { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.tap-pad { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: min(100%, 340px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent; }
.tap-pad:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.tap-ring { position: absolute; inset: -2px; border-radius: 50%; border: 3px solid var(--accent); opacity: 0; pointer-events: none; }
.tap-pad.hit .tap-ring { animation: tap-ring 0.45s ease-out; }
.tap-pad.hit { animation: tap-bump 0.15s ease-out; }
@keyframes tap-ring { from { opacity: 0.9; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
@keyframes tap-bump { 50% { transform: scale(0.97); } }
.tap-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.tap-stats div { display: flex; flex-direction: column; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.tap-stats strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.tap-stats span { font-size: 12px; color: var(--ink-3); }
a.btn[aria-disabled] { opacity: 0.5; pointer-events: none; }
.sub-fields { display: grid; gap: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.num-input { width: 100%; max-width: 140px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.num-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.footer-small { font-size: 13px; margin-top: 8px !important; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
.link-btn:hover { color: var(--accent); }
.tool-groups { scroll-margin-top: 80px; }
.group-title { margin: 34px 0 0; font-size: 19px; font-weight: 700; color: var(--ink-2); }
.group-title + .tool-cards { margin-top: 14px; }
.footer-coffee { padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent) !important; font-weight: 700; }
.footer-coffee:hover { background: var(--accent); color: var(--accent-ink) !important; }

/* Support */
.support-banner { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 16px 20px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); color: var(--ink); text-decoration: none; transition: transform 0.15s; }
.support-banner:hover { transform: translateY(-2px); }
.support-banner .coffee-badge { width: 52px; height: 52px; border-radius: 16px; font-size: 26px; margin: 0; flex: none; background: var(--surface); }
.support-banner-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.support-banner-text strong { font-size: 17px; }
.support-banner-text span { color: var(--ink-2); font-size: 14.5px; }
.support-banner .btn { flex: none; }
@media (max-width: 560px) { .support-banner { flex-wrap: wrap; } .support-banner .btn { width: 100%; } }
.support-hero { text-align: center; display: flex; flex-direction: column; align-items: center; }
.support-hero h1 { max-width: 22ch; }
.support-hero .lead { margin-inline: auto; }
.btn-lg { padding: 13px 24px; font-size: 17px; border-radius: 16px; }
.coffee-badge { display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 76px; border-radius: 24px; background: var(--accent-soft); color: var(--accent); font-size: 38px; margin-bottom: 18px; animation: steam 2.6s ease-in-out infinite; }
@keyframes steam { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
#wallets { margin-top: 40px; }
.wallets { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; margin-top: 16px; }
.wallet { display: flex; flex-direction: column; gap: 14px; }
.wallet:last-child:nth-child(odd) { grid-column: 1 / -1; }
.wallet-head { display: flex; align-items: center; gap: 12px; }
.wallet-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.wallet-net { font-size: 13px; color: var(--ink-3); }
.coin { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; font: 700 22px/1 system-ui, sans-serif; background: var(--coin); }
.wallet[data-coin='usdt'] { --coin: #26a17b; }
.wallet[data-coin='btc'] { --coin: #f7931a; }
.wallet[data-coin='eth'] { --coin: #627eea; }
.wallet[data-coin='trx'] { --coin: #eb0029; }
.address { display: block; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); font: 500 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; text-align: left; user-select: all; }
.wallet-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.wallet-actions > .btn { flex: 1 1 auto; }
.btn.is-done { background: var(--good); border-color: var(--good); color: #fff; }
.qr { flex: 1 1 auto; }
.qr summary { list-style: none; width: 100%; cursor: pointer; }
.qr summary::-webkit-details-marker { display: none; }
.qr[open] summary { background: var(--surface-2); }
.qr img { display: block; width: 200px; max-width: 100%; height: auto; margin: 12px auto 0; border-radius: 12px; background: #fff; padding: 6px; }
.wallet-warn { margin: 0; font-size: 13px; color: var(--ink-2); padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); }
.contact { display: flex; gap: 16px; align-items: flex-start; margin-top: 36px; }
.contact .tool-card-icon { flex: none; margin: 0; }
.contact h2 { margin: 0 0 6px; font-size: 20px; }
.contact p { margin: 0; color: var(--ink-2); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.contact-actions a { overflow-wrap: anywhere; }
.thanks { text-align: center; margin: 30px 0 0; font-size: 18px; font-weight: 700; color: var(--ink-2); }
@media (max-width: 520px) { .contact { flex-direction: column; } }

/* Metronome */
.pendulum { display: flex; justify-content: center; }
.pendulum svg { width: min(100%, 300px); height: auto; display: block; }
.pendulum-arc { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.pendulum-arm { transform-origin: 150px 116px; color: var(--accent); }
.pendulum-arm line { stroke: var(--ink-3); stroke-width: 3; stroke-linecap: round; }
.pendulum-arm circle { fill: var(--accent); }
.bpm-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 8px; }
.bpm-display { flex: 1; text-align: center; min-width: 120px; }
.bpm-number { display: block; font-size: clamp(60px, 11vw, 86px); font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bpm-meta { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.beats { display: flex; gap: 6px; margin-top: 18px; align-items: stretch; }
.beat { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 70px; padding: 6px 2px 3px; background: var(--surface-2); border: 0; border-radius: 12px; color: var(--ink-2); font-size: 12px; font-weight: 600; }
.beat i { display: block; width: 100%; max-width: 30px; border-radius: 6px; background: var(--ink-3); transition: background 0.1s ease, height 0.1s ease; }
.beat[data-level='2'] i { height: 34px; background: var(--ink); }
.beat[data-level='1'] i { height: 18px; }
.beat[data-level='0'] i { height: 3px; background: var(--line); }
.beat.active { background: var(--accent-soft); color: var(--accent); }
.beat.active i { background: var(--accent); }

/* Tuner */
.gauge svg { display: block; width: 100%; max-width: 420px; margin: 0 auto; height: auto; }
.tick { stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; }
.tick.major { stroke: var(--ink); stroke-width: 2; }
.tick-label { font-size: 10.5px; fill: var(--ink-3); font-weight: 600; }
.gauge-zone { fill: none; stroke: var(--good); stroke-width: 7; stroke-linecap: round; opacity: 0.55; }
.gauge.tuned .gauge-zone, #gauge.tuned .gauge-zone { opacity: 1; }
.gauge-side { font-size: 22px; fill: var(--ink-3); font-weight: 600; }
.gauge-needle { transform-origin: 160px 160px; }
.gauge-needle line { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.gauge-needle circle { fill: var(--accent); }
#gauge.tuned .gauge-needle line { stroke: var(--good); }
#gauge.tuned .gauge-needle circle { fill: var(--good); }
.tuner-note { display: flex; justify-content: center; align-items: baseline; gap: 3px; margin-top: 4px; min-height: 96px; }
.tuner-name { font-size: clamp(62px, 12vw, 84px); font-weight: 800; line-height: 1.15; }
.tuner-octave { font-size: 26px; color: var(--ink-3); font-weight: 600; }
.tuner-note.tuned .tuner-name { color: var(--good); }
.tuner-stats { display: flex; justify-content: center; gap: 12px; margin: 4px 0 10px; }
.tuner-stats > div { min-width: 104px; padding: 7px 12px; text-align: center; background: var(--surface-2); border-radius: 12px; }
.tuner-stats strong { display: block; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tuner-stats span { font-size: 12.5px; color: var(--ink-2); }
.strings { display: flex; flex-wrap: wrap; gap: 8px; }
.string-btn { display: inline-flex; align-items: baseline; justify-content: center; gap: 1px; min-width: 54px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 700; font-size: 16px; }
.string-btn sub { font-size: 11px; color: var(--ink-3); }
.string-btn:hover { background: var(--surface-2); }
.string-btn.active { border-color: var(--accent); color: var(--accent); }
.string-btn.tuned { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stepper-value { min-width: 84px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Note reading */
.reading { display: grid; gap: 16px; }
.score-card { padding: 16px; }
.score-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.score { width: 100%; min-height: 150px; overflow: hidden; user-select: none; -webkit-user-select: none; }
.score.editable { touch-action: none; cursor: crosshair; }
.system { display: block; fill: var(--ink); scroll-margin: 90px; }
.staff-line { stroke: var(--ink-3); stroke-width: 1; }
.ledger { stroke: var(--ink); stroke-width: 1.3; }
.stem { stroke: currentColor; stroke-width: 1.5; }
.bar { stroke: var(--ink-2); stroke-width: 1.2; }
.bar-final { stroke: var(--ink); stroke-width: 3.5; }
.beam { fill: var(--ink); }
.note { color: var(--ink); fill: currentColor; transition: color 0.08s ease; }
.note .ledger { stroke: currentColor; }
.note.current { color: var(--accent); fill: var(--accent); }
.note.selected { color: var(--good); fill: var(--good); }
.note-name, .ghost-label { unicode-bidi: plaintext; }
.note-name { fill: var(--ink-2); font-size: 13px; font-weight: 600; opacity: 0; transition: opacity 0.1s ease; }
.note-name.visible { opacity: 1; }
.note-name.current-name.visible { fill: var(--accent); }
.ghost { color: var(--accent); fill: var(--accent); opacity: 0.6; pointer-events: none; }
.ghost .ledger { stroke: var(--accent); }
.ghost-label { font-size: 14px; font-weight: 700; }
.edit-bar { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.edit-bar .hint { margin: 0 0 12px; }
.edit-grid { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.edit-grid .field { margin-bottom: 12px; }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.spacer { flex: 1; }
.player { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 14px; }
.btn-play { min-width: 112px; padding: 10px 18px; }
.position { margin-inline-start: auto; color: var(--ink-2); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 860px) {
  .two-col, .two-col.even { grid-template-columns: minmax(0, 1fr); }
  .nav-desktop { display: none; }
  .nav-mobile { display: grid; }
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .card { padding: 16px; }
  .score-card { padding: 12px; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .round-btn { width: 40px; height: 40px; font-size: 13px; }
  .bpm-display { min-width: 96px; }
  .bpm-row { gap: 4px; }
  .btn-play { min-width: 92px; padding-inline: 12px; }
  .player { gap: 6px; }
  .player .icon-btn { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .coffee-badge { animation: none; }
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Chords */
.crumbs { padding: 18px 2px 0; font-size: 14px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs + .page-head { padding-top: 6px; }
.chord-page { display: grid; gap: 22px; }
.chord-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; }
.chord-symbol { font-size: clamp(44px, 8vw, 64px); font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.chord-meta { display: grid; gap: 10px; margin: 0; flex: 1; min-width: 200px; }
.chord-meta div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chord-meta dt { font-size: 13px; color: var(--ink-3); min-width: 56px; }
.chord-meta dd { margin: 0; font-weight: 600; }
.chord-play { display: flex; flex-wrap: wrap; gap: 8px; }
.note-pill { display: inline-block; padding: 3px 10px; margin: 0 4px 4px 0; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px; }
.chord-block h2 { margin: 6px 0 14px; font-size: 21px; }
.link-chips + h2 { margin-top: 26px !important; }
.diagram-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.diagram-fig { margin: 0; text-align: center; }
.diagram-fig figcaption { margin-top: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.diagram-fig code { font-size: 12px; color: var(--ink-3); }
.diagram-btn, .piano-btn { display: block; width: 100%; padding: 12px 8px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; color: var(--ink); transition: border-color 0.15s, transform 0.1s; }
.diagram-btn:hover, .piano-btn:hover { border-color: var(--accent); }
.diagram-btn:active, .piano-btn:active { transform: scale(0.98); }
.piano-btn { padding: 12px; max-width: 760px; }
.fret-diagram { width: 100%; max-width: 170px; height: auto; display: block; margin: 0 auto; }
.fd-fret { stroke: var(--line); stroke-width: 1.5; }
.fd-string { stroke: var(--ink-3); stroke-width: 1.3; }
.fd-nut { fill: var(--ink); }
.fd-dot { fill: var(--ink); }
.fd-finger { fill: var(--bg); font: 700 11px system-ui, sans-serif; }
.fd-open { fill: none; stroke: var(--ink-2); stroke-width: 1.6; }
.fd-mark { fill: var(--ink-3); font: 600 15px system-ui, sans-serif; }
.fd-pos, .fd-name { fill: var(--ink-3); font: 600 11px system-ui, sans-serif; }
.piano-diagram { width: 100%; height: auto; display: block; }
.pk-white { fill: #fff; stroke: #c9c3b8; }
.pk-black { fill: #26241f; }
.pk-white.on { fill: var(--accent); stroke: var(--accent); }
.pk-black.on { fill: var(--accent); }
.pk-label { fill: #fff; font: 700 11px system-ui, sans-serif; }
.link-chips .chip { text-decoration: none; color: var(--ink); }
.link-chips .chip:hover { border-color: var(--accent); color: var(--accent); }
.finder-card { display: grid; gap: 16px; margin-bottom: 14px; }
.finder-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.finder-notes { margin-top: 8px; }
.chord-index { margin-top: 36px; max-width: none; }
.chord-index-row { margin-bottom: 16px; }
.chord-index-row h3 { margin: 0 0 8px; font-size: 17px; }
.chord-index-row h3 span { color: var(--ink-3); font-weight: 500; font-size: 14px; }
.fretboard-wrap { overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.fretboard { display: block; width: 100%; min-width: 600px; height: auto; }
.fb-fret { stroke: var(--line); stroke-width: 2; }
.fb-string { stroke: var(--ink-3); stroke-width: 1.2; }
.fb-nut { fill: var(--ink-2); }
.fb-inlay { fill: var(--surface-2); }
.fb-name, .fb-num { fill: var(--ink-3); font: 600 11px system-ui, sans-serif; }
.fb-note circle { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.4; }
.fb-note text { fill: var(--ink); font: 700 9.5px system-ui, sans-serif; }
.fb-note.root circle { fill: var(--accent); stroke: var(--accent); }
.fb-note.root text { fill: #fff; }
.pattern { display: flex; flex-wrap: wrap; gap: 6px; }
.pattern span { padding: 2px 9px; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: 14px; }
.chord-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.chord-row a { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; }
.chord-row a:hover { border-color: var(--accent); }
.chord-row small { color: var(--ink-3); font-size: 12px; }
.chord-row strong { font-size: 17px; }
.c5-card { display: flex; flex-direction: column; gap: 12px; }
.circle5 { display: block; width: 100%; max-width: 420px; margin: 0 auto; height: auto; user-select: none; }
.c5-key { cursor: pointer; outline: none; }
.c5-major { fill: var(--surface-2); stroke: var(--surface); stroke-width: 2; transition: fill 0.15s; }
.c5-minor { fill: var(--bg); stroke: var(--surface); stroke-width: 2; transition: fill 0.15s; }
.c5-key:hover .c5-major, .c5-key:focus-visible .c5-major { fill: var(--accent-soft); }
.c5-key.on .c5-major { fill: var(--accent); }
.c5-key.on .c5-minor { fill: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
.c5-t-major { font: 700 17px system-ui, sans-serif; fill: var(--ink); pointer-events: none; }
.c5-t-minor { font: 600 12px system-ui, sans-serif; fill: var(--ink-2); pointer-events: none; }
.c5-t-sig { font: 600 9px system-ui, sans-serif; fill: var(--ink-3); pointer-events: none; }
.c5-key.on text { fill: #fff; }
.c5-center { fill: var(--surface); stroke: var(--line); }
.c5-center-t { font: 800 30px system-ui, sans-serif; fill: var(--ink); }
.c5-detail { display: flex; flex-direction: column; gap: 14px; }
.c5-title { margin: 0; font-size: 22px; }
.c5-sub { margin: 4px 0 0; font-size: 15px; color: var(--ink-2); }
.c5-play { align-self: flex-start; }
.piano-card { display: flex; flex-direction: column; gap: 16px; }
.piano-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.piano-readout { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.piano-readout strong { font-size: 18px; }
.piano-readout .note-pill { margin: 0; font-size: 17px; }
.vpiano { position: relative; height: clamp(170px, 30vw, 240px); user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none; }
.vk-whites { display: flex; height: 100%; }
.vk { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0 0 10px; border: 0; cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; }
.vk.white { flex: 1; margin: 0 1px; border-radius: 0 0 8px 8px; background: #fff; color: #5d584e; box-shadow: inset 0 -5px 0 #e6e1d7, 0 0 0 1px #d6d0c4; }
.vk.white.down { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent), 0 0 0 1px var(--accent); }
.vk.black { position: absolute; top: 0; z-index: 2; height: 62%; width: calc(100% / var(--whites) * 0.62); left: calc(100% / var(--whites) * var(--i) - (100% / var(--whites) * 0.31)); border-radius: 0 0 6px 6px; background: linear-gradient(#2c2a25, #1b1a17); color: #bdb7aa; box-shadow: inset 0 -4px 0 #000; padding-bottom: 8px; }
.vk.black.down { background: var(--accent); box-shadow: none; }
.vk-name { font-size: 12px; font-weight: 700; }
.vk-name sub { font-size: 9px; }
.vk-hint { display: none; font-size: 11px; font-weight: 700; opacity: 0.7; margin-top: 4px; }
.show-hints .vk-hint { display: block; }
.no-labels .vk-name { display: none; }
.piano-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 22px; align-items: center; }
.piano-volume { margin: 0; }
.tr-card { display: flex; flex-direction: column; gap: 12px; }
.tr-text { width: 100%; min-height: 240px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow: auto; resize: vertical; tab-size: 4; }
.tr-text:focus-visible { outline: 2px solid var(--accent); }
.tr-out { background: var(--surface); }
.tr-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tr-out-head { display: flex; justify-content: space-between; align-items: center; }
.capo-card { margin-top: 16px; }
.capo-controls { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.capo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.capo-cell { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.capo-cell small { font-size: 12px; color: var(--ink-3); }
.capo-cell strong { font-size: 18px; }
.capo-cell.easy { background: var(--good-soft); }
.capo-cell.easy strong { color: var(--good); }
.chord-page > *, .chord-block { min-width: 0; }
.ear-main { display: flex; flex-direction: column; gap: 16px; }
.ear-score { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.ear-score div { display: flex; flex-direction: column; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ear-score strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.ear-score span { font-size: 12px; color: var(--ink-3); }
.ear-prompt { margin: 4px 0; text-align: center; font-size: 18px; font-weight: 700; min-height: 1.6em; }
.ear-prompt.good { color: var(--good); }
.ear-prompt.bad { color: var(--danger); }
.ear-answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.ear-answer { padding: 13px 10px; }
.ear-answer.is-right { background: var(--good); border-color: var(--good); color: #fff; }
.ear-answer.is-wrong { background: var(--danger); border-color: var(--danger); color: #fff; }
.sight-live { display: flex; align-items: center; gap: 10px; }
.sight-live strong { font-size: 20px; min-width: 3ch; }
.sight-progress { color: var(--ink-2); font-size: 14px; }
.note.done { fill: var(--good); color: var(--good); }
.rh-pad { width: min(100%, 260px); aspect-ratio: auto; height: 120px; border-radius: 26px; margin-top: 4px; }
.rh-pad-label { font-weight: 700; color: var(--ink-2); }
.note.hit-good { fill: var(--good); color: var(--good); }
.note.hit-ok { fill: #d39b00; color: #d39b00; }
.note.hit-miss { fill: var(--danger); color: var(--danger); }
.rhythm-only .note-name { display: none; }
.pl-timer, .pl-stats { display: flex; flex-direction: column; gap: 14px; }
.pl-clock { text-align: center; font-size: clamp(56px, 12vw, 84px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.05; }
.pl-input { width: 100%; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.pl-input:focus-visible { outline: 2px solid var(--accent); }
.pl-manual summary { cursor: pointer; color: var(--ink-2); font-size: 14px; }
.pl-manual-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pl-goal { position: relative; width: 150px; margin: 0 auto; }
.pl-ring { display: block; width: 100%; transform: rotate(-90deg); }
.pl-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.pl-ring-fg { fill: none; stroke: var(--accent); stroke-width: 11; stroke-linecap: round; transition: stroke-dasharray 0.4s; }
.pl-ring-fg.done { stroke: var(--good); }
.pl-goal-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pl-goal-text strong { font-size: 34px; line-height: 1; }
.pl-goal-text span { font-size: 13px; color: var(--ink-3); }
.pl-goal-step { justify-content: center; gap: 10px; }
.pl-chart-card, .pl-history-card { margin-top: 16px; }
.pl-svg { display: block; width: 100%; height: auto; }
.pl-bar { fill: var(--accent-soft); }
.pl-bar.met { fill: var(--good); }
.pl-bar.today:not(.met) { fill: var(--accent); }
.pl-goal-line { stroke: var(--ink-3); stroke-dasharray: 4 5; }
.pl-val, .pl-day { fill: var(--ink-3); font: 600 11px system-ui, sans-serif; }
.pl-day.today { fill: var(--accent); }
.pl-history { list-style: none; margin: 0; padding: 0; }
.pl-history li { display: grid; grid-template-columns: 90px 80px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pl-h-date { color: var(--ink-3); font-size: 14px; }
.pl-h-what { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-empty { display: block !important; color: var(--ink-3); border: 0 !important; }
.guide-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.guide .prose-block p + p { margin-top: 10px; }
.guide-cta { margin-top: 14px; }
.guide-chords { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.guide-chord { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; }
.guide-chord:hover { border-color: var(--accent); }
.guide-chord .fret-diagram { max-width: 120px; }
.guide-more ul { padding-inline-start: 20px; }
.guide-more a { color: var(--accent); }
/* Solfège syllables are longer than letters: shrink labels inside small shapes. */
[data-naming='solfege'] .fb-note text { font-size: 7.5px; }
[data-naming='solfege'] .pk-label { font-size: 9px; }
[data-naming='solfege'] .pk-label-b { font-size: 7px; }
[data-naming='solfege'] .fd-name { font-size: 9px; }
[data-naming='solfege'] .c5-t-major { font-size: 13px; }
[data-naming='solfege'] .c5-t-minor { font-size: 9.5px; }
[data-naming='solfege'] .c5-center-t { font-size: 22px; }
.mic-help { margin: 4px auto 0; max-width: 560px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: 14.5px; }
.mic-help ol { margin: 8px 0 12px; padding-inline-start: 20px; }
.mic-help li { margin-bottom: 4px; }
