/* ═══════════════════════════════════════════════════════════
   Personal Translator — Main Stylesheet
   Dark glassmorphism overlay theme
   ═══════════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Palette */
  --bg-primary: rgba(15, 15, 20, 0.88);
  --bg-secondary: rgba(25, 25, 35, 0.92);
  --bg-glass: rgba(30, 30, 45, 0.65);
  --bg-input: rgba(40, 40, 55, 0.7);
  --bg-hover: rgba(60, 60, 80, 0.5);
  --bg-active: rgba(80, 80, 110, 0.5);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(30, 60, 120, 0.6);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.35);
  --text-provisional: rgba(255, 255, 255, 0.4);

  --accent: #1e3c78;
  --accent-hover: #2a4f99;
  --accent-glow: rgba(30, 60, 120, 0.2);

  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;

  /* Sizing */
  --control-bar-height: 42px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: #0a0a10;
  -webkit-font-smoothing: antialiased;
}

/* ─── Views ────────────────────────────────────────────── */
.view {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.view.active {
  display: flex;
  animation: viewFadeIn 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════
   OVERLAY VIEW
   ═══════════════════════════════════════════════════════════ */

#overlay-view {
  position: relative;
  background: var(--bg-primary);
  border-radius: 0;
  border: none;
  overflow: hidden;
}

/* ─── Drag Region / Control Bar ────────────────────────── */
#drag-region {
  flex-shrink: 0;
  height: var(--control-bar-height);
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(20, 20, 30, 0.4);
}

.control-bar {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 8px;
  gap: 6px;
}

.app-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  flex-shrink: 0;
}

#btn-settings {
  margin-left: auto;
}

/* Icon Buttons */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-app-region: no-drag;
  padding: 0 4px;
  gap: 1px;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.small {
  width: 28px;
  height: 28px;
}

.close-btn:hover {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
}

/* Button labels */
.btn-label {
  font-size: 8px;
  line-height: 1;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.6;
  white-space: nowrap;
}

/* Toolbar group */
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* TTS Action Button — prominent, next to Start */
.tts-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-app-region: no-drag;
  font-size: 11px;
  font-weight: 500;
}

.tts-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

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

.tts-action-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.tts-action-btn.active:hover {
  background: rgba(30, 60, 120, 0.25);
}

.tts-label {
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Pin Button Active State */
#btn-pin.active {
  color: var(--accent);
}

#btn-pin.active:hover {
  background: var(--accent-glow);
}

/* Minimize Button Hover */
#btn-minimize:hover {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

/* ─── Compact Mode ─────────────────────────────────────── */
#drag-region.compact-hidden {
  display: none !important;
}

/* Thin hover trigger at top when compact */
.compact-mode::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  z-index: 100;
  cursor: pointer;
}

.compact-mode:hover #drag-region.compact-hidden {
  display: flex !important;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(20, 20, 30, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--control-bar-height);
}

.compact-mode #transcript-container {
  padding-top: 4px;
}

/* Status Area */
.status-area {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  flex: 1;
  pointer-events: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition-normal);
}

.status-dot.disconnected {
  background: var(--text-muted);
}

.status-dot.connecting {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.status-dot.error {
  background: var(--error);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.3);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.status-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Source Controls */
.source-controls {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 2px;
  -webkit-app-region: no-drag;
}

.source-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 30px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0 6px;
  gap: 1px;
}

.source-btn:hover {
  color: var(--text-secondary);
}

.source-btn:active {
  transform: scale(0.9);
}

.source-btn.active {
  background: var(--accent-glow);
  color: var(--accent);
}

/* Action Button (Start/Stop) */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-app-region: no-drag;
}

.action-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 12px var(--accent-glow);
}

.action-btn:active {
  transform: scale(0.92);
}

.action-btn.recording {
  background: var(--error);
  animation: recordPulse 2s infinite;
}

.action-btn.recording:hover {
  background: #ef4444;
}

@keyframes recordPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.3);
  }

  50% {
    box-shadow: 0 0 10px 3px rgba(248, 113, 113, 0.2);
  }
}

/* ─── Transcript Container ─────────────────────────────── */
#transcript-container {
  flex: 1;
  min-height: 0; /* Required for flex child to overflow-scroll properly */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 16px;
}

/* Custom scrollbar */
#transcript-container::-webkit-scrollbar {
  width: 4px;
}

#transcript-container::-webkit-scrollbar-track {
  background: transparent;
}

#transcript-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

#transcript-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Placeholder */
.transcript-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
}

.transcript-placeholder p {
  font-size: 13px;
  font-weight: 400;
}

.shortcut-hint {
  font-size: 11px !important;
  color: var(--text-muted) !important;
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 10px !important;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  font-family: -apple-system, monospace;
}

/* Listening Indicator */
.listening-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-muted);
  animation: fadeInUp 0.3s ease;
}

.listening-indicator p {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.listening-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
}

.listening-waves span {
  display: block;
  width: 3px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
}

.listening-waves span:nth-child(1) {
  animation-delay: 0s;
}

.listening-waves span:nth-child(2) {
  animation-delay: 0.15s;
}

.listening-waves span:nth-child(3) {
  animation-delay: 0.3s;
}

.listening-waves span:nth-child(4) {
  animation-delay: 0.45s;
}

.listening-waves span:nth-child(5) {
  animation-delay: 0.6s;
}

@keyframes wave {

  0%,
  100% {
    height: 8px;
    opacity: 0.5;
  }

  50% {
    height: 24px;
    opacity: 1;
  }
}

/* Transcript — Flowing Paragraph */
.transcript-flow {
  font-size: var(--transcript-font-size, 16px);
  line-height: 1.7;
  padding: 12px 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Each segment block: original + translation pair */
.seg-block {
  display: block;
  margin-bottom: 4px;
}

/* Translated text — primary white */
.seg-translated {
  display: block;
  color: var(--translation-color, var(--text-primary));
  font-weight: 400;
  font-size: var(--translation-font-size, 1em);
}

/* Original text — smaller, dimmer, above translation */
.seg-original {
  display: block;
  color: var(--original-color, rgba(255, 255, 255, 0.45));
  font-weight: 400;
  font-size: var(--original-font-size, 0.8em);
  margin-top: 8px;
  margin-bottom: 2px;
}

/* Speaker label — shown when speaker changes */
.speaker-label {
  display: block;
  color: #f5a623;
  font-weight: 600;
  font-size: 0.85em;
  letter-spacing: 0.02em;
  margin-top: 12px;
  margin-bottom: 2px;
}

/* Provisional text — dimmed, in-progress */
.seg-provisional {
  display: block;
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

/* Blinking cursor */
.cursor-blink {
  color: var(--accent);
  font-weight: 300;
  animation: blink 1s step-end infinite;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Resize Handle ────────────────────────────────────── */
#resize-handle {
  height: 6px;
  cursor: ns-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-app-region: no-drag;
}

#resize-handle::after {
  content: '';
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  transition: background var(--transition-fast);
}

#resize-handle:hover::after {
  background: rgba(255, 255, 255, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS VIEW
   ═══════════════════════════════════════════════════════════ */

#settings-view {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(30px) saturate(150%);
  -webkit-backdrop-filter: blur(30px) saturate(150%);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

#settings-drag {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(20, 20, 30, 0.4);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  height: var(--control-bar-height);
}

.settings-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.settings-body::-webkit-scrollbar {
  width: 4px;
}

.settings-body::-webkit-scrollbar-track {
  background: transparent;
}

.settings-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ─── Settings Tabs ───────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.settings-tab {
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.settings-tab:hover {
  color: var(--text-primary);
}

.settings-tab.active {
  color: #ff8c00;
  border-bottom-color: #ff8c00;
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

/* Translation terms */
.terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.btn-icon-sm:hover {
  background: var(--bg-hover);
}

.term-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
  align-items: center;
}
.term-row input {
  flex: 1;
  min-width: 0;
}
.term-row .btn-remove-term {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.term-row .btn-remove-term:hover {
  color: var(--error);
  background: rgba(248, 113, 113, 0.1);
}

/* ─── Settings Sections ────────────────────────────────── */
.settings-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-of-type {
  border-bottom: none;
  margin-bottom: 8px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.optional-badge {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.required-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--warning);
  text-transform: none;
  letter-spacing: 0;
  background: rgba(251, 191, 36, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.save-btn-top {
  color: var(--success) !important;
}

.save-btn-top:hover {
  background: rgba(74, 222, 128, 0.15) !important;
  color: var(--success) !important;
}

/* ─── Form Elements ────────────────────────────────────── */
.input-group {
  display: flex;
  gap: 4px;
}

.input-group input {
  flex: 1;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(30, 60, 120, 0.15);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color var(--transition-fast);
}

select:focus {
  border-color: var(--border-focus);
}

/* Field layout */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Radio Group */
.radio-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.radio-option {
  flex: 1;
  text-align: center;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-label {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.radio-option input[type="radio"]:checked+.radio-label {
  background: var(--accent-glow);
  color: var(--accent);
}

.radio-option:hover .radio-label {
  color: var(--text-primary);
}

/* Sliders */
.slider-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.slider-field .field-label {
  min-width: 65px;
}

input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 4px rgba(30, 60, 120, 0.4);
  transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Checkbox */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.checkbox-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-input);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.checkbox-option input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 5px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.checkbox-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Hint text */
.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.hint a {
  color: var(--accent);
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

/* ─── Settings Actions ─────────────────────────────────── */
.settings-actions {
  padding-top: 8px;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.primary-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(30, 60, 120, 0.3);
}

.primary-btn:active {
  transform: scale(0.98);
}

/* ─── Toast Notification ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  max-width: 90%;
  text-align: center;
  line-height: 1.4;
  backdrop-filter: blur(10px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.2);
}

.toast.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ─── Animations ───────────────────────────────────────── */
@keyframes viewFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ─── Setup Modal ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 0;
}

.modal-header h3 {
  color: var(--text-primary);
  font-size: 1.1em;
  font-weight: 600;
}

.modal-body {
  padding: 16px 24px;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.85em;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-footer {
  padding: 12px 24px 20px;
  display: flex;
  justify-content: flex-end;
}

.secondary-btn {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.secondary-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
}

/* Progress bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 3px;
  transition: width 0.5s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: progressShine 2s infinite;
}

.progress-pct {
  color: var(--text-secondary);
  font-size: 0.8em;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

/* Step indicators */
.setup-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.setup-step.active {
  background: var(--accent-glow);
}

.setup-step.done {
  opacity: 0.6;
}

.step-icon {
  font-size: 0.9em;
  width: 20px;
  text-align: center;
}

.step-text {
  color: var(--text-secondary);
  font-size: 0.85em;
}

.setup-step.active .step-text {
  color: var(--text-primary);
  font-weight: 500;
}

/* Status text */
.setup-status {
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  min-height: 36px;
  display: flex;
  align-items: center;
}

#setup-status-text {
  color: var(--text-muted);
  font-size: 0.8em;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  word-break: break-all;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes progressShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}