:root {
  color-scheme: light;
  --ink: #172124;
  --muted: #617175;
  --line: #cad6d8;
  --panel: #ffffff;
  --page: #f4f7f5;
  --teal: #153c48;
  --teal-2: #1d6b72;
  --gold: #b87817;
  --red: #a43d3d;
  --green: #23704d;
  --blue: #315f9e;
  --shadow: 0 16px 42px rgba(22, 42, 49, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.96;
}

h2 {
  font-size: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.ios-audio-panel {
  margin-top: 14px;
}

.ios-audio-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.capability-panel {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.capability-panel p {
  max-width: 64ch;
  margin: 8px 0 0;
  color: var(--muted);
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf3f1;
  color: var(--teal);
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.ok,
.tag.ok {
  background: #e4f4ea;
  color: var(--green);
  border-color: #b7dbc7;
}

.status-pill.warn,
.tag.warn {
  background: #fff4db;
  color: var(--gold);
  border-color: #edd093;
}

.status-pill.bad,
.tag.bad {
  background: #fae7e4;
  color: var(--red);
  border-color: #e2b7b2;
}

.meter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meter {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfa;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.meter strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.audio-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.level-wrap {
  height: 14px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef3f1;
}

.level-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 120ms ease;
}

.audio-results {
  display: grid;
  gap: 8px;
}

.uuid-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.uuid-panel label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.uuid-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.uuid-row input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.uuid-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

button span {
  display: inline-flex;
  justify-content: center;
  width: 18px;
}

button:hover:not(:disabled) {
  border-color: var(--teal-2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  margin-bottom: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.kv {
  display: grid;
  gap: 10px;
  margin: 0;
}

.kv div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hint {
  margin-top: 16px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  background: #eef3fa;
  color: #254464;
  font-size: 0.9rem;
}

.value-list {
  display: grid;
  gap: 10px;
}

.value-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.value-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.value-item strong {
  overflow-wrap: anywhere;
}

.services {
  display: grid;
  gap: 10px;
}

.service {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.service summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  font-weight: 800;
}

.characteristics {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.characteristic {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: #f7faf9;
}

.uuid,
.props {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.empty {
  margin: 0;
  color: var(--muted);
}

.log {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #11181a;
  color: #dbe7e5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .capability-panel,
  .layout,
  .controls,
  .audio-actions,
  .uuid-row {
    grid-template-columns: 1fr;
  }

  .meter-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
