/* ==========================================================
   PHYSIO MIRROR  ·  style.css
   AI posture coach for home rehabilitation

   TABLE OF CONTENTS  (press Ctrl+F and search the [number])
   [1] Design tokens (colours) & base reset
   [2] Icons
   [3] Camera stage, chips & overlays
   [4] Feedback pill & score toast
   [5] Pain button
   [6] Start screen
   [7] Right control panel (layout & header)
   [8] Exercise cards & difficulty badges
   [9] Segmented controls (intensity)
   [10] Live angle & progress bar
   [11] Goal ring & phase chip
   [12] Buttons
   [13] Tips & disclaimer text
   [14] Modals: session summary & progress
   [15] Progress chart
   [16] Pain scale (0-10)
   [17] Hold timer (selector & countdown ring)
   [18] Caregiver report sheet
   [19] Contents menu (panel navigation)
   [20] Footer credit
   [21] Print styles (report to PDF)
   [22] Responsive (mobile)
   ========================================================== */

/* ---------- [1] Design tokens (colours) & base reset ---------- */
/* Soft "ins" palette: warm cream, white cards, sage green, peach, rose */
:root {
  --bg: #f7f3ee;
  --surf: #fff;
  --surf2: #f6f2ec;
  --line: #ebe5dd;
  --txt: #2b2926;
  --mut: #8f8880;
  --a: #6f9c82;
  --a-d: rgba(111, 156, 130, 0.13);
  --s: #f0b59a;
  --s-d: rgba(240, 181, 154, 0.2);
  --w: #e5645a;
  --w-d: rgba(229, 100, 90, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'DM Sans', system-ui, sans-serif;
  height: 100vh;
  display: grid;
  grid-template-columns: 7fr 3fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

/* ---------- [2] Icons ---------- */
.ic {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- [3] Camera stage, chips & overlays ---------- */
.stage {
  position: relative;
  background: #e8e2d9;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(70, 55, 40, 0.1);
}

.wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

video, 
#cv {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 18px rgba(70, 55, 40, 0.1);
}

.chip {
  position: absolute;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  gap: 8px;
  align-items: center;
}

#chipL {
  top: 16px;
  left: 16px;
}

#chipR {
  top: 16px;
  right: 16px;
  font-variant-numeric: tabular-nums;
}

#heard {
  bottom: 22px;
  left: 16px;
  display: none;
  max-width: 34%;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9c2b8;
}

.on .dot {
  background: #4caf7a;
  box-shadow: 0 0 0 4px rgba(76, 175, 122, 0.2);
  animation: bl 2s infinite;
}

@keyframes bl {
  50% {
    opacity: 0.4;
  }
}

/* ---------- [4] Feedback pill & score toast ---------- */
.fb {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 18px;
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  transition: 0.25s;
}

.fb.ok {
  color: var(--a);
}

.fb.warn {
  color: var(--w);
}

.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translate(-50%, -10px);
  text-align: center;
  padding: 14px 26px;
  border-radius: 20px;
  opacity: 0;
  transition: 0.35s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast b {
  font-family: Fraunces, serif;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  display: block;
}

.toast span {
  font-size: 13px;
  color: var(--mut);
}

/* ---------- [5] Pain button ---------- */
.painBtn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border: none;
  border-radius: 20px;
  background: var(--w);
  color: #fff;
  font: 700 16px 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(229, 100, 90, 0.4);
  transition: 0.2s;
}

.painBtn:hover {
  transform: scale(1.04);
  color: #fff;
}

.painBtn .ic {
  width: 22px;
  height: 22px;
}

.painBtn.pulse {
  animation: pu 0.5s;
}

@keyframes pu {
  50% {
    transform: scale(1.15);
  }
}

/* ---------- [6] Start screen ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(247, 243, 238, 0.88);
  backdrop-filter: blur(10px);
  text-align: center;
  padding: 24px;
}

.overlay h2 {
  font-family: Fraunces, serif;
  font-size: 42px;
  font-weight: 500;
}

.overlay p {
  color: var(--mut);
  max-width: 440px;
  font-size: 14px;
  line-height: 1.7;
}

.logo {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  background: var(--a-d);
  color: var(--a);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo .ic {
  width: 30px;
  height: 30px;
}

.tips {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--mut);
}

.tips span {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tips .ic {
  width: 15px;
  height: 15px;
  color: var(--a);
}

/* ---------- [7] Right control panel (layout & header) ---------- */
.panel {
  background: var(--surf);
  border-radius: 28px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(70, 55, 40, 0.07);
}

.head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.head .logo {
  width: 44px;
  height: 44px;
  border-radius: 15px;
}

.head .logo .ic {
  width: 22px;
  height: 22px;
}

h1 {
  font-family: Fraunces, serif;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.sub {
  color: var(--mut);
  font-size: 12px;
  margin-top: 3px;
}

.lbl {
  color: var(--mut);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lbl .ic {
  width: 14px;
  height: 14px;
}

/* ---------- [8] Exercise cards & difficulty badges ---------- */
.exs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ex {
  padding: 11px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surf);
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
  color: var(--txt);
  font-family: inherit;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: start;
}

.ex:hover {
  border-color: #d8cfc3;
}

.ex.sel {
  border-color: var(--a);
  background: var(--a-d);
}

.exi {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--surf2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a);
}

.ex.sel .exi {
  background: #fff;
}

.bd {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 99px;
  justify-self: end;
}

.b0 {
  background: var(--a-d);
  color: var(--a);
}

.b1 {
  background: var(--s-d);
  color: #c8825f;
}

.b2 {
  background: var(--w-d);
  color: var(--w);
}

.ex b {
  grid-column: 1 / -1;
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 4px;
}

.ex small {
  grid-column: 1 / -1;
  color: var(--mut);
  font-size: 10.5px;
  line-height: 1.35;
}

/* ---------- [9] Segmented controls (intensity) ---------- */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--surf2);
  padding: 4px;
  border-radius: 14px;
}

.seg button {
  border: none;
  background: transparent;
  padding: 9px 6px;
  font-size: 12px;
  border-radius: 11px;
}

.seg button.sel {
  background: #fff;
  color: var(--a);
  box-shadow: 0 2px 8px rgba(70, 55, 40, 0.1);
}

.hint {
  font-size: 11px;
  color: var(--mut);
  margin-top: 2px;
}

/* ---------- [10] Live angle & progress bar ---------- */
.angle {
  font-family: Fraunces, serif;
  font-size: 54px;
  font-weight: 500;
  color: var(--a);
  line-height: 1;
}

.bar {
  height: 7px;
  border-radius: 99px;
  background: var(--surf2);
  overflow: hidden;
  margin-top: 12px;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--a), var(--s));
  border-radius: 99px;
  transition: width 0.1s;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.tile {
  background: var(--surf2);
  border-radius: 16px;
  padding: 11px 12px;
}

.tile .lbl {
  margin: 0 0 4px;
  font-size: 9.5px;
  letter-spacing: 1px;
}

.tile .v {
  font-family: Fraunces, serif;
  font-size: 24px;
  font-weight: 600;
}

/* ---------- [11] Goal ring & phase chip ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ring {
  position: relative;
  width: 124px;
  height: 124px;
  flex: none;
}

.ring svg {
  transform: rotate(-90deg);
}

.ring .c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring .n {
  font-family: Fraunces, serif;
  font-size: 38px;
  font-weight: 600;
  line-height: 1;
}

.ring .t {
  font-size: 11.5px;
  color: var(--mut);
}

.goal {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--mut);
}

.goal button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--s-d);
  color: #c8825f;
}

/* ---------- [12] Buttons ---------- */
.btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button {
  padding: 11px;
  background: var(--surf);
  color: var(--txt);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  font: 600 12.5px 'DM Sans', sans-serif;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

button:hover {
  border-color: var(--a);
  color: var(--a);
}

button.act {
  background: var(--a-d);
  border-color: var(--a);
  color: var(--a);
}

.pri {
  background: var(--a);
  color: #fff;
  border: none;
  font-size: 15px;
  padding: 14px 34px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(111, 156, 130, 0.4);
}

.pri:hover {
  color: #fff;
  filter: brightness(1.06);
}

.span2 {
  grid-column: 1 / -1;
}

/* ---------- [13] Tips & disclaimer text ---------- */
.tipTxt {
  font-size: 11px;
  color: var(--mut);
  line-height: 1.6;
  background: var(--surf2);
  padding: 10px 12px;
  border-radius: 14px;
}

.warnTxt {
  font-size: 10.5px;
  color: #b5aea5;
  line-height: 1.5;
}

/* ---------- [14] Modals: session summary & progress ---------- */
#modal, 
#sum {
  position: fixed;
  inset: 0;
  background: rgba(43, 41, 38, 0.35);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}

#modal.open, 
#sum.open {
  display: flex;
}

.mcard {
  background: var(--surf);
  border-radius: 28px;
  padding: 28px;
  width: min(680px, 100%);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(43, 41, 38, 0.25);
}

.mcard h3 {
  font-family: Fraunces, serif;
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0;
}

/* ---------- [15] Progress chart ---------- */
svg text {
  fill: var(--mut);
  font: 11px 'DM Sans', sans-serif;
}

.bar1 {
  fill: var(--a);
  opacity: 0.85;
}

.bar1.today {
  fill: var(--s);
}

.ln {
  stroke: #4d6f5c;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pt {
  fill: #4d6f5c;
}

.pm {
  fill: var(--w);
}

svg text.pmt {
  fill: #fff;
  font-weight: 700;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--mut);
  margin-top: 6px;
}

.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

.pmList {
  font-size: 12.5px;
  color: var(--mut);
  line-height: 1.8;
  margin-top: 12px;
}

.pmList b {
  color: var(--w);
}

.mbtn {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.mbtn button {
  flex: 1;
}

/* ---------- [16] Pain scale (0-10) ---------- */
.pain {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
  margin: 10px 0 4px;
}

.pain button {
  padding: 10px 0;
  font-size: 13px;
  border-radius: 10px;
}

.pain button.sel {
  background: var(--a);
  color: #fff;
  border-color: var(--a);
}

/* ---------- [17] Hold timer (selector & countdown ring) ---------- */
.seg4 {
  grid-template-columns: repeat(4, 1fr);
}

#hold {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 150px;
  height: 150px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: 0.2s;
}

#hold.show {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
}

#hold svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

#hold b {
  font-family: Fraunces, serif;
  font-size: 56px;
  line-height: 1;
  position: relative;
}

#hold span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mut);
  position: relative;
}

/* ---------- [18] Caregiver report sheet ---------- */
#repModal {
  position: fixed;
  inset: 0;
  background: rgba(43, 41, 38, 0.35);
  backdrop-filter: blur(8px);
  display: none;
  z-index: 20;
  padding: 16px;
  overflow: auto;
}

#repModal.open {
  display: block;
}

.rtools {
  width: min(820px, 100%);
  margin: 0 auto 12px;
  display: flex;
  gap: 8px;
}

.rtools button {
  flex: 1;
  background: #fff;
}

.sheet {
  width: min(820px, 100%);
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 34px 38px;
  box-shadow: 0 30px 80px rgba(43, 41, 38, 0.25);
  color: var(--txt);
}

.sh-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 2px solid var(--a);
  padding-bottom: 16px;
}

.sheet h2 {
  font-family: Fraunces, serif;
  font-size: 27px;
  font-weight: 600;
}

.sheet h4 {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--mut);
  margin: 22px 0 8px;
}

.sheet input, 
.sheet textarea {
  width: 100%;
  border: none;
  border-bottom: 1px dashed #d8cfc3;
  background: transparent;
  font: 500 14px 'DM Sans', sans-serif;
  color: var(--txt);
  padding: 6px 0;
  outline: none;
  resize: none;
}

.sheet .stats {
  margin: 14px 0;
}

.sheet table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sheet th {
  text-align: left;
  font-size: 11px;
  color: var(--mut);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}

.sheet td {
  padding: 8px;
  border-bottom: 1px solid var(--surf2);
}

.sheet ul {
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.8;
}

.sheet li.att {
  color: var(--w);
  font-weight: 600;
}

.sheet .fine {
  font-size: 10.5px;
  color: var(--mut);
  margin-top: 20px;
  line-height: 1.6;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------- [19] Contents menu (panel navigation) ---------- */
/* Minimal text tabs: one row, evenly spaced, green underline on the current section */
.toc {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -22px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.toc a {
  padding: 13px 4px 12px;
  margin-bottom: -1px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
  user-select: none;
}

.toc a:hover {
  color: var(--txt);
}

.toc a.cur {
  color: var(--a);
  border-bottom-color: var(--a);
}

.panel [id^="sec-"] {
  scroll-margin-top: 56px;
}

/* ---------- [20] Footer credit ---------- */
.foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--mut);
  letter-spacing: 0.3px;
}

.foot b {
  color: var(--txt);
  letter-spacing: 1.5px;
}

.foot .ic {
  width: 14px;
  height: 14px;
  color: var(--a);
}

/* ---------- [21] Print styles (report to PDF) ---------- */
@media print {
  @page {
    margin: 12mm;
  }
  
  body {
    display: block;
    height: auto;
    overflow: visible;
    background: #fff;
    padding: 0;
  }
  
  body > *:not(#repModal):not(svg) {
    display: none !important;
  }
  
  #repModal {
    position: static;
    background: none;
    padding: 0;
    overflow: visible;
    backdrop-filter: none;
  }
  
  .rtools {
    display: none;
  }
  
  .sheet {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    width: 100%;
  }
  
  .sheet input, 
  .sheet textarea {
    border-bottom: none;
  }
  
  .sheet, 
  .sheet * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ---------- [22] Responsive (mobile) ---------- */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: 60vh auto auto;
    overflow: auto;
    height: auto;
  }
  
  .painBtn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* ==========================================================
   Made by CELESTINA
   ========================================================== */