body {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #000;
  font-family: "IRANSans", "Arial", sans-serif;
  overflow: hidden;
}

.container {
  position: relative;
  width: 100%;
  height: 100vh;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

video {
  display: none;
}

canvas {
  display: block;
  object-fit: contain;
  background-color: #000;
  transform: scaleX(-1);
}

/* پیام‌ها - بازگشت به رنگ اصلی */
#message-box {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(
    135deg,
    rgba(44, 62, 80, 0.95),
    rgba(52, 73, 94, 0.95)
  );
  backdrop-filter: blur(10px);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  z-index: 20;
  display: none;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  max-width: 300px;
  transition: all 0.3s ease;
}

/* کنترل‌ها - دسکتاپ: پایین سمت راست، موبایل: وسط پایین */
#controls-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.75));
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 280px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

#controls-container:hover {
  background: linear-gradient(145deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.8));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label {
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.5px;
}

.value {
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.8)
  );
  color: #2c3e50;
  font-size: 14px;
  font-weight: bold;
  padding: 8px 12px;
  border-radius: 15px;
  min-width: 30px;
  text-align: center;
  align-self: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.9);
  text-shadow: none;
  transition: all 0.2s ease;
}

/* استایل جدید اسلایدرها - رنگ بنفش اصلی */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border-radius: 25px;
  background: linear-gradient(
    to right,
    rgba(102, 126, 234, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(118, 75, 162, 0.3) 100%
  );
  outline: none;
  width: 100%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.2);
  position: relative;
  transition: all 0.3s ease;
  touch-action: manipulation;
  cursor: pointer;
}

input[type="range"]:hover {
  background: linear-gradient(
    to right,
    rgba(102, 126, 234, 0.4) 0%,
    rgba(255, 255, 255, 0.15) 50%,
    rgba(118, 75, 162, 0.4) 100%
  );
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.2), 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Webkit Thumb - بهبود responsive */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(102, 126, 234, 0.6);
  transition: all 0.2s ease;
  position: relative;
  touch-action: manipulation;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: linear-gradient(145deg, #ffffff, #e8e8e8);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 0 15px rgba(102, 126, 234, 0.4);
  transform: scale(1.1);
  border-color: rgba(102, 126, 234, 0.8);
}

input[type="range"]::-webkit-slider-thumb:active {
  background: linear-gradient(145deg, #f8f8f8, #e0e0e0);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
}

/* Mozilla Thumb - بهبود responsive */
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  cursor: pointer;
  border: 2px solid rgba(102, 126, 234, 0.6);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  background: linear-gradient(145deg, #ffffff, #e8e8e8);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 15px rgba(102, 126, 234, 0.4);
  transform: scale(1.1);
}

/* Track styling for different browsers */
input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 25px;
  background: inherit;
}

input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 25px;
  background: inherit;
  border: none;
}

/* دکمه‌های کنترل - رنگ بنفش */
.control-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.control-btn {
  background: linear-gradient(
    145deg,
    rgba(102, 126, 234, 0.3),
    rgba(118, 75, 162, 0.2)
  );
  border: 1px solid rgba(102, 126, 234, 0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.control-btn:hover {
  background: linear-gradient(
    145deg,
    rgba(102, 126, 234, 0.5),
    rgba(118, 75, 162, 0.3)
  );
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 15px rgba(102, 126, 234, 0.3);
  transform: translateY(-2px);
  border-color: rgba(102, 126, 234, 0.6);
}

.control-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Splash Screen - رنگ بنفش */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

.splash-content {
  text-align: center;
  color: white;
}

.splash-logo {
  margin-bottom: 30px;
}

.logo-animation {
  width: 80px;
  height: 80px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

.logo-animation.necklace-theme {
  border-top: 4px solid #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.splash-content h1 {
  font-size: 28px;
  margin: 20px 0 10px 0;
  font-weight: 300;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.splash-content p {
  font-size: 16px;
  opacity: 0.8;
  margin-bottom: 0;
}

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

/* Error Fallback - رنگ بنفش */
#error-fallback {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
}

.error-content {
  text-align: center;
  color: white;
  max-width: 400px;
  padding: 40px;
}

.error-content h2 {
  font-size: 32px;
  margin-bottom: 20px;
  font-weight: 300;
}

.error-content p {
  font-size: 18px;
  margin-bottom: 30px;
  opacity: 0.9;
}

.retry-button {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid white;
  color: white;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 16px;
  font-family: "IRANSans", Arial, sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
}

.retry-button:hover {
  background: white;
  color: #667eea;
}

/* تنظیمات رسپانسیو - موبایل: وسط پایین */
@media (max-width: 768px) {
  #controls-container {
    bottom: 10px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: auto;
    max-width: calc(100vw - 20px);
    padding: 10px;
    gap: 10px;
    border-radius: 12px;
  }

  .control-item {
    gap: 6px;
  }

  .label {
    font-size: 10px;
    font-weight: 500;
  }

  .value {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 10px;
    min-width: 20px;
  }

  input[type="range"] {
    height: 10px;
    border-radius: 15px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }

  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  canvas {
    max-height: 100vh;
    max-width: 100vw;
  }

  #message-box {
    top: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
    font-size: 12px;
    padding: 8px 12px;
  }
}

/* موبایل‌های خیلی کوچک */
@media (max-width: 480px) {
  #controls-container {
    bottom: 5px;
    padding: 8px;
    gap: 8px;
    transform: translateX(-50%) scale(0.9);
  }

  .label {
    font-size: 9px;
  }

  .value {
    font-size: 10px;
    padding: 3px 6px;
  }

  input[type="range"] {
    height: 8px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }

  .control-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .splash-content h1 {
    font-size: 20px;
  }

  .splash-content p {
    font-size: 13px;
  }

  .logo-animation {
    width: 50px;
    height: 50px;
  }
}

/* بهبود landscape در موبایل */
@media (max-width: 768px) and (orientation: landscape) {
  #controls-container {
    bottom: 5px;
    padding: 6px;
    gap: 6px;
    transform: translateX(-50%) scale(0.8);
  }

  .label {
    font-size: 8px;
  }

  .value {
    padding: 2px 4px;
    font-size: 9px;
  }

  .control-btn {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }

  input[type="range"] {
    height: 6px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
  }
}

/* بهبود برای تبلت - وسط پایین */
@media (min-width: 769px) and (max-width: 1024px) {
  #controls-container {
    bottom: 25px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 220px;
    padding: 16px;
    gap: 16px;
  }

  .label {
    font-size: 12px;
  }

  .value {
    font-size: 13px;
    padding: 6px 10px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }

  .control-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
}

/* بهبود برای صفحه نمایش‌های بسیار کوچک */
@media (max-width: 360px) {
  #controls-container {
    transform: translateX(-50%) scale(0.85);
    bottom: 3px;
  }

  .label {
    font-size: 8px;
  }

  .value {
    font-size: 9px;
    padding: 2px 4px;
  }
}
