/* Clean Modern CSS Variables */
:root {
  /* Light Theme (Default) */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-dark: #1e40af;
  
  /* Modern Gradients - Subtle */
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --primary-gradient-hover: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --warning-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  
  /* Accent Colors */
  --accent: #7c3aed;
  --accent-secondary: #a855f7;
  
  /* Light Theme Colors */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --background: #ffffff;
  --background-secondary: #f9fafb;
  --background-tertiary: #f3f4f6;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --border-focus: var(--primary);
  
  /* Glass/Frosted Effects - Light */
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.9);
  --backdrop-blur: blur(16px);
  
  /* Status Colors */
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --error: #dc2626;
  --error-light: #fee2e2;
  
  /* Shadows - Layered Modern Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  
  /* Modern Spacing Scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --space-4xl: 2.5rem;
  --space-5xl: 3rem;
  
  /* Modern Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;
  
  /* Modern Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Monaco', monospace;
  
  /* Modern Animations */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  /* Dark Theme Colors */
  --text-primary: #ffffff;
  --text-secondary: #e5e7eb;
  --text-tertiary: #9ca3af;
  --background: #0f172a;
  --background-secondary: #1e293b;
  --background-tertiary: #334155;
  --surface: #1e293b;
  --surface-elevated: #334155;
  --border: #334155;
  --border-light: #475569;
  
  /* Glass/Frosted Effects - Dark (Higher Contrast) */
  --glass-bg: rgba(30, 41, 59, 0.9);
  --glass-border: rgba(71, 85, 105, 0.4);
  
  /* Adjust shadows for dark theme */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* iPhone 15/16 Pro Safe Area Support */
:root {
  /* Safe area insets for iPhone 15/16 Pro */
  --safe-area-inset-top: env(safe-area-inset-top);
  --safe-area-inset-right: env(safe-area-inset-right);
  --safe-area-inset-bottom: env(safe-area-inset-bottom);
  --safe-area-inset-left: env(safe-area-inset-left);
  
  /* Fallback values for non-supporting browsers */
  --safe-area-inset-top: 0px;
  --safe-area-inset-right: 0px;
  --safe-area-inset-bottom: 0px;
  --safe-area-inset-left: 0px;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--background);
  min-height: 100vh;
  padding: 0;
  position: relative;
  transition: background-color var(--duration-300) var(--ease-out), color var(--duration-300) var(--ease-out);
  
  /* iPhone 15/16 Pro safe area support */
  padding-top: var(--safe-area-inset-top);
  padding-left: var(--safe-area-inset-left);
  padding-right: var(--safe-area-inset-right);
  padding-bottom: var(--safe-area-inset-bottom);
}

/* Subtle background pattern for visual interest */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

/* Dark theme background pattern */
[data-theme="dark"] body::before {
  background: 
    radial-gradient(circle at 25% 25%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.1) 0%, transparent 50%);
  opacity: 0.4;
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-3xl);
  transition: padding-top 0.3s ease;
  position: relative;
  min-height: calc(100vh - var(--safe-area-inset-top) - var(--safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  
  /* Additional padding for iPhone 15/16 Pro to prevent content cutoff */
  padding-top: calc(var(--space-3xl) + var(--safe-area-inset-top));
  padding-bottom: calc(var(--space-3xl) + var(--safe-area-inset-bottom));
}

/* Compact Form Header */
.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.title-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Voice Selection */
.voice-section {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.voice-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.voice-icon {
  width: 16px;
  height: 16px;
  stroke: var(--text-secondary);
}

.voice-select {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity var(--duration-300) var(--ease-out);
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2xl);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(1);
  transition: transform var(--duration-300) var(--ease-out);
}

.modal.hidden .modal-content {
  transform: scale(0.95);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--duration-200) var(--ease-out);
}

.modal-close:hover {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-body ol {
  margin: 0;
  padding-left: var(--space-lg);
  color: var(--text-primary);
}

.modal-body li {
  margin-bottom: var(--space-sm);
  line-height: 1.5;
}

/* Theme Toggle */
.theme-toggle {
  position: absolute;
  top: calc(var(--space-lg) + var(--safe-area-inset-top));
  right: calc(var(--space-lg) + var(--safe-area-inset-right));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-200) var(--ease-out);
  z-index: 10;
}

.theme-toggle:hover {
  background: var(--surface-elevated);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.theme-icon {
  font-size: 1.25rem;
  transition: transform var(--duration-200) var(--ease-out);
}

/* Dark theme icon change */
[data-theme="dark"] .theme-icon::before {
  content: '☀️';
}

[data-theme="dark"] .theme-icon {
  font-size: 0;
}

[data-theme="dark"] .theme-icon::before {
  font-size: 1.25rem;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  margin: 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.subtitle {
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  color: var(--text-secondary);
  margin: 0;
  font-weight: 400;
  opacity: 0.8;
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

/* Main Form */
.main {
  margin-bottom: var(--space-2xl);
  position: relative;
}

.speech-form {
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: all var(--duration-300) var(--ease-out);
}

.speech-form:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2xl);
}

/* Input Section */
.input-section {
  margin-bottom: var(--space-lg);
}

/* Voice Selection */
.voice-selection {
  margin-bottom: var(--space-2xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-2xl);
  background: var(--background-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
}

.voice-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  white-space: nowrap;
}

.voice-select {
  flex: 1;
  min-width: 280px;
  padding: var(--space-lg) var(--space-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-200) var(--ease-out);
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  padding-right: 2.5rem;
}

.voice-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--surface-elevated);
}

.voice-select:hover {
  border-color: var(--primary);
  background: var(--surface-elevated);
  transform: translateY(-1px);
}

/* SSML Section */
.ssml-section {
  margin-bottom: var(--space-2xl);
  padding: var(--space-2xl);
  background: var(--background-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.ssml-toggle {
  margin-bottom: var(--space-xl);
}

.ssml-checkbox {
  margin-right: var(--space-lg);
  width: 1.25rem;
  height: 1.25rem;
  appearance: none;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: all var(--duration-200) var(--ease-out);
}

.ssml-checkbox:checked {
  background: var(--primary-gradient);
  border-color: transparent;
}

.ssml-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
}

.ssml-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  transition: color var(--duration-200) var(--ease-out);
}

.ssml-label:hover {
  color: var(--primary);
}

.ssml-icon {
  font-size: 1.2rem;
}

/* SSML Toolbar */
.ssml-toolbar {
  margin-top: var(--space-xl);
  padding: var(--space-2xl);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(5px);
}

.toolbar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.toolbar-tip {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.toolbar-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: var(--space-lg);
}

.toolbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-200) var(--ease-out);
  font-family: var(--font-family);
  font-size: 0.85rem;
  min-height: 80px;
  position: relative;
  overflow: hidden;
}

.toolbar-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--duration-200) var(--ease-out);
}

.toolbar-btn:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-lg);
}

.toolbar-btn:hover::before {
  opacity: 0.1;
}

.toolbar-btn:active {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-md);
}

.toolbar-btn .btn-icon {
  font-size: 1.5rem;
  line-height: 1;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.toolbar-btn .btn-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.text-input {
  width: 100%;
  min-height: 150px;
  height: 150px;
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
  background: var(--surface);
  color: var(--text-primary);
  transition: all var(--duration-300) var(--ease-out);
  font-weight: 500;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), var(--shadow-lg);
  background: var(--surface-elevated);
  transform: translateY(-1px);
}

.text-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.character-count {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.9rem;
  color: var(--text-tertiary);
  font-weight: 500;
  padding: var(--space-sm) var(--space-lg);
  background: var(--background-tertiary);
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Action Section */
.action-section {
  text-align: center;
  margin-top: var(--space-3xl);
}

.generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: var(--space-xl) var(--space-3xl);
  border-radius: var(--radius-lg);
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-300) var(--ease-out);
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--space-xl);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 200px;
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: buttonShimmer 3s infinite;
}

@keyframes buttonShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-2xl);
  background: var(--primary-gradient-hover);
}

.generate-btn:active:not(:disabled) {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  animation: none;
}

.generate-btn:disabled::before {
  display: none;
}

/* Button Spinner */
.btn-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: var(--space-md);
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Generating state styles */
.generate-btn.generating {
  background: var(--primary-gradient);
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
}

.generate-btn.generating:hover {
  transform: none;
  box-shadow: var(--shadow-lg);
}

.btn-icon {
  font-size: 1.4rem;
  position: relative;
  z-index: 1;
}

.btn-text {
  position: relative;
  z-index: 1;
}


  background: var(--background-tertiary);
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Loading State - Removed ugly overlay, now handled by button */

/* Error State */
.error-state {
  text-align: center;
  padding: var(--space-4xl);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  position: relative;
  overflow: hidden;
}

.error-state::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--warning-gradient);
  opacity: 0.05;
}

.error-content h3 {
  color: var(--error);
  margin-bottom: var(--space-lg);
  font-size: 1.5rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.error-content p {
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  font-size: 1.1rem;
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.retry-btn {
  background: var(--warning-gradient);
  color: white;
  border: none;
  padding: var(--space-xl) var(--space-3xl);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--duration-300) var(--ease-out);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.retry-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-xl);
}









/* Dark theme: Make subtitle consistent white color */
[data-theme="dark"] .subtitle {
  color: var(--text-primary);
}

.instructions ol {
  list-style: none;
  counter-reset: step-counter;
  max-width: 650px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.instructions li {
  counter-increment: step-counter;
  margin-bottom: var(--space-xl);
  padding-left: 4rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.6;
}

.instructions li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-gradient);
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Utility Classes */
.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Version Footer */
.version-footer {
    position: static;
    background: transparent;
    padding: 6px 0;
    margin-top: auto;
    text-align: center;
    pointer-events: none;
}

.version-info {
    text-align: center;
    font-size: 0.6875rem; /* 11px */
    color: #a1a1aa; /* Light theme: subtle zinc-400 */
    font-weight: 400;
    letter-spacing: 0.02em;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.version-info a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.version-info a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

[data-theme="dark"] .version-info {
    color: #71717a; /* Dark theme: slightly lighter zinc-500 */
    opacity: 0.5;
}

.version-info:hover {
    opacity: 0.9;
}

[data-theme="dark"] .version-info:hover {
    opacity: 0.8;
}

.version-info span {
    cursor: default;
}

/* Footer is now static - no bottom padding needed */

/* Responsive Design */

/* iPhone 15/16 Pro Specific Optimizations */
@media only screen and (device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3),
       only screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) {
  
  /* iPhone 15/16 Pro specific adjustments */
  .container {
    min-height: calc(100vh - 100px); /* Account for dynamic island and home indicator */
    padding-top: calc(var(--space-2xl) + 44px); /* Dynamic island height */
    padding-bottom: calc(var(--space-2xl) + 34px); /* Home indicator area */
  }
  
  .speech-form {
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
  }
  
  .text-input {
    min-height: 120px;
    height: 120px;
    font-size: 16px; /* Prevent zoom on focus */
  }
  
  .generate-btn {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.1rem;
    min-height: 48px; /* Ensure touch target size */
  }
  
  .theme-toggle {
    top: calc(var(--space-md) + 44px); /* Account for dynamic island */
    right: var(--space-md);
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .form-header {
    margin-bottom: var(--space-md);
  }
  
  .voice-section {
    margin-bottom: var(--space-md);
  }
  
  .voice-select {
    padding: var(--space-md);
    font-size: 16px; /* Prevent zoom on focus */
  }
  
  /* Optimize modal for iPhone 15/16 Pro */
  .modal-content {
    margin: var(--space-lg);
    max-height: calc(100vh - 100px);
  }
  
  /* Version footer adjustments */
  .version-footer {
    padding-bottom: calc(6px + var(--safe-area-inset-bottom));
  }
}

/* iPhone 15/16 Pro Max Specific Optimizations */
@media only screen and (device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) {
  .container {
    padding-top: calc(var(--space-3xl) + 44px);
    padding-bottom: calc(var(--space-3xl) + 34px);
  }
  
  .text-input {
    min-height: 140px;
    height: 140px;
  }
  
  .speech-form {
    padding: var(--space-2xl);
  }
}

/* MacBook Pro 14" and similar high-res displays */
@media (max-width: 1200px) and (min-width: 769px) {
  .container {
    padding: var(--space-2xl);
  }
  
  .hero {
    padding: var(--space-3xl);
    margin-bottom: var(--space-4xl);
  }
  
  .title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    margin-bottom: var(--space-sm);
  }
  
  .subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  }
  
  .form-container {
    padding: var(--space-3xl);
  }
  
  .text-input {
    min-height: 280px;
    padding: var(--space-xl);
  }
  
  .generate-btn {
    padding: var(--space-xl) var(--space-3xl);
  }
  
  .instructions {
    padding: var(--space-3xl);
  }
}

@media (max-width: 768px) {
  .container {
    padding: var(--space-2xl);
    min-height: auto;
    justify-content: flex-start;
    padding-top: calc(var(--space-3xl) + var(--safe-area-inset-top));
    padding-bottom: calc(var(--space-2xl) + var(--safe-area-inset-bottom));
  }
  
  .header {
    padding: var(--space-3xl);
    margin-bottom: var(--space-4xl);
  }
  
  .speech-form {
    padding: var(--space-3xl);
  }
  
  .voice-selection {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-xl);
  }
  
  .voice-select {
    min-width: auto;
    width: 100%;
    padding: var(--space-xl);
  }
  
  .ssml-section {
    padding: var(--space-xl);
  }
  
  .ssml-toolbar {
    padding: var(--space-xl);
  }
  
  .toolbar-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
  }
  
  .toolbar-buttons {
    grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
    gap: var(--space-md);
  }
  
  .toolbar-btn {
    min-height: 70px;
    padding: var(--space-lg);
  }
  
  .text-input {
    min-height: 280px;
    padding: var(--space-xl);
  }
  
  .generate-btn {
    width: 100%;
    justify-content: center;
    padding: var(--space-xl) var(--space-3xl);
  }
  
  .instructions {
    padding: var(--space-3xl);
  }
  
  .instructions li {
    padding-left: 3.5rem;
  }
  
  .instructions li::before {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: var(--space-xl);
    padding-top: calc(var(--space-2xl) + var(--safe-area-inset-top));
    padding-bottom: calc(var(--space-xl) + var(--safe-area-inset-bottom));
  }
  
  .header {
    padding: var(--space-2xl);
    margin-bottom: var(--space-3xl);
  }
  
  .speech-form {
    padding: var(--space-2xl);
  }
  
  .voice-selection,
  .ssml-section,
  .ssml-toolbar {
    padding: var(--space-lg);
  }
  
  .text-input {
    min-height: 250px;
    padding: var(--space-lg);
    font-size: 1rem;
  }
  
  .generate-btn {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.1rem;
  }
  
  .toolbar-buttons {
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
    gap: var(--space-sm);
  }
  
  .toolbar-btn {
    min-height: 60px;
    padding: var(--space-md);
  }
  
  .toolbar-btn .btn-icon {
    font-size: 1.3rem;
  }
  
  .toolbar-btn .btn-label {
    font-size: 0.75rem;
  }
  
  .instructions {
    padding: var(--space-2xl);
  }
  
  .instructions li {
    padding-left: 3rem;
    font-size: 1rem;
  }
  
  .instructions li::before {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.8rem;
  }
}