:root {
  color-scheme: light;
  --bg: #0f172a;
  --surface: #132238;
  --surface-2: #1b314d;
  --text: #e8f1ff;
  --muted: #9db6d6;
  --accent: #3ddc97;
  --accent-2: #49a5ff;
  --danger: #ff6b6b;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(73, 165, 255, 0.18), transparent 30%),
    radial-gradient(circle at bottom left, rgba(61, 220, 151, 0.18), transparent 25%),
    var(--bg);
  color: var(--text);
}

.app-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 20px 14px 40px;
}

.topbar,
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

.status-badge {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(73, 165, 255, 0.12);
  color: #cfe7ff;
  border: 1px solid rgba(73, 165, 255, 0.28);
  white-space: nowrap;
}

.panel {
  margin-bottom: 18px;
  padding: 16px;
}

.panel-header,
.action-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.action-row {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.window-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mode-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.menu-anchor {
  position: relative;
  margin-left: auto;
}

.menu-button {
  min-width: 42px;
  padding: 10px 12px;
  font-size: 20px;
  line-height: 1;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 28, 45, 0.98), rgba(11, 20, 34, 0.98));
  box-shadow: var(--shadow);
  z-index: 20;
}

.dropdown-menu[hidden] {
  display: none !important;
}

.dropdown-menu button {
  width: 100%;
  text-align: left;
}

.dropdown-menu .menu-danger {
  color: #ffd6d6;
  border-color: rgba(255, 107, 107, 0.28);
  background: rgba(255, 107, 107, 0.1);
}

.window-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
}

.window-card.active {
  border-color: rgba(61, 220, 151, 0.5);
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.12), rgba(73, 165, 255, 0.08));
}

.mode-row button.active {
  border-color: rgba(61, 220, 151, 0.5);
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.12), rgba(73, 165, 255, 0.08));
}

.window-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.window-index {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.pane-output,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.26);
  color: var(--text);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
}

.pane-output {
  min-height: 280px;
  max-height: 50vh;
  overflow: auto;
  padding: 14px 14px 64px;
  margin-top: 14px;
  white-space: pre-wrap;
}

.output-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

textarea {
  resize: vertical;
  margin-top: 12px;
  padding: 14px;
}

button {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

button:active {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  opacity: 0.92;
}

button.button-busy {
  border-color: rgba(73, 165, 255, 0.45);
  background: linear-gradient(90deg, rgba(73, 165, 255, 0.22), rgba(73, 165, 255, 0.12));
  box-shadow: 0 0 0 1px rgba(73, 165, 255, 0.12);
}

button.button-success {
  border-color: rgba(61, 220, 151, 0.45);
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.24), rgba(61, 220, 151, 0.12));
  box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.12);
}

button.button-error {
  border-color: rgba(255, 107, 107, 0.42);
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.22), rgba(255, 107, 107, 0.12));
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.12);
}

button.primary {
  background: linear-gradient(90deg, var(--accent), #4af0b0);
  color: #062219;
  border-color: rgba(61, 220, 151, 0.4);
}

button.danger {
  background: rgba(255, 107, 107, 0.12);
  color: #ffd6d6;
  border-color: rgba(255, 107, 107, 0.35);
}

.input-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.voice-status {
  color: var(--muted);
  font-size: 13px;
}

button.is-recording {
  border-color: rgba(255, 107, 107, 0.5);
  background: linear-gradient(90deg, rgba(255, 107, 107, 0.22), rgba(255, 107, 107, 0.12));
  box-shadow: 0 0 0 1px rgba(255, 107, 107, 0.12);
}

button.is-transcribing {
  border-color: rgba(73, 165, 255, 0.45);
  background: linear-gradient(90deg, rgba(73, 165, 255, 0.22), rgba(73, 165, 255, 0.12));
  box-shadow: 0 0 0 1px rgba(73, 165, 255, 0.12);
}

@media (max-width: 640px) {
  .topbar,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-header.menu-header {
    flex-direction: row;
    align-items: center;
  }

  .status-badge {
    align-self: flex-start;
  }
}
