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

:root {
  --primary: #e74c3c;
  --primary-dark: #c0392b;
  --primary-light: #ff6b5a;
  --dark: #1a1a1a;
  --darker: #0d0d0d;
  --light: #f8f9fa;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --success: #27ae60;
  --warning: #f39c12;
  --glass: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.1);
  --shadow-hard: 0 20px 60px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  overflow-x: hidden;
}

.teleprompter-container {
  min-height: 100vh;
  position: relative;
}

/* Setup Panel - Professional Card Design */
.setup-panel {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.setup-panel h1 {
  color: white;
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.02em;
}

.subtitle {
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 3rem;
  font-size: 1.2rem;
  font-weight: 300;
}

/* Glass Card Container */
.card-container {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  padding: 2.5rem;
  box-shadow: var(--shadow-hard);
  margin-bottom: 2rem;
}

/* Input Section */
.input-section {
  margin-bottom: 2rem;
}

.input-section > label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  color: white;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.input-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn-small {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.btn-small::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-small:hover::before {
  transform: translateX(100%);
}

.btn-small:active {
  transform: translateY(0);
}

label.btn-small {
  margin: 0;
  font-weight: 500;
}

#scriptInput {
  width: 100%;
  padding: 1.25rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid transparent;
  border-radius: 16px;
  resize: vertical;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  line-height: 1.6;
  transition: var(--transition);
  color: var(--text);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

#scriptInput:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Controls Section */
.controls-section {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
  margin-bottom: 2rem;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 500;
  color: white;
  font-size: 1.05rem;
}

.control-group label span {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
  font-size: 0.95rem;
}

/* Modern Sliders */
.control-group input[type="range"] {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  border-radius: 4px;
  -webkit-appearance: none;
  position: relative;
  cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: white;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: 3px solid var(--primary);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: white;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  border: 3px solid var(--primary);
}

.control-group input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Font Preview */
.font-preview {
  margin-top: 1.5rem;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, var(--darker), var(--dark));
  border-radius: 16px;
  text-align: center;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

.font-preview::before {
  content: 'PREVIEW';
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
  letter-spacing: 2px;
}

.font-preview p {
  margin: 0;
  color: white;
  transition: all 0.3s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Checkboxes */
.checkbox-group {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: var(--transition);
}

.checkbox-group:hover {
  background: rgba(255, 255, 255, 0.1);
}

.checkbox-group label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  color: white;
  font-size: 1.05rem;
  width: 100%;
}

.checkbox-group input[type="checkbox"] {
  margin-right: 0.75rem;
  width: 20px;
  height: 20px;
  cursor: pointer;
  position: relative;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  transition: all 0.3s ease;
}

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

.checkbox-group input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.btn {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  color: white;
  box-shadow: 0 10px 30px rgba(231, 76, 60, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(231, 76, 60, 0.4);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(255, 255, 255, 0.1);
}

/* Stats Display */
.stats-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
  text-align: center;
  padding: 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 0.25rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stat-label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Keyboard Shortcuts - Modern Design */
.shortcuts-info {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 1.75rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.shortcuts-info h3 {
  margin-bottom: 1.25rem;
  color: white;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1rem;
}

.shortcuts-info ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.shortcuts-info li {
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

kbd {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  min-width: 60px;
  text-align: center;
  display: inline-block;
}

/* Teleprompter Display - Professional Overlay */
.teleprompter-display {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(180deg, #000 0%, #0a0a0a 100%);
  z-index: 10000;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.teleprompter-display.active {
  display: block;
}

/* Countdown Overlay */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.countdown-number {
  font-size: 10rem;
  font-weight: 700;
  color: white;
  animation: countdownPulse 1s ease-in-out;
  text-shadow: 0 10px 40px rgba(231, 76, 60, 0.5);
}

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

/* Professional Display Controls */
.display-controls {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.25rem;
  align-items: center;
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  padding: 1rem 1.5rem;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.control-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.control-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.control-btn:hover::before {
  opacity: 1;
  transform: scale(1);
}

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

.speed-indicator {
  color: white;
  font-size: 1rem;
  padding: 0 1.25rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.speed-indicator::before {
  content: '⚡';
  font-size: 1.2rem;
}

/* Teleprompter Content */
.teleprompter-content {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding-top: 20vh;
}

/* Focus Line Indicator */
.focus-line {
  position: absolute;
  top: 20vh;
  left: 5%;
  right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(231, 76, 60, 0.8), rgba(231, 76, 60, 0.8), transparent);
  z-index: 5;
  pointer-events: none;
}

.teleprompter-text {
  width: 85%;
  max-width: 1400px;
  margin: 0 auto;
  color: white;
  font-size: 48px;
  line-height: 1.5;
  text-align: center;
  position: relative;
  transition: transform 0.05s linear;
  padding-bottom: 100vh;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.teleprompter-text.mirror {
  transform: scaleX(-1);
}

.teleprompter-text p {
  margin-bottom: 2em;
  opacity: 0.6;
  transition: all 0.3s ease;
  position: relative;
}

.teleprompter-text p.current {
  opacity: 1;
  color: white;
  font-weight: 500;
  text-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
}

.teleprompter-text p.highlight {
  background: linear-gradient(90deg, transparent 0%, rgba(231, 76, 60, 0.2) 20%, rgba(231, 76, 60, 0.2) 80%, transparent 100%);
  padding: 0.3em 0;
  opacity: 1;
  border-radius: 8px;
}

/* Progress Bar - Modern Design */
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: white;
  filter: blur(10px);
  animation: progressGlow 2s linear infinite;
}

@keyframes progressGlow {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .setup-panel {
    padding: 2rem 1rem;
  }
  
  .setup-panel h1 {
    font-size: 2.5rem;
  }
  
  .card-container {
    padding: 1.5rem;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .teleprompter-text {
    width: 90%;
    font-size: 32px;
  }
  
  .display-controls {
    transform: translateX(-50%) scale(0.9);
  }
  
  .stats-display {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .teleprompter-text {
    font-size: 24px;
  }
  
  .setup-panel h1 {
    font-size: 2rem;
  }
  
  .shortcuts-info ul {
    grid-template-columns: 1fr;
  }
}