/* Tokens are the contract in DESIGN.md. Do not add a second saturated colour. */
:root {
  --bg: #0a0a0b;
  --surface: #141417;
  --surface-hi: #1d1d22;
  --line: #2a2a31;
  --text: #f4f4f5;
  --text-dim: #9a9aa4;
  --accent: #22d3ee;
  --accent-ink: #04222a;
  --warn: #f2c14e;
  --error: #ff5c5c;

  --ui: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;

  --lyric-scale: 1;

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}

button:hover {
  background: var(--surface-hi);
}

button:active {
  opacity: 0.8;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.dim {
  color: var(--text-dim);
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------- screen -- */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 20px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  margin-right: auto;
}

.pill {
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  white-space: nowrap;
}

.pill.on {
  color: var(--accent);
  border-color: var(--accent);
}

.pill.bad {
  color: var(--error);
  border-color: var(--error);
}

.search {
  display: flex;
  gap: 10px;
  margin: 18px 0 14px;
}

.search input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 17px;
}

.search input::placeholder {
  color: var(--text-dim);
}

.search button[type="submit"] {
  padding: 0 22px;
  font-weight: 600;
}

/* The mic is a state indicator: if it moves, audio is being captured. */
.mic {
  width: 52px;
  padding: 0;
  display: grid;
  place-items: center;
}

.mic svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.mic.live {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  animation: micpulse 1.1s ease-in-out infinite;
}

.mic.busy {
  color: var(--accent);
  border-color: var(--accent);
}

@keyframes micpulse {
  50% {
    box-shadow: 0 0 0 7px rgba(34, 211, 238, 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mic.live {
    animation: none;
  }
}

/* Notices are never decorative - each one states what actually happened. */
.notices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notice {
  border-left: 3px solid var(--warn);
  background: var(--surface);
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.45;
}

.notice.error {
  border-left-color: var(--error);
  color: var(--error);
}

.notice a {
  color: var(--accent);
}

.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 12px;
}

.results {
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.row {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 13px 8px;
}

.row:hover {
  background: var(--surface-hi);
}

.row .t {
  font-weight: 600;
}

.row .a {
  color: var(--text-dim);
  font-size: 14px;
  margin-right: auto;
}

.badge {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  white-space: nowrap;
}

.badge.sync {
  color: var(--accent);
  border-color: var(--accent);
}

.empty {
  color: var(--text-dim);
  padding: 40px 4px;
  font-size: 15px;
  line-height: 1.6;
}

.empty kbd {
  font: inherit;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
}

/* --------------------------------------------------------------- track --- */

.track-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.track-head h1 {
  margin: 0;
  font-size: 19px;
}

.track-head p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

.track-head .grow {
  flex: 1;
  min-width: 0;
}

.ctl {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ctl button {
  padding: 8px 12px;
  font-size: 13px;
}

.speed {
  padding-left: 10px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}

.speed .label {
  min-width: 6ch;
  text-align: center;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button:disabled:hover {
  background: var(--surface);
}

.ctl button.on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.lyrics {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 22px 4px 45vh;
  font-family: var(--serif);
  font-size: calc(clamp(20px, 2.6vw, 34px) * var(--lyric-scale));
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 34ch;
  scrollbar-width: thin;
}

/* --------------------------------------------------------------- remote -- */

.remote {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  gap: 12px;
}

.remote .search input {
  padding: 18px 16px;
  font-size: 17px;
}

/* Primary verb: by far the largest target on the page. */
.mic-big {
  width: 100%;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mic-big svg {
  width: 40px;
  height: 40px;
  fill: currentColor;
}

.mic-big.live {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  animation: micpulse 1.1s ease-in-out infinite;
}

.mic-big.busy {
  color: var(--accent);
  border-color: var(--accent);
}

.remote .row {
  min-height: 60px;
  align-items: center;
  padding: 12px 8px;
  flex-wrap: wrap;
}

.remote .search button[type="submit"],
.remote .ctl button {
  min-height: 60px;
  min-width: 60px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid button {
  min-height: 60px;
  font-size: 15px;
}

.code-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  font-size: 28px;
  letter-spacing: 0.28em;
  text-align: center;
  text-transform: uppercase;
}

.pair-split {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pair-split > div:last-child {
  flex: 1;
  min-width: 240px;
}

/* The QR keeps its own white ground - scanners need the contrast, and the
   near-black UI cannot provide it. */
.qr svg {
  display: block;
  width: 208px;
  height: 208px;
  border-radius: 6px;
}

.btn {
  display: inline-block;
  margin-top: 6px;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-size: 15px;
}

.btn:hover {
  background: var(--surface-hi);
}

.code-show {
  font-size: clamp(34px, 12vw, 64px);
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
}

.panel {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
  margin-top: 14px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.panel p {
  margin: 8px 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}

.url {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  color: var(--text);
  word-break: break-all;
}

/* Undo instead of a confirmation dialog. */
.snack {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-hi);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  z-index: 10;
  max-width: calc(100% - 28px);
}

.snack button {
  min-height: 44px;
  color: var(--accent);
  border-color: var(--accent);
  background: none;
}
