/* styles.css — app-style layout: full-height shell, big central Start/Stop,
   bottom tab bar. Behaviour lives in real controls so it works without this.
   High-contrast, visible focus, light/dark aware, iOS safe-areas. CC0. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #f4f2ec;
  --fg: #16130f;
  --muted: #57524b;
  --accent: #5b3fd6;
  --accent-fg: #ffffff;
  --danger: #c0392b;
  --line: #d3cfc5;
  --focus: #b3401d;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110d;
    --panel: #1f1b16;
    --fg: #f2efe8;
    --muted: #b7b1a6;
    --accent: #b3aef0;
    --accent-fg: #14110d;
    --danger: #e5674f;
    --line: #3a352d;
    --focus: #f0997b;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, sans-serif;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Phone-shaped centered column on wider screens. */
@media (min-width: 560px) {
  body {
    max-width: 460px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* Header */
.app-header {
  flex: none;
  padding: max(env(safe-area-inset-top), .6rem) 1rem .3rem;
}
h1 { font-size: 1.3rem; margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }

.status {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: .5rem .7rem;
  border-radius: 8px;
  margin: .35rem 0;
  font-size: .9rem;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.pitch { font-weight: 600; margin: .25rem 0 0; font-size: .95rem; }

/* Transport — big central Start/Stop */
.transport {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* keeps the mic button dead-centered */
  align-items: center;
  padding: .75rem 1rem 1rem;
}
.transport .mic-btn { grid-column: 2; justify-self: center; }
.transport .rec-btn { grid-column: 3; justify-self: start; margin-left: 1rem; }
.mic-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.mic-btn .mic-icon { font-size: 2rem; line-height: 1; }
.mic-btn.active { background: var(--danger); box-shadow: 0 4px 14px color-mix(in srgb, var(--danger) 35%, transparent); }

.rec-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.rec-btn .rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); display: inline-block; }
.rec-btn.active { background: var(--danger); color: #fff; border-color: var(--danger); }
.rec-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Scrolling content */
main {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .5rem 1.1rem 1.25rem;
}
[role="tabpanel"] { outline: none; }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin: .85rem 0;
  border: 0;
  padding: 0;
}
fieldset.row { border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .8rem; }
legend { font-weight: 600; padding: 0 .3rem; }
label { font-weight: 500; }
fieldset label { font-weight: 400; display: inline-flex; align-items: center; gap: .35rem; min-height: 2rem; }

button.secondary {
  font: inherit;
  padding: .55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}

select {
  font: inherit;
  padding: .5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  min-height: 2.4rem;
}

input[type="range"] { flex: 1 1 10rem; min-width: 8rem; accent-color: var(--accent); height: 2rem; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
output { min-width: 3.4rem; font-variant-numeric: tabular-nums; color: var(--muted); }

/* Effects */
.effect {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .55rem .8rem;
  margin: .6rem 0;
  background: var(--panel);
}
.effect legend { font-size: 1.02rem; }
.effect .group-tag { font-size: .78rem; color: var(--muted); font-weight: 400; }

/* Recordings */
.rec-list { list-style: none; margin: .75rem 0; padding: 0; }
.rec-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  margin: .5rem 0;
  background: var(--panel);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.rec-item .rec-name { font-weight: 600; flex: 1 1 9rem; }
.rec-item .rec-meta { color: var(--muted); font-size: .85rem; }
.rec-item audio { flex: 1 1 100%; height: 2.2rem; }
.rec-item button, .rec-item a { padding: .4rem .8rem; font-size: .9rem; border-radius: 8px; }
.rec-item a { border: 1px solid var(--line); text-decoration: none; color: var(--fg); }

/* Bottom tab bar */
.tabbar {
  flex: none;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding-bottom: env(safe-area-inset-bottom);
}
.tablist { display: grid; grid-template-columns: repeat(4, 1fr); }
[role="tab"] {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .72rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .5rem 0 .6rem;
  cursor: pointer;
}
[role="tab"] .tabicon { font-size: 1.3rem; line-height: 1; }
[role="tab"][aria-selected="true"] { color: var(--accent); }

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

.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 10;
  background: var(--bg); padding: .5rem .8rem;
  border: 2px solid var(--focus); border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
