:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1a1c21;
  --panel-soft: #23262d;
  --text: #f4f5f7;
  --muted: #a4a9b3;
  --line: #30343d;
  --accent: #46d37d;
  --accent-strong: #2fbd66;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.app {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px;
}

.app-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.1rem;
}

button,
select,
input {
  width: 100%;
  border: 0;
  border-radius: 12px;
  font: inherit;
}

button {
  cursor: pointer;
  font-weight: 700;
}

.primary-button {
  padding: 15px 18px;
  background: var(--accent);
  color: #06120a;
}

.primary-button:active {
  background: var(--accent-strong);
}

.secondary-button {
  width: auto;
  padding: 10px 14px;
  background: var(--panel-soft);
  color: var(--text);
}

.workout-card,
.previous-workout,
.workout-history {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.previous-workout {
  padding: 14px;
  border-color: rgba(255, 107, 107, 0.55);
  background: #211719;
}

.previous-workout h2 {
  margin-bottom: 10px;
  color: #ff8a8a;
}

.previous-workout .recent-meta {
  margin-bottom: 8px;
}

.previous-workout .recent-list {
  gap: 8px;
}

.previous-workout .recent-list > li {
  padding: 10px;
  background: rgba(255, 107, 107, 0.09);
}

.hidden {
  display: none;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

select,
input {
  min-height: 46px;
  padding: 12px;
  background: var(--panel-soft);
  color: var(--text);
  outline: 1px solid transparent;
}

select:focus,
input:focus {
  outline-color: var(--accent);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.exercise-list {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.exercise {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: #15171b;
}

.exercise-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exercise-title {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.preset-exercise {
  color: var(--muted);
}

.remove-button {
  width: auto;
  padding: 8px 10px;
  background: transparent;
  color: var(--danger);
}

.exercise-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sets-list {
  display: grid;
  gap: 10px;
}

.set-row {
  display: grid;
  gap: 8px;
}

.set-title {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.add-set-button {
  margin-top: 2px;
}

.recent-empty {
  color: var(--muted);
}

.previous-empty {
  color: #d9a0a0;
}

.recent-meta {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.recent-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-list > li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-soft);
}

.recent-list strong {
  overflow-wrap: anywhere;
}

.recent-list span {
  flex-shrink: 0;
  color: var(--muted);
}

.saved-exercise {
  display: block;
}

.saved-exercise-name {
  display: block;
  margin-bottom: 8px;
}

.saved-sets {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved-sets li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-group,
.day-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #15171b;
  overflow: hidden;
}

.week-summary,
.day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.week-summary::-webkit-details-marker,
.day-summary::-webkit-details-marker {
  display: none;
}

.week-summary {
  font-weight: 700;
}

.week-date-range {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.week-date-range:empty {
  display: none;
}

.week-content,
.day-content {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.day-card {
  background: var(--panel);
}

.day-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.day-badge {
  flex-shrink: 0;
  min-width: 74px;
  padding: 6px 9px;
  border-radius: 999px;
  color: #101114;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.day-date {
  color: var(--muted);
  font-size: 0.85rem;
}

.muscle-summary {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-workout {
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-soft);
}

.history-workout h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.history-workout .recent-list {
  margin-top: 10px;
}

.day-monday {
  background: #46d37d;
}

.day-tuesday {
  background: #6cb6ff;
}

.day-wednesday {
  background: #ffd166;
}

.day-thursday {
  background: #c69cff;
}

.day-friday {
  background: #ff8a8a;
}

.day-saturday {
  background: #4dd4c6;
}

.day-sunday {
  background: #ffb86b;
}

@media (min-width: 700px) {
  .app {
    padding-top: 48px;
  }
}
