:root {
  --bg: #f2f5f7; --card: #ffffff; --ink: #14232d; --muted: #667682; --line: #dde4e9;
  --navy: #1f3a4d; --green: #2e7d5b; --green-ink: #ffffff; --greenSoft: #dff0e7; --warn: #b4651f; --warnSoft: #fbeedd; --danger: #b3382c;
  --field: #eef2f5;
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d161c; --card: #16232c; --ink: #e8eef2; --muted: #93a3ae; --line: #25343f; --navy: #264a61; --green: #3fa479; --green-ink: #07130d; --greenSoft: #173a2c; --warn: #e0a25e; --warnSoft: #3a2a15; --danger: #ef7b6f; --field: #1d2d38; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
h1 { font-size: 30px; line-height: 1.12; margin: 6px 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 17px; margin: 0 0 10px; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.page { padding: calc(14px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.ph { margin: 6px 2px 0; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: 0 1px 0 var(--line); }
.chead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chead h2 { margin: 0; flex: 1 1 auto; }
.note { color: var(--muted); font-size: 14px; }

.hero { background: linear-gradient(145deg, var(--navy), #2d5a78); color: #fff; border-radius: 22px; padding: 22px 20px; }
.hero .hlabel { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.hero .htext { margin-top: 8px; font-size: 16px; opacity: 0.92; }
.hero.missed-today, .hero.missed { background: linear-gradient(145deg, #6b4a1f, #8a6a2f); }
.hero.done-today { background: linear-gradient(145deg, #1f5c43, #2e7d5b); }

button.primary { background: var(--green); color: var(--green-ink); font-weight: 700; border-radius: 16px; padding: 16px 18px; width: 100%; font-size: 18px; min-height: 58px; }
button.primary.big { min-height: 64px; font-size: 20px; }
button.primary:active { transform: scale(0.985); filter: brightness(0.95); }
button.secondary, label.secondary { background: var(--field); border-radius: 14px; padding: 12px 14px; min-height: 48px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
button.ghost { color: var(--muted); padding: 12px; font-weight: 600; width: 100%; min-height: 48px; }
button.link { color: var(--green); font-weight: 600; padding: 8px 4px; min-height: 40px; }
button.danger { color: var(--danger); font-weight: 600; padding: 12px 0; margin-top: 8px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow > * { flex: 1 1 120px; }
.filebtn { width: 100%; margin-top: 8px; cursor: pointer; }

.banner { background: var(--warnSoft); color: var(--warn); border-radius: 14px; padding: 12px 14px; font-weight: 600; font-size: 14px; }
.banner.info { background: var(--greenSoft); color: var(--green); }

.exlist { list-style: none; margin: 8px 0 0; padding: 0; }
.exlist li { padding: 10px 0; border-top: 1px solid var(--line); }
.exlist li.off { opacity: 0.5; }
.exlist b { font-size: 16px; }
.opt { display: flex; gap: 10px; align-items: flex-start; }
.opt input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--green); }
.ss { font-size: 11px; font-weight: 700; color: var(--green); border: 1px solid var(--green); border-radius: 99px; padding: 1px 7px; margin-left: 4px; vertical-align: 2px; }
.tag { font-size: 11px; font-weight: 700; background: var(--greenSoft); color: var(--green); border-radius: 99px; padding: 3px 9px; margin-left: 6px; white-space: nowrap; }
.tag.warn { background: var(--warnSoft); color: var(--warn); }
.tag.rec { background: #ffe9a8; color: #6b4a00; }
.tgl { display: flex; gap: 10px; align-items: center; padding: 10px 0; }
.tgl input { width: 22px; height: 22px; accent-color: var(--green); flex: none; }
.tgl.small { font-size: 14px; border-top: 1px solid var(--line); margin-top: 6px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.row select, .row .num { background: var(--field); border-radius: 12px; border: 0; padding: 10px 12px; min-width: 96px; text-align: right; }

.weighrow { display: flex; gap: 8px; align-items: center; }
.weighrow input { flex: 1; background: var(--field); border: 0; border-radius: 14px; padding: 14px; font-size: 22px; font-weight: 700; min-width: 0; }
.weighrow span { color: var(--muted); }

.sq { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; margin: 4px 0 14px; }
.sq i { height: 14px; border-radius: 4px; background: var(--field); }
.sq i.on { background: var(--green); }
.sq i.nx { box-shadow: inset 0 0 0 2px var(--green); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; text-align: center; }
.stats b { display: block; font-size: 22px; letter-spacing: -0.02em; }
.stats span { font-size: 12px; color: var(--muted); }

.weeks { list-style: none; padding: 0; margin: 0; }
.weeks li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.weeks li b { width: 78px; }
.chip { border-radius: 99px; padding: 3px 11px; font-size: 13px; font-weight: 700; background: var(--field); color: var(--muted); }
.chip.done { background: var(--greenSoft); color: var(--green); }
.chip.next { background: var(--green); color: var(--green-ink); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 4px 6px 0; }
.tbl td { padding: 8px 4px 8px 0; border-top: 1px solid var(--line); vertical-align: top; }
.plain { margin: 0; padding-left: 20px; } .plain li { margin: 4px 0; }
.prin { padding: 10px 0; border-top: 1px solid var(--line); } .prin p { margin: 2px 0 6px; font-size: 14px; } .srcs { font-size: 12px; }

.big-n { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; } .big-n small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.chart { width: 100%; height: auto; margin-top: 8px; }
.chart .axis { stroke: var(--line); stroke-width: 1; } .chart .goal { stroke: var(--green); stroke-dasharray: 4 4; opacity: 0.7; }
.chart .ct { fill: var(--muted); font-size: 10px; } .chart .ct.b { fill: var(--ink); font-weight: 700; }
.lift { padding: 10px 0; border-top: 1px solid var(--line); } .lhead { display: flex; justify-content: space-between; }
.up { color: var(--green); font-style: normal; font-weight: 700; } .down { color: var(--danger); font-style: normal; font-weight: 700; }

/* ---- tabit ---- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tab { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; color: var(--muted); font-size: 11px; font-weight: 600; min-height: 56px; }
.tab.on { color: var(--green); }

/* ---- treeninäkymä ---- */
.wk { min-height: 100vh; min-height: 100dvh; padding: calc(8px + env(safe-area-inset-top)) 18px calc(130px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.wkhead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.wkhead > :first-child { justify-self: start; } .wkhead > :last-child { justify-self: end; }
.pill { align-self: flex-start; background: var(--greenSoft); color: var(--green); font-weight: 800; border-radius: 99px; padding: 6px 14px; margin-top: 8px; }
.target { color: var(--muted); margin: 0 0 14px; }
.sub { color: var(--muted); font-size: 17px; }
.stepper { background: var(--card); border-radius: 20px; padding: 14px 14px 16px; margin-bottom: 12px; }
.slabel { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.srow { display: grid; grid-template-columns: 76px 1fr 76px; gap: 8px; align-items: center; margin-top: 8px; }
.sbtn { height: 76px; border-radius: 18px; background: var(--field); font-size: 38px; font-weight: 500; line-height: 1; }
.sbtn:active { background: var(--green); color: var(--green-ink); }
.sval { display: flex; align-items: baseline; justify-content: center; gap: 6px; min-width: 0; }
.sval input { width: 100%; min-width: 0; text-align: center; border: 0; background: transparent; font-size: 54px; font-weight: 800; letter-spacing: -0.03em; padding: 0; }
.sval span { font-size: 17px; color: var(--muted); font-weight: 600; }
.bw { background: var(--card); border-radius: 20px; padding: 18px; text-align: center; font-size: 20px; font-weight: 700; margin-bottom: 12px; color: var(--muted); }
.why { font-size: 14px; color: var(--muted); margin-top: 2px; } .why summary { cursor: pointer; padding: 8px 2px; } .why p { margin: 0 0 8px; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; display: grid; gap: 4px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.checks { list-style: none; padding: 0; margin: 8px 0; } .checks li { background: var(--card); border-radius: 14px; margin-bottom: 8px; }
.checks label { display: flex; gap: 12px; padding: 14px; align-items: center; } .checks input { width: 24px; height: 24px; accent-color: var(--green); flex: none; }
.checks input:checked + span { color: var(--muted); text-decoration: line-through; }

.rest .restwrap { text-align: center; margin: 22px 0 10px; }
.rlabel { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; }
.rtime { font-size: 108px; font-weight: 800; letter-spacing: -0.05em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.rbar { height: 10px; background: var(--field); border-radius: 99px; overflow: hidden; margin: 12px 0 14px; } .rbar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width 0.3s linear; }
.radj { display: flex; gap: 10px; justify-content: center; } .radj .ghost { width: auto; background: var(--field); border-radius: 14px; padding: 12px 22px; color: var(--ink); }
.next { background: var(--card); border-radius: 18px; padding: 16px; margin-top: 14px; }
.nlabel { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; } .nname { font-size: 22px; font-weight: 800; margin: 2px 0; } .nmeta { color: var(--muted); }

.rirs { display: grid; gap: 12px; margin-top: 18px; }
.rir { background: var(--card); border-radius: 20px; padding: 18px; display: flex; align-items: center; gap: 16px; text-align: left; min-height: 84px; }
.rir b { font-size: 40px; min-width: 74px; letter-spacing: -0.03em; } .rir span { color: var(--muted); font-size: 17px; font-weight: 600; }
.rir:active { background: var(--green); } .rir:active b, .rir:active span { color: var(--green-ink); }

.sumlist { list-style: none; padding: 0; margin: 10px 0; } .sumlist li { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.toggles { background: var(--card); border-radius: 14px; padding: 4px 14px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); background: #10202a; color: #fff; padding: 12px 16px; border-radius: 14px; display: flex; gap: 14px; align-items: center; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,0.3); font-weight: 600; max-width: calc(100vw - 32px); white-space: nowrap; }
body.inwk .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
.toast button { color: #7fe0b5; font-weight: 800; padding: 6px 4px; }

.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { margin: 0; }
.fold > summary::after { content: "Näytä"; color: var(--green); font-weight: 600; font-size: 14px; }
.fold[open] > summary { margin-bottom: 10px; }
.fold[open] > summary::after { content: "Piilota"; }

.dlg { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dbox { background: var(--card); color: var(--ink); border-radius: var(--r); padding: 20px; width: 100%; max-width: 400px; }
.dbox p { margin: 0 0 16px; font-size: 17px; }
.dbtns { display: flex; gap: 10px; }
.dbtns button { flex: 1; min-height: 52px; font-size: 16px; padding: 12px; }
.hl { display: flex; gap: 14px; }
button.link.back { justify-self: start; padding: 4px 2px; margin-bottom: -6px; }
.datebar { font-size: 15px; font-weight: 600; color: var(--muted); margin: 2px 2px -4px; }

.calnav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calnav h2 { flex: 1; text-align: center; margin: 0; }
.calnav button { min-width: 48px; font-size: 20px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calh { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 2px; }
.cday { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--field); font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.cday.now { box-shadow: inset 0 0 0 2px var(--green); }
.cday.gym { background: var(--green); color: var(--green-ink); }
.cday.home { background: var(--navy); color: #fff; }
.cday.min { background: var(--warnSoft); color: var(--warn); }
.cday.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
.cday small { position: absolute; top: 2px; right: 5px; font-size: 10px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.legend i.gym { background: var(--green); } .legend i.home { background: var(--navy); } .legend i.min { background: var(--warnSoft); box-shadow: inset 0 0 0 1px var(--warn); }
.calsess + .calsess { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

:root { --jog: #6d55c7; --climb: #b23f6c; }
.cday.jog { background: var(--jog); color: #fff; }
.cday.climb { background: var(--climb); color: #fff; }
.legend i.jog { background: var(--jog); } .legend i.climb { background: var(--climb); }
.cday .dots { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; justify-content: center; gap: 3px; }
.cday .dots i { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 0 1px var(--card); }
.dots i.gym { background: var(--green); } .dots i.home { background: var(--navy); } .dots i.min { background: var(--warn); } .dots i.jog { background: var(--jog); } .dots i.climb { background: var(--climb); }
.calsess .chead .link { margin-left: auto; padding: 4px 0; }
.actform h2 { margin-bottom: 4px; }
.actform input[type=date] { background: var(--field); border: 0; border-radius: 12px; padding: 10px 12px; }
.actform .note { width: 100%; background: var(--field); border: 0; border-radius: 12px; padding: 12px; margin: 8px 0 16px; }

/* ===================== KASARI-TEEMA ===================== */
:root {
  --bg: #fff3d1; --card: #ffffff; --ink: #1d0b33; --muted: #5d4677; --line: #e6d6f2; --field: #f6ecff;
  --green: #d10069; --green-ink: #ffffff; --greenSoft: #ffd9ec; --warn: #b85500; --warnSoft: #ffe6bf; --danger: #c4002f;
  --edge: #1d0b33; --shade: #1d0b33; --grid: rgba(209, 0, 105, 0.08);
  --c-gym: #ff2e88; --c-home: #00c2e0; --c-jog: #7b2ff7; --c-climb: #ff7a00; --c-min: #ffd400;
  --jog: var(--c-jog); --climb: var(--c-climb); --navy: #1d0b33;
  --r: 0px;
  --display: "Futura", "Avenir Next Condensed", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #160827; --card: #241040; --ink: #fdf2ff; --muted: #c4a8e0; --line: #3d2463; --field: #321856;
    --green: #ff4fa3; --green-ink: #160827; --greenSoft: #4b1640; --warn: #ffb347; --warnSoft: #3d2610; --danger: #ff6b8b;
    --edge: #00e5ff; --shade: #ff2e88; --grid: rgba(0, 229, 255, 0.07);
  }
}
*, *::before, *::after { border-radius: 0 !important; }
body { background-color: var(--bg); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 28px 28px; }
h1, h2, .hero .hlabel, .tile b, .nname, .big-n, .rtime, .stats b, button.primary, .pill, .chip, .tag { font-family: var(--display); }
h1 { font-size: 34px; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0; text-shadow: 3px 3px 0 var(--c-min); }
h2 { font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; font-size: 16px; }

.card, .stepper, .bw, .next, .rir, .sumlist li, .toggles, .checks li, .dbox {
  border: 3px solid var(--edge); box-shadow: 5px 5px 0 var(--shade);
}
.sumlist li { box-shadow: 3px 3px 0 var(--shade); border-width: 2px; }
.card .sumlist li, .card .checks li { box-shadow: none; }

.hero {
  border: 3px solid var(--edge); box-shadow: 6px 6px 0 var(--shade); color: #fff; position: relative; overflow: hidden;
  background:
    repeating-linear-gradient(180deg, transparent 0 14px, rgba(255, 255, 255, 0.18) 14px 17px),
    linear-gradient(170deg, #ff2e88 0%, #ff7a00 60%, #ffd400 100%);
}
.hero .hlabel { font-style: italic; text-transform: uppercase; font-size: 36px; text-shadow: 3px 3px 0 #1d0b33; }
.hero .htext { font-weight: 600; text-shadow: 1px 1px 0 rgba(29, 11, 51, 0.6); opacity: 1; }
.hero.done-today { background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(255, 255, 255, 0.18) 14px 17px), linear-gradient(170deg, #00c2e0 0%, #7b2ff7 100%); }
.hero.missed-today, .hero.missed { background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(255, 255, 255, 0.18) 14px 17px), linear-gradient(170deg, #7b2ff7 0%, #ff2e88 100%); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  position: relative; min-height: 104px; padding: 14px 12px 12px; text-align: left; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  border: 3px solid var(--edge); box-shadow: 5px 5px 0 var(--shade); color: #fff; transition: transform 0.06s, box-shadow 0.06s;
}
.tile b { font-size: 21px; font-weight: 800; font-style: italic; text-transform: uppercase; line-height: 1.05; }
.tile span { font-size: 13px; font-weight: 700; opacity: 0.95; }
.tile em { position: absolute; top: 8px; right: 8px; font-style: normal; font-size: 11px; font-weight: 800; background: #fff; color: #1d0b33; padding: 2px 6px; border: 2px solid #1d0b33; }
.tile:active, button.primary:active, button.secondary:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--shade); }
.t-gym { background: var(--c-gym); }
.t-home { background: var(--c-home); color: #1d0b33; }
.t-jog { background: var(--c-jog); }
.t-climb { background: var(--c-climb); color: #1d0b33; }
.t-min { background: var(--c-min); color: #1d0b33; }

button.primary { background: var(--c-gym); color: #fff; border: 3px solid var(--edge); box-shadow: 5px 5px 0 var(--shade); text-transform: uppercase; font-style: italic; font-weight: 800; letter-spacing: 0.03em; }
button.primary:active { filter: none; }
button.secondary, label.secondary { background: var(--card); border: 2px solid var(--edge); box-shadow: 3px 3px 0 var(--shade); font-weight: 800; }
.dbtns button.primary { font-size: 16px; }
.sbtn { background: var(--card); border: 3px solid var(--edge); box-shadow: 4px 4px 0 var(--shade); }
.sbtn:active { background: var(--c-min); color: #1d0b33; transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shade); }
.rir:active { background: var(--c-gym); }

.pill { background: var(--c-min); color: #1d0b33; border: 2px solid var(--edge); }
.tag { border: 2px solid currentColor; background: transparent; text-transform: uppercase; }
.ss { border-width: 2px; text-transform: uppercase; }
.chip { border: 2px solid var(--line); }
.chip.next { background: var(--c-gym); color: #fff; border-color: var(--edge); }
.chip.done { background: var(--c-home); color: #1d0b33; border-color: var(--c-home); }
.banner { border: 2px solid currentColor; }
.sq i { background: var(--field); border: 1px solid var(--line); }
.sq i.on { background: var(--c-gym); border-color: var(--edge); }
.sq i.nx { box-shadow: inset 0 0 0 2px var(--c-gym); }
.rbar { border: 2px solid var(--edge); height: 14px; } .rbar i { background: repeating-linear-gradient(90deg, var(--c-gym) 0 12px, var(--c-climb) 12px 24px); }
.rtime { font-style: italic; text-shadow: 4px 4px 0 var(--c-min); }
.datebar { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--green); font-weight: 800; }

.tabs { background: #1d0b33; border-top: 3px solid var(--c-gym); backdrop-filter: none; }
.tab { color: #c4a8e0; text-transform: uppercase; letter-spacing: 0.03em; font-size: 10px; }
.tab.on { color: var(--c-min); }

.cday { border: 2px solid transparent; }
.cday.now { box-shadow: none; border-color: var(--edge); }
.cday.gym { background: var(--c-gym); color: #fff; }
.cday.home { background: var(--c-home); color: #1d0b33; }
.cday.min { background: var(--c-min); color: #1d0b33; }
.cday.jog { background: var(--c-jog); color: #fff; }
.cday.climb { background: var(--c-climb); color: #1d0b33; }
.cday.sel { outline: 3px solid var(--shade); outline-offset: 1px; }
.legend i.gym, .dots i.gym { background: var(--c-gym); } .legend i.home, .dots i.home { background: var(--c-home); }
.legend i.min, .dots i.min { background: var(--c-min); box-shadow: none; } .legend i.jog, .dots i.jog { background: var(--c-jog); } .legend i.climb, .dots i.climb { background: var(--c-climb); }
.legend i { border: 1px solid var(--edge); }

.weighrow input, .row select, .row .num, .actform input[type=date], .actform .note { border: 2px solid var(--edge); }
.toast { background: #1d0b33; border: 3px solid var(--c-min); box-shadow: 4px 4px 0 var(--c-gym); }
.toast button { color: var(--c-min); }
.chart .goal { stroke: var(--c-home); }

/* ---- kasarifontit (itse isännöidyt, SIL OFL: fonts/LICENSE-*) ---- */
@font-face { font-family: "Audiowide"; src: url("fonts/audiowide-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-600.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Chakra Petch"; src: url("fonts/chakra-petch-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
:root { --display: "Audiowide", "Chakra Petch", system-ui, sans-serif; --body: "Chakra Petch", system-ui, sans-serif; }
body { font-family: var(--body); }
h1, h2, .hero .hlabel, .tile b, .nname, .big-n, .rtime, .stats b, button.primary, .pill, .chip, .tag, .datebar, .sval input, .rir b, .calnav h2, .rlabel, .nlabel, .slabel {
  font-family: var(--display); font-weight: 400; font-synthesis: style;
}
h1 { font-size: 30px; letter-spacing: 0.01em; }
h2 { font-size: 15px; letter-spacing: 0.05em; }
.hero .hlabel { font-size: 32px; }
.tile b { font-size: 18px; }
.rtime { font-size: 96px; letter-spacing: 0; }
.sval input { font-size: 50px; letter-spacing: 0; }
.stats b { font-size: 21px; letter-spacing: 0; }
.cday { font-family: var(--display); font-weight: 400; font-size: 14px; }
.tab { font-weight: 700; font-size: 10px; gap: 3px; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: #1d0b33; background: var(--c-min); box-shadow: inset 0 3px 0 var(--c-gym); }

/* ---- liikeohjeet ja kuvakortit ---- */
.fig { width: 100%; height: auto; display: block; background: var(--card); }
.fig line, .fig path { stroke-linecap: square; }
.fig-main line, .fig-main path { stroke: var(--c-gym); stroke-width: 5; }
.fig-main circle { fill: var(--c-gym); }
.fig-main .far line { stroke: var(--c-jog); }
.fig-ghost line, .fig-ghost path { stroke: var(--line); stroke-width: 4; }
.fig-ghost circle { fill: var(--line); }
.fig-floor { stroke: var(--edge); stroke-width: 3; }
.fig-eq, .fig-eq line, .fig-eq rect, .fig-eq path { stroke: var(--edge); stroke-width: 3; fill: var(--c-min); }
.fig-eq line, .fig-eq path { fill: none; }
.fig-box { fill: var(--field); }
.fig-arrow { stroke: var(--c-home); stroke-width: 3; fill: none; stroke-dasharray: 6 4; }
.fig-ahead { fill: var(--c-home); }
.fig-guide { stroke: var(--c-home); stroke-width: 2; stroke-dasharray: 3 4; }
.fig-band { stroke: var(--c-climb); stroke-width: 3; }
.fig-stretch { stroke: var(--c-min); stroke-width: 7; opacity: 0.9; }
.fig-spine { stroke-width: 5; }
.fig-ghost line, .fig-ghost path { stroke: var(--muted); opacity: 0.35; }
.fig-ghost circle { fill: var(--muted); opacity: 0.35; }
.guide { color: var(--ink); }
.guide > summary, .gmini > summary { color: var(--green); font-weight: 700; cursor: pointer; }
.g-card { border: 3px solid var(--edge); box-shadow: 4px 4px 0 var(--shade); margin: 8px 0 12px; max-width: 360px; }
.g-steps ul, .g-cues ul, .g-avoid ul { margin: 4px 0 10px; padding-left: 20px; }
.g-steps li, .g-cues li, .g-avoid li { margin: 3px 0; }
.g-steps b, .g-cues b, .g-avoid b { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 12px; letter-spacing: 0.06em; }
.g-cues b { color: var(--green); } .g-avoid b { color: var(--danger); }
.g-safety { background: var(--warnSoft); color: var(--warn); border: 2px solid currentColor; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.checks li .gmini { padding: 0 14px 12px 50px; font-size: 14px; }
.gsec { margin-top: 10px; } .gsec > h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 13px; letter-spacing: 0.06em; margin: 14px 0 4px; color: var(--muted); }
.gsec details { border-top: 1px solid var(--line); padding: 10px 0; } .gsec details > summary { font-weight: 700; cursor: pointer; }
.checks .guide li, .sumlist .guide li { background: none; border: 0; box-shadow: none; margin: 3px 0; padding: 0; }
.checks .guide ul { list-style: disc; }
.hl { gap: 10px; } .hl button, .wkhead button { white-space: nowrap; }
.wkhead > span:nth-child(2) { text-align: center; padding: 0 6px; }

/* ---- treenin yläpalkki ---- */
.wkbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: #1d0b33; color: #fff3d1; border-bottom: 3px solid var(--c-gym); }
.wkt { font-family: var(--display); font-size: 20px; color: var(--c-min); font-variant-numeric: tabular-nums; min-width: 64px; }
.wkprog { flex: 1; height: 12px; border: 2px solid #fff3d1; background: #321856; }
.wkprog i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--c-gym) 0 10px, var(--c-home) 10px 20px); transition: width 0.3s; }
.wkn { font-size: 13px; font-weight: 700; white-space: nowrap; }
body.inwk .wk { padding-top: 10px; }
.wkn { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-size: 12px; } .wkn b { font-family: var(--display); font-weight: 400; font-size: 13px; color: var(--c-min); text-transform: uppercase; }

/* ---- musiikkinappi ---- */
.musicbtn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 8px; min-height: 34px; font-family: var(--display); font-size: 12px; background: #321856; color: #c4a8e0; border: 2px solid #c4a8e0; }
.musicbtn.on { background: var(--c-min); color: #1d0b33; border-color: #1d0b33; }
.musicbtn.float { position: fixed; z-index: 7; top: calc(10px + env(safe-area-inset-top)); right: max(12px, calc(50% - 268px)); box-shadow: 3px 3px 0 var(--shade); }

/* ---- treeniäly: viikko, RPE, uni/fiilis, lisäblokki ---- */
:root { --c-add: #2bd96b; }
.cday.addon { background: var(--c-add); color: #1d0b33; }
.legend i.addon, .dots i.addon { background: var(--c-add); }
.mrow { margin: 10px 0; }
.mhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.mhead span { font-family: var(--display); font-size: 14px; font-variant-numeric: tabular-nums; }
.mhead em { font-family: var(--body); font-style: normal; font-size: 12px; }
.meter { height: 14px; margin-top: 4px; border: 2px solid var(--edge); background: var(--field); }
.meter i { display: block; height: 100%; background: var(--c-home); }
.meter.low i { background: var(--c-climb); }
.meter.full i { background: repeating-linear-gradient(90deg, var(--c-gym) 0 10px, var(--c-min) 10px 20px); }
.lbars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 96px; margin: 10px 0 4px; }
.lb { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 3px; }
.lb i { display: block; min-height: 2px; background: var(--c-jog); border: 2px solid var(--edge); border-bottom-width: 0; }
.lb.cur i { background: var(--c-gym); }
.lb span { font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
p.warn { color: var(--warn); font-weight: 700; }
.calnav button:disabled { opacity: 0.35; }
.rpes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 10px 0 6px; }
.rpes button, .rdyrow button { min-height: 44px; font-family: var(--display); font-size: 17px; background: var(--card); border: 2px solid var(--edge); box-shadow: 2px 2px 0 var(--shade); color: var(--ink); }
.rpes button.on, .rdyrow button.on { background: var(--c-min); color: #1d0b33; }
.rdy { margin: 12px 0; } .rdy b { display: block; margin-bottom: 6px; }
.rdyrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 4px; }
.card.addon { border-color: var(--c-add); box-shadow: 5px 5px 0 var(--edge); }
.card.addon .chead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card.addon .btnrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.card.addon button.primary { padding: 12px 18px; font-size: 15px; }
.dbox .card.addon { border: 0; box-shadow: none; padding: 0; margin: 0; background: none; }
:root { --c-str: #9be7ff; }
.cday.stretch { background: var(--c-str); color: #1d0b33; }
.legend i.stretch, .dots i.stretch { background: var(--c-str); }
.strgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.strgrid span { display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; border: 2px solid var(--line); font-size: 13px; font-weight: 600; }
.strgrid span b { font-family: var(--display); font-weight: 400; }
.strgrid span.some { border-color: var(--c-home); }
.strgrid span.ok { background: var(--c-str); color: #1d0b33; border-color: var(--edge); }
.stretchbox { max-height: 86vh; overflow-y: auto; }
.stretchbox .checks { padding: 0; }
/* ---- etusivun seuraava treeni ---- */
.hero .hnext { font-family: var(--display); text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; background: #1d0b33; color: var(--c-min); display: inline-block; padding: 3px 8px; margin-bottom: 8px; }
.hero .hlabel { font-size: 28px; line-height: 1.1; }
.hero .hlist { margin-top: 8px; font-weight: 700; font-size: 15px; line-height: 1.45; text-shadow: 1px 1px 0 rgba(29, 11, 51, 0.6); }
.hero .htext.small { font-size: 13px; }
.hero .hdone { margin-top: 6px; font-weight: 800; font-size: 14px; }
.hero .hbtn { margin-top: 14px; width: 100%; min-height: 52px; background: #fff3d1; color: #1d0b33; border: 3px solid #1d0b33; box-shadow: 4px 4px 0 #1d0b33; font-family: var(--display); text-transform: uppercase; font-size: 16px; }
.hero .hbtn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #1d0b33; }
.hero .hbtns { display: flex; gap: 12px; align-items: center; } .hero .hbtns .hbtn { flex: 1; }
.hero .hlink { margin-top: 14px; color: #fff; font-weight: 700; text-decoration: underline; padding: 8px; }
.hero.addon { background: repeating-linear-gradient(180deg, transparent 0 14px, rgba(255, 255, 255, 0.16) 14px 17px), linear-gradient(170deg, #2bd96b 0%, #00c2e0 100%); }
/* minimitreenit puolikokoisina */
.tile.mini { min-height: 52px; padding: 8px 10px; flex-direction: row; align-items: center; justify-content: space-between; box-shadow: 3px 3px 0 var(--shade); }
.tile.mini b { font-size: 14px; } .tile.mini span { font-size: 12px; }
.tile.mini em { top: -9px; right: 6px; font-size: 10px; }
/* ---- laattojen tikku-ukot ---- */
.tile .tfig { position: absolute; top: 8px; right: 10px; width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 4; stroke-linecap: square; stroke-linejoin: miter; filter: drop-shadow(2px 2px 0 rgba(29, 11, 51, 0.45)); }
.tile .tfig circle { fill: currentColor; stroke: none; }
.tile .tfig .f { fill: var(--c-min); stroke: #1d0b33; stroke-width: 2; }
.tile .tfig .s { stroke-width: 2.5; opacity: 0.75; }
.tile .tfig .z { fill: currentColor; stroke: none; font-family: var(--display); font-size: 14px; }
.tile.mini .tfig { position: static; width: 30px; height: 30px; order: -1; flex: none; stroke-width: 5; }
.tile.mini { justify-content: flex-start; gap: 8px; } .tile.mini b { flex: 1; }
.tile em { z-index: 1; }
.tile:has(em) .tfig { top: 30px; }
/* ---- 7 päivän suunnitelma ---- */
.plan7 { list-style: none; padding: 0; margin: 8px 0; }
.pday { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pday.now { background: var(--field); border: 3px solid var(--edge); padding: 8px; box-shadow: 3px 3px 0 var(--shade); margin-bottom: 6px; }
.pdl { width: 64px; flex: none; font-family: var(--display); text-transform: uppercase; font-size: 13px; display: flex; flex-direction: column; }
.pdl small { font-family: var(--body); font-size: 12px; color: var(--muted); text-transform: none; }
.pday ul { list-style: none; padding: 0; margin: 0; flex: 1; display: grid; gap: 6px; }
.pi { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pi > i { width: 10px; align-self: stretch; flex: none; border: 1px solid var(--edge); }
.pi > div { flex: 1; display: flex; flex-direction: column; } .pi span { font-size: 12px; color: var(--muted); }
.pi button { padding: 6px 10px; min-height: 36px; font-size: 13px; }
.pi.light b { font-weight: 600; } .pi.done b { color: var(--muted); }
.pi.rest b { color: var(--muted); font-weight: 600; }
.k-gym > i { background: var(--c-gym); } .k-home > i { background: var(--c-home); } .k-jog > i { background: var(--c-jog); } .k-climb > i { background: var(--c-climb); }
.k-min > i { background: var(--c-min); } .k-addon > i { background: var(--c-add); } .k-stretch > i { background: var(--c-str); }
.tiles .tile:not(.mini) { min-height: 124px; }
.tile .tfig { width: 48px; height: 48px; }
.tile.mini b { font-size: 12px; } .tile.mini span { font-size: 11px; }
.card.wknav { padding: 6px 8px; } .wknav .calnav { margin: 0; } .wknav .calnav button { min-height: 34px; min-width: 40px; padding: 2px 10px; } .wknav h2 { font-size: 14px; margin: 0; }
/* ---- rauhallinen tausta: pastelliliuku ---- */
body { background-image: none; background: linear-gradient(180deg, #f4eefc 0%, #fdf1e8 100%) fixed; }
@media (prefers-color-scheme: dark) { body { background: linear-gradient(180deg, #1c0d33 0%, #2a1230 100%) fixed; } }
