:root {
  color-scheme: light;
  --sound-paper: #f5f4ef;
  --sound-surface: #fbfaf6;
  --sound-ink: #222824;
  --sound-muted: #687069;
  --sound-line: #cfd3cc;
  --sound-line-strong: #9fa79f;
  --sound-accent: #245b49;
  --sound-accent-soft: #e2ebe5;
  --sound-blue: #2c5d75;
  --sound-blue-soft: #e6eff3;
  --sound-error: #8b302b;
  --sound-error-soft: #faece9;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
button, input, select { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sound-accent); outline-offset: 3px; }

.sound-tool h2,
.sound-content-section h2,
.sound-visual-panel h2 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.48rem); line-height: 1.35; }
.sound-tool h3,
.sound-content-section h3 { margin: 0; line-height: 1.35; }
.sound-section-heading { margin-bottom: 15px; }
.sound-section-kicker { margin: 0 0 5px; color: var(--sound-muted); font-size: .8rem; font-weight: 780; letter-spacing: .06em; }

.sound-tool {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1.06fr);
  border: 1px solid var(--sound-line-strong);
  background: var(--sound-surface);
}
.sound-calculator,
.sound-visual-panel { min-width: 0; padding: 24px; }
.sound-calculator { border-right: 1px solid var(--sound-line); }
.sound-mode-fieldset,
.sound-values-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.sound-mode-fieldset { margin-top: 16px; }
.sound-mode-fieldset legend,
.sound-values-fieldset legend { margin-bottom: 8px; color: var(--sound-ink); font-size: .88rem; font-weight: 760; }
.sound-mode-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sound-mode-option { display: flex; min-width: 0; align-items: center; gap: 8px; padding: 10px 11px; border: 1px solid var(--sound-line); background: var(--sound-paper); color: var(--sound-ink); font-size: .87rem; line-height: 1.4; cursor: pointer; }
.sound-mode-option:has(input:checked) { border-color: var(--sound-accent); background: var(--sound-accent-soft); color: var(--sound-accent); }
.sound-mode-option input { flex: 0 0 auto; accent-color: var(--sound-accent); }
.sound-values-fieldset { margin-top: 18px; }
.sound-input-grid { display: grid; gap: 13px; }
.sound-field { display: grid; gap: 5px; min-width: 0; }
.sound-field label { color: var(--sound-ink); font-size: .9rem; font-weight: 760; }
.sound-field input,
.sound-field select { width: 100%; min-height: 44px; border: 1px solid var(--sound-line-strong); border-radius: 2px; padding: 8px 10px; color: var(--sound-ink); background: var(--sound-surface); font-variant-numeric: tabular-nums; }
.sound-field input[aria-invalid="true"],
.sound-field select[aria-invalid="true"] { border-color: var(--sound-error); background: #fff8f7; }
.sound-input-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(112px, .8fr); gap: 8px; min-width: 0; }
.sound-unit-only { display: grid; grid-template-columns: minmax(0, 1fr) minmax(112px, .8fr); gap: 8px; align-items: center; }
.sound-unit-only input { min-width: 0; }
.sound-field-help { margin: 0; color: var(--sound-muted); font-size: .76rem; line-height: 1.45; overflow-wrap: anywhere; }
.sound-input-note { margin: 13px 0 0; color: var(--sound-muted); font-size: .78rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-form-error { margin: 12px 0 0; padding: 8px 10px; border-left: 4px solid var(--sound-error); background: var(--sound-error-soft); color: #6e2926; font-size: .86rem; line-height: 1.45; overflow-wrap: anywhere; }
.sound-form-error[hidden] { display: none; }
.sound-form-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 17px; }
.sound-button { min-height: 44px; border: 1px solid var(--sound-accent); border-radius: 2px; padding: 8px 12px; cursor: pointer; font-weight: 760; line-height: 1.35; }
.sound-button-primary { background: var(--sound-accent); color: #fff; }
.sound-button-primary:hover { background: #1b4738; }
.sound-button-secondary { background: var(--sound-surface); color: var(--sound-accent); }
.sound-button:hover:not(:disabled) { border-color: var(--sound-ink); }

.sound-results { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--sound-line); }
.sound-results-heading,
.sound-visual-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sound-status { flex: 0 0 auto; max-width: 44%; padding: 3px 8px; border: 1px solid var(--sound-line-strong); background: var(--sound-paper); color: var(--sound-muted); font-size: .74rem; font-weight: 760; line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.sound-status[data-state="ready"] { border-color: var(--sound-accent); background: var(--sound-accent-soft); color: var(--sound-accent); }
.sound-status[data-state="error"] { border-color: var(--sound-error); background: var(--sound-error-soft); color: var(--sound-error); }
.sound-result-status { min-height: 2.9em; margin: 11px 0 0; color: #38413b; font-size: .87rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-result-value { display: block; min-height: 1.5em; margin-top: 8px; color: var(--sound-ink); font-size: clamp(1.35rem, 3vw, 1.9rem); font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sound-result-details { display: grid; gap: 0; margin: 16px 0 0; border-top: 1px solid var(--sound-line); }
.sound-result-details[hidden] { display: none; }
.sound-result-details > div { display: grid; grid-template-columns: minmax(90px, .42fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--sound-line); }
.sound-result-details dt { color: var(--sound-muted); font-size: .77rem; font-weight: 700; }
.sound-result-details dd { min-width: 0; margin: 0; color: var(--sound-ink); font-size: .82rem; line-height: 1.45; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.sound-visual-panel { background: #f8faf8; }
.sound-figure { margin: 23px 0 0; }
.sound-log-visual { display: block; width: 100%; height: auto; min-height: 170px; overflow: visible; }
.sound-log-axis { color: var(--sound-line-strong); }
.sound-log-axis > line { stroke: var(--sound-line-strong); stroke-width: 2; }
.sound-axis-tick line { stroke: var(--sound-line-strong); stroke-width: 1.5; }
.sound-axis-tick text { fill: var(--sound-muted); font-size: 13px; font-family: inherit; }
.sound-reference-tick line { stroke: var(--sound-blue); stroke-width: 2.5; }
.sound-reference-tick text { fill: var(--sound-blue); font-weight: 800; }
.sound-axis-caption { fill: var(--sound-muted); font-size: 12px; font-family: inherit; }
.sound-figure figcaption { min-height: 3em; margin-top: 10px; color: var(--sound-muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-scale-note { margin: 14px 0 0; padding-left: 11px; border-left: 3px solid var(--sound-line-strong); color: var(--sound-muted); font-size: .77rem; line-height: 1.55; overflow-wrap: anywhere; }
.sound-visual-marker { fill: var(--sound-accent); stroke: var(--sound-surface); stroke-width: 4; }
.sound-visual-marker-line { stroke: var(--sound-accent); stroke-width: 2.5; stroke-dasharray: 5 4; }
.sound-visual-reference-line { stroke: var(--sound-blue); stroke-width: 2; stroke-dasharray: 3 4; }
.sound-visual-label { fill: var(--sound-accent); font-size: 14px; font-family: inherit; font-weight: 800; }
.sound-visual-reference-label { fill: var(--sound-blue); font-size: 13px; font-family: inherit; font-weight: 800; }
.sound-visual-ratio { fill: var(--sound-ink); font-size: 14px; font-family: inherit; font-weight: 760; }

.sound-content-section { margin-top: 30px; padding-top: 25px; border-top: 1px solid var(--sound-line-strong); }
.sound-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; border-block: 1px solid var(--sound-line); list-style: none; counter-reset: sound-steps; }
.sound-steps li { position: relative; min-width: 0; padding: 35px 12px 13px; border-right: 1px solid var(--sound-line); counter-increment: sound-steps; font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-steps li:last-child { border-right: 0; }
.sound-steps li::before { content: counter(sound-steps, decimal-leading-zero); position: absolute; top: 7px; left: 12px; color: var(--sound-accent); font-size: .75rem; font-weight: 800; }
.sound-formula-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--sound-line); border-left: 1px solid var(--sound-line); }
.sound-formula-list article { display: grid; min-width: 0; gap: 4px; padding: 12px 13px; border-right: 1px solid var(--sound-line); border-bottom: 1px solid var(--sound-line); }
.sound-formula-list strong { overflow-wrap: anywhere; }
.sound-formula-list span { color: var(--sound-muted); font-size: .83rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-scope { margin-top: 18px; border: 1px solid var(--sound-line); }
.sound-scope h3 { padding: 11px 13px; color: var(--sound-accent); font-size: .92rem; }
.sound-scope ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.sound-scope li { min-width: 0; padding: 10px 13px; border-top: 1px solid var(--sound-line); border-right: 1px solid var(--sound-line); color: var(--sound-muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.sound-scope li:last-child { border-right: 0; }

@media (max-width: 900px) {
  .sound-tool { grid-template-columns: 1fr; }
  .sound-calculator { border-right: 0; border-bottom: 1px solid var(--sound-line); }
}
@media (max-width: 700px) {
  .sound-formula-list,
  .sound-scope ul { grid-template-columns: 1fr; }
  .sound-scope li { border-right: 0; }
}
@media (max-width: 600px) {
  .sound-calculator,
  .sound-visual-panel { padding: 17px 14px; }
  .sound-mode-options,
  .sound-input-pair,
  .sound-unit-only { grid-template-columns: 1fr; }
  .sound-form-actions { grid-template-columns: 1fr; }
  .sound-button { width: 100%; }
  .sound-results-heading,
  .sound-visual-heading { gap: 8px; }
  .sound-status { max-width: 42%; }
  .sound-steps { grid-template-columns: 1fr; }
  .sound-steps li { border-right: 0; border-bottom: 1px solid var(--sound-line); }
  .sound-steps li:last-child { border-bottom: 0; }
  .sound-axis-tick text { font-size: 11px; }
  .sound-axis-caption { font-size: 10px; }
}
@media (max-width: 390px) {
  .sound-result-value { font-size: 1.3rem; }
  .sound-result-details > div { grid-template-columns: minmax(80px, .46fr) minmax(0, 1fr); gap: 7px; }
  .sound-log-visual { min-height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
