:root {
  --bg: #04080d;
  --bg-2: #08121d;
  --panel: rgba(11, 18, 27, 0.92);
  --panel-2: rgba(15, 25, 37, 0.86);
  --panel-3: rgba(8, 15, 24, 0.88);
  --border: rgba(71, 104, 135, 0.38);
  --border-strong: rgba(55, 216, 255, 0.38);
  --text: #eef5ff;
  --muted: #9facbd;
  --accent: #1fbdf5;
  --accent-2: #28e1ff;
  --ok: #26d772;
  --warn: #f2b84b;
  --danger: #ef5b68;
  --entry: rgba(6, 11, 17, 0.92);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --glow: 0 0 24px rgba(31, 189, 245, 0.15);
  --radius: 16px;
}

body[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-2: #eaf1f9;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: rgba(248, 251, 255, 0.96);
  --panel-3: rgba(244, 248, 253, 0.96);
  --border: rgba(153, 174, 199, 0.5);
  --border-strong: rgba(24, 103, 222, 0.32);
  --text: #132033;
  --muted: #5d6f86;
  --accent: #0b6fe8;
  --accent-2: #1790ff;
  --ok: #14a765;
  --warn: #c48318;
  --danger: #cc3b48;
  --entry: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 42px rgba(36, 55, 77, 0.12);
  --glow: 0 0 20px rgba(24, 103, 222, 0.10);
}

* { box-sizing: border-box; }
html { color-scheme: dark; background: var(--bg); }
body[data-theme="light"] { color-scheme: light; }
body {
  margin: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  color: var(--text);
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(32, 180, 240, 0.16), transparent 24%),
    radial-gradient(circle at 80% 8%, rgba(58, 80, 123, 0.18), transparent 22%),
    linear-gradient(145deg, #05080d 0%, var(--bg) 48%, #020407 100%);
}
body[data-theme="light"] {
  background:
    radial-gradient(circle at 16% 0%, rgba(255,255,255,0.9), transparent 26%),
    radial-gradient(circle at 80% 10%, rgba(11,111,232,0.10), transparent 22%),
    linear-gradient(145deg, #f7fbff 0%, var(--bg) 55%, #e6eef8 100%);
}

.app-frame {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 56px 1fr;
  border: 1px solid rgba(255,255,255,0.06);
}

.app-topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 16px;
  background: linear-gradient(180deg, rgba(11, 18, 27, 0.98), rgba(7, 12, 18, 0.96));
  border-bottom: 1px solid rgba(72, 104, 135, 0.28);
  box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}
body[data-theme="light"] .app-topbar {
  background: rgba(255,255,255,0.92);
  border-bottom: 1px solid rgba(153,174,199,0.4);
}
.top-brand { display: flex; align-items: center; gap: 10px; min-width: 280px; }
.top-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; }
.brand-title { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.brand-title strong { font-size: 25px; letter-spacing: 0.01em; }
.brand-title span { color: var(--accent-2); font-size: 16px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-control { display: flex; align-items: center; gap: 8px; padding: 0 4px; }
.top-control label { color: var(--muted); font-size: 12px; font-weight: 700; }
.icon-button, .avatar {
  min-height: 36px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(17, 29, 42, 0.86), rgba(9, 15, 22, 0.9));
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
}
.avatar { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; color: var(--accent-2); }

.app-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 74px 350px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 16px 14px 0;
}
.nav-rail {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 0 10px;
  background: linear-gradient(180deg, rgba(8,15,23,0.98), rgba(5,9,14,0.98));
  border-right: 1px solid rgba(72, 104, 135, 0.25);
}
body[data-theme="light"] .nav-rail { background: rgba(255,255,255,0.92); }
.nav-item {
  position: relative;
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  cursor: default;
}
.nav-item span { font-size: 26px; line-height: 1; color: color-mix(in srgb, var(--accent) 68%, var(--muted)); }
.nav-item small { font-size: 11px; font-weight: 700; }
.nav-item.active {
  color: var(--accent-2);
  background: linear-gradient(90deg, rgba(31,189,245,0.20), transparent);
  border-left: 3px solid var(--accent-2);
}
.nav-version { margin-top: auto; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.2; }

.control-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
}
.workspace {
  min-height: 0;
  display: grid;
  grid-template-rows: 282px minmax(250px, 1fr) 172px;
  gap: 12px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.035);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.05), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(31,189,245,0.08), transparent 34%);
}
.panel > * { position: relative; z-index: 1; }
.panel-title, .plot-title {
  text-transform: uppercase;
  letter-spacing: 0.035em;
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 12px;
  color: var(--text);
}

.audio-panel, .record-panel-card, .options-panel, .message-panel { padding: 16px; }
.audio-panel { min-height: 180px; }
.record-panel-card { min-height: 234px; }
.options-panel { min-height: 0; }
.message-panel { min-height: 82px; }

.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-row.compact { margin-bottom: 9px; }
.form-row label { color: var(--muted); font-size: 12px; font-weight: 800; }
.form-grid { display: grid; gap: 10px; }
.compact-grid { grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.span-two { grid-column: span 2; }

select, input {
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--entry);
  color: var(--text);
  padding: 7px 10px;
  outline: none;
  font: inherit;
}
input[type="file"] {
  padding: 8px;
  font-size: 12px;
}
select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 189, 245, 0.14);
}

.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.button-row.tight { margin-top: 8px; }
.two-buttons .btn { flex: 1 1 0; }
.utility-buttons .btn { flex: 1 1 0; }
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 36px;
  padding: 8px 12px;
  font-weight: 900;
  cursor: pointer;
  color: white;
  transition: 120ms ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  font-size: 13px;
}
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #17bdf7, #0b8cdc); border-color: rgba(118, 215, 255, 0.7); color: #00111c; }
.btn.secondary { background: linear-gradient(180deg, #27384c, #182535); border-color: rgba(113, 139, 165, 0.65); color: var(--text); }
.btn.danger { background: linear-gradient(180deg, #1ec9ff, #0c9ee2); border-color: rgba(118, 215, 255, 0.8); color: #00111c; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.08); }

.meter-block { margin-top: 12px; }
.compact-meter { margin-top: 10px; }
.meter-header, .meter-hints { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; gap: 12px; }
.meter-hints { margin-top: 6px; }
.meter {
  height: 11px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.72);
}
#levelBar { height: 100%; width: 0%; background: linear-gradient(90deg, #22c55e, #a3e635, #f59e0b, #ef4444); transition: width 80ms linear; }
.micro-note { color: var(--muted); font-size: 11.5px; line-height: 1.35; margin: 6px 0 0; }
.muted { color: var(--muted); }
.upload-box {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(71,104,135,0.28);
  border-radius: 12px;
  background: rgba(4,9,15,0.42);
}
.upload-label { color: var(--muted); font-size: 12px; font-weight: 800; display: block; margin-bottom: 6px; }
.record-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  margin: 8px 0;
}
.record-state { font-weight: 900; font-size: 13px; }
.record-state.idle { color: var(--muted); }
.record-state.live { color: #fecaca; }
.timer { font-size: 20px; font-weight: 900; letter-spacing: 0.03em; }
.messages { color: var(--muted); min-height: 38px; max-height: 54px; overflow: hidden; white-space: pre-line; font-size: 12px; line-height: 1.35; }
.messages .warn { color: #facc15; }
.messages .error { color: #ef4444; }
.messages .ok { color: #2fbf74; }

.results-panel { padding: 16px; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.section-header h2, .info-card h2 { margin: 0; font-size: 18px; }
.privacy-pill {
  color: color-mix(in srgb, var(--ok) 55%, var(--text));
  border: 1px solid rgba(38,215,114,0.42);
  background: rgba(38,215,114,0.08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}
.result-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.metric {
  min-height: 76px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 10px;
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: auto 1fr;
  align-items: center;
  column-gap: 8px;
}
.metric-icon { grid-row: span 2; font-size: 24px; color: var(--accent-2); text-align: center; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.metric strong { font-size: 22px; line-height: 1.05; }
#vibratoStatus { color: var(--ok); }
#reliability { color: var(--ok); }
.interpretation {
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.24);
  color: var(--text);
  line-height: 1.35;
  font-size: 13px;
  max-height: 52px;
  overflow: hidden;
}
body[data-theme="light"] .interpretation { background: rgba(255,255,255,0.4); }

.plot-grid { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plot-card { padding: 14px; min-width: 0; }
.plot-title { margin-bottom: 8px; }
canvas {
  width: 100%;
  height: 178px;
  display: block;
  background: #061020;
  border-radius: 12px;
  border: 1px solid var(--border);
}
body[data-theme="light"] canvas { background: #f5f9ff; }
#pitchCanvas { cursor: crosshair; touch-action: none; }
.roi-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-3);
}
.roi-panel p { margin: 4px 0 0; }
.roi-panel .btn { min-width: 96px; }

.info-row { display: grid; grid-template-columns: 0.9fr 1.4fr 1.05fr; gap: 12px; min-height: 0; }
.info-card { padding: 14px; min-height: 0; }
.info-card h2 { margin-bottom: 8px; font-size: 16px; }
.info-block { background: transparent; border: 0; padding: 0; }
.info-block summary { cursor: default; font-weight: 900; color: var(--text); margin-bottom: 6px; font-size: 13px; }
.info-block ul, .info-block ol { margin: 0 0 0 18px; line-height: 1.35; padding: 0; }
.info-block li { margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.info-block p, .about-card p { font-size: 12.5px; line-height: 1.36; margin: 0 0 7px; }
.score-guide { list-style: none; margin-left: 0 !important; }
.score-guide li { display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; display: inline-block; border-radius: 999px; }
.dot.high { background: #22c55e; }
.dot.good { background: #84cc16; }
.dot.mid { background: #f59e0b; }
.dot.low { background: #ef4444; }
a { color: var(--accent-2); font-weight: 800; text-decoration: none; }
a:hover { text-decoration: underline; }

@media (max-width: 1280px), (max-height: 760px) {
  .app-layout { grid-template-columns: 62px 320px minmax(0, 1fr); gap: 10px; padding-right: 10px; }
  .workspace { grid-template-rows: 260px minmax(220px, 1fr) 150px; gap: 10px; }
  canvas { height: 150px; }
  .metric { min-height: 66px; padding: 10px; }
  .metric strong { font-size: 19px; }
  .metric-icon { font-size: 20px; }
  .audio-panel, .record-panel-card, .options-panel, .message-panel { padding: 13px; }
  .info-card h2 { font-size: 14px; }
  .info-block li, .info-block p, .about-card p { font-size: 11.5px; }
}

@media (max-width: 1050px) {
  body { overflow: auto; }
  .app-frame { height: auto; min-height: 100vh; }
  .app-layout { grid-template-columns: 64px 1fr; }
  .control-column { grid-column: 2; grid-template-rows: auto; }
  .workspace { grid-column: 2; grid-template-rows: auto; }
  .plot-grid, .info-row { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* v0.4.1 interface fixes: remove inactive app chrome, prevent cropped text, and improve light-theme buttons */
.app-layout {
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 14px 12px;
}
.control-column {
  grid-template-rows: 152px 210px 256px minmax(66px, 1fr);
  gap: 8px;
}
.workspace {
  grid-template-rows: 238px minmax(232px, 1fr) 148px;
  gap: 10px;
}
.top-actions { gap: 10px; }
.top-control select { min-height: 32px; font-size: 12px; padding: 5px 8px; }
.audio-panel, .record-panel-card, .options-panel, .message-panel { padding: 12px; }
.audio-panel, .record-panel-card, .options-panel, .message-panel,
.results-panel, .plot-card, .info-card { overflow: hidden; }
.panel-title, .plot-title { font-size: 13px; margin-bottom: 8px; }
.form-row { gap: 3px; margin-bottom: 7px; }
.form-row.compact { margin-bottom: 6px; }
.form-row label { font-size: 10.8px; }
.compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; }
.span-two { grid-column: span 1; }
select, input { min-height: 31px; border-radius: 9px; padding: 5px 8px; font-size: 12px; }
input[type="file"] { padding: 7px; font-size: 11px; }
.btn { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button-row { gap: 7px; margin-top: 7px; }
.upload-box { margin-top: 8px; padding: 8px; }
.upload-label { font-size: 11px; margin-bottom: 4px; }
.micro-note { font-size: 10.5px; line-height: 1.28; margin-top: 4px; }
.record-panel { padding: 11px; margin: 7px 0; }
.timer { font-size: 18px; }
.meter-block { margin-top: 8px; }
.meter-header, .meter-hints { font-size: 10.8px; margin-bottom: 4px; }
.meter-hints { margin-top: 4px; }
.messages {
  min-height: 0;
  max-height: 96px;
  overflow: auto;
  font-size: 10.8px;
  line-height: 1.25;
  padding-right: 2px;
}
.results-panel { padding: 12px; }
.section-header { margin-bottom: 8px; }
.section-header h2 { font-size: 16px; }
.privacy-pill { font-size: 10.5px; padding: 4px 8px; }
.result-grid { gap: 7px; }
.metric {
  min-height: 59px;
  padding: 8px;
  grid-template-columns: 26px 1fr;
  column-gap: 6px;
}
.metric-icon { font-size: 19px; }
.metric-label { font-size: 10.5px; }
.metric strong { font-size: 18px; }
.interpretation {
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.25;
  max-height: 46px;
  overflow: auto;
}
.plot-grid { gap: 10px; }
.plot-card { padding: 12px; }
canvas { height: 140px; border-radius: 10px; }
.roi-panel { margin-top: 7px; padding: 8px 10px; }
.roi-panel .btn { min-width: 84px; }
.info-row { grid-template-columns: 0.9fr 1.45fr 1.1fr; gap: 10px; }
.info-card { padding: 11px 12px; }
.info-card h2 { font-size: 13px; margin-bottom: 6px; }
.compact-list, .score-guide { margin: 0 0 0 16px; padding: 0; line-height: 1.22; }
.compact-list li, .score-guide li { font-size: 10.6px; margin-bottom: 3px; color: var(--muted); }
.info-card p, .about-card p { font-size: 10.8px; line-height: 1.24; margin: 0 0 5px; }
.score-guide { list-style: none; margin-left: 0 !important; }
.score-guide li { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; flex: 0 0 auto; }

body[data-theme="light"] .btn.secondary,
body[data-theme="light"] .btn.ghost {
  background: linear-gradient(180deg, #ffffff, #eaf2fb);
  border-color: rgba(104, 130, 160, 0.55);
  color: #132033;
}
body[data-theme="light"] .btn.secondary:disabled,
body[data-theme="light"] .btn.ghost:disabled {
  background: linear-gradient(180deg, #edf3fa, #dce7f2);
  color: #52657c;
  opacity: 0.85;
}
body[data-theme="light"] .btn.primary,
body[data-theme="light"] .btn.danger {
  color: #03192a;
}
body[data-theme="light"] .upload-box {
  background: rgba(244, 248, 253, 0.98);
}
body[data-theme="light"] input[type="file"] {
  background: #ffffff;
  color: #132033;
}

@media (max-width: 1280px), (max-height: 760px) {
  .app-layout { grid-template-columns: 318px minmax(0, 1fr); gap: 9px; padding: 8px 10px 10px; }
  .control-column { grid-template-rows: 144px 202px 246px minmax(62px, 1fr); gap: 7px; }
  .workspace { grid-template-rows: 224px minmax(214px, 1fr) 136px; gap: 8px; }
  canvas { height: 126px; }
  .metric { min-height: 54px; padding: 7px; }
  .metric strong { font-size: 16.5px; }
  .metric-label { font-size: 10px; }
  .metric-icon { font-size: 17px; }
  .interpretation { font-size: 10.8px; max-height: 40px; }
  .info-card h2 { font-size: 12px; }
  .compact-list li, .score-guide li, .info-card p, .about-card p { font-size: 9.7px; }
  .micro-note { font-size: 9.6px; }
  .messages { font-size: 9.8px; max-height: 72px; }
}

@media (max-width: 1050px) {
  .app-layout { grid-template-columns: 1fr; }
  .control-column { grid-column: 1; grid-template-rows: auto; }
  .workspace { grid-column: 1; grid-template-rows: auto; }
}

/* v0.4.2 layout correction: fix left-column crowding, compact status, and larger plot panels */
.app-layout {
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 14px 12px;
}
.control-column {
  grid-template-rows: 178px 226px 268px 76px;
  gap: 8px;
}
.workspace {
  grid-template-rows: 230px minmax(300px, 1fr) 164px;
  gap: 10px;
}
.audio-panel,
.record-panel-card,
.options-panel,
.message-panel {
  padding: 12px 14px;
}
.audio-panel .button-row.tight {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.audio-panel .btn {
  min-width: 0;
  width: 100%;
}
.record-panel-card .button-row.tight {
  margin-top: 8px;
}
.record-panel-card .utility-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.options-panel {
  overflow: hidden;
}
.options-panel .micro-note {
  display: none;
}
.message-panel {
  min-height: 0;
  height: 76px;
}
.message-panel .panel-title {
  margin-bottom: 5px;
}
.messages {
  max-height: 38px;
  min-height: 0;
  overflow: hidden;
  font-size: 10.6px;
  line-height: 1.25;
}
.plot-card {
  padding: 14px;
}
canvas {
  height: 192px;
}
.roi-panel {
  margin-top: 9px;
}
.pitch-card .micro-note:last-child {
  max-height: 34px;
  overflow: hidden;
}
.info-row {
  grid-template-columns: 0.95fr 1.35fr 1.05fr;
}
.info-card {
  overflow: hidden;
}
.compact-list li,
.score-guide li,
.info-card p,
.about-card p {
  font-size: 10.9px;
  line-height: 1.24;
}
body[data-theme="light"] .btn.secondary,
body[data-theme="light"] .btn.ghost,
body[data-theme="light"] .btn.secondary:disabled,
body[data-theme="light"] .btn.ghost:disabled {
  color: #132033;
  text-shadow: none;
}
body[data-theme="light"] .btn.secondary:not(:disabled),
body[data-theme="light"] .btn.ghost:not(:disabled) {
  background: linear-gradient(180deg, #ffffff, #eaf2fb);
  border-color: rgba(104, 130, 160, 0.62);
}
body[data-theme="light"] .btn.secondary:disabled,
body[data-theme="light"] .btn.ghost:disabled {
  background: linear-gradient(180deg, #edf3fa, #dbe6f2);
  opacity: 0.9;
}

@media (max-width: 1280px), (max-height: 760px) {
  .app-layout {
    grid-template-columns: 330px minmax(0, 1fr);
    gap: 9px;
    padding: 8px 10px 10px;
  }
  .control-column {
    grid-template-rows: 166px 214px 248px 70px;
    gap: 7px;
  }
  .workspace {
    grid-template-rows: 218px minmax(270px, 1fr) 132px;
    gap: 8px;
  }
  .audio-panel,
  .record-panel-card,
  .options-panel,
  .message-panel {
    padding: 10px 12px;
  }
  .panel-title,
  .plot-title {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .record-panel {
    padding: 9px 10px;
  }
  select, input {
    min-height: 29px;
    font-size: 11.5px;
  }
  .btn {
    min-height: 30px;
    font-size: 11.5px;
    padding: 5px 8px;
  }
  .message-panel {
    height: 70px;
  }
  .messages {
    max-height: 34px;
    font-size: 9.8px;
  }
  canvas {
    height: 174px;
  }
  .roi-panel {
    padding: 7px 9px;
  }
  .pitch-card .micro-note:last-child {
    max-height: 26px;
  }
  .info-card h2 {
    font-size: 12px;
  }
  .compact-list li,
  .score-guide li,
  .info-card p,
  .about-card p {
    font-size: 9.6px;
  }
}

/* Hide non-functional navigation/app chrome in v0.4.2 */
.nav-rail,
.icon-button,
.avatar {
  display: none !important;
}

/* v0.4.2 final redistribution after visual inspection */
.control-column {
  grid-template-rows: 174px 270px 242px 64px;
}
.record-panel-card {
  min-height: 0;
}
.options-panel {
  min-height: 0;
}
.message-panel {
  height: 64px;
}
.messages {
  max-height: 28px;
}
.workspace {
  grid-template-rows: 226px minmax(300px, 1fr) 172px;
}
.info-card {
  padding: 10px 12px;
}
.info-card h2 {
  font-size: 13px;
  margin-bottom: 5px;
}
.compact-list li,
.score-guide li,
.info-card p,
.about-card p {
  font-size: 10.4px;
  line-height: 1.2;
  margin-bottom: 3px;
}

@media (max-width: 1280px), (max-height: 760px) {
  .control-column {
    grid-template-rows: 160px 246px 226px 58px;
  }
  .message-panel { height: 58px; }
  .messages { max-height: 24px; }
  .workspace {
    grid-template-rows: 210px minmax(258px, 1fr) 128px;
  }
  canvas { height: 166px; }
}

/* v0.4.2 app zoom implementation: scale the app while giving the layout more logical space */
:root { --app-zoom: 1; }
.app-frame {
  width: calc(100vw / var(--app-zoom));
  height: calc(100vh / var(--app-zoom));
  transform: scale(var(--app-zoom));
  transform-origin: top left;
}

/* v0.4.2 final left-column allocation: full F0 processing control, compact status */
.control-column {
  grid-template-rows: 168px 250px 285px 54px;
}
.message-panel { height: 54px; }
.messages { max-height: 22px; }
@media (max-width: 1280px), (max-height: 760px) {
  .control-column {
    grid-template-rows: 154px 232px 270px 50px;
  }
  .message-panel { height: 50px; }
  .messages { max-height: 19px; }
}

/* v0.4.2 record/action button visibility tweak */
.control-column {
  grid-template-rows: 168px 265px 275px 54px;
}
@media (max-width: 1280px), (max-height: 760px) {
  .control-column {
    grid-template-rows: 154px 246px 260px 50px;
  }
}

/* v0.4.3 left-column spacing and status visibility fix */
.app-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 14px 12px;
}
.control-column {
  grid-template-rows: 200px 270px 282px 82px;
  gap: 10px;
}
.audio-panel,
.record-panel-card,
.options-panel,
.message-panel {
  overflow: hidden;
}
.message-panel {
  height: 82px;
  min-height: 82px;
}
.message-panel .panel-title {
  margin-bottom: 6px;
}
.messages {
  max-height: 48px;
  min-height: 36px;
  overflow: hidden;
  font-size: 10.8px;
  line-height: 1.25;
}
.audio-panel .button-row.tight,
.record-panel-card .button-row.tight,
.record-panel-card .utility-buttons {
  position: relative;
  z-index: 2;
}
.record-panel-card { margin-top: 0; }
.options-panel { margin-top: 0; }
canvas { height: 205px; }
.workspace {
  grid-template-rows: 226px minmax(314px, 1fr) 168px;
}
@media (max-width: 1280px), (max-height: 760px) {
  .app-layout {
    grid-template-columns: 348px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 10px 10px;
  }
  .control-column {
    grid-template-rows: 194px 262px 274px 78px;
    gap: 9px;
  }
  .message-panel {
    height: 78px;
    min-height: 78px;
  }
  .messages {
    max-height: 44px;
    min-height: 34px;
    font-size: 10.2px;
  }
  canvas { height: 188px; }
  .workspace {
    grid-template-rows: 212px minmax(290px, 1fr) 136px;
  }
}
@media (max-width: 1050px) {
  .app-layout { grid-template-columns: 1fr; }
  .control-column { grid-template-rows: auto; }
  .message-panel { height: auto; min-height: 78px; }
  .messages { max-height: none; overflow: visible; }
}

/* v0.4.4 final spacing fix: enlarge Record/Load and Status, and rebalance plot/info heights */
.app-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 14px 12px;
}
.control-column {
  grid-template-rows: 198px 288px 274px 92px;
  gap: 10px;
}
.record-panel-card {
  min-height: 288px;
}
.message-panel {
  height: 92px;
  min-height: 92px;
}
.messages {
  max-height: 56px;
  min-height: 46px;
  overflow: hidden;
}
.workspace {
  grid-template-rows: 226px minmax(286px, 1fr) 190px;
  gap: 8px;
}
.plot-card {
  padding-bottom: 10px;
}
canvas {
  height: 198px;
}
.waveform-card .micro-note,
.pitch-card > .micro-note:last-child {
  margin-top: 4px;
}
.info-row {
  align-items: stretch;
}
.info-card {
  padding: 12px 12px 10px;
}
.info-card h2 {
  margin-bottom: 6px;
}
.compact-list li,
.score-guide li,
.info-card p,
.about-card p,
.info-block li {
  font-size: 10.7px;
  line-height: 1.22;
}

@media (max-width: 1280px), (max-height: 760px) {
  .app-layout {
    grid-template-columns: 348px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 10px 10px;
  }
  .control-column {
    grid-template-rows: 190px 280px 266px 88px;
    gap: 8px;
  }
  .record-panel-card {
    min-height: 280px;
  }
  .message-panel {
    height: 88px;
    min-height: 88px;
  }
  .messages {
    max-height: 52px;
    min-height: 42px;
    font-size: 10.1px;
  }
  .workspace {
    grid-template-rows: 212px minmax(270px, 1fr) 178px;
    gap: 8px;
  }
  canvas {
    height: 184px;
  }
  .compact-list li,
  .score-guide li,
  .info-card p,
  .about-card p,
  .info-block li {
    font-size: 9.9px;
  }
}

/* v0.4.5: slightly taller Record/Load card so CSV/JSON/Delete are fully visible */
.control-column {
  grid-template-rows: 198px 310px 252px 92px;
  gap: 10px;
}
.record-panel-card {
  min-height: 310px;
}
.record-panel-card .utility-buttons {
  margin-top: 9px;
  padding-bottom: 2px;
}
.record-panel-card .utility-buttons .btn {
  min-height: 32px;
}
.options-panel {
  min-height: 252px;
}
.message-panel {
  height: 92px;
  min-height: 92px;
}
.messages {
  max-height: 56px;
  min-height: 46px;
}

@media (max-width: 1280px), (max-height: 760px) {
  .control-column {
    grid-template-rows: 190px 302px 250px 88px;
    gap: 8px;
  }
  .record-panel-card {
    min-height: 302px;
  }
  .options-panel {
    min-height: 250px;
  }
  .message-panel {
    height: 88px;
    min-height: 88px;
  }
}

/* v0.4.6: give Analysis Options a little more height so F0 processing is not cropped */
.control-column {
  grid-template-rows: 198px 310px 270px 92px;
  gap: 10px;
}
.options-panel {
  min-height: 270px;
}
.message-panel {
  height: 92px;
  min-height: 92px;
}
@media (max-width: 1280px), (max-height: 760px) {
  .control-column {
    grid-template-rows: 190px 302px 266px 88px;
    gap: 8px;
  }
  .options-panel {
    min-height: 266px;
  }
  .message-panel {
    height: 88px;
    min-height: 88px;
  }
}


/* v0.4.8: professional mobile guard for small phone screens */
.mobile-guard {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 16% 0%, rgba(31, 189, 245, 0.18), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(40, 225, 255, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(2, 6, 12, 0.98), rgba(5, 10, 18, 0.98));
  color: #eef5ff;
}
body.mobile-guard-active .mobile-guard {
  display: grid;
}
.mobile-guard-card {
  width: min(94vw, 520px);
  border: 1px solid rgba(71, 216, 255, 0.32);
  border-radius: 24px;
  padding: 28px 24px 24px;
  background: linear-gradient(145deg, rgba(11, 18, 27, 0.96), rgba(15, 25, 37, 0.92));
  box-shadow: 0 28px 70px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  text-align: center;
}
.mobile-guard-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin-bottom: 10px;
}
.mobile-guard-eyebrow {
  margin: 0 0 10px;
  color: #28e1ff;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 900;
}
.mobile-guard h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1.05;
}
.mobile-guard p {
  margin: 0 auto 12px;
  color: #b8c7d9;
  font-size: 15px;
  line-height: 1.42;
  max-width: 420px;
}
.mobile-guard-note {
  font-size: 13px !important;
  color: #94a8bd !important;
}
.mobile-guard-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
.mobile-guard-actions .btn {
  min-height: 44px;
  min-width: 190px;
  font-size: 14px;
}
