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

body {
  font-family: Arial, sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
}

h1 {
  text-align: center;
  padding: 24px 16px 16px;
  font-size: 28px;
}

.hidden { display: none !important; }

/* ── Buttons ── */
button {
  font-size: 20px;
  padding: 12px 28px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { opacity: 0.85; }

.secondary-btn {
  background: transparent;
  color: #888;
  border: 1px solid #333;
  font-size: 16px;
  padding: 10px 20px;
}
.secondary-btn:hover { color: #fff; border-color: #666; }

.btn-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

/* ── Type select ── */
#type-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.type-options {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 140px;
  height: 140px;
  font-size: 18px;
  border-radius: 16px;
  background: #111;
  color: #fff;
  border: 2px solid #333;
}
.type-btn:hover { border-color: #fff; background: #1a1a1a; opacity: 1; }
.type-icon { font-size: 40px; }

/* ── Cardio setup ── */
#setup {
  text-align: center;
  padding: 20px;
}
.options {
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
  text-align: left;
}
.options label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  cursor: pointer;
}
.options input[type="checkbox"] {
  width: 20px; height: 20px;
  accent-color: #fff;
}

/* ── Resistance setup ── */
#resistance-setup {
  padding: 16px;
  max-width: 500px;
  margin: 0 auto;
}

#exercise-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 40px;
}

.exercise-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
}
.exercise-item button {
  font-size: 14px;
  padding: 4px 10px;
  background: #333;
  color: #fff;
}

.add-exercise-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}
.add-exercise-form input {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  padding: 8px;
  width: 100%;
}
.add-exercise-form button {
  font-size: 15px;
  padding: 8px 14px;
  white-space: nowrap;
}
@media (max-width: 500px) {
  .add-exercise-form { grid-template-columns: 1fr 1fr; }
  .add-exercise-form input:first-child { grid-column: 1 / -1; }
  .add-exercise-form button { grid-column: 1 / -1; }
}

/* ── Cardio dashboard ── */
#dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#tiles {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
}
.tile {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border: 2px solid #222;
  min-height: 180px;
}
.value { font-size: 60px; font-weight: bold; }
.label { font-size: 20px; opacity: 0.7; }

/* ── Resistance dashboard ── */
#resistance-dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#resistance-timer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #111;
  border-bottom: 1px solid #222;
  font-size: 22px;
  font-weight: bold;
}

#rest-countdown {
  color: #4ade80;
  font-size: 20px;
}

#exercise-tracker {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ex-card {
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  overflow: hidden;
}

.ex-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #1a1a1a;
  font-size: 18px;
  font-weight: bold;
}

.ex-sets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px;
}

.set-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 80px;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.set-row span { color: #888; }

.set-row input {
  background: #222;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fff;
  font-size: 15px;
  padding: 6px 8px;
  text-align: center;
  width: 100%;
}

.set-done-btn {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #222;
  color: #888;
  border: 1px solid #444;
}
.set-done-btn.done {
  background: #14532d;
  color: #4ade80;
  border-color: #166534;
}

/* ── Dash footer ── */
.dash-footer {
  text-align: center;
  padding: 16px;
  border-top: 1px solid #222;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

button.cooldown-active {
  background: #0ea5e9;
  color: #fff;
}

.tile-cooldown {
  border-color: #0ea5e9 !important;
}
.tile-cooldown .value {
  color: #38bdf8;
}
.tile-cooldown .label {
  color: #7dd3fc;
}

/* ── History ── */
#history-screen {
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
}

#history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.history-card {
  background: #111;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 14px 16px;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #888;
  margin-bottom: 6px;
}

.history-card-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 6px;
}

.history-card-detail {
  font-size: 14px;
  color: #aaa;
}

.no-history {
  text-align: center;
  color: #555;
  padding: 40px;
  font-size: 18px;
}

.hist-ex {
  margin-top: 8px;
  font-size: 15px;
}
.hist-ex strong {
  display: block;
  color: #ddd;
  margin-bottom: 4px;
}
.hist-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hist-set {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  color: #888;
}
.hist-set-done {
  border-color: #166534;
  color: #4ade80;
}
