:root {
  --primary-color: #2196F3;
  --primary-dark: #1976D2;
  --secondary-color: #757575;
  --background-color: #f8f8f8;
  --panel-background: #ffffff;
  --text-color: #333333;
  --border-radius: 8px;
  --spacing-unit: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,0.1);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--spacing-unit);
}

.container {
  display: flex;
  gap: calc(var(--spacing-unit) * 2);
}

/* Sidebar Styles */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.panel {
  background: var(--panel-background);
  border-radius: var(--border-radius);
  padding: var(--spacing-unit);
  margin-bottom: var(--spacing-unit);
  box-shadow: var(--shadow);
}

.panel h3 {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--secondary-color);
  margin: calc(var(--spacing-unit) * 1.5) 0 var(--spacing-unit) 0;
  letter-spacing: 0.5px;
}

/* Upload Area Styles */
.upload-area {
  border: 2px dashed #e0e0e0;
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 1.5);
  text-align: center;
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background-color: rgba(33, 150, 243, 0.05);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--secondary-color);
}

.upload-icon {
  font-size: 24px;
}

.upload-input {
  display: none;
}

/* Control Groups */
.control-group {
  margin-bottom: var(--spacing-unit);
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  background: #e0e0e0;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.value-display {
  min-width: 40px;
  text-align: right;
  font-size: 14px;
  color: var(--secondary-color);
}

/* Select Styles */
.dither-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  color: var(--text-color);
  cursor: pointer;
}

/* Button Styles */
.action-panel {
  display: flex;
  gap: var(--spacing-unit);
}

.btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: #f5f5f5;
  color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

/* Recording Button States */
.btn.recording {
  background-color: #dc3545;
  color: white;
  animation: pulse 1.5s infinite;
}

.btn.recording:hover {
  background-color: #bd2130;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

/* Main Content Area */
.main-content {
  flex: 1;
  height: calc(100vh - 32px);
  background: var(--panel-background);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  position: relative;
  padding: var(--spacing-unit);
  box-sizing: border-box;
  overflow: hidden;
}

canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

#recordingTime {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  z-index: 100;
}

/* Frame Preview Styles */
.preview-container {
  margin-top: var(--spacing-unit);
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  padding: 8px;
  background: #fff;
  width: 100%;
  height: 150px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

#framePreview {
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #fafafa;
  border-radius: 4px;
  object-fit: contain;
}

#videoFrameControls {
  margin-top: var(--spacing-unit);
  padding-top: var(--spacing-unit);
  border-top: 1px solid #e0e0e0;
  width: 100%;
  box-sizing: border-box;
}

/* Export Panel Styles */
.export-panel h3 {
  margin-top: 0;
}

#videoFrameControls {
  margin-top: var(--spacing-unit);
  padding-top: var(--spacing-unit);
  border-top: 1px solid #e0e0e0;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    max-height: none;
    overflow-y: visible;
  }
  
  .main-content {
    min-height: 60vh;
    height: auto;
    margin-top: var(--spacing-unit);
  }
  
  .canvas-container {
    width: 100%;
    height: 100%;
    min-height: 50vh;
    padding: calc(var(--spacing-unit) / 2);
  }
  
  .preview-container {
    height: 120px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: calc(var(--spacing-unit) / 2);
  }
  
  .main-content {
    min-height: 40vh;
  }
  
  .canvas-container {
    min-height: 40vh;
  }
  
  .preview-container {
    height: 100px;
  }
}

.credits {
  position: fixed;
  bottom: 20px;
  right: 20px;
  text-align: center;
  z-index: 1000;
  display: flex;
  gap: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 800;
  background: rgba(59, 59, 59, 0.678);
  padding: 8px 8px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(165, 70, 194, 0.712);
}

.credits-text {
  text-decoration: none;
  display: flex;
  gap: 8px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.word-container {
  perspective: 1000px;
  display: inline-block;
  filter: brightness(1.2) contrast(1.1);
}

.word {
  display: inline-block;
  transform-style: preserve-3d;
  position: relative;
  animation: none;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  transition: all 0.3s ease;
}

@keyframes fluidGradient {
  0% {
    background-image: linear-gradient(45deg, #ffffff, #333333, #ffffff);
    background-size: 200% 100%;
    background-position: 0% 50%;
  }
  50% {
    background-image: linear-gradient(45deg, #ffffff, #333333, #ffffff);
    background-size: 200% 100%;
    background-position: 100% 50%;
  }
  100% {
    background-image: linear-gradient(45deg, #ffffff, #333333, #ffffff);
    background-size: 200% 100%;
    background-position: 0% 50%;
  }
}

.word.made {
  animation: flipMade 3s infinite, fluidGradient 3s infinite;
  animation-delay: 0s;
  background-size: 200% 100%;
}

.word.by {
  animation: flipBy 3s infinite, fluidGradient 3s infinite;
  animation-delay: 1s;
  background-size: 200% 100%;
}

.word.rahul {
  animation: flipRahul 3s infinite, fluidGradient 3s infinite;
  animation-delay: 2s;
  background-size: 200% 100%;
}

@keyframes flipMade {
  0%, 30% {
    transform: rotateX(0deg);
  }
  40%, 50% {
    transform: rotateX(360deg);
  }
  60%, 100% {
    transform: rotateX(0deg);
  }
}

@keyframes flipBy {
  0%, 30% {
    transform: rotateX(0deg);
  }
  40%, 50% {
    transform: rotateX(360deg);
  }
  60%, 100% {
    transform: rotateX(0deg);
  }
}

@keyframes flipRahul {
  0%, 30% {
    transform: rotateX(0deg);
  }
  40%, 50% {
    transform: rotateX(360deg);
  }
  60%, 100% {
    transform: rotateX(0deg);
  }
}

.credits-text:hover .word {
  animation-play-state: paused;
  filter: brightness(1.4);
}

.credits-text:hover {
  text-decoration: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .credits {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: none;
    justify-content: center;
    border-radius: 0;
    background: rgba(0, 0, 0, 0.85);
    padding: 12px;
    margin: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
  }
  
  .word {
    font-size: 16px;
    font-weight: 800;
  }
  
  .credits-text {
    gap: 12px;
  }
}