:root {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172e43;
  background: #edf2f5;
  --blue: #1757a6;
  --line: #cbd6de;
  --muted: #455e71;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1100px; margin: auto; padding: 34px 32px 56px; }
header { margin-bottom: 30px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: .9rem; }
.mark { display: inline-flex; align-items: center; gap: 2px; height: 25px; color: var(--blue); }
.mark i { width: 3px; height: 8px; border-radius: 2px; background: currentColor; }
.mark i:nth-child(even) { height: 16px; }
.mark i:nth-child(3) { height: 24px; }
h1, h2, h3, p { margin: 0; }
h1 { margin: 20px 0 8px; font-size: clamp(2.25rem, 6vw, 4rem); line-height: 1.04; letter-spacing: -.055em; }
header p { font-size: 1.1rem; max-width: 560px; color: var(--muted); line-height: 1.5; }
h2 { font-size: 1.45rem; letter-spacing: -.035em; margin-bottom: 16px; }
h3 { font-size: 1.08rem; margin: 24px 0 8px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; min-width: 0; }
.instrument { background: #172e43; color: #f4f8fa; border-radius: 12px; padding: 20px; }
.instrument-head { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; }
.indicator { width: 10px; height: 10px; border: 2px solid #9bb1c4; border-radius: 50%; }
.indicator.live { background: #8de2cc; border-color: #8de2cc; }
.meter-label, .scale { display: flex; justify-content: space-between; font-family: var(--mono); }
.meter-label { font-size: .85rem; }
.scale { color: #bfccda; font-size: .72rem; margin: 5px 0 20px; }
#segments { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 3px; margin: 8px 0 0; }
#segments i { height: 32px; background: #3e5468; border-radius: 2px; }
#segments i.lit { background: #8de2cc; }
#segments i.lit:nth-last-child(-n+5) { background: #f2ce87; }
.actions, .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
button, select, textarea, input { font: inherit; font-size: 1rem; color: inherit; }
button { min-height: 46px; border: 1px solid #8b9eae; border-radius: 8px; padding: 10px 14px; background: white; cursor: pointer; font-weight: 650; }
button:hover:enabled { filter: brightness(.94); }
#start { background: #c2dfff; color: #143453; border-color: transparent; }
#tone { background: #243e54; color: white; border-color: #8faabe; }
#tone:disabled { color: #b1bdc8; border-color: #556b7d; }
button:disabled, select:disabled { cursor: default; }
.primary { background: var(--blue); border-color: var(--blue); color: white; }
label { display: block; font-size: .95rem; font-weight: 650; line-height: 1.4; }
select, input, textarea { display: block; width: 100%; min-width: 0; min-height: 46px; border: 1px solid #94a7b6; border-radius: 7px; padding: 9px 10px; background: #fff; margin-top: 5px; }
textarea { resize: vertical; }
select:disabled { background: #f3f6f8; color: #546779; opacity: 1; }
:focus-visible { outline: 3px solid #1c79c9; outline-offset: 3px; }
.message, .intro, .hint, .active-line, #events, #trials { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.message { font-size: .94rem; margin: 12px 0 20px; }
.message.error { border-left: 3px solid #ab452a; padding-left: 10px; color: #81351f; }
.active-line { font-size: .9rem; margin: 10px 0 4px; }
.active-line strong { color: #172e43; margin-left: 5px; }
details { border-bottom: 1px solid var(--line); }
summary { padding: 12px 0; min-height: 44px; font-weight: 650; cursor: pointer; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .82rem/1.5 var(--mono); }
.hint, #events, #trials { font-size: .9rem; }
#events, #trials { padding: 0; margin-bottom: 0; list-style: none; }
#events { max-height: 190px; overflow-y: auto; }
#events li, #trials li { padding: 7px 0; border-top: 1px solid var(--line); }
#events time { display: inline-block; font: .78rem var(--mono); margin-right: 8px; }
.intro { margin-top: -7px; margin-bottom: 10px; }
.setup { margin: 14px 0 18px; border-top: 1px solid var(--line); }
.pair { margin: 0 0 12px; }
form { display: grid; gap: 15px; }
.optional { font-weight: 400; }
.saved { margin-top: 20px; border-top: 1px solid var(--line); }
.saved h3 { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
#count { font: .9rem var(--mono); }
#copy { margin: 8px 0; }
#manual-label { margin-top: 12px; }
[hidden] { display: none !important; }
.sr { position: absolute; clip-path: inset(50%); height: 1px; width: 1px; overflow: hidden; }
@media (max-width: 760px) {
  main { max-width: 570px; padding: 22px 14px 32px; }
  header { margin-bottom: 20px; padding: 0 4px; }
  header p { font-size: 1rem; }
  h1 { margin-top: 14px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .panel { padding: 17px; border-radius: 14px; }
  .instrument { padding: 15px; }
  #tone, #start { padding-inline: 5px; }
}
@media (max-width: 340px) { .pair, .actions { grid-template-columns: 1fr; } }
