body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f5f5f5;
  padding: 0;
  color: #333;
  margin: 0;
  display: block;
}


.page-wrap {
  max-width: 700px;
  width: 100%;
  margin: 20px auto;
  /* spacing below navbar */
  padding: 20px;
  box-sizing: border-box;
}


h1 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 3rem;
  font-weight: 700;
  text-align: center;
  color: #0066cc;
  margin: 10px 0 20px;
  letter-spacing: -0.5px;
}

h3 {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-align: left;
  color: #333;
  margin: 10px 0 20px;
}

.add-form p {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

.add-form,
.exercise-list,
.current-box,
.preset-box {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  color: #333;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  padding: 20px;
  margin: 10px 0;
}

.exercise {
  padding: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.exercise-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #e0e0e0;
}

.exercise-item:last-child {
  border-bottom: none;
}

.exercise-item button {
  height: 28px;
  line-height: 28px;
  padding: 0 10px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.exercise:last-child {
  border-bottom: none;
}

.controls {
  text-align: center;
  margin-top: 20px;
}

button {
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  margin: 5px;
  background: #0066cc;
  border: 2px solid #0066cc;
  color: #ffffff;
  font-weight: 500;
  transition: all 0.2s ease;
  font-family: 'Segoe UI', Arial, sans-serif;
}

button:hover {
  background: #0052a3;
  border-color: #0052a3;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

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

input,
select {
  padding: 8px;
  font-size: 1rem;
  margin-right: 10px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #ffffff;
  color: #333;
  font-family: 'Segoe UI', Arial, sans-serif;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.big-timer {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 10vw;
  text-align: center;
  margin-top: 10px;
  font-weight: 700;
}

.exercise-timer {
  color: #0066cc;
}

.cooldown {
  color: #666;
}

.label {
  text-align: center;
  font-size: 2rem;
  margin-top: 5px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #0066cc;
  font-weight: 600;
}

.exercise-buttons {
  display: flex;
  gap: 6px;
}

.edit-btn,
.delete-btn {
  margin-left: 8px;
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-btn:hover {
  background: #0052a3;
}

.delete-btn:hover {
  background: #cc0000;
}

.exercise-list {
  transition: max-height 0.4s ease, opacity 0.3s ease;
  overflow: hidden;
}

.exercise-list.hidden {
  display: none;
}


.next-label {
  text-align: center;
  font-size: 1rem;
  margin-top: 4px;
  color: #666;
  opacity: 0.9;
  font-family: 'Segoe UI', Arial, sans-serif;
}

#fullscreenBtn {
  background: #0066cc !important;
  border: 2px solid #0066cc !important;
  color: #ffffff !important;
}

#fullscreenBtn:hover {
  background: #0052a3 !important;
  border-color: #0052a3 !important;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3) !important;
}

.page-wrap:fullscreen {
  width: 100%;
  max-width: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* instead of center */
}

.page-wrap:fullscreen h1 {
  margin-bottom: 30px;
}


/* Normal behavior: allow wrapping and scaling */
.page-wrap h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  white-space: normal;
  flex-shrink: 1;
  text-align: center;
  margin-bottom: 30px;
}

/* Fullscreen behavior: prevent wrapping */
.page-wrap:fullscreen h1 {
  white-space: nowrap;
  flex-shrink: 0;
}

.current-box {
  margin-top: 10px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day {
  padding: 8px;
  background: #ffffff;
  border: 1px solid #e0e0e0;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
}

.day.done {
  background: #0066cc;
  color: #ffffff;
  font-weight: bold;
  border-color: #0066cc;
}

.day.selected {
  border: 2px solid #0052a3;
  box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.3);
}

.day.today {
  background: #f0f0f0;
  color: #333;
  font-weight: bold;
  border-color: #0066cc;
  border-width: 2px;
}

.day.today.done {
  background: #0052a3;
  color: #ffffff;
}

#modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#modalBox {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  padding: 20px;
  border-radius: 8px;
  width: 280px;
  text-align: center;
  color: #333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#modalClose {
  margin-top: 15px;
  padding: 8px 16px;
  background: #0066cc;
  color: #ffffff;
  border: 2px solid #0066cc;
  border-radius: 6px;
  font-size: 1rem;
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
  font-family: 'Segoe UI', Arial, sans-serif;
  cursor: pointer;
}

#modalClose:hover {
  background: #0052a3;
  border-color: #0052a3;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.3);
}

.exercise-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.exercise-inputs input,
.exercise-inputs select,
.exercise-inputs button {
  margin: 0;
}

.input-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  flex-wrap: wrap;
}

.input-row input {
  flex: 1;
  min-width: 150px;
}

.input-row select {
  flex: 0 0 auto;
}

.input-row button {
  flex: 0 0 auto;
  margin-left: auto;
}

.preset-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
  width: 100%;
}

.preset-row button:first-child {
  flex: 0 0 auto;
}

.preset-row select {
  flex: 0 0 auto;
}

.preset-row button:last-child {
  flex: 0 0 auto;
  margin-left: auto;
}

.preset-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-box select {
  flex: 0 0 auto;
}

.preset-box {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.preset-box select {
  flex: 0 0 auto;
}

.preset-box p {
  flex: 1;
  margin: 0;
  padding-left: 10px;
}

/* Tracker controls row - all on one line, aligned with webcam */
.tracker-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  margin-bottom: 15px;
  width: 100%;
}

.tracker-dropdowns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.tracker-controls-row select {
  flex: 0 0 auto;
}

.tracker-controls-row #addToSequence {
  flex: 0 0 auto;
  padding: 8px 30px;
  min-width: 100px;
}

.tracker-controls-row select {
  padding: 8px 12px;
  font-size: 0.95rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #ffffff;
  color: #333;
  min-width: 150px;
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
}

.tracker-controls-row select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.tracker-controls-row #repTarget {
  min-width: 80px;
  width: 80px;
}

.tracker-controls-row button {
  padding: 8px 20px;
  margin: 0;
  white-space: nowrap;
}

.auth-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.auth-box input,
.auth-box button {
  margin: 0;
}

#authStatus {
  flex-basis: 100%;
  margin-top: 5px;
}

.auth-user {
  color: #fff;
  font-weight: bold;
  margin-left: 10px;
}

#currentBox {
  position: relative;
  min-height: 400px;
}

#weightsWebcamContainer {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 180px;
  height: 135px;
  z-index: 5;
}

#weightsWebcamCanvas {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  display: block;
  background: #000;
}

#stopTrackerInBox {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 5;
}

#lottie-container {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 120px;
  height: 120px;
  pointer-events: none;
  display: none;
  /* hidden until timer starts */
  z-index: 10;
}

#video {
  display: none;
  /* hide raw video, use canvas only */
}

#canvas {
  width: 640px;
  height: 480px;
  display: block;
}

.tracker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  width: 100%;
}

#videoWrapper {
  display: none !important;
}

.tracker-header h3 {
  margin: 0;
}

#miniCam {
  width: 180px;
  height: 135px;
  border: 1px solid #e0e0e0;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  margin-left: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#miniCam canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#miniCanvas {
  width: 180px;
  height: 135px;
}

#trackerInfo {
  display: none !important;
}

#chooseLabel {
  display: none !important;
}

#videoWrapper {
  position: relative;
  width: 640px;
  height: 480px;
  display: none;
  /* ⭐ HIDE BY DEFAULT — prevents the giant black flash */
}

/* Loading spinner */
.spinner {
  border: 4px solid rgba(0, 102, 204, 0.2);
  border-top: 4px solid #0066cc;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

#chooseLabel,
#trackerExercise {
  display: none;
}