* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: #0f0f10;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
}
#app { flex: 1; display: flex; flex-direction: column; max-width: 600px; margin: 0 auto; width: 100%; }
.screen { display: none; flex: 1; flex-direction: column; padding: 16px; }
.screen.active { display: flex; }

.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px 20px;
}
.header h1 { margin: 0; font-size: 22px; font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; min-width: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
}
.icon-btn:active { background: rgba(255,255,255,0.12); transform: scale(0.96); }
.icon-btn.danger { color: #ef4444; }

/* LIST */
.list-item {
  background: #1a1a1c;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 12px;
}
.list-main { flex: 1; min-width: 0; cursor: pointer; }
.list-main:active { opacity: 0.6; }
.list-name { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.list-meta { font-size: 13px; color: #9a9a9e; }
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #9a9a9e;
  font-size: 15px;
  line-height: 1.6;
}
.empty svg { margin-bottom: 16px; opacity: 0.4; }

/* EDIT */
.field { margin-bottom: 20px; }
.field label {
  display: block; font-size: 13px;
  color: #9a9a9e; margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input {
  width: 100%;
  background: #1a1a1c;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  color: #fff;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus {
  outline: none;
  border-color: #16a34a;
}
.stepper {
  display: flex; align-items: center; gap: 8px;
}
.stepper input {
  text-align: center;
  flex: 1;
}
.stepper button {
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #1a1a1c;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
}
.stepper button:active { background: #2a2a2c; }

.primary-btn {
  width: 100%;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 18px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}
.primary-btn:active { background: #15803d; }
.primary-btn.full-width { margin-top: auto; }

/* RUN */
#screen-run { padding: 0; }
.runner {
  flex: 1;
  display: flex; flex-direction: column;
  transition: background-color 0.3s;
  padding: 16px;
}
.runner.work { background: #16a34a; }
.runner.rest { background: #2563eb; }
.runner.idle { background: #1a1a1c; }
.runner.done { background: #1a1a1c; }

.runner-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.runner-header .icon-btn {
  background: rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.2);
}
.runner-title { font-size: 17px; font-weight: 600; }

.runner-body {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
}
.phase-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 16px;
}
.big-time {
  font-size: clamp(120px, 32vw, 200px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0;
  letter-spacing: -4px;
}
.rep-info {
  font-size: 22px;
  font-weight: 500;
  margin-top: 24px;
  opacity: 0.9;
}
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 32px;
}
.progress-fill {
  height: 100%;
  background: rgba(255,255,255,0.9);
  transition: width 1s linear;
  width: 0%;
}
.runner-controls {
  display: flex; gap: 12px;
  padding-top: 16px;
}
.runner-controls button {
  flex: 1;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 14px;
  padding: 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.runner-controls button:active { background: rgba(0,0,0,0.4); }
.runner-controls .play {
  background: #fff;
  color: #0f0f10;
  border-color: #fff;
}
.runner.idle, .runner.done {
  color: #fff;
}
.runner.idle .progress-fill,
.runner.done .progress-fill { background: #16a34a; }

.spacer-44 { width: 44px; }
.list-container { flex: 1; }
