@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Cosmic Dark Palette */
  --bg-color: #080512;
  --panel-bg: rgba(255, 255, 255, 0.03);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-glow: rgba(108, 92, 231, 0.3);
  
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.5);
  --color-accent: #8e2de2;
  --color-accent-glow: #4a00e0;
  --color-success: #00f2fe;
  
  color-scheme: dark;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--color-text-primary);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Glows */
.bg-ambient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
  animation: float 20s infinite alternate;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--color-accent);
  top: -10%;
  left: -10%;
  animation-duration: 25s;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: var(--color-accent-glow);
  bottom: -15%;
  right: -10%;
  animation-duration: 30s;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: var(--color-success);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.08;
  animation-duration: 20s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.95); }
}

/* Main Container */
.app-container {
  width: 100%;
  max-width: 900px;
  min-height: 550px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 40px;
  border-radius: 32px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: border-color 0.5s ease, box-shadow 0.5s ease;
  position: relative;
  z-index: 1;
}

.app-container.completed {
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 30px 60px rgba(0, 242, 254, 0.15), 
              inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: pulse-glow 3s infinite alternate;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 30px 60px rgba(0, 242, 254, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
  100% { box-shadow: 0 30px 70px rgba(0, 242, 254, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
}

/* Header Styles */
.header {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.badge {
  font-size: 0.75rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--color-success);
  font-weight: 700;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
  animation: pulse-badge 2s infinite alternate;
}

@keyframes pulse-badge {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  padding: 4px 16px;
  border-radius: 12px;
  transition: background 0.3s;
}

.title-container:hover {
  background: rgba(255, 255, 255, 0.05);
}

.title {
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #fff 0%, #b3b3b3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.edit-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
  transition: color 0.3s;
}

.title-container:hover .edit-icon {
  color: var(--color-text-primary);
}

/* Countdown Grid */
.countdown-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 30px 0;
}

/* Individual Timer Cards */
.timer-card {
  position: relative;
  width: 140px;
  height: 160px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
}

.timer-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 20px rgba(142, 45, 226, 0.15);
}

.progress-ring-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.progress-ring {
  width: 110px;
  height: 110px;
  transform: rotate(-90deg);
}

.progress-ring__circle {
  transition: stroke-dashoffset 0.35s;
  transform-origin: 50% 50%;
  stroke-linecap: round;
}

.card-value {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
  color: #fff;
  z-index: 2;
  font-feature-settings: "tnum";
}

.card-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: 8px;
  z-index: 2;
}

/* Interactive Controls */
.controls {
  display: flex;
  gap: 16px;
  align-items: center;
  z-index: 2;
  margin-top: 10px;
}

.btn {
  font-family: var(--font-sans);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-glow) 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(142, 45, 226, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(142, 45, 226, 0.45);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--color-text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

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

.icon-svg {
  width: 18px;
  height: 18px;
  stroke-width: 2px;
}

/* Glass Setup Panel (overlay slider) */
.setup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 5, 18, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.setup-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.setup-panel {
  width: 100%;
  max-width: 500px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.setup-overlay.active .setup-panel {
  transform: scale(1);
}

.setup-panel h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 5px;
  text-align: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-input {
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 15px rgba(142, 45, 226, 0.2);
}

/* Quick Select Presets */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-preset {
  font-size: 0.75rem;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  color: var(--color-text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

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

.setup-actions .btn {
  flex: 1;
}

/* Sound indicator status text */
.sound-badge {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  transition: all 0.3s;
}

.sound-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-primary);
}

/* Sandbox indicator badge */
.sandbox-badge {
  position: absolute;
  bottom: 15px;
  right: 25px;
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.6;
  display: none;
}

/* Celebration Celebrate Effect */
.celebration-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  box-shadow: inset 0 0 50px rgba(0, 242, 254, 0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
  z-index: 1;
}

.completed .celebration-glow {
  opacity: 1;
}

/* Spinner/Loader Styles */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loader-ring {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  border-top-color: var(--color-accent);
  animation: spin 1s linear infinite;
}

.loader-text {
  font-size: 0.9rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  animation: pulse-text 1.5s infinite alternate;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-text {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app-container {
    padding: 30px 20px;
    min-height: auto;
    border-radius: 24px;
  }
  
  .title { font-size: 1.75rem; }
  .countdown-grid {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .timer-card {
    width: calc(50% - 6px);
    height: 130px;
    border-radius: 16px;
  }
  
  .card-value { font-size: 2.5rem; }
  
  .progress-ring {
    width: 90px;
    height: 90px;
  }
  
  .setup-panel { padding: 15px; }
}

@media (max-width: 400px) {
  .timer-card {
    width: 100%;
    height: 110px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 20px;
  }
  
  .progress-ring-container { display: none; }
  .card-label { margin-top: 0; }
  .controls {
    flex-direction: column;
    width: 100%;
  }
  
  .controls .btn { width: 100%; }
}
