/* ── App shell layout ── */
.app-shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.main-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.ring-panel { display: flex; justify-content: center; }
.carousel-panel { width: 100%; }
.banners-panel { display: flex; flex-direction: column; gap: 0.5rem; }
.controls-panel { display: flex; flex-direction: column; gap: 0.75rem; }

.goal-action-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.action-btn-desktop { width: 100%; }

.ring-svg-size { width: 200px; height: 200px; }
.timer-text    { font-size: 3rem; }

/* ── Desktop layout (≥ 768px) ── */
@media (min-width: 768px) {
  .app-shell {
    max-width: 860px;
    padding: 2.5rem 2rem;
    gap: 1.5rem;
  }

  .main-content {
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
  }

  .ring-panel {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
  }

  .carousel-panel { flex: 1; min-width: 0; }

  .ring-svg-size { width: 260px; height: 260px; }
  .timer-text    { font-size: 3.75rem; }
}

/* ── Progress ring ── */
.ring-bg {
  fill: none;
  stroke: #1f2937;
  stroke-width: 14;
}
.ring-fill {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 603;
  stroke-dashoffset: 603;
  transform: rotate(-90deg);
  transform-origin: 110px 110px;
  transition: stroke-dashoffset 1s linear, stroke 0.5s;
}

/* ── Goal buttons ── */
.goal-btn {
  background-color: #1f2937;
  color: #9ca3af;
  border: 1px solid #374151;
  border-radius: 0.75rem;
  padding: 0.6rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.goal-btn:hover { background-color: #374151; color: #fff; }
.goal-btn.active { background-color: #f59e0b; color: #000; border-color: #f59e0b; }

/* ── Action button ── */
.action-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  border: none;
  background-color: #f59e0b;
  color: #000;
  transition: background-color 0.2s, transform 0.1s;
}
.action-btn:active { transform: scale(0.97); }
.action-btn.ending { background-color: #ef4444; color: #fff; }
.action-btn:disabled { background-color: #374151; color: #6b7280; cursor: not-allowed; }

/* Smooth collapse for offset row */
#offsetRow {
  max-height: 200px;
  opacity: 1;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
  overflow: hidden;
}
#offsetRow.collapsed {
  max-height: 0;
  opacity: 0;
  margin: 0;
  border-color: transparent;
  pointer-events: none;
}

/* ── Offset slider ── */
.offset-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #374151;
  outline: none;
  cursor: pointer;
}
.offset-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: 2px solid #000;
}
.offset-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #f59e0b;
  cursor: pointer;
  border: 2px solid #000;
}

/* ── Status carousel ── */
.status-carousel {
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 12px;
  padding: 6px 6px 10px;
}
.status-carousel::-webkit-scrollbar { display: none; }

.status-card {
  flex: 0 0 calc(100% - 4px);
  scroll-snap-align: center;
  background-color: #111827;
  border: 2px solid #1f2937;
  border-radius: 2rem;
  padding: 1.1rem 1rem;
  text-align: center;
  transition: border-color 0.4s;
}

/* Current stage — green pulse */
.status-card.status-current {
  animation: greenPulse 2s ease-in-out infinite;
}
@keyframes greenPulse {
  0%, 100% {
    border-color: #16a34a;
    box-shadow: 0 0 6px 2px rgba(34, 197, 94, 0.5),
                0 0 0 0 rgba(34, 197, 94, 0.3);
  }
  50% {
    border-color: #4ade80;
    box-shadow: 0 0 18px 4px rgba(74, 222, 128, 0.75),
                0 0 32px 10px rgba(34, 197, 94, 0.15);
  }
}

/* ── Emoji animations — only active on the current stage card ── */
.emoji-anabolic,
.emoji-catabolic,
.emoji-fat,
.emoji-ketosis,
.emoji-deep { display: inline-block; }

.status-card.status-current .emoji-anabolic {
  animation: bobAnabolic 3s ease-in-out infinite;
}
@keyframes bobAnabolic {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

.status-card.status-current .emoji-catabolic {
  animation: drainCatabolic 2s ease-in-out infinite;
}
@keyframes drainCatabolic {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.88); }
}

.status-card.status-current .emoji-fat {
  transform-origin: center bottom;
  animation: flickerFat 0.65s ease-in-out infinite;
}
@keyframes flickerFat {
  0%   { transform: scale(1)    rotate(-2deg); opacity: 1; }
  20%  { transform: scale(1.12) rotate(2deg);  opacity: 0.85; }
  40%  { transform: scale(0.94) rotate(-3deg); opacity: 1; }
  60%  { transform: scale(1.1)  rotate(1deg);  opacity: 0.8; }
  80%  { transform: scale(1.03) rotate(-1deg); opacity: 1; }
  100% { transform: scale(1)    rotate(-2deg); opacity: 1; }
}

.status-card.status-current .emoji-ketosis {
  animation: zapKetosis 1.4s ease-in-out infinite;
}
@keyframes zapKetosis {
  0%, 100% { transform: scale(1);    filter: brightness(1); }
  10%      { transform: scale(1.25); filter: brightness(2.5); }
  20%      { transform: scale(1);    filter: brightness(1); }
  35%      { transform: scale(1.18); filter: brightness(2); }
  50%      { transform: scale(1);    filter: brightness(1); }
}

.status-card.status-current .emoji-deep {
  animation: spinDeep 5s linear infinite;
}
@keyframes spinDeep {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Stage-specific border colours (non-current) */
.status-card.stage-anabolic  { border-color: #3b82f6; }
.status-card.stage-catabolic { border-color: #a855f7; }
.status-card.stage-fat       { border-color: #f59e0b; }
.status-card.stage-ketosis   { border-color: #10b981; }
.status-card.stage-deep      { border-color: #06b6d4; }

/* Carousel dots */
.carousel-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #374151;
  transition: background 0.3s, transform 0.3s;
  cursor: pointer;
}
.carousel-dot.active {
  background: #22c55e;
  transform: scale(1.3);
}

/* ── End Fast modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 0;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: #111827;
  border: none;
  border-radius: 0;
  padding: 3rem 2rem;
  width: 100%;
  height: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 480px) {
  .modal-overlay { padding: 1.5rem; }
  .modal-card {
    height: auto;
    border: 1px solid #374151;
    border-radius: 1.5rem;
    max-width: 360px;
  }
}

/* ── PWA install banner ── */
.install-banner {
  width: 100%;
  max-width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.install-banner.hidden { display: none; }

.install-banner-text {
  font-size: 0.8rem;
  color: #9ca3af;
  flex: 1;
}

.install-banner-btn {
  background: #f59e0b;
  color: #000;
  border: none;
  border-radius: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* ── iOS install hint ── */
.ios-banner {
  width: 100%;
  max-width: 100%;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.ios-banner.hidden { display: none; }

.ios-banner-body {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #9ca3af;
  flex: 1;
}

.ios-share-icon {
  width: 16px;
  height: 16px;
  color: #3b82f6;
  flex-shrink: 0;
}

.install-banner-dismiss {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.modal-btn-end {
  width: 100%;
  padding: 0.9rem;
  border-radius: 0.875rem;
  background: #ef4444;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  margin-bottom: 0.75rem;
  transition: background 0.2s, transform 0.1s;
}
.modal-btn-end:active { transform: scale(0.97); }

.modal-btn-cancel {
  width: 100%;
  padding: 0.9rem;
  border-radius: 0.875rem;
  background: #1f2937;
  color: #9ca3af;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid #374151;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.modal-btn-cancel:active { transform: scale(0.97); }

/* ── History overlay ── */
.history-overlay {
  position: fixed;
  inset: 0;
  background: #030712;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.history-overlay.hidden { display: none; }

.history-container {
  width: 100%;
  max-width: 520px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem 1rem;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-entry {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 1rem;
  padding: 0.875rem 1rem;
}

.history-entry-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.history-date { font-size: 0.8rem; color: #6b7280; flex: 1; }

.history-duration {
  font-size: 1rem;
  font-weight: 700;
  color: #f59e0b;
  font-family: monospace;
}

.history-hit { font-size: 0.85rem; font-weight: 700; min-width: 2.5rem; text-align: right; }
.history-hit-success { color: #22c55e; }
.history-hit-miss    { color: #9ca3af; }

.history-entry-bottom { display: flex; align-items: center; gap: 0.5rem; }

.history-goal-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #4b5563;
  background: #1f2937;
  border-radius: 0.375rem;
  padding: 0.1rem 0.4rem;
}

.history-stage-label { font-size: 0.75rem; font-weight: 600; }

.history-delete-btn {
  background: none;
  border: none;
  color: #4b5563;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0 0 0 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}
.history-delete-btn:hover { color: #ef4444; }

.history-entry-deleting {
  border-color: #ef4444 !important;
  background: #1c0a0a;
}

.history-confirm-delete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.history-confirm-label {
  font-size: 0.9rem;
  color: #d1d5db;
  font-weight: 500;
}

.history-confirm-btns {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.history-confirm-cancel {
  flex: 1;
  padding: 0.55rem;
  border-radius: 0.625rem;
  background: #1f2937;
  color: #9ca3af;
  border: 1px solid #374151;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.history-confirm-yes {
  flex: 1;
  padding: 0.55rem;
  border-radius: 0.625rem;
  background: #ef4444;
  color: #fff;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
