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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  background-color: #4b6cb7;
  animation: calm 40s ease-in-out infinite;
}

@keyframes calm {
  0%   { background-color: #4b6cb7; }
  20%  { background-color: #3a8f85; }
  40%  { background-color: #6a7fc1; }
  60%  { background-color: #8a6fa8; }
  80%  { background-color: #4a8fa8; }
  100% { background-color: #4b6cb7; }
}

#viewport {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#master.animated {
  transition: transform 0.9s cubic-bezier(.65, .05, .25, 1);
}

.step {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 2rem 6rem;
}

.step h1 { font-size: clamp(2rem, 6vw, 4rem); font-weight: 300; margin-bottom: 0.6rem; }
.step .date { font-size: 1.1rem; opacity: 0.85; letter-spacing: 0.08em; margin-bottom: 1.5rem; }
.step .desc { max-width: 36rem; font-size: 1.2rem; line-height: 1.6; margin-bottom: 1.2rem; white-space: pre-wrap; }
.step .loc, .step .time, .step .countdown { font-size: 1rem; opacity: 0.85; }
.step .countdown { margin-top: 0.25rem; opacity: 0.65; font-size: 0.9rem; }

#next-btn {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  padding: 0.8rem 1.8rem;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#next-btn:hover { background: rgba(255, 255, 255, 0.28); }
#next-btn .arrow { margin-left: 0.3rem; }
body.has-today-btn #next-btn { bottom: 3.4rem; }

#today-btn {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
#today-btn:hover { background: rgba(255, 255, 255, 0.25); }

#menu-btn {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 3.2rem;
  height: 3.2rem;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  z-index: 6; /* above the all-steps overlay (z-index 5) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
#menu-btn:hover { background: rgba(255, 255, 255, 0.35); }

#add-form {
  position: fixed;
  right: 1.5rem;
  bottom: 5.4rem;
  width: min(18rem, calc(100vw - 3rem));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  z-index: 6; /* above the all-steps overlay (z-index 5) */
}
#add-form.hidden { display: none; }

#add-form input,
#add-form textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  resize: vertical;
  color-scheme: dark;
}
/* Calendar button on the left of the date input (Chromium/WebKit) */
#add-form input[type="date"]::-webkit-calendar-picker-indicator {
  order: -1;
  margin: 0 0.5rem 0 0;
  cursor: pointer;
}
#add-form ::placeholder { color: rgba(255, 255, 255, 0.65); }

#add-form button {
  padding: 0.5rem;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  cursor: pointer;
}
#add-form button:hover { background: rgba(255, 255, 255, 0.4); }

/* Go Back button: original pill style (needs the #add-form prefix to beat "#add-form button") */
#add-form #back-btn {
  align-self: center;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.8;
}
#add-form #back-btn:hover { opacity: 1; background: rgba(255, 255, 255, 0.15); }
#back-btn .arrow { margin-left: 0.2rem; }

/* View all steps overlay */
#all-steps {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 4rem 0 5.5rem; /* no side padding, so today is centered on the screen */
  background: rgba(20, 30, 50, 0.85);
  backdrop-filter: blur(10px);
}
#all-steps.hidden { display: none; }

#all-steps-close {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.8rem;
  line-height: 1;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
}
#all-steps-close:hover { background: rgba(255, 255, 255, 0.2); }

/* Daily steps, in a row across the top (side margins keep clear of the close button) */
#all-steps-daily-title {
  flex-shrink: 0;
  margin: -3rem 4.75rem 0.5rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
}
#all-steps-daily-title[hidden] { display: none; }
#all-steps-daily {
  flex-shrink: 0;
  display: flex;
  justify-content: safe center;
  gap: 0.75rem;
  margin: 0 4.75rem 0.75rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
#all-steps-daily[hidden] { display: none; }
#all-steps-daily .all-card { flex: 0 0 12rem; width: 12rem; }

/* One column per day; --col is set from the screen width */
#all-steps-board {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
}
.day-spacer { flex: 0 0 var(--col); scroll-snap-align: start; }
.day-column {
  flex: 0 0 var(--col);
  min-width: 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.day-column.today { background: rgba(255, 255, 255, 0.07); }
.day-head {
  padding: 0.6rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.day-name { font-size: 0.95rem; font-weight: 600; }
.day-date { font-size: 0.75rem; opacity: 0.8; }
.day-column.past-day .day-head { opacity: 0.55; }
.day-cards {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
}

.all-card.draggable { cursor: grab; touch-action: none; user-select: none; }
.all-card.dragging { opacity: 0.35; }
.all-card.ghost { position: fixed; z-index: 7; opacity: 0.9; pointer-events: none; }
.drop-indicator {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  height: 4px;
  border-radius: 2px;
  background: #fff;
  pointer-events: none;
}

.all-card {
  box-sizing: border-box;
  flex: 0 0 7rem;
  width: 100%;
  height: 7rem;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  text-align: left;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: default;
}
.all-card:hover { background: rgba(255, 255, 255, 0.22); }
.all-card.current { border-color: #fff; background: rgba(255, 255, 255, 0.2); }
.all-card-title {
  flex-shrink: 0;
  font-size: 1.1rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.all-card-loc {
  flex-shrink: 0;
  font-size: 0.85rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Faint reminder of today's timed steps */
#today-bar {
  position: fixed;
  top: 0.9rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 7rem);
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  opacity: 0.45;
  pointer-events: none;
  z-index: 3;
}

/* Per-card delete button, shown on hover */
.all-card { position: relative; }
.all-card-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.7rem;
  height: 1.7rem;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
}
.all-card:hover .all-card-delete { display: flex; }
.all-card-delete:hover { background: #c0392b; }

/* Delete confirmation popup */
#confirm-delete {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
}
#confirm-delete.hidden { display: none; }
.confirm-box {
  max-width: 22rem;
  padding: 1.5rem;
  color: #fff;
  background: rgb(30, 42, 66);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  text-align: center;
}
.confirm-box p { margin: 0 0 1.2rem; overflow-wrap: anywhere; }
.confirm-actions { display: flex; gap: 0.75rem; justify-content: center; }
.confirm-actions button {
  padding: 0.5rem 1.2rem;
  font: inherit;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  cursor: pointer;
}
.confirm-actions button:hover { background: rgba(255, 255, 255, 0.15); }
#confirm-ok { background: #c0392b; border-color: #c0392b; }
#confirm-ok:hover { background: #e04b3a; }

/* Steps before the current one are faded; full strength on hover */
.all-card.past { opacity: 0.45; }
.all-card.past:hover { opacity: 0.85; }

/* Google Calendar sync */
#gcal-status { font-size: 0.8rem; opacity: 0.8; text-align: center; }
.step .link a { color: #fff; opacity: 0.85; font-size: 1rem; }

#add-form button:disabled { opacity: 0.4; cursor: default; }
#add-form button:disabled:hover { background: rgba(255, 255, 255, 0.25); }

/* Badge on cards synced from Google Calendar */
.all-card-gcal {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  display: flex;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
}

/* Hide/show Google Calendar steps toggle, at the bottom of the all-steps overlay */
#gcal-hide-btn {
  position: absolute;
  bottom: 1.9rem;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 11rem); /* keep clear of the menu button */
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  cursor: pointer;
}
#gcal-hide-btn:hover { background: rgba(255, 255, 255, 0.28); }
#gcal-hide-btn[hidden] { display: none; }

/* Normal / Daily toggle */
#mode-toggle { display: flex; gap: 0; }
#add-form #mode-toggle button { flex: 1; border-radius: 0; background: transparent; }
#add-form #mode-toggle button:first-child { border-radius: 6px 0 0 6px; }
#add-form #mode-toggle button:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
#add-form #mode-toggle button.active { background: rgba(255, 255, 255, 0.35); }
#add-form input[hidden] { display: none; }

/* Per-card "Skip to" button, shown on hover next to the delete button */
.all-card-skip {
  position: absolute;
  top: 0.4rem;
  right: 2.4rem;
  height: 1.7rem;
  padding: 0 0.6rem;
  box-sizing: border-box;
  display: none;
  align-items: center;
  font-size: 0.75rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.85rem;
}
.all-card-skip:last-child { right: 0.4rem; } /* no delete button (Google Calendar steps) */
.all-card:hover .all-card-skip { display: flex; }
.all-card-skip:hover { background: rgba(255, 255, 255, 0.35); }

/* Per-card edit button (not on Google Calendar steps), shown on hover in the bottom corner */
.all-card-edit {
  position: absolute;
  bottom: 0.4rem;
  right: 0.4rem;
  width: 1.7rem;
  height: 1.7rem;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
}
.all-card:hover .all-card-edit { display: flex; }
.all-card-edit:hover { background: rgba(255, 255, 255, 0.35); }

/* Edit step popup */
#edit-step {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
}
#edit-step.hidden { display: none; }
#edit-form {
  width: min(24rem, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: rgb(30, 42, 66);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
}
#edit-form h2 { font-size: 1.1rem; text-align: center; margin-bottom: 0.4rem; }
#edit-form input,
#edit-form textarea {
  flex-shrink: 0;
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  resize: vertical;
  color-scheme: dark;
}
#edit-form ::placeholder { color: rgba(255, 255, 255, 0.65); }
#edit-form .confirm-actions { margin-top: 0.5rem; }

/* Account and sync */
#account-status { font-size: 0.8rem; opacity: 0.8; text-align: center; overflow-wrap: anywhere; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.5);
}
.modal.hidden { display: none; }
.modal-box {
  width: min(24rem, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  overflow-wrap: anywhere;
  background: rgb(30, 42, 66);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
}
.modal-box h2 { font-size: 1.1rem; }
.modal-box input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  font: inherit;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
}
.modal-box input[hidden], .link-button[hidden] { display: none; }
.modal-box input[readonly] { opacity: 0.6; }
.modal-box ::placeholder { color: rgba(255, 255, 255, 0.65); }
.modal-error { font-size: 0.85rem; color: #ffb4a8; }
.modal-error:empty { display: none; }
.confirm-actions button:disabled { opacity: 0.4; cursor: default; }
.link-button {
  font: inherit;
  font-size: 0.8rem;
  color: #fff;
  opacity: 0.75;
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
#sync-notice {
  position: fixed;
  top: 2.8rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(28rem, calc(100% - 2rem));
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  background: rgb(30, 42, 66);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
}
#sync-notice[hidden] { display: none; }
#sync-notice button { font-size: 1.3rem; color: #fff; background: none; border: 0; cursor: pointer; }
