/* Shared by the patient pages: the plan and the community. */
:root {
  --bg: #0b0f1a; --panel: #141a28; --panel2: #1b2233; --line: #2a3246;
  --text: #eef2f8; --text2: #aab3c5; --text3: #7c869b;
  --teal: #2ee6c4; --blue: #5b8cff; --amber: #ffb547; --coral: #ff6b6b; --violet: #a77bff;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(1400px 700px at 50% -20%, #13263d 0%, var(--bg) 60%) fixed; color: var(--text);
       font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
a { color: var(--teal); }
header.top { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
header.top .brand { font-weight: 800; font-size: 18px; white-space: nowrap; } header.top .brand span { color: #7c869b; font-weight: 600; }
header.top .spacer { flex: 1; }
main { max-width: 1040px; margin: 0 auto; padding: 28px 24px 60px; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -.4px; }
h2 { font-size: 19px; margin: 0 0 14px; }
.sub { color: var(--text2); margin: 0 0 22px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; margin-bottom: 18px; }
.narrow { max-width: 560px; margin: 40px auto; }
input { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
        padding: 12px 14px; font: inherit; }
input:focus { outline: 2px solid rgba(46,230,196,.45); border-color: transparent; }
/* iPhone Safari gives a date field a minimum width of its own, wider than a phone's card. */
input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; min-height: 50px; }
input::-webkit-date-and-time-value { text-align: left; }
label.f { display: block; font-size: 12px; color: var(--text3); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .6px; }
button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 10px 18px; }
button.primary { background: linear-gradient(90deg, var(--teal), var(--blue)); color: #06101c; border: 0; font-weight: 700; }
button.link { background: none; border: 0; color: var(--teal); padding: 0; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--line);
       background: var(--panel2); margin-top: 10px; cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.row:hover { border-color: var(--teal); }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; background: linear-gradient(135deg, var(--teal), var(--blue));
          color: #06101c; font-weight: 800; display: grid; place-items: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.muted { color: var(--text3); font-size: 14px; }
.verified { color: var(--teal); font-size: 13px; font-weight: 600; }
.hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; }
.day { font-size: 54px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.day small { font-size: 20px; color: var(--text2); font-weight: 600; letter-spacing: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
/* The phases, each a button that shows its exercises. */
.timeline { display: flex; gap: 6px; margin-top: 18px; position: relative; }
.seg { flex: 1; min-width: 0; display: block; background: none; border: 0; border-radius: 10px; padding: 6px 2px 4px;
       color: inherit; text-align: left; }
.seg .bar { display: block; height: 10px; border-radius: 99px; background: var(--c); opacity: .3; transition: opacity .15s; }
.seg.done .bar { opacity: .7; }
.seg.now .bar { opacity: 1; }
.seg:hover .bar { opacity: .95; }
.seg.viewing .bar { opacity: 1; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--c); }
.seg:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.seg .lbl { display: block; font-size: 12px; color: var(--text3); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg:hover .lbl { color: var(--text2); }
.seg.viewing .lbl { color: var(--text); font-weight: 700; }
.grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.card-head .play { padding: 8px 16px; font-size: 15px; white-space: nowrap; flex: none; }
.ex { display: grid; grid-template-columns: 144px 1fr; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); align-items: start; }
.ex:first-of-type { border-top: 0; }
/* An exercise's figure; it opens the exercise full screen. */
.fig { width: 144px; height: 144px; border-radius: 22px; background: #0f1422; display: grid; place-items: center; overflow: hidden;
       padding: 0; border: 1px solid transparent; position: relative; cursor: zoom-in; }
.fig:hover { border-color: var(--line); }
.fig:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.fig::after { content: "⤢"; position: absolute; right: 8px; bottom: 6px; font-size: 15px; color: var(--text3); opacity: 0; transition: opacity .15s; }
.fig:hover::after, .fig:focus-visible::after { opacity: 1; }
.fig img, .fig video { width: 100%; height: 100%; object-fit: contain; display: block; }
.fig .none { font-size: 28px; opacity: .35; }
.ex .name { font-weight: 700; font-size: 17px; }
.dose { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; margin: 4px 0 6px; }
.ex .detail { color: var(--text2); font-size: 15px; }
.prec { padding: 12px 14px; border-radius: 14px; background: var(--panel2); margin-top: 10px; border-left: 3px solid var(--line); }
.prec.critical { border-left-color: var(--coral); }
.prec .t { font-weight: 700; } .prec .d { color: var(--text2); font-size: 15px; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--text3); font-weight: 400; }
details[open] summary::after { content: "–"; }
details .a { color: var(--text2); margin-top: 8px; }
.about p { color: var(--text2); font-size: 15px; margin: 0 0 10px; }
.about .leaflet { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 12px; border-radius: 14px;
                  background: var(--panel2); border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.about .leaflet:hover { border-color: var(--teal); }
.about .leaflet > span:first-child { font-size: 22px; }
.prod { padding: 12px 0; border-top: 1px solid var(--line); } .prod:first-of-type { border-top: 0; }
.prod .n { font-weight: 700; } .prod .b { color: var(--text3); font-size: 14px; }
.prod .note { color: var(--text2); font-size: 15px; margin-top: 4px; }
.notice { font-size: 14px; color: var(--text2); background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.3);
          border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; }
.phase-all .ex { grid-template-columns: 104px 1fr; } .phase-all .fig { width: 104px; height: 104px; border-radius: 18px; }
.settings { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 8px; }
.err { color: var(--coral); }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } .hero { grid-template-columns: 1fr; } }
/* On a phone five phases don't fit across with their names: they scroll sideways instead,
   each name in full, rather than being cut to "Streng…". */
@media (max-width: 520px) {
  .timeline { overflow-x: auto; margin: 18px -22px 0; padding: 0 22px 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .timeline::-webkit-scrollbar { display: none; }
  .seg { flex: 0 0 auto; min-width: 108px; scroll-snap-align: start; }
  .seg .lbl { overflow: visible; text-overflow: clip; }
}
@media (max-width: 520px) { main { padding: 20px 16px 48px; } .day { font-size: 44px; } .ex { grid-template-columns: 112px 1fr; gap: 14px; }
  .fig { width: 112px; height: 112px; border-radius: 18px; } .phase-all .ex { grid-template-columns: 88px 1fr; }
  .phase-all .fig { width: 88px; height: 88px; border-radius: 16px; } .card-head { flex-direction: column; gap: 0; }
  .card-head .play { margin: 12px 0 6px; } }
@media print { body { background: #fff; color: #000; } header.top, .settings, .noprint, .player { display: none !important; } .card { border-color: #ccc; background: #fff; } }

/* Going through the exercises one at a time, each filling the screen (plan.js openPlayer). */
body.playing { overflow: hidden; }
.player { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; gap: 12px;
          padding: max(16px, env(safe-area-inset-top)) 24px max(16px, env(safe-area-inset-bottom)); overflow-y: auto; }
.pl-view { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pl-view > * { width: 100%; max-width: 1100px; margin: 0 auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pl-top { display: flex; align-items: center; gap: 12px; }
.pl-count { flex: 1; color: var(--text2); font-size: 15px; }
.pl-close { width: 44px; height: 44px; padding: 0; font-size: 18px; flex: none; }
.pl-steps { display: flex; gap: 4px; }
.pl-steps button { flex: 1; min-width: 0; height: 22px; padding: 0; border: 0; border-radius: 0; background: none; }
.pl-steps button::after { content: ""; display: block; height: 6px; border-radius: 99px; background: var(--line); }
.pl-steps button.done::after { background: var(--c); opacity: .45; }
.pl-steps button.on::after { background: var(--c); }
.pl-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 36px; align-items: center; padding: 8px 0; }
.pl-stage { position: relative; width: min(100%, 68vh); aspect-ratio: 1; justify-self: center; background: #0f1422; border-radius: 28px;
            overflow: hidden; display: grid; place-items: center; }
.pl-stage video, .pl-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pl-stage .none { font-size: 48px; opacity: .3; }
.pl-motion { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.pl-name { font-size: 32px; line-height: 1.15; margin: 0 0 10px; }
.pl-text .dose { font-size: 15px; padding: 4px 12px; }
.pl-detail { font-size: 19px; line-height: 1.55; color: var(--text2); margin: 12px 0 0; }
.pl-nav { display: flex; justify-content: space-between; gap: 12px; }
.pl-nav button { min-height: 50px; padding: 12px 26px; font-weight: 700; }
@media (max-width: 760px) {
  .player { padding-left: 16px; padding-right: 16px; }
  .pl-body { grid-template-columns: 1fr; gap: 16px; align-content: start; }
  .pl-stage { width: min(100%, 50vh); }
  .pl-name { font-size: 25px; } .pl-detail { font-size: 17px; }
  .pl-nav button { flex: 1; }
}
.wm { font-weight: 600; letter-spacing: -.02em; color: #eef2f8; }
.wm em { font-style: normal; font-weight: 800; color: transparent;
         background: linear-gradient(90deg, #2de2c4 0%, #4c8dff 55%, #8b5cf6 100%);
         -webkit-background-clip: text; background-clip: text; }
/* The account: signed in or not, on every patient page. */
.acct { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text3); }
.acct button.link { font-size: 14px; }
.acct .who { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-note { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text2);
              background: rgba(46,230,196,.07); border: 1px solid rgba(46,230,196,.25); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; }
textarea { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
           padding: 12px 14px; font: inherit; resize: vertical; min-height: 96px; }
textarea:focus { outline: 2px solid rgba(46,230,196,.45); border-color: transparent; }
select { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; }
nav.tabs { display: flex; gap: 18px; }
nav.tabs a { color: var(--text2); text-decoration: none; font-size: 15px; }
nav.tabs a.on { color: var(--text); font-weight: 700; }
@media (max-width: 620px) { header.top { flex-wrap: wrap; padding: 12px 16px; } .acct .who { max-width: 140px; } }
