
/* Layout: two-pane chart room — patient index on the left, one patient's chart (summary + chronological record) on the right; stacks on phones. */
:root {
  --bg: #f3f5f4;
  --paper: #ffffff;
  --ink: #1d2a2c;
  --muted: #5f6f72;
  --line: #d9e0de;
  --soft: #e8eeec;
  --ai: #2c4f7c;          /* 藍: 継続カルテ, primary actions */
  --ai-soft: #e3eaf4;
  --shu: #b4472e;         /* 朱: 新規カルテ */
  --shu-soft: #f7e6e1;
  --moegi: #4f7a52;       /* 萌葱: 対応履歴 */
  --moegi-soft: #e5efe4;
  --warn: #a5660b;
  --warn-soft: #fbefd9;
  --f-display: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141a1b; --paper: #1c2425; --ink: #e4ebea; --muted: #9aa9aa; --line: #2f3a3b; --soft: #243032;
  --ai: #8fb0de; --ai-soft: #22324a; --shu: #e9876f; --shu-soft: #3d2620; --moegi: #93bf95; --moegi-soft: #22331f;
  --warn: #e6b05c; --warn-soft: #3a2c14; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #141a1b; --paper: #1c2425; --ink: #e4ebea; --muted: #9aa9aa; --line: #2f3a3b; --soft: #243032;
  --ai: #8fb0de; --ai-soft: #22324a; --shu: #e9876f; --shu-soft: #3d2620; --moegi: #93bf95; --moegi-soft: #22331f;
  --warn: #e6b05c; --warn-soft: #3a2c14; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.6; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; }
.side { border-right: 1px solid var(--line); background: var(--paper); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding-block: 18px 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; display: grid; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.brand h1 { margin: 0; font-family: var(--f-display); font-size: 22px; letter-spacing: .04em; cursor: pointer; }
.brand span { font-size: 12px; color: var(--muted); }
.search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.plist { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.plist li button { width: 100%; text-align: left; border: 0; background: none; padding-block: 11px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; border-bottom: 1px solid var(--soft); display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.plist li button:hover { background: var(--soft); }
.plist li button[aria-current="true"] { background: var(--ai-soft); box-shadow: inset 3px 0 0 var(--ai); }
.pname { font-weight: 700; }
.pkana { font-size: 12px; color: var(--muted); grid-column: 1; }
.pmeta { font-size: 12px; color: var(--muted); text-align: right; }
.flag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); font-weight: 700; margin-left: 6px; vertical-align: 1px; }
.side-foot { padding: 12px 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.main { overflow-y: auto; min-width: 0; }
.main-inner { max-width: 980px; padding-block: 24px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); margin: 0 auto; display: grid; gap: 22px; }

.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 8px 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--ai); border-color: var(--ai); color: var(--paper); }
.btn.new { color: var(--shu); border-color: var(--shu); }
.btn.cont { color: var(--ai); border-color: var(--ai); }
.btn.log { color: var(--moegi); border-color: var(--moegi); }
.btn.danger { color: var(--shu); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.small { padding: 4px 10px; font-size: 13px; }

.banner { padding: 10px 14px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.back { display: none; }

/* patient header */
.phead { display: grid; gap: 14px; }
.phead-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.chartno { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.phead h2 { margin: 0; font-family: var(--f-display); font-size: 30px; line-height: 1.2; letter-spacing: .03em; }
.phead h2 small { font-family: var(--f-body); font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 10px; letter-spacing: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.fact { background: var(--paper); padding: 10px 14px; min-width: 0; }
.fact dt { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.fact dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.alert { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; border-radius: 6px; background: var(--shu-soft); color: var(--shu); font-size: 14px; }
.alert b { white-space: nowrap; }
.caution-box { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 10px 14px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); border-left: 4px solid var(--warn); font-size: 14px; margin-bottom: 4px; }
.caution-box b { white-space: nowrap; }
.caution-box > div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ctag { background: var(--paper); border: 1px solid currentColor; border-radius: 999px; padding: 1px 10px; font-size: 13px; font-weight: 700; }
.cnote { white-space: pre-wrap; font-size: 13.5px; }
.cflag { color: var(--warn); font-size: 13px; margin-left: 6px; }
.ccheck { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; min-width: 0; }
.panel h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .1em; color: var(--muted); font-weight: 500; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

/* timeline */
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.tl-head h3 { margin: 0; font-family: var(--f-display); font-size: 20px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.entry { display: grid; grid-template-columns: 92px 18px minmax(0, 1fr); gap: 0 12px; }
.entry .when { text-align: right; padding-top: 12px; font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.entry .when b { display: block; color: var(--ink); font-weight: 500; }
.rail { position: relative; }
.rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.rail::after { content: ""; position: absolute; left: 3px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--k); }
.card { margin-block: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.kind { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 3px; color: var(--k); background: var(--ks); }
.k-new { --k: var(--shu); --ks: var(--shu-soft); }
.k-cont { --k: var(--ai); --ks: var(--ai-soft); }
.k-log { --k: var(--moegi); --ks: var(--moegi-soft); }
.card-title { font-weight: 700; margin-top: 4px; }
.soap { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px 10px; margin: 8px 0 0; font-size: 14px; }
.soap dt { font-family: var(--f-mono); font-weight: 500; color: var(--k); }
.soap dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.soap.wide { grid-template-columns: 7.5em minmax(0, 1fr); }
.soap.wide dt { font-family: var(--f-body); font-size: 12px; padding-top: 2px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.card-foot .spacer { flex: 1; }
.nrs { font-family: var(--f-mono); font-size: 12px; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; }
.confirm { display: inline-flex; gap: 6px; align-items: center; color: var(--shu); }

/* dashboard */
.dash-title { font-family: var(--f-display); font-size: 26px; margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--soft); }
.list li:first-child { border-top: 0; }
.list button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 2px; display: flex; gap: 10px; align-items: baseline; }
.list button:hover { color: var(--ai); }
.list .d { font-family: var(--f-mono); font-size: 13px; color: var(--muted); min-width: 5.5em; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.welcome { display: grid; gap: 10px; padding: 28px; text-align: left; }
.welcome h2 { margin: 0; font-family: var(--f-display); font-size: 24px; }
.welcome ol { margin: 0; padding-left: 1.3em; color: var(--muted); }

/* sparkline */
.spark { width: 100%; height: 70px; display: block; }
.spark text { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); }

/* dialog */
dialog { border: 0; padding: 0; border-radius: 10px; background: var(--paper); color: var(--ink); width: min(980px, calc(100vw - 24px)); max-height: calc(100% - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20, 28, 30, .45); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dlg-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-head h2 { margin: 0; font-family: var(--f-display); font-size: 20px; }
.dlg-body { padding: 16px 20px; overflow-y: auto; display: grid; gap: 14px; }
.dlg-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; align-items: center; }
.dlg-foot .msg { margin-right: auto; font-size: 13px; color: var(--shu); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
label.f > span b { color: var(--shu); font-weight: 500; }
label.f input, label.f select, label.f textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font-size: 15px; }
label.f textarea { min-height: 70px; resize: vertical; }
.soap-in { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; }
.soap-in .letter { font-family: var(--f-mono); font-size: 20px; font-weight: 500; color: var(--ai); text-align: center; padding-top: 22px; }
.prev { background: var(--ai-soft); border-radius: 8px; padding: 12px 14px; font-size: 14px; display: grid; gap: 6px; }
.prev-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.prev .soap { --k: var(--ai); margin: 0; }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; padding: 0; }
.range output { font-family: var(--f-mono); font-size: 18px; min-width: 2ch; color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.sect { font-size: 12px; letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }

/* body chart (drawing) */
.bc-field { display: grid; gap: 8px; }
.bc-thumb { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; padding: 0; cursor: pointer; }
.bc-thumb canvas { width: 100%; height: 100%; display: block; }
.bc-thumb .hint { position: absolute; right: 8px; bottom: 8px; font-size: 12px; background: rgba(255,255,255,.92); color: #2c4f7c; padding: 2px 8px; border-radius: 4px; border: 1px solid #c9d4e3; }
.card .bc-thumb { margin-top: 10px; }
.cr { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.cr button { display: grid; gap: 2px; justify-items: center; align-content: start; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 6px 2px; min-height: 58px; }
.cr button b { font-family: var(--f-mono); font-size: 17px; font-weight: 500; }
.cr button small { font-size: 10px; line-height: 1.25; color: var(--muted); text-align: center; }
.cr button[aria-pressed="true"] { background: var(--ai); border-color: var(--ai); color: var(--paper); }
.cr button[aria-pressed="true"] small { color: var(--paper); }
.cr-note { font-size: 12px; color: var(--muted); }

#ed { inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border-radius: 0; box-shadow: none; }
.ed { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.ed-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding-block: 8px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); background: var(--paper); border-bottom: 1px solid var(--line); }
.ed-bar.bottom { border-bottom: 0; border-top: 1px solid var(--line); padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
.ed-title { font-family: var(--f-display); font-size: 17px; margin-right: auto; }
.tg { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tg > .lab { font-size: 11px; color: var(--muted); letter-spacing: .06em; margin-right: 2px; }
.tool { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 5px 9px; font-size: 13px; line-height: 1.2; }
.tool .sw { width: 13px; height: 13px; border-radius: 50%; background: var(--c); border: 1px solid rgba(0,0,0,.25); flex: none; }
.tool .sw.sq { border-radius: 2px; opacity: .75; }
.tool[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--soft); font-weight: 700; }
.tool:disabled { opacity: .4; cursor: default; }
.ed-bar select, .ed-bar input[type=range] { font-size: 13px; }
.ed-bar select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.vp { flex: 1; position: relative; overflow: hidden; touch-action: none; background: var(--soft); min-height: 0; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.stage img, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; -webkit-user-drag: none; user-select: none; pointer-events: none; }
.stage.hand { cursor: grab; }
.vp-zoom { position: absolute; right: max(10px, env(safe-area-inset-right, 0px)); bottom: 10px; display: flex; gap: 4px; }
.vp-zoom .tool { background: var(--paper); }
.tool .tx { font-size: 13px; line-height: 1; }
.ed-text { position: absolute; z-index: 3; margin: 0; padding: 2px 6px; min-width: 120px; max-width: 70%; resize: none; overflow: hidden; border: 1.5px dashed #1d1d1f; border-radius: 4px; background: rgba(255,255,255,.88); color: #1d1d1f; font-family: "Zen Kaku Gothic New", sans-serif; font-weight: 700; line-height: 1.25; white-space: pre; }
.ed-info { font-size: 12px; color: var(--muted); }
.ed-confirm { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--shu); }

/* self-care: practitioner side */
.sc-list { display: grid; gap: 12px; }
.sc-list:empty { display: none; }
.sc-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 10px; background: var(--bg); }
.sc-item-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--moegi); font-weight: 700; }
.sc-video { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.sc-video .ok { color: var(--moegi); font-weight: 700; }
.sc-video .sc-vmsg { color: var(--muted); }
.sc-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sc-tags { margin-top: 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.sc-tags b { color: var(--moegi); font-weight: 700; margin-right: 8px; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--soft); }
.link-row:first-child { border-top: 0; }
.link-row img { width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--soft); }
.link-row .nm { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 3px; background: var(--soft); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.badge.live { background: var(--moegi-soft); color: var(--moegi); }
.steps-note { margin: 0; padding-left: 1.2em; font-size: 13px; line-height: 1.8; color: var(--muted); }

/* self-care: patient view (also used for the practitioner's preview) */
/* patient view: KERN brand — charcoal, monochrome, quiet serif wordmark */
.pv {
  --pv-bg: #1b1c1c; --pv-card: #232426; --pv-field: #1a1b1b; --pv-ink: #ecebe8; --pv-muted: #8f9093; --pv-line: #36383b;
  --pv-hi: #c3c5c8; --pv-hi-ink: #1b1c1c; --pv-soft: #2c2e31; --pv-warm: #f2eee6; --pv-amber: #d8c2a2; --pv-amber-soft: #2b2722;
  --pv-serif: "Cormorant Garamond", "Shippori Mincho", "Times New Roman", serif;
  --pv-latin: "Jost", "Zen Kaku Gothic New", sans-serif;
  background: var(--pv-bg); color: var(--pv-ink); min-height: 100%; line-break: strict; color-scheme: dark;
}
.pv h1 { font-family: var(--f-body); font-weight: 700; font-size: 24px; line-height: 1.4; margin: 0; letter-spacing: .08em; text-wrap: balance; }
.pv-sub { margin: 6px 0 0; color: var(--pv-muted); font-size: 14px; letter-spacing: .04em; }
.pv-label { font-family: var(--pv-latin); font-size: 11.5px; letter-spacing: .16em; color: var(--pv-muted); font-weight: 400; }
/* brand */
.pv-brand { display: flex; align-items: center; gap: 14px; }
.pv-logo { display: block; height: 44px; width: auto; }
.pv-word { font-family: var(--pv-serif); font-weight: 600; font-size: 26px; letter-spacing: .2em; line-height: 1; color: var(--pv-warm); }
.pv-tag { font-family: var(--pv-latin); font-weight: 300; font-size: 11px; letter-spacing: .12em; color: var(--pv-muted); margin-top: 6px; }
/* hero */
.pv-hello { margin: 0 0 4px; font-size: 14px; color: var(--pv-muted); letter-spacing: .06em; }
.pv-hello:empty { display: none; }
/* shared card */
.pv-next, .pv-today, .pv-card, .pv-login, .pv-empty { background: var(--pv-card); border: 1px solid var(--pv-line); border-radius: 18px; }
/* next appointment */
.pv-next { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.pv-cal { flex: none; width: 62px; border: 1px solid var(--pv-line); border-radius: 12px; text-align: center; display: grid; padding: 6px 0; background: var(--pv-field); }
.pv-cal span:first-child { font-size: 11.5px; color: var(--pv-muted); letter-spacing: .08em; }
.pv-cal b { font-family: var(--pv-latin); font-weight: 300; font-size: 28px; line-height: 1.1; color: var(--pv-warm); }
.pv-cal span:last-child { font-size: 11px; color: var(--pv-muted); }
.pv-next > div:last-child b { font-size: 18px; font-weight: 700; display: block; margin-top: 4px; letter-spacing: .04em; }
.pv-next p { margin: 2px 0 0; color: var(--pv-muted); font-size: 12.5px; }
/* today */
.pv-today { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; padding: 18px; }
.pv-ring { --p: 0; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(closest-side, var(--pv-card) 88%, transparent 89%), conic-gradient(var(--pv-warm) calc(var(--p) * 1%), var(--pv-soft) 0); }
.pv-ring b { font-family: var(--pv-latin); font-weight: 300; font-size: 18px; font-variant-numeric: lining-nums; color: var(--pv-warm); }
.pv-today-text p { margin: 4px 0 0; font-size: 14px; }
.pv-chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.pv-chip { border: 1px solid var(--pv-line); background: var(--pv-field); color: var(--pv-ink); border-radius: 999px; padding: 8px 15px; font-size: 14px; }
.pv-chip.on { background: var(--pv-hi); border-color: var(--pv-hi); color: var(--pv-hi-ink); font-weight: 700; }
/* history */
.pv-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--pv-card); border: 1px solid var(--pv-line); border-radius: 999px; scrollbar-width: none; }
.pv-tabs::-webkit-scrollbar { display: none; }
.pv-tab { flex: none; border: 0; background: transparent; color: var(--pv-muted); font-size: 13.5px; padding: 8px 15px; border-radius: 999px; }
.pv-tab[aria-selected="true"] { background: var(--pv-hi); color: var(--pv-hi-ink); font-weight: 700; }
.pv-visit { display: flex; flex-direction: column; gap: 16px; }
.pv-note { border-left: 2px solid var(--pv-warm); padding: 4px 0 4px 16px; }
.pv-note span { font-family: var(--pv-latin); font-size: 11.5px; letter-spacing: .16em; color: var(--pv-muted); }
.pv-note p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
/* exercise cards */
.pv-card { overflow: hidden; }
.pv-card.old { opacity: .85; }
.pv-video { display: block; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; background: #000; }
.pv-novideo { aspect-ratio: 16 / 9; max-width: 100%; display: grid; place-items: center; background: var(--pv-field); color: var(--pv-muted); font-size: 13px; padding: 12px; text-align: center; }
.pv-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.pv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; }
.pv-num { font-family: var(--pv-latin); font-weight: 300; font-size: 15px; color: var(--pv-warm); letter-spacing: .08em; margin-right: 4px; }
.pv-area, .pv-dose { border: 1px solid var(--pv-line); color: var(--pv-muted); border-radius: 999px; padding: 2px 11px; overflow-wrap: anywhere; }
.pv-dose { color: var(--pv-ink); }
.pv-body h3 { font-size: 19px; font-weight: 700; margin: -2px 0 0; line-height: 1.45; letter-spacing: .04em; overflow-wrap: anywhere; }
.pv-steps { list-style: none; margin: 0; padding: 0; counter-reset: st; display: grid; gap: 9px; }
.pv-steps li { counter-increment: st; display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; font-size: 15px; overflow-wrap: anywhere; }
.pv-steps li::before { content: counter(st); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--pv-line); color: var(--pv-warm); font-family: var(--pv-latin); font-weight: 300; font-size: 13px; }
.pv-caution { display: flex; gap: 10px; align-items: baseline; background: var(--pv-amber-soft); color: var(--pv-amber); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.pv-caution b { flex: none; font-size: 12px; letter-spacing: .1em; }
.pv-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pv-tick { flex: 1 1 180px; border: 1px solid var(--pv-hi); background: transparent; color: var(--pv-ink); font-size: 15px; font-weight: 700; border-radius: 14px; padding: 12px 16px; letter-spacing: .04em; }
.pv-tick.on { background: var(--pv-hi); color: var(--pv-hi-ink); }
.pv-link { flex: 1 1 140px; text-align: center; border-radius: 14px; padding: 12px 16px; background: var(--pv-field); color: var(--pv-ink); border: 1px solid var(--pv-line); text-decoration: none; font-size: 15px; }
.pv-empty { padding: 24px 20px; color: var(--pv-muted); text-align: center; }
.pv .banner { border-radius: 12px; }
/* motto footer */
/* login */
.pv-login { display: grid; gap: 16px; padding: 26px 22px 22px; }
.pv-login label.f { gap: 10px; }
.pv-login label.f span { color: var(--pv-ink); font-size: 15px; font-weight: 500; }
.pv-login input:not([type=checkbox]) { font-size: 17px; letter-spacing: .06em; background: var(--pv-field); border: 1px solid var(--pv-line); border-radius: 14px; padding: 15px 16px; color: var(--pv-ink); }
.pv-login input::placeholder { color: var(--pv-muted); }
.pv-login input:not([type=checkbox]):focus { outline: 1px solid var(--pv-hi); outline-offset: 0; border-color: var(--pv-hi); }
.pv-login .check { color: var(--pv-muted); font-size: 13px; }
.pv-login input[type=checkbox] { accent-color: var(--pv-hi); }
.pv-go { border: 0; background: var(--pv-hi); color: var(--pv-hi-ink); font-size: 17px; font-weight: 700; letter-spacing: .12em; border-radius: 16px; padding: 16px; margin-top: 2px; }
.pv-go:disabled { opacity: .6; }
.pv-help { margin: 4px 0 0; color: var(--pv-muted); font-size: 13px; line-height: 1.8; }
.pv-err { margin: 0; min-height: 1.2em; color: #e8a08a; font-size: 14px; }
.pv-err:empty { display: none; }
.pv-previewbar { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: #f3e3b5; color: #3b2f12; font-size: 13px; box-shadow: 0 -4px 14px rgb(0 0 0 / .3); }
.pv-previewbar button { border: 0; background: #3b2f12; color: #fff; border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 700; }
body.pv:has(#pvBar) #pv { padding-bottom: 72px; }
/* website shell */
.pv-site { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pv-banner { margin: 12px 16px 0; }
.pv-nav { position: sticky; top: 0; z-index: 20; background: rgb(27 28 28 / .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--pv-line); }
.pv-nav-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
.pv-nav-in > .pv-brand { margin-right: auto; }
.pv-brand.sm .pv-logo { height: 34px; }
.pv-brand.sm .pv-word { font-size: 21px; }
.pv-brand.sm .pv-tag { font-size: 10px; margin-top: 4px; }
.pv-links { display: none; gap: 2px; }
.pv-navlink { border: 0; background: none; color: var(--pv-muted); font-family: var(--pv-latin); font-size: 12px; letter-spacing: .22em; padding: 8px 12px; }
.pv-navlink:hover { color: var(--pv-ink); }
@media (min-width: 600px) { .pv-links { display: flex; } }
.pv-logout { border: 1px solid var(--pv-line); background: none; color: var(--pv-muted); font-size: 12.5px; padding: 6px 14px; border-radius: 999px; }
.pv-heroband { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 520px; background: #3b3b3b url("kern-hero.jpg") center / cover no-repeat; }
.pv-heroband::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgb(27 28 28 / .15) 0%, transparent 30%, transparent 62%, var(--pv-bg) 100%); }
.pv-wrap { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding-block: 4px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 44px; }
.pv-wrap.pv-gate { max-width: 560px; gap: 22px; }
.pv-intro { position: relative; z-index: 1; margin-top: -6px; }
.pv-intro .pv-hello { margin: 0 0 6px; }
.pv-sec { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 76px; }
.pv-sechead { display: flex; align-items: baseline; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--pv-line); }
.pv-secnum { font-family: var(--pv-latin); font-weight: 300; font-size: 13px; letter-spacing: .1em; color: var(--pv-muted); }
.pv-secnum:empty { display: none; }
.pv-sechead h2 { margin: 0; font-family: var(--pv-latin); font-weight: 400; font-size: 15px; letter-spacing: .3em; color: var(--pv-warm); }
.pv-secja { margin-left: auto; font-size: 12.5px; color: var(--pv-muted); letter-spacing: .06em; }
.pv-gate-head .pv-sechead { margin-bottom: 18px; }
.pv-foot { margin-top: auto; background: #151616; border-top: 1px solid var(--pv-line); display: grid; justify-items: center; gap: 22px; text-align: center; padding: 44px max(16px, env(safe-area-inset-right, 0px)) calc(32px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.pv-brand.ft { flex-direction: column; gap: 14px; }
.pv-brand.ft .pv-logo { height: 54px; }
.pv-brand.ft .pv-word { font-size: 24px; letter-spacing: .24em; padding-left: .24em; }
.pv-motto { display: grid; justify-items: center; gap: 12px; color: var(--pv-muted); font-family: var(--pv-latin); font-weight: 300; }
.pv-motto p { margin: 0; letter-spacing: .32em; font-size: 11.5px; padding-left: .32em; }
.pv-motto p:last-child { font-size: 9.5px; letter-spacing: .28em; }
.pv-motto span { display: block; width: 44px; height: 1px; background: var(--pv-muted); opacity: .7; }
.pv-copy { font-family: var(--pv-latin); font-size: 11px; letter-spacing: .12em; color: #6c6d70; }
#pvDlg { width: min(620px, calc(100vw - 24px)); }
#pvDlg .dlg-body { padding: 0; background: #1b1c1c; }


.cred { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; padding: 12px 14px; background: var(--moegi-soft); border-radius: 8px; margin-bottom: 10px; }
.cred div { display: grid; }
.cred-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; margin-bottom: 8px; }
.cred-form input { font-size: 18px; letter-spacing: .06em; }
.cred span { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.cred b { font-size: 20px; font-weight: 500; letter-spacing: .08em; user-select: all; }
.portal-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.portal-bar > div { display: grid; min-width: 0; }
.portal-bar span { font-size: 13px; color: var(--muted); }
.portal-bar.dirty span { color: var(--warn); font-weight: 500; }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app.detail .side { display: none; }
  .app:not(.detail) .main { display: none; }
  .back { display: inline-block; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .entry { grid-template-columns: 64px 14px minmax(0, 1fr); gap: 0 8px; }
  .rail::before { left: 6px; } .rail::after { left: 1px; }
  .main-inner { padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .phead h2 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.backup-note { font-size: 11.5px; color: var(--muted, #6b7280); margin-top: -6px; text-align: center; }
.backup-note:empty { display: none; }
.backup-note.err { color: var(--shu, #b4432f); }
