:root {
  color-scheme: light;
  --ink: #211711;
  --muted: #66584d;
  --paper: #f8f2e8;
  --surface: #fffaf4;
  --line: rgba(33, 23, 17, 0.1);
  --coal: #2a211b;
  --accent: #a3532d;
  --accent-dark: #7f3e22;
  --gold: #bd7b38;
  --rose: #a23f52;
  --soft: #f0e2d0;
  --shadow: 0 24px 80px rgba(42, 24, 11, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(163, 83, 45, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(189, 123, 56, 0.12), transparent 34%),
    var(--paper);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(340px, 0.94fr);
  gap: 24px;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.composer,
.status {
  min-width: 0;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 28px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow: var(--shadow);
}

.composer {
  padding: 28px;
}

.status {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 44px);
  padding: 22px;
}

.topbar,
.status-head,
.record-actions,
.actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.topbar a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(33, 23, 17, 0.12);
  border-radius: 999px;
  background: #fff7ef;
  color: var(--accent-dark);
  font-weight: 800;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  font-size: clamp(2.45rem, 4.8vw, 4.8rem);
  line-height: 0.94;
}

h2 {
  font-size: 1.06rem;
}

.recorder {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 18px;
  background: var(--surface);
}

.meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  height: 46px;
  margin-bottom: 14px;
}

.meter span {
  align-self: end;
  height: 28%;
  border-radius: 6px 6px 2px 2px;
  background: var(--line);
  transition: height 180ms ease, background 180ms ease;
}

.meter.listening span {
  background: var(--rose);
  animation: pulse 920ms ease-in-out infinite;
}

.meter.listening span:nth-child(2) {
  animation-delay: 90ms;
}

.meter.listening span:nth-child(3) {
  animation-delay: 180ms;
}

.meter.listening span:nth-child(4) {
  animation-delay: 270ms;
}

.meter.listening span:nth-child(5) {
  animation-delay: 360ms;
}

@keyframes pulse {
  0%, 100% { height: 24%; }
  45% { height: 100%; }
}

.record-button,
.launch-button,
.secondary {
  min-height: 46px;
  border: 1px solid rgba(163, 83, 45, 0.22);
  border-radius: 999px;
  font-weight: 850;
}

.record-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: var(--coal);
  color: #fff8f3;
}

.record-button.is-recording {
  border-color: var(--rose);
  background: var(--rose);
}

#recordIcon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.secondary {
  padding: 0 16px;
  background: #fff7ef;
  color: var(--accent-dark);
}

.support {
  margin: 12px 0 0;
  max-width: 68ch;
  color: var(--muted);
  line-height: 1.45;
}

.idea-label {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 330px;
  padding: 18px;
  resize: vertical;
  border: 1px solid rgba(33, 23, 17, 0.11);
  border-radius: 18px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(33, 23, 17, 0.11);
  border-radius: 16px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--soft);
}

.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.odapp-settings {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.odapp-settings label[hidden] {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.launch-button {
  width: 100%;
  margin-top: 18px;
  min-height: 56px;
  background: var(--accent);
  color: #ffffff;
  font-size: 1.02rem;
}

.launch-button:disabled,
.secondary:disabled,
.record-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.pipeline {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.pipeline li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.pipeline span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.pipeline li.done {
  color: var(--accent-dark);
  background: var(--soft);
  border-color: var(--accent);
}

.pipeline li.done span {
  background: var(--accent);
}

.pipeline li.active {
  color: var(--gold);
  border-color: var(--gold);
}

.pipeline li.active span {
  background: var(--gold);
}

.log {
  min-height: 120px;
  max-height: 220px;
  margin-top: 12px;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  line-height: 1.45;
}

.handoff {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 18px;
  background: var(--surface);
}

dl {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

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

.audio-output p {
  margin: 0;
  color: var(--muted);
}

.audio-output audio {
  width: 100%;
  max-width: 100%;
}

.audio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.audio-actions a {
  color: var(--accent-dark);
  font-weight: 900;
}

.actions {
  margin-top: 12px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.manuscript {
  flex: 1;
  min-height: 220px;
  margin-top: 12px;
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(33, 23, 17, 0.1);
  border-radius: 18px;
  background: var(--surface);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 1.7;
}

.manuscript h1,
.manuscript h2 {
  margin: 1.4em 0 0.7em;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.15;
}

.manuscript h1:first-child,
.manuscript h2:first-child {
  margin-top: 0;
}

.manuscript p {
  margin: 0 0 1em;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--accent-dark);
  color: #ffffff;
  font-weight: 850;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .status {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

  .topbar,
  .status-head,
  .record-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .odapp-settings {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.45rem;
  }
}
