:root {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-accent: #e2d4be;
  --ink: #1f2a22;
  --muted: #536156;
  --card: rgba(255, 252, 246, 0.82);
  --line: rgba(31, 42, 34, 0.12);
  --brand: #1d8f5a;
  --brand-dark: #146a42;
  --shadow: 0 20px 50px rgba(74, 57, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(29, 143, 90, 0.16), transparent 24rem),
    linear-gradient(180deg, #f8f4eb, var(--bg));
  min-height: 100vh;
}

code {
  font-family: "SF Mono", "Menlo", monospace;
}

.shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--brand-dark);
  margin-bottom: 0.25rem;
}

h1,
h2,
.value {
  font-family: "Iowan Old Style", "Georgia", serif;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 0.94;
  margin: 0;
  max-width: 10ch;
}

.lede {
  max-width: 60ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.panel {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-top: 1rem;
}

.panel-header,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.power-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 999px;
  background: rgba(29, 143, 90, 0.1);
  border: 1px solid var(--line);
}

.autostart-toggle {
  align-self: start;
}

.power-toggle input {
  appearance: none;
  width: 3rem;
  height: 1.7rem;
  background: #d9d2c5;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 140ms ease;
}

.power-toggle input::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: white;
  transition: transform 140ms ease;
}

.power-toggle input:checked {
  background: var(--brand);
}

.power-toggle input:checked::after {
  transform: translateX(1.3rem);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.95rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 0.85rem 0.95rem;
  background: rgba(255, 255, 255, 0.8);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  background: var(--brand);
  color: white;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
}

button.secondary {
  background: #e8dfd0;
  color: var(--ink);
}

.toggle {
  flex-direction: row;
  align-items: center;
  padding-top: 1.9rem;
}

.toggle input {
  width: auto;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 1.25rem;
}

.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.value {
  margin: 0;
  font-size: 1.35rem;
}

.logs {
  margin: 0;
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  padding: 1rem;
  background: #1d251f;
  color: #d6f5df;
  border-radius: 16px;
  line-height: 1.45;
}

.notes {
  margin: 0 0 1rem;
  min-height: 110px;
  padding: 1rem;
  background: rgba(23, 54, 39, 0.08);
  color: var(--ink);
  border-radius: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.audio-routing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.autostart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1rem;
}

.actions.vertical {
  flex-direction: column;
  align-items: stretch;
}

.drawer {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.drawer-in-form {
  grid-column: 1 / -1;
}

.drawer summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  background: #e8dfd0;
  color: var(--ink);
}

.drawer summary::-webkit-details-marker {
  display: none;
}

.drawer summary::before {
  content: "\2261";
  font-size: 1.1rem;
  line-height: 1;
}

.drawer-body {
  margin-top: 1rem;
}

.compact-status {
  padding-top: 1rem;
  padding-bottom: 0.75rem;
}

.save-feedback {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  color: var(--brand-dark);
}

.save-feedback[data-kind="error"] {
  color: #9a2f2f;
}

.inline-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .panel-header,
  .actions,
  .audio-routing,
  .autostart-row,
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    max-width: none;
  }

  .audio-routing {
    display: flex;
  }

  .autostart-row {
    display: flex;
  }
}
