:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-work: #10b981;
  --accent-rest: #3b82f6;
  --accent-action: #6366f1;
  --danger: #ef4444;
  --border-color: #334155;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  height: 100%;
}

.view.active {
  display: flex;
}

/* Card Components */
.card {
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

input {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}

input:focus {
  outline: 2px solid var(--accent-action);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary { background: var(--accent-action); color: #fff; width: 100%; }
.btn-accent { background: var(--accent-work); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-control { background: var(--card-bg); color: var(--text-main); border: 1px solid var(--border-color); }

.btn-large {
    padding: 1.25rem;
    font-size: 1.25rem; 
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-subtext {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.15);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

/* Exercise List */
.exercise-list-container {
  flex-grow: 1;
}

#exercise-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.exercise-item {
  background-color: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
}

.exercise-item-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1rem;
}

/* Workout Runner View */
#workout-view {
  text-align: center;
  justify-content: center;
  align-items: center;
}

.badge {
  padding: 0.25rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
  background-color: var(--accent-work);
  color: #000;
}

#workout-view.rest .badge {
  background-color: var(--accent-rest);
  color: #fff;
}

#current-title {
  font-size: 2.25rem;
  font-weight: 800;
}

.timer-display {
  font-size: clamp(5rem, 25vw, 8rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 1.5rem 0;
}

.next-up-banner {
  color: var(--text-muted);
  font-size: 1.1rem;
  background-color: var(--card-bg);
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
}

.controls {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  width: 100%;
}

.controls .btn {
  flex: 1;
}

.timer-container {
  position: relative;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem auto;
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-270deg) scaleX(-1); /* Rotate to start countdown at 12 o'clock, scaleX to flip clockwise */
}

.progress-ring__bg {
  stroke: var(--card-bg);
  stroke-width: 12;
  fill: transparent;
}

.progress-ring__circle {
  stroke: var(--accent-work);
  stroke-width: 12;
  fill: transparent;
  stroke-linecap: round;
  /* Circumference = 2 * PI * 120 ≈ 753.98 */
  stroke-dasharray: 753.98; 
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

/* Change ring color during rest phase */
#workout-view.rest .progress-ring__circle {
  stroke: var(--accent-rest);
}

.timer-display {
  font-size: 3.5rem;
  font-weight: 900;
  z-index: 1;
  margin: 0;
}

.app-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.app-footer a:hover {
  opacity: 1;
  text-decoration: underline;
}