:root {
  --bg: #0f1115;
  --bg-surface: #1a1d24;
  --text: #e2e4e9;
  --text-muted: #8b90a0;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --danger: #ef4444;
  --radius: 16px;
  --font: system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
#app {
  width: 100%;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.5px; color: var(--text-muted); }
#preset-label {
  font-size: 0.85rem;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
main { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.timer-ring {
  position: relative;
  width: 260px;
  height: 260px;
  background: var(--bg-surface);
  border-radius: 50%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}
svg { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
circle#ring {
  transition: stroke-dashoffset 0.3s ease-out;
  will-change: stroke-dashoffset;
}
.time-display {
  font-size: 2.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  z-index: 2;
  user-select: none;
}
.controls { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-surface);
  padding: 14px;
  border-radius: 12px;
}
input[type="number"] {
  width: 64px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  text-align: center;
  font-weight: 500;
  outline: none;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus { box-shadow: 0 0 0 2px var(--accent); border-radius: 6px; }
.separator { color: var(--text-muted); font-size: 1.3rem; }
.presets { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.presets button {
  background: var(--bg-surface);
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}
.presets button:hover, .presets button:focus {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.actions { display: flex; gap: 12px; margin-top: 4px; }
button#start {
  flex: 2;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s;
}
button#start:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--accent-glow); }
button#start:active { transform: translateY(0); }
button.secondary {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
button.secondary:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.hidden { display: none !important; }
#pause-overlay, #complete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  z-index: 100;
  backdrop-filter: blur(12px);
  letter-spacing: 1px;
}
#pause-overlay { cursor: pointer; color: var(--text-muted); }
#complete-overlay { background: rgba(99, 102, 241, 0.12); color: var(--accent); animation: pulse 2s infinite alternate; }
@keyframes pulse {
  0% { box-shadow: inset 0 0 0 2px var(--accent); }
  100% { box-shadow: inset 0 0 60px 15px var(--accent-glow); }
}
@media (max-width: 380px) {
  .timer-ring { width: 220px; height: 220px; }
  .time-display { font-size: 2.2rem; }
  input[type="number"] { width: 52px; font-size: 1.1rem; }
  .presets button { padding: 8px 12px; font-size: 0.85rem; }
}
