@font-face { font-family: Oswald; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/oswald-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Oswald; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/oswald-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Oswald; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/oswald-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format('woff2'); }
:root {
  --ink: #1D1E20;
  --paper: #F5F4F0;
  --card: #FFFFFF;
  --line: #E3E2E0;
  --muted: #6E6E6E;
  --accent: #D6738E;
  --accent-soft: #F8E6EB;
  --ok: #2E9E6B;
  --warn: #B45309;
  --sq: #D6738E;
  --bp: #6BA586;
  --dl: #6C94C6;
  --acc: #A8A49B;
  --title: Oswald, "Arial Narrow", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }

header { position: sticky; top: 0; z-index: 10; background: var(--ink); color: #fff; padding: calc(10px + var(--safe-t)) 16px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--title); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.brand span { opacity: .75; }
.brand .mark { width: 22px; height: 22px; }
.wk { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.wk button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 22px; line-height: 1; }
.wk .lbl { text-align: center; display: flex; flex-direction: column; }
.wk .lbl b { font-family: var(--title); font-size: 24px; font-weight: 600; letter-spacing: .02em; }
.wk .lbl span { font-family: var(--title); font-size: 15px; opacity: .8; margin-top: 2px; }

.days { display: flex; gap: 6px; margin: 0 -16px; padding: 10px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.days:empty { padding: 0 0 10px; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 auto; border: 1px solid rgba(255,255,255,.22); background: transparent; color: #fff; border-radius: 999px; padding: 7px 16px; font-family: var(--title); font-size: 15px; letter-spacing: .04em; }
.day.on { background: var(--accent); border-color: var(--accent); color: #fff; }

main { padding: 12px 16px calc(120px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.sec { font-family: var(--title); font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; transition: border-color .2s; }
.card.saved { border-color: var(--ok); }
.ex { font-family: var(--title); font-size: 21px; font-weight: 500; line-height: 1.2; }
.tag { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.presc { margin-top: 8px; background: var(--paper); border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.presc b { font-weight: 600; }
.presc i { color: var(--muted); font-style: normal; }
.guide { display: block; text-align: center; margin: 22px 0 8px; font-family: var(--title); font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 8px; margin-top: 12px; }
.fld label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.step { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 44px; }
.step button { width: 34px; border: 0; background: var(--paper); font-size: 18px; color: var(--ink); }
.step input, .kg input { width: 100%; border: 0; text-align: center; font-size: 17px; font-weight: 600; min-width: 0; background: #fff; color: var(--ink); font-family: inherit; }
.kg input { border: 1px solid var(--line); border-radius: 10px; height: 44px; }
input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.rpe { margin-top: 12px; }
.rpe .top { display: flex; justify-content: space-between; align-items: baseline; }
.rpe .val { font-family: var(--title); font-size: 26px; font-weight: 600; color: var(--accent); }
.rpe .val.none { color: var(--muted); font-size: 14px; font-weight: 400; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 40px; margin: 0; background: transparent; touch-action: none; cursor: pointer; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
input[type=range].unset::-webkit-slider-runnable-track { background: var(--line); }
input[type=range].unset::-moz-range-track { background: var(--line); }
input[type=range].unset::-webkit-slider-thumb { background: var(--muted); }
input[type=range].unset::-moz-range-thumb { background: var(--muted); }
.ticks { position: relative; height: 14px; font-size: 11px; color: var(--muted); }
.ticks span { position: absolute; top: 0; transform: translateX(-50%); }

.actions { display: flex; gap: 8px; margin-top: 10px; }
.btn { flex: 1; height: 44px; border-radius: 10px; border: 0; font-family: var(--title); font-size: 17px; letter-spacing: .05em; text-transform: uppercase; }
.btn.main { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--paper); color: var(--ink); flex: 0 0 auto; padding: 0 14px; }
.btn.ok { background: var(--ok); color: #fff; }
.btn:active, .step button:active, .day:active { transform: scale(.97); opacity: .85; }

.note { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 10px; font-size: 14px; }
.note b { color: var(--accent); }
textarea { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 15px; resize: vertical; background: #fff; color: var(--ink); }
.nbox { background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 14px; }
.nbox label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.nbox .actions { justify-content: flex-end; }

footer { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(transparent, var(--paper) 30%); }
footer .btn { width: 100%; max-width: 640px; display: block; margin: 0 auto; background: var(--accent); color: #fff; height: 52px; font-size: 19px; }

.empty, .spin { text-align: center; color: var(--muted); padding: 56px 16px; }
.spin { font-family: var(--title); letter-spacing: .08em; font-size: 15px; }
.empty h2 { font-family: var(--title); font-weight: 500; color: var(--ink); font-size: 22px; margin: 0 0 8px; }
.empty input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 15px; margin: 14px 0 10px; }

.toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 40; max-width: 90vw; }
.toast.show { opacity: 1; }
.sync { position: fixed; top: calc(8px + var(--safe-t)); right: 12px; z-index: 30; font-size: 11px; letter-spacing: .04em; color: #fff; background: rgba(255,255,255,.16); padding: 3px 8px; border-radius: 999px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.sync.on { opacity: 1; }
.sync.off { background: var(--warn); }

.install { position: fixed; left: 12px; right: 12px; bottom: calc(76px + var(--safe-b)); z-index: 25; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 8px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.install[hidden] { display: none; }
.install span { flex: 1; }
.install #installOk { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.install #installNo { background: transparent; color: #fff; border: 0; font-size: 22px; width: 32px; }

.orfani { max-width: 640px; margin: 12px auto 0; padding: 12px 14px; background: #FBEFE2; border: 1px solid #F0D2AE; border-radius: 14px; font-size: 14px; color: var(--ink); width: calc(100% - 32px); }
.orfani b { color: var(--warn); font-family: var(--title); font-size: 16px; letter-spacing: .03em; text-transform: uppercase; font-weight: 500; }
.orfani p { margin: 4px 0 6px; }
.orfani ul { margin: 0 0 8px; padding-left: 18px; }
.orfani li span { font-weight: 600; }
.orfani .btn { width: 100%; }
