:root {
  --bg: #0e1013;
  --surface: #161a20;
  --surface-elevated: #1e232b;
  --border: #282f3a;
  --text: #f3f5f8;
  --text-muted: #98a2b3;
  --accent: #e5484d;
  --accent-hover: #f05a5f;
  --green: #30a46c;
  --amber: #f5a524;
  --blue: #3b82f6;
  --radius: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  min-height: 100dvh;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

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

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.2);
  flex-shrink: 0;
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.badge-success {
  border-color: rgba(48, 164, 108, 0.4);
  background: rgba(48, 164, 108, 0.14);
  color: #6ee7b7;
}

.badge-amber {
  border-color: rgba(245, 165, 36, 0.45);
  background: rgba(245, 165, 36, 0.14);
  color: #fcd34d;
}

.badge-danger {
  border-color: rgba(229, 72, 77, 0.45);
  background: rgba(229, 72, 77, 0.14);
  color: #fca5a5;
}

.badge-blue {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
}

.app-main {
  flex: 1;
  padding: 14px 16px calc(86px + env(safe-area-inset-bottom));
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-view.active {
  display: flex;
}

.hidden {
  display: none !important;
}

.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 165, 36, 0.45);
  background: rgba(245, 165, 36, 0.12);
}

.alert-banner.alert-success {
  border-color: rgba(48, 164, 108, 0.45);
  background: rgba(48, 164, 108, 0.12);
}

.alert-banner.alert-danger {
  border-color: rgba(229, 72, 77, 0.45);
  background: rgba(229, 72, 77, 0.14);
}

.alert-content strong {
  display: block;
  font-size: 0.88rem;
}

.alert-content p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text);
}

.alert-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.studio-card,
.section-card,
.options-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-elevated);
  color: var(--text-muted);
}

.status-pill.status-recording {
  background: rgba(229, 72, 77, 0.16);
  color: #fca5a5;
}

.status-pill.status-recording::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.mono-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.timer-display {
  margin: 18px 0 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.8rem, 12vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.meter-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.level-canvas {
  width: 100%;
  height: 54px;
  display: block;
}

.record-controls {
  margin: 24px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.record-btn {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.22);
  background: var(--surface-elevated);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease;
}

.record-btn:active {
  transform: scale(0.95);
}

.record-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.record-btn-inner {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  transition: border-radius 0.15s ease, width 0.15s ease, height 0.15s ease;
}

.record-btn.is-recording {
  border-color: rgba(229, 72, 77, 0.55);
}

.record-btn.is-recording .record-btn-inner {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.record-hint {
  margin: 4px 0 0;
  font-size: 0.86rem;
  color: var(--text);
  text-align: center;
}

.save-status-line {
  margin: 0;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
}

.quick-toggles {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  cursor: pointer;
}

.switch-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.options-summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.94rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.options-summary::after {
  content: "Show";
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
}

details[open] > .options-summary::after {
  content: "Hide";
}

.options-body,
.settings-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.84rem;
  font-weight: 600;
}

.field-group select,
.field-group textarea,
.title-edit-input,
.inline-select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.9rem;
}

.inline-select {
  width: auto;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.field-help,
.muted-text {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.install-note {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.install-note strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 3px;
}

.diag-subblock {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}

.test-tools-row,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-xs {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 0.73rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-blue {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

.btn-secondary {
  background: var(--surface-elevated);
}

.btn-amber {
  background: rgba(245, 165, 36, 0.16);
  border-color: rgba(245, 165, 36, 0.45);
  color: #fcd34d;
}

.btn-danger {
  background: rgba(229, 72, 77, 0.14);
  border-color: rgba(229, 72, 77, 0.4);
  color: #fca5a5;
}

.btn-ghost {
  background: transparent;
}

h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.storage-header,
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.transcription-banner {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #bfdbfe;
  font-size: 0.8rem;
}

.recordings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recording-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recording-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.recording-title-wrap {
  flex: 1;
  min-width: 0;
}

.recording-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recording-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  word-break: break-word;
}

.title-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.title-edit-input {
  flex: 1;
  min-width: 160px;
  padding: 6px 10px;
  font-size: 0.92rem;
}

.recording-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.recording-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.recording-player {
  width: 100%;
  height: 40px;
}

.recording-actions,
.export-drawer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.export-drawer {
  padding: 10px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.progress-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

.progress-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-elevated);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  transition: width 0.2s ease;
}

.transcript-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transcript-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.transcript-lang-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.transcript-segments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.transcript-segment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(40, 47, 58, 0.7);
}

.transcript-seg-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.seek-chip {
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
}

.seek-chip:hover {
  border-color: rgba(59, 130, 246, 0.55);
}

.transcript-seg-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.tech-details {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tech-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.tech-details-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tech-details ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.cap-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.cap-label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.cap-value {
  display: block;
  margin-top: 3px;
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-word;
}

.checklist-container {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scenario-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scenario-instructions {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-choice {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.status-choice.active[data-status="pass"] {
  border-color: rgba(48, 164, 108, 0.5);
  background: rgba(48, 164, 108, 0.18);
  color: #6ee7b7;
}

.status-choice.active[data-status="partial"] {
  border-color: rgba(245, 165, 36, 0.5);
  background: rgba(245, 165, 36, 0.18);
  color: #fcd34d;
}

.status-choice.active[data-status="fail"] {
  border-color: rgba(229, 72, 77, 0.5);
  background: rgba(229, 72, 77, 0.18);
  color: #fca5a5;
}

.status-choice.active[data-status="untested"] {
  border-color: rgba(152, 162, 179, 0.5);
  background: var(--surface-elevated);
  color: var(--text);
}

.scenario-notes {
  width: 100%;
  min-height: 54px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-size: 0.82rem;
  resize: vertical;
}

.event-log {
  margin: 8px 0 0;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #cbd5e1;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px;
  background: rgba(14, 16, 19, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  gap: 8px;
  z-index: 20;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn.active {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}

.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

button.badge {
  font-family: inherit;
  cursor: pointer;
}

.recording-warning {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid rgba(245, 165, 36, 0.45);
  background: rgba(245, 165, 36, 0.12);
  color: #fde68a;
  font-size: 0.79rem;
  line-height: 1.4;
}

.recording-warning.recording-warning-danger {
  border-color: rgba(229, 72, 77, 0.45);
  background: rgba(229, 72, 77, 0.14);
  color: #fecaca;
}
