:root {
  --bg: #06070c;
  --surface: #111522;
  --surface-2: #171d30;
  --surface-soft: #1d2438;
  --primary: #ff7b2f;
  --primary-strong: #ff9b45;
  --success: #2fd16d;
  --danger: #ff5c5c;
  --text: #f7f7f2;
  --muted: #a4b0c0;
  --border: #263047;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

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

body {
  font-family: "Montserrat", "Poppins", sans-serif;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3ff 100%);
  padding: 0 0 40px;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.logo {
  color: var(--bg);
  padding: 8px 0;
}

.logo img {
  background-color: transparent;
  height: 45px;
  width: auto;
}

.header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 8px 4px 12px;
}

.nav-menu {
  position: absolute;
  top: 72px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dbe3f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  z-index: 20;
  transform-origin: top right;
  animation: menuOpen 0.2s ease-out;
}

.nav-menu.hidden {
  display: none;
}

@keyframes menuOpen {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.nav-menu a {
  color: #111827;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.nav-menu a:hover {
  background: #f3f6fb;
}

.burger {
  padding: 10px;
  align-items: center;
  width: 46px;
  height: 46px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: white;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.line {
  width: 22px;
  height: 2px;
  background: #111827;
  border-radius: 999px;
}

.hr {
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  height: 1px;
  width: 100%;
  border: 0;
  margin: 8px 0 16px;
}

#dateBtn {
  text-decoration: none;
  text-align: center;
  color: black;
  width: min(100%, 280px);
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 16px;
  background: white;
  border: 2px solid #cbd5e1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  letter-spacing: 0.02em;
  min-height: 48px;
}

.top-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 10px 0 18px;
  padding: 10px;
  border: 1px solid rgba(219, 227, 240, 0.85);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.date-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.top-picker button {
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
  cursor: pointer;
}

#dayName {
  min-width: 110px;
  text-align: center;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 8, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal::backdrop {
  backdrop-filter: blur(4px);
}

.modal-content {
  width: min(92vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #171d2f 0%, #0f1422 100%);
  box-shadow: var(--shadow);
}

.modal-content input,
.completion-popup__input,
.completion-popup__content input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  background: #0f1422;
  color: var(--text);
}

.modal-content input:focus,
.completion-popup__input:focus,
.completion-popup__content input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 123, 47, 0.18);
}

.modal-field.hidden {
  display: none;
}

.weight-time-row {
  display: flex;
  gap: 8px;
}

.weight-time-row input {
  flex: 1;
}
.time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.time-row input {
  width: 0;
  flex: 1;
}

.time-row span {
  font-size: 20px;
}

#timeBtn svg,
#bodyweightBtn svg {
  width: 40px;
  height: 40px;
}

#timeBtn,
#bodyweightBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  width: 40px;
  background-color: var(--primary-strong);
  color: var(--bg);
}

.workout-title {
  display: inline-block;
  padding: 8px 12px;
  margin: 6px 0 14px;
  border-radius: 999px;
  background: rgba(255, 123, 47, 0.14);
  color: #ffb36a;
  font-weight: 700;
}

#addBtn {
  width: 100%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #0f1218;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(255, 123, 47, 0.24);
  cursor: pointer;
}

#addBtn:hover {
  filter: brightness(1.04);
}

.modal-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.modal-content button:not(.removeBtn) {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#saveBtn,
#saveTimeBtn {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #0f1218;
}

#closeBtn,
#closeTimeBtn {
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal.hidden {
  display: none;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

span {
  color: #f3f6fa;
}

span.done {
  color: var(--success);
  font-weight: 700;
  transition: color 0.2s ease;
}

span.undone {
  color: var(--danger);
  transition: color 0.2s ease;
}

.completion-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.completion-popup.hidden {
  display: none;
}

.completion-popup__content {
  width: min(90vw, 320px);
  padding: 20px;
  border-radius: 18px;
  text-align: center;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #171d2f 0%, #121826 100%);
  box-shadow: var(--shadow);
  transform: scale(0.95);
  animation: popIn 0.2s ease forwards;
}

.completion-popup__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.completion-popup__actions button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

button {
  transition:
    transform 0.12s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.burger:active {
  transform: scale(0.96);
}

button:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.doneBtn.pulse {
  animation: donePulse 0.16s ease;
}

@keyframes popIn {
  to {
    transform: scale(1);
  }
}

@keyframes donePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

button:active {
  transform: scale(0.94);
}

button * {
  pointer-events: none;
}

.toggleBtn {
  transition: transform 0.15s ease;
}

.toggleBtn:active {
  transform: scale(0.95);
}
.exercise-info {
  display: flex;
  flex-direction: column;
}
.rep-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.rep-range-row input {
  width: 0;
  flex: 1;
}

.rep-range-row span {
  font-size: 20px;
}

.sets-panel {
  overflow: hidden;
  transition:
    max-height 0.2s ease,
    opacity 0.2s ease;
}

.sets-panel.hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sets-panel:not(.hidden) {
  max-height: 500px;
  opacity: 1;
}

.completion-popup__actions button:first-child {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #0f1218;
}

.timer-alert {
  position: fixed;
  text-align: center;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1100;
  display: grid;
  gap: 2px;
  width: min(calc(100vw - 32px), 360px);
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(135deg, #f35d24, #ff9b45);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(173, 57, 16, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 24px) scale(0.96);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.timer-alert--visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.timer-alert strong {
  color: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.11em;
}

.timer-alert span {
  color: inherit;
  font-size: 0.92rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #171d2f 0%, #121826 100%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.card:active {
  transform: scale(0.99);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-left h3 {
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card.completed {
  border-color: rgba(47, 209, 109, 0.4);
  background: linear-gradient(180deg, #192627 0%, #111a1d 100%);
}

.card.completed h3 {
  color: var(--success);
}

.completed {
  transition: color 0.25s ease;
  color: var(--success);
}

.toggleBtn,
.doneBtn,
.undoneBtn,
.deleteBtn,
.deleteSetBtn,
.cancelDeleteBtn,
.addSetBtn,
.restBtn {
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.toggleBtn {
  background: var(--surface-soft);
  color: #ffb36a;
  padding: 6px 10px;
}

.doneBtn {
  background: rgba(47, 209, 109, 0.16);
  color: var(--success);
  padding: 6px 10px;
}

.undoneBtn {
  background: rgba(255, 92, 92, 0.16);
  color: var(--danger);
  padding: 6px 10px;
}
.restBtn {
  background: var(--surface-soft);
  padding: 6px 10px;
  color: var(--primary);
}

.deleteBtn,
.deleteSetBtn,
.cancelDeleteBtn {
  background: var(--surface-soft);
  color: var(--muted);
  padding: 6px 10px;
}

.addSetBtn {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255, 123, 47, 0.14);
  color: #ffb36a;
  font-weight: 600;
}

.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 8px 6px;
  align-items: center;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.set-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.set-values {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.set-text {
  font-weight: 700;
  color: #f3f6fa;
}

.set-text--secondary {
  color: var(--muted);
  font-weight: 600;
}

.set-separator {
  color: #707e91;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.set-actions {
  gap: 20px;
}

.repsDone {
  font-weight: bold;
  color: var(--primary);
}

.sets {
  overflow: hidden;
  max-height: 500px;
  opacity: 1;
  transition:
    max-height 0.25s ease,
    opacity 0.2s ease;
}

.sets.hidden {
  max-height: 0;
  opacity: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  color: #ffb36a;
}

.empty-state h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state p {
  font-size: 0.95rem;
}
.copy-paste-del {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 16px 0;
}
.copy-paste-del button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-strong) 100%
  );
  color: #0f1218;
}
.card {
  cursor: grab;
}

.card.dragging {
  opacity: 0.5;
}

.card:active {
  cursor: grabbing;
}
.sortable-ghost {
  opacity: 0.4;
}
.drag-handle {
  user-select: none;
  touch-action: none;
}

.sortable-chosen {
  transform: scale(1.02);
}
.hidden {
  margin: 15px;
  display: none;
}
#circuitBox h3 {
  margin: 15px;
}
#normalTimeBox h3 {
  margin-bottom: 15px;
}

.timerButtons {
  display: flex;
  gap: 20px;
}
.playBtn,
.stopBtn,
.resetBtn {
  color: var(--muted);
  background-color: transparent;
  border: none;
}

.circuit-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0;
  cursor: pointer;
}

.circuit-toggle input {
  display: none;
}

.toggle-text {
  width: 100%;
  padding: 12px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--primary-strong);
  color: var(--primary);
}

.circuit-toggle input:checked + .toggle-text {
  background: var(--primary-strong);
  color: var(--bg);
  font-weight: 500;
  border: 1px solid var(--bg);
}
#addCircuitExerciseBtn {
  margin-top: 15px;
  padding: 12px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid var(--primary-strong);
  color: var(--bg);
  background: var(--primary-strong);
}

.circuit-exercise-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.circuit-exercise-row input {
  flex: 1;
}
.removeBtn {
  background: transparent;
  border: 1px solid var(--primary);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.removeBtn svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(30, 30, 30, 0.95);
  color: white;
  padding: 14px 22px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;

  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.meal-popup {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);

  background: #222;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;

  z-index: 9999;
  animation: popupShow 0.3s ease;
}
.undo-popup {
  display: flex;
  gap: 12px;
}

.undo-popup button {
  border: none;
  background: var(--primary);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.restTimer {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1090;

  display: grid;
  place-items: center;

  width: min(calc(100vw - 32px), 360px);
  padding: 14px 18px;

  color: #fff;
  background: linear-gradient(135deg, #f35d24, #ff9b45);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 16px;

  box-shadow: 0 14px 34px rgba(173, 57, 16, 0.42);

  transform: translate(-50%, 0);
}

.restTimer.hidden {
  display: none;
}

#restTimerValue {
  color: inherit;
  font-family: "Orbitron", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.restTimer strong {
  font-size: 0.82rem;
  letter-spacing: 0.11em;
}

.restTimer span {
  font-family: "Orbitron", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
}

.set-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
