:root {
  --bg-primary: #0d0d1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --accent-pink: #ff2e63;
  --accent-blue: #00d9ff;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --glow-pink: 0 0 20px rgba(255, 46, 99, 0.5);
  --glow-blue: 0 0 20px rgba(0, 217, 255, 0.5);
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: 
    radial-gradient(circle at 20% 20%, rgba(255, 46, 99, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 217, 255, 0.08) 0%, transparent 50%),
    var(--bg-primary);
}

.header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: blur(10px);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.camera-icon {
  position: relative;
  width: 40px;
  height: 30px;
}

.camera-body {
  width: 40px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
  border-radius: 6px;
  position: relative;
}

.camera-body::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 8px;
  width: 12px;
  height: 6px;
  background: var(--accent-blue);
  border-radius: 3px 3px 0 0;
}

.camera-lens {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: var(--bg-primary);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.camera-lens.pulsing {
  animation: pulse-lens 1s infinite;
}

@keyframes pulse-lens {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 46, 99, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(255, 46, 99, 0); }
}

.app-title {
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-size: 0.9rem;
}

.settings-toggle:hover {
  background: rgba(0, 217, 255, 0.1);
  border-color: var(--accent-blue);
}

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

.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.content-wrapper {
  display: flex;
  gap: 2rem;
}

.settings-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  height: fit-content;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.panel-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--accent-blue);
}

.settings-section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.presets-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.9rem;
  text-align: left;
}

.preset-btn:hover {
  background: rgba(255, 46, 99, 0.1);
  border-color: var(--accent-pink);
  transform: translateX(4px);
}

.setting-item {
  margin-bottom: 1.25rem;
}

.setting-item label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.setting-value {
  color: var(--accent-blue);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.slider {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--glow-pink);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.quality-buttons {
  display: flex;
  gap: 0.5rem;
}

.quality-btn {
  flex: 1;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.8rem;
}

.quality-btn.active {
  background: rgba(0, 217, 255, 0.2);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.select-input,
.number-input {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.select-input:focus,
.number-input:focus {
  border-color: var(--accent-blue);
}

.recording-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-box {
  aspect-ratio: 16/9;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.preview-box.recording {
  border-color: var(--accent-pink);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 46, 99, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 46, 99, 0); }
}

.preview-placeholder {
  text-align: center;
  color: var(--text-secondary);
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.hint {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(255, 255, 255, 0.3);
}

.countdown-display {
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-number {
  font-size: 8rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: countPulse 1s ease;
}

@keyframes countPulse {
  0% { transform: scale(1.5); opacity: 0; }
  50% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.recording-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent-pink);
}

.rec-dot {
  width: 12px;
  height: 12px;
  background: var(--accent-pink);
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 300;
  color: var(--text-primary);
}

.size-estimate {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.countdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.countdown-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
}

.main-controls {
  display: flex;
  gap: 1rem;
}

.record-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent-pink), #ff4757);
  border: none;
  border-radius: 50px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: var(--glow-pink);
}

.record-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 46, 99, 0.6);
}

.record-icon {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
}

.pause-btn,
.stop-btn {
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.pause-btn {
  background: var(--bg-tertiary);
  color: var(--accent-blue);
  border: 1px solid var(--accent-blue);
}

.pause-btn.paused {
  background: rgba(0, 217, 255, 0.2);
}

.stop-btn {
  background: var(--accent-pink);
  color: white;
}

.stop-btn:hover {
  transform: scale(1.05);
}

.history-section {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

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

.clear-history-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 46, 99, 0.3);
  border-radius: 6px;
  color: var(--accent-pink);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.clear-history-btn:hover {
  background: rgba(255, 46, 99, 0.1);
}

.history-grid {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.history-item {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.history-meta {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.history-download {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.history-item:hover .history-download {
  opacity: 1;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.export-modal {
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.processing {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.export-content h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.gif-preview {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.gif-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
}

.gif-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.export-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.download-btn {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent-blue), #00b4d8);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: var(--glow-blue);
}

.download-btn:hover {
  transform: scale(1.05);
}

.again-btn {
  padding: 1rem 2rem;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.again-btn:hover {
  border-color: var(--accent-pink);
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-pink);
  border-radius: 12px;
  color: var(--text-primary);
  z-index: 2000;
  animation: toastIn 0.3s ease;
  font-family: 'JetBrains Mono', monospace;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 3000;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 3s forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--accent-pink);
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .content-wrapper {
    flex-direction: column;
  }
  
  .settings-panel {
    width: 100%;
  }
  
  .control-bar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .main-controls {
    width: 100%;
    justify-content: center;
  }
  
  .gif-stats {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .export-actions {
    flex-direction: column;
  }
}