:root{
  --deep-blue:#2c3e50;
  --light-gray:#ecf0f1;
  --white:#ffffff;
  --teal:#1abc9c;
}

/* ---- Base / layout ---- */
html, body {
  margin: 0;
  background: var(--light-gray);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
  color: var(--deep-blue);
  overflow-x: hidden;
}

.hidden { display: none !important; }

#timer-app {
  max-width: 720px;
  margin: 24px auto;
  padding: 16px 16px 24px;
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}

/* ---- Card / stage ---- */
.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  padding: 16px;
  border: 2px dashed var(--light-gray);
  border-radius: 16px;
  background: #fff;
}

/* ---- Big time text ---- */
.big {
  font-weight: 900;
  letter-spacing: 1px;
  text-align: center;
  font-size: clamp(40px,9vw,96px);
  line-height: 1;
  color: var(--deep-blue);
}

/* ---- helpers ---- */
.row-center { display:flex; align-items:center; justify-content:center; }
.gap { gap: 10px; }

/* ---- Number keypad ---- */
.controls { display:flex; align-items:center; gap:10px; width:100%; margin-top:12px; }
.numkeypad.numkeypad-inline { display:flex; gap:8px; flex-wrap:nowrap; align-items:center; flex:1 1 auto; min-width:0; }

.nbtn {
  border: 2px solid #e4ebf0;
  background: #fff;
  color: var(--deep-blue);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-align: center;
  flex: 1 1 0;
  min-width: 40px;
  user-select: none;
}
.nbtn:active { transform: translateY(1px); }

/* ---- Buttons ---- */
.btn {
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  padding: 10px 16px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(26,188,156,.3);
}
.btn:disabled { opacity:.6; cursor:not-allowed; }
.btn.alt { background:#f39c12; box-shadow:0 4px 12px rgba(243,156,18,.3); }

/* ---- Pills (options) ---- */
.pill {
  background: var(--light-gray);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 14px;
}

/* ---- Progress bar: LEFT -> RIGHT using transform scaleX ---- */
.barWrap {
  position: relative;
  width: 100%;
  height: 64px;
  border-radius: 12px;
  background: #f7fafb;
  border: 4px solid var(--deep-blue);
  overflow: hidden;
}

/* Labels positioned to match left→right direction */
.bar-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: var(--deep-blue);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  z-index: 3;
  pointer-events: none;
  white-space: nowrap;
}
.bar-label.start { left: 10px; text-align: left; }   /* Start on left */
.bar-label.finish { right: 10px; text-align: right; }/* Finish on right */

/* the visible fill */
.bar {
  position: absolute;
  inset: 0;
  background: var(--teal);
  transform-origin: left center; /* anchor left so scaleX shrinks left->right */
  transform: scaleX(1);          /* JS will adjust this to 0..1 */
  will-change: transform;
  border-radius: 8px;
  z-index: 1;
}

/* ticks overlay */
.tick {
  position: absolute;
  top: 0; bottom: 0;
  width: 4px;
  background: var(--deep-blue);
  z-index: 2;
}
.tick.t25 { left: 25%; }
.tick.t50 { left: 50%; }
.tick.t75 { left: 75%; }

.tick::after {
  content: attr(data-label);
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  color: var(--deep-blue);
  z-index: 2;
}

/* ---- Responsive tweaks ---- */
@media (max-width: 520px) {
  .nbtn { min-width: 34px; padding: 8px 10px; font-size: 15px; }
  .btn  { padding: 8px 12px; }
  .bar-label { font-size: 12px; padding: 5px 8px; }
}

/* Very narrow screens hide finish label to avoid overlap */
@media (max-width: 360px) {
  .bar-label.finish { display: none; }
}
