:root {
  --bg: #12131a;
  --surface: #1b1d27;
  --surface-2: #232634;
  --line: #2f3345;
  --text: #eceef5;
  --muted: #9aa0b5;
  --accent: #6f8cff;
  --accent-soft: #2a3358;
  --danger: #ff5f56;
  --ok: #3ddc97;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f0f2f8;
    --line: #dfe3ee;
    --text: #171a22;
    --muted: #626a80;
    --accent: #3b5bdb;
    --accent-soft: #dde3ff;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 6px;
}

.brand { font-weight: 650; letter-spacing: .2px; }

.icon-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 20px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.banner {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
}
.banner.error { background: rgba(255, 95, 86, .14); border-color: rgba(255, 95, 86, .4); }
.banner.is-clickable { cursor: pointer; }
.banner.is-clickable:hover { border-color: var(--accent); }

.modes {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.mode {
  flex: 1;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 9px 4px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.mode.is-active { background: var(--accent); color: #fff; font-weight: 600; }

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 0 6px;
}

.record {
  position: relative;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 8px 30px rgba(0,0,0,.25);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .12s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.record:active { transform: scale(.97); }
.record-icon { font-size: 40px; line-height: 1; }

.record.is-recording { background: var(--danger); }
.record.is-recording .record-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--danger);
  animation: pulse 1.6s ease-out infinite;
}
.record.is-busy { opacity: .6; pointer-events: none; }

@keyframes pulse {
  0%   { transform: scale(.94); opacity: .8; }
  100% { transform: scale(1.18); opacity: 0; }
}

.status { color: var(--muted); font-size: 14px; min-height: 21px; }

.hotkey-hint { color: var(--muted); font-size: 12.5px; opacity: .75; }
.hotkey-hint kbd {
  font: inherit;
  font-size: 11.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
}
/* Auf Geräten ohne Tastatur ist der Hinweis nur Rauschen. */
@media (hover: none) { .hotkey-hint { display: none; } }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.meta { font-size: 12px; }

.link {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.raw {
  color: var(--muted);
  font-size: 14px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.out {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
}
.out:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

button.primary, button.ghost {
  font: inherit;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
button.primary { background: var(--accent); color: #fff; font-weight: 600; flex: 1; min-width: 130px; }
button.ghost { background: transparent; border-color: var(--line); color: var(--text); }
button.primary.is-done { background: var(--ok); color: #06281c; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history li {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history li:hover { color: var(--text); }

.sheet {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 520px;
  width: calc(100% - 24px);
  color: var(--text);
}
.sheet::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }

.sheet-inner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 85dvh;
  overflow-y: auto;
}

.sheet h2 { margin: 0; font-size: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field[hidden] { display: none; }

.field input, .field select, .field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
}

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); }
.check input { width: 18px; height: 18px; }

.hint { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.45; }

.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; }
.sheet-actions button { flex: 0 0 auto; min-width: 0; }
