:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f9fafb;
  background: #030712;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: linear-gradient(180deg, #111827 0%, #030712 100%);
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="password"] {
  min-height: 48px;
  border-radius: 12px;
}

button {
  border: 0;
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: #07111f;
  background: #7dd3fc;
}

button:disabled {
  opacity: 0.45;
}

button.secondary {
  color: #f9fafb;
  background: #374151;
}

button.warning {
  color: #fff7ed;
  background: #c2410c;
}

input[type="password"],
select {
  width: 100%;
  border: 1px solid #4b5563;
  padding: 0.75rem;
  color: #f9fafb;
  background: #111827;
}

input[type="range"] {
  width: 100%;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1.5rem, env(safe-area-inset-bottom));
}

.app-header,
.inline-control,
.button-row,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header {
  justify-content: space-between;
  margin-bottom: 1rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 8vw, 2.5rem);
}

h2 {
  font-size: 1rem;
}

.eyebrow,
.hint,
.connection-label {
  color: #9ca3af;
}

.eyebrow {
  margin-bottom: 0.2rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 0.25rem;
}

.state-pill {
  border: 1px solid #38bdf8;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: #bae6fd;
  background: rgba(3, 105, 161, 0.25);
}

.panel {
  margin-bottom: 1rem;
  border: 1px solid rgba(156, 163, 175, 0.25);
  border-radius: 16px;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 650;
}

.panel input,
.panel select {
  margin-bottom: 0.9rem;
}

.inline-control input {
  margin-bottom: 0;
}

.inline-control button {
  flex: 0 0 auto;
}

.button-row {
  flex-wrap: wrap;
}

.button-row button {
  flex: 1 1 140px;
}

.toggle-row {
  justify-content: space-between;
}

.toggle-row input {
  width: 24px;
  height: 24px;
  margin: 0;
}

.partial {
  min-height: 1.5rem;
  color: #93c5fd;
  font-style: italic;
}

.transcript-log,
.assistant-text {
  max-height: 30vh;
  overflow: auto;
  white-space: pre-wrap;
}

.transcript-log {
  color: #d1d5db;
}

.assistant-text {
  margin-top: 0.75rem;
  border-left: 3px solid #38bdf8;
  padding-left: 0.75rem;
  color: #f9fafb;
}

.confirmation-panel {
  border-color: #f59e0b;
}

.error-panel {
  min-height: 1.5rem;
  color: #fecaca;
}

@media (max-width: 520px) {
  .app-header {
    align-items: flex-start;
  }

  .inline-control {
    align-items: stretch;
    flex-direction: column;
  }
}
