/* Papa's Daily Exercises — live follow-along
   Large type, high contrast, phone / tablet / TV. */

:root {
  --ink: #14202b;
  --teal: #0b3d47;
  --teal-deep: #082c33;
  --gold: #f3d089;
  --gold-deep: #c9891a;
  --cream: #fff6e8;
  --paper: #fffaf2;
  --coral: #c44b2a;
  --green: #1c6b4a;
  --green-soft: #d8f3e5;
  --rule: #9b2c2c;
  --btn: #0b3d47;
  --btn-text: #ffffff;
  --shadow: 0 8px 24px rgba(20, 32, 43, 0.12);
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: "Segoe UI", "Liberation Sans", "Noto Sans", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.35;
  -webkit-text-size-adjust: 100%;
}

html, body, #app {
  height: 100%;
  max-height: 100dvh;
  max-height: 100vh;
  overflow: hidden;
}
#app {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-t)) calc(16px + var(--safe-r)) calc(8px + var(--safe-b)) calc(16px + var(--safe-l));
}

h1 { font-size: clamp(28px, 5vw, 52px); line-height: 1.1; margin: 0 0 12px; color: var(--teal-deep); }
h2 { font-size: clamp(24px, 4vw, 40px); line-height: 1.15; margin: 0 0 10px; color: var(--teal-deep); }

button {
  font-family: inherit;
  font-weight: 800;
  border: 3px solid var(--ink);
  border-radius: 16px;
  cursor: pointer;
  line-height: 1.15;
}

button:focus-visible {
  outline: 4px solid var(--gold-deep);
  outline-offset: 3px;
}

/* Physio reminder — every exercise screen */
.physio {
  background: var(--gold);
  color: #1a1408;
  border: 3px solid #1a1408;
  padding: 8px 16px;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 800;
  text-align: center;
  border-radius: 12px;
  margin: 0 0 8px;
  flex: 0 0 auto;
  z-index: 2;
}

/* Progress */
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  font-weight: 800;
  font-size: clamp(16px, 2vw, 20px);
  color: var(--teal);
}
.progress-bar {
  flex: 1;
  height: 16px;
  background: #e0d4c2;
  border: 2px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--teal);
  width: 0%;
  transition: width 0.25s ease;
}

/* Counter */
.counter {
  background: var(--teal);
  color: #fff;
  border-radius: 18px;
  text-align: center;
  padding: 12px 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.counter .big {
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.counter .label {
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 800;
  margin-top: 4px;
  opacity: 0.95;
}
.counter .phase {
  font-size: clamp(18px, 2.6vw, 26px);
  font-weight: 800;
  margin-top: 2px;
}

.cue {
  font-size: clamp(18px, 2.6vw, 28px);
  font-weight: 700;
  text-align: center;
  margin: 0 0 12px;
  min-height: 2.6em;
}

/* Figure stage */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef6f3;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0 0 8px;
}
.stage .figure-svg { width: 100%; height: 100%; max-height: 100%; }

/* Controls — huge, left-hand friendly */
.controls {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 10px;
  margin-top: auto;
  flex: 0 0 auto;
}
.controls button {
  min-height: 72px;
  font-size: clamp(20px, 3vw, 32px);
  padding: 12px 10px;
  color: var(--btn-text);
  background: var(--btn);
}
.controls .btn-pause {
  background: #f3d089;
  color: #1a1408;
  font-size: clamp(24px, 3.4vw, 36px);
}
.controls .btn-pause.is-paused {
  background: #1c6b4a;
  color: #fff;
}
.controls .btn-back { background: #4a5560; }
.controls .btn-next { background: #0b3d47; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.icon-btn {
  min-width: 64px;
  min-height: 56px;
  font-size: 18px;
  background: #fff;
  color: var(--ink);
  padding: 8px 14px;
}

/* Home */
.screen-home, .screen-safety, .screen-ready, .screen-done {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;
}
.kicker {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 8px;
}
.lede { font-size: clamp(18px, 2.4vw, 24px); margin: 0 0 16px; }
.streak {
  background: #fff;
  border: 3px solid var(--teal);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 800;
  color: var(--teal-deep);
  text-align: center;
  margin: 0 0 18px;
}
.btn-start, .btn-primary, .btn-ack {
  min-height: 80px;
  font-size: clamp(26px, 4vw, 40px);
  background: var(--coral);
  color: #fff;
  width: 100%;
  margin-top: auto;
  flex: 0 0 auto;
  box-shadow: var(--shadow);
}
.btn-start { background: #c44b2a; }
.home-art { flex: 1; min-height: 0; margin: 8px 0 12px; }

/* Safety */
.rules { list-style: none; margin: 0 0 16px; padding: 0; }
.rules li {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px 12px 56px;
  margin: 0 0 10px;
  position: relative;
  font-size: clamp(17px, 2.2vw, 22px);
  font-weight: 650;
}
.rules li::before {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  content: attr(data-n);
}
.rules li.call000 {
  border-color: var(--rule);
  border-width: 3px;
  background: #fdeeee;
  font-weight: 800;
  color: #3a1010;
}
.rules li.call000::before { background: var(--rule); content: "000"; font-size: 11px; width: 40px; border-radius: 8px; }

.ack {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--gold);
  border: 3px solid #1a1408;
  border-radius: 14px;
  padding: 14px;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 800;
  margin: 0 0 16px;
  cursor: pointer;
}
.ack input {
  width: 32px;
  height: 32px;
  min-width: 32px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.warn-box {
  background: #fdeeee;
  border: 3px solid var(--rule);
  color: #3a1010;
  font-weight: 800;
  font-size: clamp(18px, 2.4vw, 24px);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 12px;
  text-align: center;
}

.stand-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
}
.stand-choices button {
  min-height: 80px;
  font-size: clamp(18px, 2.4vw, 24px);
  padding: 10px;
}
.stand-choices .yes { background: var(--teal); color: #fff; }
.stand-choices .skip { background: #fff; color: var(--ink); }

/* Done / Shabash */
.screen-done {
  text-align: center;
  position: relative;
  overflow: hidden;
}
.screen-done h1 {
  font-size: clamp(36px, 7vw, 72px);
  color: var(--green);
  margin-top: 12px;
}
.screen-done .papa {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 800;
  margin: 0 0 16px;
}
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Exercise layout */
.screen-ex {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}

.ex-title {
  font-size: clamp(26px, 4.2vw, 42px);
  margin: 0 0 8px;
}

/* Wide / TV */
@media (min-width: 900px) {
  .screen-ex.wide {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 0 20px;
    max-width: 1400px;
  }
  .screen-ex.wide .physio { grid-column: 1 / -1; }
  .screen-ex.wide .progress-wrap { grid-column: 1 / -1; }
  .screen-ex.wide .stage {
    grid-row: 3;
    margin: 0;
    min-height: 0;
  }
  .screen-ex.wide .right-col {
    grid-row: 3;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
  }
  .screen-ex.wide .controls { grid-column: 1 / -1; }
  .screen-ex.wide .stage .figure-svg { max-height: none; }
}

@media (min-width: 1400px) {
  html, body { font-size: 22px; }
  .controls button { min-height: 88px; }
}

/* Landscape phone: keep buttons visible */
@media (max-height: 520px) and (orientation: landscape) {
  .stage { min-height: 140px; }
  .stage .figure-svg { max-height: 42vh; }
  .controls button { min-height: 56px; }
  .counter .big { font-size: 40px; }
}

.hidden { display: none !important; }

.screen-safety { overflow: hidden; }
.screen-safety .rules { flex: 1; min-height: 0; overflow: auto; }
.screen-done #confetti { position: fixed; }
.lede { overflow: auto; min-height: 0; }
