/* Palette: one set of 10 colours. Every colour below comes from here. */
:root {
  --bg-page: #f5f7fa; --bg-card: #ffffff;
  --text: #111827; --text-muted: #4b5563; --line: #d1d5db;
  --primary: #1d4ed8; --primary-dark: #1e40af; --primary-soft: #dbeafe;
  --good: #15803d; --warn: #b45309;
  --link: var(--primary); --hover-bg: var(--primary-soft);
}
/* Dark mode reuses the same ten values, only reassigned: no extra colours. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #111827; --bg-card: #111827;
    --text: #f5f7fa; --text-muted: #d1d5db; --line: #4b5563;
    --link: #dbeafe; --hover-bg: #1e40af;
  }
}

/* Tuner component (feat-044). Mobile first: one column, large touch targets. Colours carry state, and every state also
   has text (the action line), so the needle is never the only signal. */
.tuner {
  color: var(--text); background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 16px; max-width: 560px; margin: 0 auto; box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tuner *, .tuner *::before, .tuner *::after { box-sizing: border-box; }
.tuner-dial { text-align: center; padding: 8px 0 4px; }
.tuner-note { font-size: 72px; line-height: 1; font-weight: 700; letter-spacing: -0.02em; min-height: 72px; }
.tuner-scale { position: relative; height: 96px; margin: 8px auto 0; max-width: 320px; overflow: hidden; border-bottom: 2px solid var(--line); }
.tuner-zone { position: absolute; left: 50%; bottom: 0; width: 28px; height: 100%; transform: translateX(-50%); background: linear-gradient(to top, var(--good), transparent); opacity: 0.18; }
.tuner-needle { position: absolute; left: 50%; bottom: 0; width: 4px; height: 88px; border-radius: 2px; background: var(--text-muted); transform-origin: 50% 100%; transform: translateX(-50%) rotate(0deg); transition: transform 90ms linear, background-color 120ms linear, opacity 120ms linear; opacity: 0.25; }
.tuner-needle[data-visible="true"] { opacity: 1; }
.tuner-dial[data-state="flat"] .tuner-needle, .tuner-dial[data-state="sharp"] .tuner-needle { background: var(--warn); }
.tuner-dial[data-state="in_tune"] .tuner-needle { background: var(--good); }
.tuner-dial[data-state="in_tune"] .tuner-note { color: var(--good); }
.tuner-cents { min-height: 22px; margin-top: 6px; font-size: 15px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tuner-action { min-height: 28px; margin: 4px 0 10px; text-align: center; font-size: 18px; font-weight: 600; }
.tuner-strings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tuner-string { display: grid; grid-template-columns: 1fr 52px; gap: 8px; }
.tuner-string-pick, .tuner-tone, .tuner-start, .tuner-reset {
  font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-page); min-height: 52px;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.tuner-string-pick:hover, .tuner-tone:hover, .tuner-reset:hover { background: var(--hover-bg); border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.tuner-string-pick { display: grid; grid-template-columns: 28px auto 1fr; align-items: center; gap: 10px; padding: 6px 14px; text-align: left; }
.tuner-string-number { color: var(--text-muted); font-size: 14px; }
.tuner-string-note { font-size: 24px; font-weight: 700; min-width: 34px; }
.tuner-string-hz { justify-self: end; color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.tuner-string-pick[aria-pressed="true"] { border-color: var(--link); background: var(--hover-bg); box-shadow: inset 0 0 0 1px var(--link); }
.tuner-string[data-tuned="true"] .tuner-string-pick { border-color: var(--good); }
.tuner-string[data-tuned="true"] .tuner-string-number::after { content: " ✓"; color: var(--good); font-weight: 700; }
.tuner-tone { font-size: 22px; }
.tuner-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 4px; }
/* White on --primary is about 6.7:1, on --primary-dark about 8.7:1 (both modes). */
.tuner-start { flex: 1 1 180px; background: var(--primary); border-color: var(--primary); color: #ffffff; font-weight: 700; font-size: 18px; padding: 0 18px; }
.tuner-start:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #ffffff; }
.tuner-reset { padding: 0 16px; }
.tuner-auto { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; min-height: 44px; }
.tuner-auto input { width: 20px; height: 20px; }
.tuner-status { min-height: 22px; margin: 10px 0 14px; font-size: 15px; color: var(--text-muted); }
.tuner button:focus-visible, .tuner input:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
@media (min-width: 520px) { .tuner { padding: 28px; } .tuner-note { font-size: 88px; min-height: 88px; } }

/* anytuning.top page chrome (feat-045): header, text blocks, notes table, list of tunings. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 17px; line-height: 1.6; }
a { color: var(--link); }
.site-header, .site-footer, main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.site-brand { font-weight: 800; font-size: 20px; color: var(--text); text-decoration: none; }
.site-header nav, .site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-header nav a, .site-footer nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border-radius: 8px;
  transition: background-color 150ms ease, color 150ms ease;
}
.site-header nav a:hover, .site-footer nav a:hover { background: var(--hover-bg); color: var(--text); text-decoration: underline; }
main { padding-top: 8px; padding-bottom: 32px; }
h1 { font-size: 30px; line-height: 1.2; margin: 12px 0 12px; }
h2 { font-size: 22px; line-height: 1.3; margin: 32px 0 10px; }
h3 { font-size: 18px; margin: 20px 0 4px; }
p { margin: 0 0 14px; }
.tuning-intro { margin: 0 0 16px; }
.tuner + .tuning-intro { margin-top: 20px; }
.tuning-notes table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-variant-numeric: tabular-nums; }
.tuning-notes th, .tuning-notes td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.tuning-notes tbody tr:last-child th, .tuning-notes tbody tr:last-child td { border-bottom: 0; }
.tuning-notes thead th { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.tuning-notes tr.changed td:nth-child(3), .tuning-notes tr.changed td:nth-child(4) { font-weight: 700; }
.tuning-steps ol { padding-left: 22px; margin: 0; }
.tuning-steps li { margin-bottom: 8px; }
.tuning-list ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.tuning-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--text);
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.tuning-list a:hover { background: var(--hover-bg); border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); }
.tuning-list a[aria-current="page"] { border-color: var(--link); }
.tuning-list small { color: var(--text-muted); white-space: nowrap; }
.site-footer { padding-top: 16px; padding-bottom: 32px; border-top: 1px solid var(--line); color: var(--text-muted); font-size: 15px; }
a:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; border-radius: 4px; }
@media (min-width: 620px) { .tuning-list ul { grid-template-columns: 1fr 1fr; } h1 { font-size: 36px; } }
@media (prefers-reduced-motion: reduce) {
  .tuner-needle, .tuner-string-pick, .tuner-tone, .tuner-start, .tuner-reset, .site-header nav a, .site-footer nav a, .tuning-list a { transition: none; }
}

/* Narrow-screen guards (320px / 390px, no horizontal scroll). */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }
main, .tuner, .tuner-dial, .tuner-controls, .tuner-string, .tuner-string-pick, .tuning-list a, .tuning-list a span { min-width: 0; }
p, li, h1, h2, h3, td, th, .tuner-action, .tuner-status { overflow-wrap: anywhere; }
.tuning-notes { max-width: 100%; overflow-x: auto; }
@media (max-width: 400px) {
  .site-header, .site-footer, main { padding-left: 12px; padding-right: 12px; }
  .site-header nav, .site-footer nav { gap: 12px; }
  .tuner { padding: 16px 12px; }
  .tuner-note { font-size: 60px; min-height: 60px; }
  .tuner-string { grid-template-columns: minmax(0, 1fr) 48px; }
  .tuner-string-pick { grid-template-columns: 22px auto minmax(0, 1fr); gap: 8px; padding: 6px 10px; }
  .tuner-string-hz { font-size: 12px; text-align: right; }
  .tuner-start { flex-basis: 100%; }
  .tuning-notes th, .tuning-notes td { padding: 8px 8px; font-size: 15px; }
  .tuning-list a { flex-wrap: wrap; }
  .tuning-list small { white-space: normal; }
  h1 { font-size: 26px; }
}
