/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f7d6e0;
  color: #4a3e3d;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* App Container - Simulates phone on large screens */
.app-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Phone Frame (Standard mobile aspect ratio wrapper) */
.phone-frame {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 850px;
  background: linear-gradient(135deg, #f7d6e0 0%, #f3b0c3 100%);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(74, 62, 61, 0.15);
  display: flex;
  flex-direction: column;
}

/* On screens larger than phone, style the frame like a floating device */
@media (min-width: 481px) {
  .phone-frame {
    border-radius: 40px;
    border: 12px solid #ffffff;
    height: 92vh;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
  }
}

/* Ambient Background Glows */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 1;
  pointer-events: none;
  opacity: 0.6;
  animation: floatGlow 20s infinite alternate ease-in-out;
}

.glow-1 {
  width: 300px;
  height: 300px;
  background: #ffeb3b;
  top: -10%;
  left: -20%;
  opacity: 0.3;
}

.glow-2 {
  width: 350px;
  height: 350px;
  background: #00e5ff;
  bottom: -10%;
  right: -20%;
  opacity: 0.25;
  animation-delay: -5s;
}

@keyframes floatGlow {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(40px, 60px) scale(1.2);
  }
}

/* Particle Canvas */
#particleCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: block;
}

/* UI Overlay Layer */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none; /* Let clicks pass through to canvas (though canvas controls settings) */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

/* Interactive elements in overlay must enable pointer-events */
.app-header, .instruction-box, #settingsBtn, .settings-drawer {
  pointer-events: auto;
}

/* Header Styling */
.app-header {
  text-align: center;
  margin: 24px auto 0 auto;
  color: #4a3e3d;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 14px 24px;
  border-radius: 24px;
  max-width: 85%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.status-bar {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 4px;
}

.breathing-indicator {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #c2185b;
  opacity: 0.75;
  animation: pulseOpacity 3s infinite ease-in-out;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.app-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.app-header .subtitle {
  font-size: 0.78rem;
  opacity: 0.6;
  font-weight: 300;
  letter-spacing: 0.2px;
}

/* Dynamic Instruction Box */
.instruction-box {
  margin: 0 auto 35px auto;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 14px 24px;
  border-radius: 24px;
  max-width: 85%;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.5s ease;
}

.instruction-box p {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: #3b2c2b;
  letter-spacing: 0.2px;
}

/* Settings Toggle Button */
#settingsBtn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a3e3d;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#settingsBtn:hover {
  transform: rotate(45deg) scale(1.05);
  background: rgba(255, 255, 255, 0.7);
}

#settingsBtn:active {
  transform: scale(0.95);
}

/* Glassmorphic Settings Drawer (Sliding from bottom) */
.settings-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.6);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -10px 40px rgba(74, 62, 61, 0.12);
  transform: translateY(105%);
  transition: transform 0.4s cubic-bezier(0.1, 0.76, 0.55, 0.94);
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-height: 75%;
}

.settings-drawer.open {
  transform: translateY(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px 12px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4a3e3d;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  color: #887472;
  cursor: pointer;
  padding: 0 4px;
}

.drawer-content {
  overflow-y: auto;
  padding: 12px 24px 24px 24px;
}

/* Settings Form Elements */
.setting-group {
  margin-bottom: 18px;
}

.setting-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #887472;
  margin-bottom: 6px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: #4a3e3d;
  margin-bottom: 6px;
}

/* Range input styling */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.08);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d81b60;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(216, 27, 96, 0.3);
  transition: transform 0.1s;
}

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

/* Preset Buttons styling */
.preset-buttons {
  display: flex;
  gap: 8px;
}

.preset-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px 4px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 10px;
  color: #6d5b5a;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-btn.active {
  background: #d81b60;
  color: #ffffff;
  border-color: #d81b60;
  box-shadow: 0 4px 10px rgba(216, 27, 96, 0.2);
}

.drawer-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

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

.action-btn.outline {
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #6d5b5a;
}

.action-btn.outline:hover {
  background: rgba(0, 0, 0, 0.02);
}
