:root {
  --bg:      #0a0a0a;
  --surface: #1a1a1a;
  --border:  #222;
  --text:    #e0e0e0;
  --muted:   #888;
  --accent:  #e74c3c;
  --blue:    #3498db;
  --green:   #66cc66;
  color-scheme: dark;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;

  h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.5px;

    a { color: inherit; text-decoration: none; }
    span { color: var(--accent); }
  }
}

/* ── Layout ── */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;

  .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px;
  }
}

/* ── Exercise grid ── */
.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.exercise-card {
  background: var(--bg);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, background 0.15s;

  &:hover { border-color: var(--accent); background: #1a0a0a; }

  .exercise-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
  .exercise-meta { font-size: 0.72rem; color: var(--muted); }
}

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

  label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
  }

  input {
    background: var(--bg);
    border: 1px solid #333;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    padding: 8px 10px;
    outline: none;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;

    &:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
    }

    &::placeholder { color: #555; }

    &[type="number"] {
      appearance: textfield;
      &::-webkit-inner-spin-button,
      &::-webkit-outer-spin-button { appearance: none; margin: 0; }
    }
  }
}

.form-actions { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn {
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 5px;
  color: #aaa;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 9px 20px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;

  &:hover { border-color: #555; color: var(--text); }
  &:disabled { opacity: 0.4; pointer-events: none; }

  &.btn-primary {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
    color: var(--accent);
    &:hover { border-color: var(--accent); background: #2d1010; }
  }
}

/* ── Timer ── */
.timer-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 20px 32px;
  text-align: center;
  transition: border-color 0.3s, background 0.3s;

  &.phase-work { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: #1a0e0e; --phase-color: var(--accent); }
  &.phase-rest { border-color: color-mix(in srgb, var(--blue)   30%, transparent); background: #0e121a; --phase-color: var(--blue); }
  &.phase-done { border-color: color-mix(in srgb, var(--green)  30%, transparent); background: #0d1a0d; --phase-color: var(--green); }

  .timer-phase {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--phase-color, var(--muted));
    margin-bottom: 12px;
  }

  .timer-display {
    font-size: 5rem;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
    color: var(--phase-color, var(--text));
    font-variant-numeric: tabular-nums;
    margin-bottom: 14px;
  }
}

.timer-sets { font-size: 0.78rem; color: #666; margin-bottom: 20px; }
.timer-done { font-size: 0.78rem; color: var(--green); margin-bottom: 20px; }

.timer-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.timer-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--phase-color, var(--accent));
  transition: width 1s linear;
}

.timer-controls {
  display: flex;
  gap: 10px;
  justify-content: center;

  .btn { min-width: 100px; text-align: center; }
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .container { padding: 12px; }
  .timer-display { font-size: 4rem; }
  .timer-card { padding: 32px 16px 24px; }
}
