:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.8);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #22c55e;
  --danger: #ef4444;
  --border: rgba(148, 163, 184, 0.15);
  --radius: 16px;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Animated background blobs */
.background {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: #8b5cf6;
  bottom: -100px;
  right: -100px;
  animation-delay: -5s;
}

.blob-3 {
  width: 300px;
  height: 300px;
  background: #06b6d4;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -30px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
}

/* App layout */
.app {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.app__header {
  text-align: center;
}

.app__title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-hover), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.app__subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
}

/* Timer card */
.timer-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.timer-card__status {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.1);
  transition: var(--transition);
}

.timer-card__status.running {
  color: var(--accent-hover);
  background: var(--accent-glow);
}

.timer-card__status.paused {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
}

.timer-card__status.completed {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

/* Progress ring */
.timer-display {
  position: relative;
  width: 300px;
  height: 300px;
}

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

.progress-ring__track,
.progress-ring__bar {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.progress-ring__track {
  stroke: rgba(148, 163, 184, 0.15);
}

.progress-ring__bar {
  stroke: var(--accent);
  stroke-dasharray: 816.8;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s linear;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.timer-display__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.timer-display__time {
  font-size: 4rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.timer-display__end {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.btn:hover {
  transform: translateY(-2px);
}

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

.btn:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

.btn .icon {
  width: 20px;
  height: 20px;
}

.btn--primary {
  background: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 30px var(--accent-glow);
}

.btn--secondary {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

.btn--accent {
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--accent:hover {
  filter: brightness(1.1);
}

.timer-controls {
  display: flex;
  gap: 1rem;
}

/* Presets */
.presets,
.custom-timer {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.presets__title,
.custom-timer__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.presets__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.preset-btn {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.preset-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.preset-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* Custom timer */
.custom-timer__form {
  display: flex;
  gap: 0.75rem;
}

.custom-timer__form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.05);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.custom-timer__form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.custom-timer__form input::placeholder {
  color: var(--text-secondary);
}

.custom-timer__form input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.custom-timer__hint {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Footer */
.app__footer {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: auto;
}

kbd {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.1);
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.app__credit {
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.app__credit a {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.app__credit a:hover {
  color: #a78bfa;
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .app {
    padding: 1.5rem 1rem;
  }

  .timer-display {
    width: 250px;
    height: 250px;
  }

  .timer-display__time {
    font-size: 3rem;
  }

  .presets__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-timer__form {
    flex-direction: column;
  }
}
