/* Stretcher (web) — styles.

   Colour scheme taken from the Frizzy G logo: mid-grey ground, neon lime,
   and black for every outline and hard offset shadow. One scheme, no themes.

   Contrast rules the palette forces:
     lime on grey is only ~3:1, so lime text always gets a black outline (the
     logo treatment, .logo-text) or sits on black;
     body text is black on grey (5.3:1) or black on lime (15:1);
     on black panels, text is white or lime (both well over 12:1). */

:root {
  --grey: #808080;
  --grey-2: #9b9b9b;          /* a raised grey: chips, secondary buttons */
  --grey-3: #b4b4b4;
  --lime: #55ff00;
  --ink: #000000;
  --paper: #ffffff;
  --line: 3px;                /* outline weight used everywhere */
  --radius: 14px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--grey);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input, select { user-select: text; -webkit-user-select: text; }

/* The logo treatment: lime fill, thick black outline drawn UNDER the fill
   (paint-order) so the letters keep their weight, and a hard black offset
   shadow that follows the outline (drop-shadow, not text-shadow, which would
   only shadow the fill). Sizes in em so it scales with the text. */
.logo-text {
  color: var(--lime);
  font-weight: 900;
  font-style: italic;
  -webkit-text-stroke: 0.15em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0.055em 0.06em 0 var(--ink));
}

button {
  font-family: inherit;
  font-weight: 700;
  background: var(--grey-2);
  color: var(--ink);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 15px;
  padding: 9px 14px;
  touch-action: manipulation;          /* no double-tap-zoom delay on phones */
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
/* Pressing a button pushes it into its shadow, like a sticker being stamped. */
button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 3px solid var(--lime); outline-offset: 3px;
}
button.primary { background: var(--lime); }
button.icon {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px 10px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
}
button.icon:active { transform: scale(0.92); box-shadow: none; }

/* Each screen is the full dynamic viewport (dvh keeps phone toolbars from
   covering the controls), capped in width so a desktop browser gets a
   phone-shaped column rather than cards stretched across 1920px. */
.screen {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.topbar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* The wordmark gets the logo's underline bar too. */
.brand { flex: 1; font-size: 30px; line-height: 1.1; letter-spacing: 0.5px; padding: 2px 0 12px; position: relative; }
.brand::after {
  content: ""; position: absolute; left: 2px; bottom: 0; width: 6.4em; max-width: 100%; height: 9px;
  background: var(--lime); border: var(--line) solid var(--ink); border-radius: 3px;
  box-shadow: var(--shadow-sm);
  -webkit-text-stroke: 0; filter: none;
}
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

/* ---------- Settings (a black card, so lime and white both read) ---------- */
.settings-panel {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--grey-3);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
}
.settings-panel label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.settings-panel select, .settings-panel input[type="number"] {
  background: var(--grey);
  color: var(--ink);
  border: 2px solid var(--lime);
  border-radius: 8px;
  padding: 7px 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}
.settings-panel input[type="number"] { width: 72px; }
.settings-panel input[type="checkbox"] { accent-color: var(--lime); width: 20px; height: 20px; }
.fine-print { font-size: 12px; font-weight: 500; line-height: 1.45; color: #d6d6d6; }
.fine-print b { color: var(--lime); }

/* ---------- Home: choose a focus, choose a length, go ---------- */
#dashboard { display: flex; flex-direction: column; padding: 0 6px 6px 0; }
.hero { padding: 12px 2px 2px; flex-shrink: 0; }
.hero-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--ink); margin-bottom: 8px;
}
.hero-title { font-size: 34px; line-height: 1.12; letter-spacing: 0.3px; }

.focus-row { display: flex; gap: 10px; margin-top: 18px; flex-shrink: 0; }
.focus-chip {
  flex: 1; padding: 10px 6px; border-radius: 999px;
  font-size: 14.5px; font-weight: 800; font-style: italic;
}
.focus-chip[aria-pressed="true"] { background: var(--lime); }
.focus-note { font-size: 13px; font-weight: 600; color: var(--ink); margin: 11px 4px 0; min-height: 18px; flex-shrink: 0; }

.time-grid {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 14px; margin-top: 14px; max-height: 540px; min-height: 300px;
}
/* Five lengths in a two-column grid: the longest takes the whole bottom row,
   which reads as deliberate rather than as a missing card. */
.time-grid .time-card:last-child { grid-column: 1 / -1; }
.time-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 8px; text-align: center; line-height: 1;
  background: var(--lime);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
@media (hover: hover) {
  .time-card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
}
.time-card:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.time-card .t-num {
  font-size: 50px; font-weight: 900; font-style: italic; letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.time-card .t-unit { font-size: 15px; font-weight: 800; margin-left: 4px; letter-spacing: 0; }
.time-card .t-tag { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.3px; }

/* ---------- Play ---------- */
#play { gap: 10px; }
.play-top { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.play-top .routine-title {
  flex: 1; font-size: 15px; font-weight: 800; font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.play-top .total-remaining {
  font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--ink); color: var(--lime); padding: 4px 10px; border-radius: 8px;
}
.play-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 0;
  text-align: center;
}
/* Phase is a black pill: white while you get into position, lime once the
   stretch is live, so the change of state reads from across the room. */
.phase-label {
  font-size: 14px;
  letter-spacing: 3px;
  font-weight: 900;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 4px 12px 4px 15px;
  border-radius: 999px;
  min-height: 26px;
}
.phase-label:empty { visibility: hidden; }
.phase-label.holding, .phase-label.up { color: var(--lime); }
.phase-label.lowering { color: var(--paper); }
.stretch-title {
  font-size: clamp(24px, 6.4vmin, 36px); font-weight: 900; font-style: italic;
  line-height: 1.12; padding: 6px 8px 0;
}
.side-chip {
  display: inline-block;
  background: var(--ink);
  color: var(--lime);
  border-radius: 20px;
  padding: 3px 16px;
  font-size: clamp(14px, 4vmin, 18px);
  font-weight: 800;
  font-style: italic;
  margin-top: 5px;
  visibility: hidden;
}
.side-chip.visible { visibility: visible; }
.stretch-img {
  max-width: min(88%, 340px);
  max-height: 26vh;
  max-height: 26dvh;
  border-radius: var(--radius);
  border: var(--line) solid var(--ink);
  box-shadow: var(--shadow);
  object-fit: contain;
  background: var(--paper);
  margin: 10px 0 4px;
  display: none;
}
.stretch-img.visible { display: block; }
/* The big number is the logo, basically. */
.countdown {
  font-size: clamp(84px, 30vmin, 220px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 2px;
  -webkit-text-stroke-width: 0.11em;
  filter: drop-shadow(0.045em 0.05em 0 var(--ink));
}
.countdown.lead { color: var(--paper); }
/* Last three seconds invert: black numerals, lime shadow. */
.countdown.ending {
  color: var(--ink);
  -webkit-text-stroke-color: var(--lime);
  filter: drop-shadow(0.045em 0.05em 0 var(--ink));
}
.countdown.reps { font-size: clamp(60px, 20vmin, 140px); }
.countdown.reps .of { font-size: 0.45em; color: var(--paper); }
.step-note {
  max-width: min(94%, 460px);
  margin: 10px auto 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--ink);
  border-left: 6px solid var(--lime);
  color: var(--paper);
  font-size: clamp(13px, 3.4vmin, 16px);
  font-weight: 500;
  line-height: 1.38;
  text-align: left;
}
.intensity {
  font-size: clamp(12px, 3vmin, 14px); font-weight: 600;
  margin-top: 8px; font-style: italic; max-width: min(94%, 460px);
}
.cadence {
  width: min(80%, 300px);
  height: 12px;
  background: var(--grey-2);
  border: var(--line) solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
  margin: 10px auto 0;
}
.cadence-fill { height: 100%; width: 0%; background: var(--ink); }
.cadence-fill.up { background: var(--lime); }
.next-up {
  font-size: clamp(14px, 4vmin, 17px);
  font-weight: 600;
  height: 22px;
  margin-top: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.next-up b { font-weight: 900; font-style: italic; }
.play-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  padding: 4px 0 6px;
}
.play-controls button { font-size: 20px; padding: 11px 17px; border-radius: 50px; line-height: 1; }
.play-controls .big { font-size: 26px; padding: 14px 30px; background: var(--lime); box-shadow: var(--shadow); }
.play-controls .big:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.progress-track {
  height: 14px;
  background: var(--grey-2);
  border: var(--line) solid var(--ink);
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
  margin-right: 3px;
}
.progress-fill {
  height: 100%;
  background: var(--lime);
  border-right: var(--line) solid var(--ink);
  width: 0%;
  transition: width 0.15s linear;
}
.finish-box { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.finish-box .big-check { font-size: 64px; }
.finish-box h2 { font-size: 40px; }
.finish-box .meta { font-weight: 700; }
.finish-box .btns { display: flex; gap: 14px; margin-top: 8px; }
.finish-box .btns button { font-size: 17px; padding: 11px 20px; }
.kbd-hint { font-size: 12px; font-weight: 600; text-align: center; flex-shrink: 0; }
.kbd-hint kbd {
  background: var(--ink); color: var(--lime); border-radius: 4px;
  padding: 1px 6px; font-family: inherit; font-weight: 800;
}
/* Keyboard shortcuts mean nothing on a phone. */
@media (hover: none) { .kbd-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  button:active, .time-card:hover, .time-card:active { transform: none; }
}
