:root {
  --bg: #0f1115;
  --panel: #161a22;
  --panel-2: #1e242f;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --accent: #ff5f5f;
  --accent-2: #2bd4a8;
  --ring-bg: #2a3140;
  --ok: #2bd4a8;
  --warn: #ffb454;
  --err: #ff5f5f;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #1d2333 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  display: grid;
  place-items: start center;
  padding: 32px 16px 48px;
}

main {
  width: min(720px, 100%);
  display: grid;
  gap: 22px;
}

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.bar h1 { margin: 0; font-size: 22px; letter-spacing: 0.3px; }

.counts { display: flex; gap: 8px; }
.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 13px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.pill.muted { color: var(--muted); }

.timer-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 18px;
  justify-items: center;
}

.mode-toggle {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: 12px;
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.mode-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.ring-wrap {
  position: relative;
  width: 280px;
  height: 280px;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--ring-bg); stroke-width: 12; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.2s;
}
.ring-fg.break { stroke: var(--accent-2); }

.time {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
  font-weight: 600;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  gap: 10px;
}
.controls button {
  border: 0;
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: filter 0.15s, transform 0.05s;
}
.controls button:hover { filter: brightness(1.15); }
.controls button:active { transform: translateY(1px); }
.controls button:disabled { opacity: 0.35; cursor: not-allowed; }
.controls .primary { background: var(--accent); color: #fff; }
.controls .primary.break { background: var(--accent-2); color: #06241c; }

.history {
  background: var(--panel);
  border-radius: 18px;
  padding: 18px 22px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.history h2 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.history-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.history-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 13px;
}
.history-list li.empty { color: var(--muted); justify-content: center; padding: 14px; }
.history-list .kind { font-weight: 600; }
.history-list .kind.work { color: var(--accent); }
.history-list .kind.break { color: var(--accent-2); }
.history-list .meta { color: var(--muted); font-variant-numeric: tabular-nums; }

.foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}
.dim { opacity: 0.7; }
.health.ok::before { content: "● "; color: var(--ok); }
.health.err::before { content: "● "; color: var(--err); }
.health.warn::before { content: "● "; color: var(--warn); }
