﻿:root {
  color-scheme: light;
  --bg-primary: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --bg-secondary: rgba(255, 255, 255, 0.95);
  --card-bg: rgba(255, 255, 255, 0.9);
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-hover: #a78bfa;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: rgba(99, 102, 241, 0.2);
  --shadow-light: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.08);
  --radius: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-secondary: rgba(15, 23, 42, 0.9);
    --card-bg: rgba(30, 41, 59, 0.95);
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-hover: #c4b5fd;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-color: rgba(139, 92, 246, 0.3);
    --shadow-light: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%);
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.app {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.app__header {
  text-align: center;
  padding: 20px 0;
}

.app__title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  letter-spacing: -0.05em;
}

.app__subtitle {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
}

.app__main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.timer-card,
.settings {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.timer-card:hover,
.settings:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.timer-card__phase {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.timer-card__time {
  font-size: 7rem;
  font-weight: 800;
  margin: 16px 0;
  letter-spacing: -0.05em;
  text-align: center;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.timer-card__info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.progress {
  width: 100%;
  height: 8px;
  background: rgba(99, 102, 241, 0.2);
  border-radius: 9999px;
  overflow: hidden;
  margin: 24px 0;
}

.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: inherit;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px var(--accent-primary);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.button {
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.button:hover::before {
  left: 100%;
}

.button:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button--accent {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.button--accent:hover {
  box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

#startButton {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

#startButton:hover {
  box-shadow: 0 15px 30px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

#pauseButton {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}

#pauseButton:hover {
  box-shadow: 0 15px 30px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

#resetButton {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3);
}

#resetButton:hover {
  box-shadow: 0 15px 30px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.next-stage {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 500;
}

.next-stage--error {
  color: #ef4444;
}

.next-stage--success {
  color: var(--accent-primary);
}

.settings__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--text-primary);
}

.settings__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.input input {
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.input input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.presets {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: none;
  border-radius: 9999px;
  padding: 10px 20px;
  font-size: 0.875rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  color: var(--accent-primary);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.chip:hover,
.chip.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.2);
}

.app__footer {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  margin-top: auto;
}

.app__footer strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.app__footer:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.app__footer span {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(99, 102, 241, 0.05);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.app__footer span:hover {
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .app__title {
    font-size: 2rem;
  }

  .timer-card__time {
    font-size: 5rem;
  }

  .timer-card,
  .settings {
    padding: 24px;
  }

  .controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings__grid {
    grid-template-columns: 1fr;
  }

  .presets {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
