:root {
  color-scheme: dark;
  /* "Alpenglühen" -- warm alpine-hut-at-dusk palette instead of a generic
     dark-IDE theme, so the one app most people will only ever see on a
     phone screen for a few seconds a day still feels like it belongs to
     this project rather than any other dark-mode utility app. */
  --bg: #18120c;
  --bg-2: #1f1710;
  --surface: #241b13;
  --surface-2: #2f2317;
  --text: #f3e9d7;
  --text-dim: #a8937a;
  --accent: #d9a441;
  --accent-soft: #6b4f22;
  --record: #c1573a;
  --record-bright: #e0714f;
  --ok: #86a06a;
  --border: #3a2c1c;
  --shadow: rgba(10, 6, 2, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

header.topbar .peaks {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
}

header.topbar .peaks svg {
  width: 100%;
  height: 100%;
  fill: var(--accent-soft);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 18px;
  margin: 0;
  letter-spacing: 0.02em;
  font-weight: 700;
}

.brand-text .tagline {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

#online-indicator {
  position: relative;
  font-size: 12px;
  color: var(--ok);
}

main {
  flex: 1;
  padding: 16px;
  padding-bottom: 100px;
}

.view { display: none; }
.view.active { display: block; }

.capture-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 0 8px;
}

#record-button {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(circle at 35% 30%, var(--record-bright), var(--record) 70%);
  color: #fff8ef;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px var(--shadow), 0 0 0 0 rgba(193, 87, 58, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: breathe 4s ease-in-out infinite;
}

.record-icon {
  width: 34px;
  height: 34px;
}

#record-button:active { transform: scale(0.97); }

#record-button.recording {
  background: radial-gradient(circle at 35% 30%, #9fc37f, var(--ok) 70%);
  animation: pulse 1.4s infinite;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 12px 30px -8px var(--shadow), 0 0 0 0 rgba(217, 164, 65, 0.25); }
  50% { box-shadow: 0 12px 34px -6px var(--shadow), 0 0 0 14px rgba(217, 164, 65, 0); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(134, 160, 106, 0.55); }
  70% { box-shadow: 0 0 0 28px rgba(134, 160, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(134, 160, 106, 0); }
}

#record-hint {
  color: var(--text-dim);
  font-size: 14px;
  min-height: 20px;
  text-align: center;
}

.quick-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.quick-actions button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}

.enrich-panel {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: none;
}

.enrich-panel.active { display: block; }

.enrich-panel h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
}

.chip.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff3de;
}

.enrich-panel .done-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent-soft);
  color: #fff3de;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.list-item .meta {
  color: var(--text-dim);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.list-item .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--text-dim);
}

.pending-badge { color: var(--record-bright); font-weight: 600; }
.uploaded-badge { color: var(--ok); }

nav.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

nav.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 10px 0 8px;
  font-size: 11px;
  cursor: pointer;
}

nav.tabbar button svg {
  width: 21px;
  height: 21px;
}

nav.tabbar button.active {
  color: var(--accent);
}

nav.tabbar button.active span {
  position: relative;
}

nav.tabbar button.active span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

input[type=text], input[type=url], textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  margin-bottom: 10px;
}

input[type=text]:focus, input[type=url]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.primary-btn {
  background: linear-gradient(180deg, var(--accent), #c08f36);
  color: #241a08;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

#toast {
  position: fixed;
  bottom: 92px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ok);
  color: #14210a;
  padding: 10px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 20px -6px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#toast.show { opacity: 1; }

.section-title {
  font-size: 14px;
  color: var(--text-dim);
  margin: 4px 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.empty-hint {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.saved-filter-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.saved-filter-row select {
  flex: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

.saved-filter-row button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: #fff3de;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  margin-top: 8px;
  cursor: pointer;
}

.candidate-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.candidate-card {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px;
  margin-top: 6px;
  font-size: 12px;
}

.candidate-card .abc-preview {
  white-space: pre-wrap;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  max-height: 90px;
  overflow-y: auto;
  margin: 6px 0;
}

.candidate-card .candidate-actions {
  display: flex;
  gap: 6px;
}

.candidate-card .candidate-actions button {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
  cursor: pointer;
}

.list-item .card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.list-item .card-actions button {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
}
