/*
 * Today screen visual theme (ticket 9v690s).
 *
 * Ported from the approved prototype (slnpjy):
 *   prototypes/today-screen-and-per-set-logging.html
 *
 * Custom properties, class names, and the tick-flash keyframe are carried
 * forward as closely as practical; layout is adapted from the prototype's
 * "phone mockup" frame to a real full-viewport mobile page.
 */

:root {
  --bg: #EDEFE7;
  --surface: #FFFFFF;
  --surface-sunk: #E3E6DC;
  --ink: #1B2521;
  --ink-muted: #5B665F;
  --accent: #2F6F63;
  --accent-ink: #FFFFFF;
  --warn: #B9862E;
  --border: rgba(27, 37, 33, 0.12);
  --border-strong: rgba(27, 37, 33, 0.22);
  --shadow: 0 1px 2px rgba(27, 37, 33, 0.06), 0 6px 16px rgba(27, 37, 33, 0.05);
  --focus: #1B6E96;
}

:root[data-theme="dark"] {
  --bg: #121714;
  --surface: #1B211D;
  --surface-sunk: #222923;
  --ink: #EDEFE7;
  --ink-muted: #9AA79E;
  --accent: #4FA394;
  --accent-ink: #0A1210;
  --warn: #D9A54B;
  --border: rgba(237, 239, 231, 0.14);
  --border-strong: rgba(237, 239, 231, 0.26);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
  --focus: #6FC3EE;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714;
    --surface: #1B211D;
    --surface-sunk: #222923;
    --ink: #EDEFE7;
    --ink-muted: #9AA79E;
    --accent: #4FA394;
    --accent-ink: #0A1210;
    --warn: #D9A54B;
    --border: rgba(237, 239, 231, 0.14);
    --border-strong: rgba(237, 239, 231, 0.26);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
    --focus: #6FC3EE;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--accent) 7%, var(--bg)) 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header --------------------------------------------------------------- */

header.day {
  padding: max(20px, env(safe-area-inset-top)) 20px 14px;
  flex-shrink: 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.day-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  text-wrap: balance;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-sunk);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 400ms ease;
}

.progress-count {
  font-family: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Import plan ------------------------------------------------------------ */

.import-plan {
  margin-top: 12px;
}

.import-plan-label {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.import-plan-label input[type="file"] {
  font: inherit;
  color: inherit;
  max-width: 180px;
}

.import-error {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--warn) 16%, var(--surface));
  color: var(--warn);
  font-size: 13px;
}

/* List ------------------------------------------------------------------ */

.list {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 4px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-muted);
  padding: 14px 4px 2px;
  margin: 0;
}

/* Cards ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: opacity 200ms ease, transform 200ms ease;
}

.card.in-progress {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.ex-name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.ex-rx {
  font-family: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.occ-block + .occ-block {
  margin-top: 12px;
}

.occ-chip {
  display: inline-block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  background: var(--surface-sunk);
  border-radius: 6px;
  padding: 2px 7px;
  margin-bottom: 7px;
}

.sets-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Set circles (Reps + Duration) ------------------------------------------ */

.set-btn {
  --size: 46px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-muted);
  font-family: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease;
}

.set-btn:active {
  transform: scale(0.93);
}

.set-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.set-btn.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.set-btn.running {
  border-color: var(--warn);
  color: var(--ink);
}

.set-btn .ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(var(--warn) calc(var(--pct, 0) * 1%), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  transition: background 900ms linear;
}

.set-btn .label {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .set-btn, .progress-fill, .card {
    transition: none;
  }
}

.tick-flash {
  animation: flash 420ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .tick-flash {
    animation: none;
  }
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  100% {
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent);
  }
}

/* NoMetric "Mark done" button --------------------------------------------- */

.none-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.none-btn.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.none-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* "Done today" collapsed strip -------------------------------------------- */

.done-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  opacity: 0.75;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 150ms ease;
}

.done-strip:hover,
.done-strip:focus-visible {
  opacity: 0.95;
}

.done-strip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.done-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.done-strip .ex-name {
  font-size: 14px;
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.done-strip .ex-rx {
  margin-left: auto;
}

.empty-note {
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  padding: 18px 8px;
}
