* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #ff9500;
  --primary-dark: #e68600;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #0f3460;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --error: #ff4757;
  --success: #2ecc71;
  --border-radius: 12px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
}

#root {
  min-height: 100%;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  padding: 30px 0;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Main content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Mode selector */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover:not(:disabled) {
  border-color: var(--primary);
}

.mode-btn.active {
  border-color: var(--primary);
  background: rgba(255, 149, 0, 0.1);
}

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

.mode-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Model status */
.model-status {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 16px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

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

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
}

.model-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Error banner */
.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid var(--error);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  color: var(--error);
}

.error-banner button {
  background: none;
  border: none;
  color: var(--error);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.record-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 40px;
  border: none;
  border-radius: 50px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.record-btn.start {
  background: var(--primary);
  color: var(--bg-dark);
}

.record-btn.start:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: scale(1.02);
}

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

.record-btn.stop {
  background: var(--error);
  color: white;
}

.record-btn.stop:hover {
  background: #e84152;
  transform: scale(1.02);
}

.record-btn svg {
  flex-shrink: 0;
}

/* Recording indicator */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--error);
}

.pulse {
  width: 12px;
  height: 12px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.time {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Transcript */
.transcript-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.transcript-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.transcript-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.transcript-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 12px;
  background: var(--bg-input);
  border: none;
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.action-btn:hover {
  background: rgba(255, 149, 0, 0.2);
}

.clear-btn:hover {
  background: rgba(255, 71, 87, 0.2);
  color: var(--error);
}

.transcript-box {
  flex: 1;
  min-height: 200px;
  padding: 20px;
  overflow-y: auto;
}

.transcript-text {
  font-size: 1.125rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.transcript-placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

.interim-text {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-style: italic;
}

.transcribing-indicator {
  margin-top: 12px;
  color: var(--primary);
  font-size: 0.875rem;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0;
}

.footer p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
  .app {
    padding: 16px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .record-btn {
    padding: 16px 32px;
    font-size: 1rem;
  }

  .transcript-actions {
    flex-wrap: wrap;
  }
}

/* PWA standalone mode */
@media (display-mode: standalone) {
  .header {
    padding-top: env(safe-area-inset-top, 20px);
  }

  .footer {
    padding-bottom: env(safe-area-inset-bottom, 20px);
  }
}
