/* generated-by: Claude | source: player.html + player-dev.html | purpose: shared CSS for player.html and player-dev.html */

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #f5f5f5;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
@media (max-width: 500px) {
  body { padding: 10px 10px 10px; }
}

/* ── Graph Card ── */
.graph-card {
  background: white; border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  padding: 28px 28px 20px; max-width: 460px; width: 100%;
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.graph-title { display: none; }

.feed-title {
  font-family: 'Open Sans', sans-serif; font-size: 21px; font-weight: 600; color: #555555;
  text-align: center; padding: 12px 8px 16px; flex-shrink: 0;
}
@media (max-width: 768px) {
  .graph-card { box-shadow: none; border-radius: 0; width: 100%; max-width: 100%; background: transparent; padding: 16px 12px; }
  body { padding: 0; background: #f5f5f5; }
}
@media (max-width: 500px) {
  .graph-card { padding: 16px 12px 14px; border-radius: 0; }
}

/* ── Graph Body ── */
.graph-body { display: flex; flex: 1; min-height: 0; }

/* ── Bars Column ── */
.bars-col {
  padding-bottom: 32px;
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}

/* ── Individual Bar ── */
.seg-bar {
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  cursor: default;
}

/* States */
.seg-bar.done   { opacity: 0.55; }
.seg-bar.active { opacity: 1; }
.seg-bar.future { opacity: 0.25; }

/* Label + countdown locked as one animated unit */
.content-group {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  width: calc(90% - 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              top     0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.seg-bar.active .content-group { opacity: 1; }

.seg-label {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600; text-align: center;
  line-height: 1.2; white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  padding-bottom: 0.15em;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}
.seg-bar.active .seg-label { opacity: 1; }

/* Duration + timestamp on active bar */
.seg-dur {
  position: absolute; left: 8px; top: 10px; transform: none;
  font-weight: 800; z-index: 3; opacity: 0; transition: opacity 0.3s ease;
  display: flex; align-items: baseline; gap: 1px;
}
.seg-bar.active .seg-dur { opacity: 0.6; }
.dur-n { font-weight: 700; }
.dur-u { font-weight: 500; }

.seg-ts {
  position: absolute; left: 12px; top: 0; transform: none;
  font-family: 'Open Sans', sans-serif;
  font-size: 11px; font-weight: 600; z-index: 3;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              top     0.8s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(0,0,0,0.45);
}
.seg-bar.active .seg-ts { opacity: 1; }

/* Cluster intensities */
.cluster-ints {
  display: flex; gap: 5px; font-size: 12px; font-weight: 700; z-index: 2;
  opacity: 0; transition: opacity 0.3s ease 0.1s;
}
.seg-bar.active .cluster-ints { opacity: 1; }

/* ── Elapsed ── */
.elapsed-title { display: none; }

.elapsed {
  margin-top: 12px;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  font-family: 'Open Sans', sans-serif;
  font-size: 21px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  padding: 0;
}

/* Overall progress bar */
.overall-progress-inline {
  margin: 10px 0 2px;
  flex-shrink: 0;
  height: 8px;
  background: rgba(0,0,0,0.10);
  border-radius: 999px;
  overflow: hidden;
}
.overall-progress__fill {
  height: 100%;
  width: 0%;
  background: #2E9E6B;
  border-radius: 999px;
  transition: width 0.15s linear;
}

.elapsed .now { font-size: 20px; font-weight: 800; color: #1B5E20; }
#enow { color: #2E9E6B; }
#erem { color: #B3B3B3; }
@media (max-width: 768px) {
  .graph-card { padding-top: 4px; padding-bottom: 0; }
  .feed-title { padding-top: 0; padding-bottom: 12px; }
  .elapsed { margin-top: 0; padding-top: 10px; padding-bottom: 2px; }
  .overall-progress-inline { margin-top: 0; margin-bottom: 0; }
}
@media (max-width: 500px) {
  .overall-progress-inline { height: 10px; }
}

/* ── Bars viewport — scrollable, hidden scrollbar ── */
.bars-viewport {
  position: relative;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bars-viewport::-webkit-scrollbar { display: none; }

/* ── Circular timer per segment ── */
.seg-timer {
  position: relative;
  width: 22px; height: 22px;
  z-index: 4;
  opacity: 0.35;
  transition: opacity 0.25s ease;
  display: grid;
  place-items: center;
}
.seg-bar.done   .seg-timer { opacity: 0.55; }
.seg-bar.future .seg-timer { opacity: 0.18; }
/* Active: large ring absolutely centered in bar; size set by JS */
.seg-bar.active .seg-timer {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  transform: none;
  margin: 0;
  opacity: 0.95;
}
.seg-timer svg { width: 100%; height: 100%; display: block; }
.content-group .ttext {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 10px;
  line-height: 1;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0.85;
}

/* Rounded segment edges — Figma: top r=14, bottom r=10 */
.seg-bar { border-radius: 10px; }
.bars-col .seg-bar:first-child { border-top-left-radius: 14px; border-top-right-radius: 14px; }
.bars-col .seg-bar:last-child  { border-bottom-left-radius: 14px; border-bottom-right-radius: 14px; }
.seg-bar.active { border-radius: 14px 14px 10px 10px !important; }

/* Hide all circles until workout starts, and after it ends */
.seg-timer { display: none; }
body.playing .seg-timer { display: grid; }
body.playing .seg-bar.done .seg-timer { display: none; }
body.done .seg-timer { display: none; }

/* Hide per-segment top-right duration */
.seg-dur { display: none !important; }

/* ── Exercise Instructions Panel ── */
#instructions-panel {
  overflow: hidden;
  height: 0;
  opacity: 0;
  border-radius: 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}
#instructions-panel .instr-inner {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  white-space: pre-line;
}

/* Hide elapsed time and progress bar until workout is running */
body:not(.playing):not(.done) .elapsed,
body:not(.playing):not(.done) .overall-progress-inline { opacity: 0; }

/* ── Pause / play overlay ── */
@keyframes pulse-play {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(255,255,255,0.3); }
  50%       { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(255,255,255,0); }
}

#pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}
#pause-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#pause-dim-layer {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 0;
}

.overlay-card {
  z-index: 2;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 24px;
  padding: 40px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.overlay-play-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pulse-play 2s ease-in-out infinite;
}

.overlay-play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #ffffff;
  margin-left: 4px;
}

.overlay-label {
  font-family: 'Open Sans', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
}

.overlay-context {
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.overlay-context:empty { display: none; }

@media (orientation: landscape) and (max-height: 500px) {
  .overlay-card { padding: 24px 36px; gap: 8px; }
  .overlay-label { font-size: 22px; }
  .overlay-play-circle { width: 52px; height: 52px; }
  .overlay-play-icon { border-width: 10px 0 10px 16px; }
}
