/* Airborne Tone Link - MIT (c) 2026 ipusiron */
:root {
  color-scheme: light;
  --bg: #f6f5f0;
  --surface: #eeede6;
  --fg: #1b2129;
  --muted: #505a66;
  --line: #c9cfd6;
  --border: #5c6773;
  --accent: #0a6c9a;
  --on-accent: #ffffff;
  --warning: #8a5200;
  --focus: #000000;
  --plot-bg: #f6f5f0;
  --plot-ink: #0a527b;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #161d27;
    --fg: #e8eef4;
    --muted: #a7b4c2;
    --line: #2b3a4a;
    --border: #7d8b9a;
    --accent: #56c8ff;
    --on-accent: #0d1117;
    --warning: #f2b84b;
    --focus: #ffffff;
    --plot-bg: #0d1117;
    --plot-ink: #56c8ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161d27;
  --fg: #e8eef4;
  --muted: #a7b4c2;
  --line: #2b3a4a;
  --border: #7d8b9a;
  --accent: #56c8ff;
  --on-accent: #0d1117;
  --warning: #f2b84b;
  --focus: #ffffff;
  --plot-bg: #0d1117;
  --plot-ink: #56c8ff;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-wrap: anywhere;
}
.page-header, main, footer { width: min(1040px, calc(100% - 32px)); margin-inline: auto; }
.page-header { padding-block: 24px 12px; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.8rem); letter-spacing: 0.02em; }
h2 { margin: 0 0 16px; font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 12px 0; }
.header-tools { display: flex; gap: 8px; margin-left: auto; }
.number, .mono { font-family: var(--mono); }
.number { color: var(--accent); margin-right: 10px; font-size: 0.9rem; }
main { display: grid; gap: 20px; }
.card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.muted, dt { color: var(--muted); }
.warning { color: var(--warning); }
.warning:empty { display: none; }
button, input, select, textarea { font: inherit; }
:where(button, select, textarea, input:not([type="radio"])) {
  min-width: 0; min-height: 44px; border: 1px solid var(--border); border-radius: 5px;
  color: var(--fg); background: var(--bg); padding: 8px 12px;
}
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.65; }
.icon-button { width: 44px; height: 44px; border-radius: 50%; padding: 0; font-weight: 700; }
.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (hover: hover) { :where(button:not(:disabled):hover, a:hover) { text-decoration: underline; } }
fieldset { padding: 0; margin: 16px 0 0; border: 0; min-width: 0; }
legend, label { font-weight: 600; }
.choices, .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; min-width: 44px; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; flex: 0 0 18px; accent-color: var(--accent); }
.field { display: grid; gap: 8px; margin-block: 16px; }
.field p { margin: 0; }
.field-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-label .icon-button { flex: 0 0 44px; display: grid; place-items: center; border: 0; background: transparent; }
.field-label .icon-button span {
  display: grid; place-items: center; width: 24px; height: 24px;
  border: 1px solid var(--border); border-radius: 50%; font-size: 0.875rem; line-height: 1;
}
textarea, select, input[type="file"], input[type="range"] { width: 100%; max-width: 100%; }
textarea { resize: vertical; }
select { margin-block: 8px; }
input[type="range"] { padding-inline: 0; accent-color: var(--accent); }
.actions { margin-top: 16px; }
.environment, .result-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
.environment div, .result-grid div { min-width: 0; }
dt { font-size: 0.85rem; }
dd { margin: 0; font-family: var(--mono); }
.plot-wrap { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--plot-bg); }
canvas { display: block; width: 100%; height: 170px; }
.settings-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.plot-legend { display: flex; align-items: center; gap: 12px; font: 0.8rem var(--mono); }
.ramp { height: 12px; flex: 1; max-width: 220px; background: linear-gradient(to right, var(--plot-bg), var(--plot-ink)); }
.tone-pair { font-size: 0.9rem; min-height: 1.6em; }
.table-wrap table { min-width: 380px; }
.live-text { display: block; min-height: 60px; padding: 12px; border: 1px solid var(--border); font: 1.2rem/1.6 var(--mono); }
.diagnostic-details { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.9rem/1.8 var(--mono); }
meter { display: block; width: 100%; max-width: 480px; height: 24px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); }
details { border-top: 1px solid var(--border); padding-block: 8px; }
summary { min-height: 44px; padding-block: 10px; cursor: pointer; font-weight: 600; }
a { color: var(--accent); }
footer { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding-block: 24px 40px; }
footer a, .tool-link { display: inline-flex; align-items: center; min-height: 44px; }
dialog { width: min(640px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; color: var(--fg); background: var(--surface); }
dialog { border: 2px solid var(--border); border-radius: 8px; padding: 20px; }
dialog::backdrop { background: #00000099; }
.setting-help-dialog { max-width: 480px; }
.setting-help-list { padding-inline-start: 1.25em; }
.setting-help-list li + li { margin-top: 8px; }
@media (min-width: 600px) {
  .card { padding: 24px; }
  .environment, .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  canvas { height: 210px; }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
