/* Baloo 2 (SIL Open Font License), self-hosted: latin-ext covers Polish letters */
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(../fonts/baloo2-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Baloo 2';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(../fonts/baloo2-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #3b2a5a;
  --muted: #7a6d94;
  --card: #ffffff;
  --line: #ece2d3;
  --field: #faf6f0;
  --ok: #2fb36d;
  --ok-edge: #1f8f53;
  --ok-soft: #e6f8ee;
  --danger: #d9435a;
  --focus: #3a86ff;
  --tint: #e0f0ff;
  --acc: #3d8fe0;
  --radius: 22px;
  --shadow: 0 2px 0 rgba(59, 42, 90, .06), 0 10px 26px rgba(59, 42, 90, .08);
  --font: 'Baloo 2', 'Comic Sans MS', 'Segoe UI', system-ui, sans-serif;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
  background: linear-gradient(180deg, #fff1df 0%, #fff8f0 35%, #f3f8ff 100%) fixed;
  background-color: #fff6ec;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.inline-ic { vertical-align: -2px; }

/* Pictures fill their box; emoji scale with it */
.ic { display: block; width: 100%; height: 100%; }
.ic.emoji { display: grid; place-items: center; font-family: var(--emoji); font-size: 3em; font-size: 72cqw; line-height: 1; }
.ic.photo { object-fit: cover; border-radius: 18%; }
.pic, .step-pic, .tile-pic, .one-pic, .dot, .pic-btn, .timer-pic, .opt-pic { container-type: inline-size; }

/* ---------- common controls ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 6px 18px 4px; border-radius: 999px;
  border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 17px;
  text-decoration: none; white-space: nowrap; box-shadow: 0 2px 0 rgba(59, 42, 90, .07);
}
.pill:hover { border-color: #d9cbb6; }
.pill:active { transform: translateY(1px); }
.pill.small { min-height: 36px; padding: 4px 12px 2px; font-size: 15px; }
.pill.big { min-height: 54px; padding: 8px 26px 6px; font-size: 19px; }
.pill.ok { background: var(--ok); border-color: var(--ok-edge); color: #fff; box-shadow: 0 3px 0 var(--ok-edge); }
.pill.danger { background: var(--danger); border-color: #b5303f; color: #fff; }
.pill.ghost { background: transparent; box-shadow: none; }
.pill.danger.ghost { background: transparent; color: var(--danger); border-color: #f1c4cb; }
.round-btn {
  flex: 0 0 auto; display: inline-grid; place-items: center;
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--line); background: #fff;
  box-shadow: 0 2px 0 rgba(59, 42, 90, .07); padding: 0;
}
.round-btn.small { width: 42px; height: 42px; font-size: 18px; }
.round-btn.big { width: 64px; height: 64px; }
.round-btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.round-btn.ghost:hover { background: rgba(59, 42, 90, .06); }
.big-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; padding: 8px 30px 6px; border-radius: 999px; border: 0;
  background: var(--ok); color: #fff; font-weight: 800; font-size: 24px;
  box-shadow: 0 5px 0 var(--ok-edge); transition: transform .08s;
}
.big-btn svg { width: 30px; height: 30px; }
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ok-edge); }
.big-btn.soft { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 #e2d6c4; font-size: 20px; }

/* ---------- screens & top bar ---------- */
.screen {
  max-width: 1180px; margin: 0 auto;
  padding: calc(var(--safe-t) + 6px) max(16px, env(safe-area-inset-right)) calc(var(--safe-b) + 28px) max(16px, env(safe-area-inset-left));
}
.bar { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.bar h2 { flex: 1; font-size: 24px; font-weight: 800; min-width: 0; }
.logo { flex: 1; display: flex; align-items: center; gap: 2px; font-size: 40px; font-weight: 800; letter-spacing: .5px; }
.logo-feet { width: 46px; height: 46px; margin-right: 6px; }
.logo span:nth-child(2) { color: #f28c28; } .logo span:nth-child(3) { color: #e8578a; }
.logo span:nth-child(4) { color: #4caf50; } .logo span:nth-child(5) { color: #3d8fe0; }
.logo span:nth-child(6) { color: #9a6be0; }

.hold-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 4px 16px 2px 12px; border-radius: 999px;
  border: 2px solid var(--line); background: rgba(255, 255, 255, .75); color: var(--muted); font-weight: 700; font-size: 15px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.hold-ring { position: absolute; left: 3px; top: 50%; width: 40px; height: 40px; transform: translateY(-50%) rotate(-90deg); pointer-events: none; }
.hold-ring circle { fill: none; stroke: var(--acc); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 120; stroke-dashoffset: 120; }
.hold-btn.holding .hold-ring circle { stroke-dashoffset: 0; transition: stroke-dashoffset var(--hold, 1s) linear; }
.hold-btn.holding { border-color: var(--acc); color: var(--ink); }
.hold-tip { text-align: center; color: var(--muted); margin: 18px 0 0; }
.hold-tip.nudge { animation: nudge .5s; }
@keyframes nudge { 0%, 100% { transform: none; } 30% { transform: translateX(-6px); } 60% { transform: translateX(6px); } }

/* ---------- home ---------- */
.hello { font-size: 24px; margin: 4px 2px 16px; }
.hello b { color: #e8578a; }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px; border-radius: 16px; background: #fff7d6; border: 2px solid #f3e2a0; font-size: 15px;
}
.banner-actions { display: flex; gap: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 41vw), 1fr)); gap: 16px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 12px 14px; border-radius: 28px; border: 3px solid #fff;
  background: var(--tint); box-shadow: 0 5px 0 var(--acc), 0 12px 24px rgba(59, 42, 90, .08);
  text-align: center; transition: transform .12s;
}
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--acc); }
.tile-pic { width: min(62%, 130px); aspect-ratio: 1; }
.tile-name { font-size: 21px; font-weight: 800; line-height: 1.1; min-height: 2.2em; display: grid; place-items: center; }
.tile-prog { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0 6px; min-height: 26px; }
.tile .bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .85); overflow: hidden; display: block; min-height: 0; }
.tile .bar span { display: block; height: 100%; background: var(--acc); border-radius: 99px; }
.tile-n { font-weight: 700; font-size: 15px; color: var(--muted); }
.tile-done { flex: 1; font-weight: 800; color: var(--ok-edge); }
.tile.now { outline: 4px solid var(--acc); outline-offset: 3px; }
.tile-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: 3px 14px 1px; border-radius: 99px; background: var(--acc); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12);
}
.tile.all { background: linear-gradient(180deg, var(--tint), #fff); }
.empty-home { grid-column: 1 / -1; text-align: center; font-size: 21px; padding: 30px 0; }
.empty-home svg { width: 120px; height: 120px; margin: 0 auto; }

/* ---------- going through a list ---------- */
.run .bar { position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: calc(var(--safe-t) + 4px) 16px 4px; background: rgba(255, 248, 240, .9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.run { padding-top: 0; }
.run-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 24px; font-weight: 800; }
.run-title .pic { flex: 0 0 auto; width: 42px; height: 42px; }
.run-title .rt { display: flex; flex-direction: column; min-width: 0; }
.run-title #run-name { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.05; }
.run-title #run-count { font-size: 15px; font-weight: 700; color: var(--muted); line-height: 1.2; }
.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: rgba(255, 255, 255, .8); border: 2px solid var(--line); }
.seg-btn { width: 44px; height: 40px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.seg-btn[aria-pressed="true"] { background: var(--acc); color: #fff; }

.track { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 8px 4px 12px; scrollbar-width: none; }
.track::-webkit-scrollbar { display: none; }
/* centred while it fits, scrollable from the very first dot when it doesn't */
.track > .dot:first-child { margin-left: auto; }
.track > .dot:last-child { margin-right: auto; }
.dot {
  position: relative; flex: 1 1 40px; min-width: 30px; max-width: 44px; aspect-ratio: 1; padding: 4px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff;
}
.dot.done { background: var(--ok-soft); border-color: #a8e2c0; }
.dot.done .ic { opacity: .45; }
.dot { border-color: var(--c, var(--line)); }
.dot.now { border-width: 3px; box-shadow: 0 0 0 3px var(--cs, var(--tint)); transform: scale(1.12); }
.dot-check { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; padding: 2px; display: none; }
.dot.done .dot-check { display: block; }
.dot-check svg { width: 100%; height: 100%; display: block; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(168px, 42vw), 1fr)); gap: 14px; }
.step { position: relative; }
.step-main {
  position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 10px 12px; border-radius: 26px; border: 3px solid var(--c, var(--tint)); background: var(--cs, #fff);
  box-shadow: 0 5px 0 var(--c, var(--tint)), 0 10px 22px rgba(59, 42, 90, .06);
  transition: transform .1s, background-color .2s, border-color .2s;
}
.step-main:active { transform: translateY(3px); }
.step-pic { width: 72%; aspect-ratio: 1; transition: opacity .25s, filter .25s; }
.step-label { font-size: clamp(17px, 4.6vw, 22px); font-weight: 800; line-height: 1.1; min-height: 2.2em; display: grid; place-items: center; text-align: center; }
.step-n {
  position: absolute; top: 8px; left: 9px; min-width: 32px; height: 32px; padding: 2px 6px 0; border-radius: 99px;
  background: var(--c, var(--tint)); font-weight: 800; font-size: 19px; line-height: 30px;
}
.step-check {
  position: absolute; left: 50%; top: 38%; width: 46%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(0);
  border-radius: 50%; background: var(--ok); color: #fff; padding: 9%; box-shadow: 0 4px 0 var(--ok-edge);
  opacity: 0; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
.step-check svg { width: 100%; height: 100%; display: block; }
.step.done .step-main { background: var(--ok-soft); border-color: #b5e7c9; box-shadow: 0 5px 0 #b5e7c9; }
.step.done .step-pic { opacity: .4; filter: saturate(.5); }
.step.done .step-check { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.step.done .step-n { background: #b5e7c9; }
.step.now .step-main { border-width: 4px; box-shadow: 0 5px 0 var(--c, var(--acc)), 0 0 0 7px var(--cs, var(--tint)), 0 0 0 10px var(--c, var(--acc)); animation: breathe 2.8s ease-in-out infinite; }
.step.pop .step-check { animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes stamp { from { transform: translate(-50%, -50%) scale(.2) rotate(-25deg); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.step-timer {
  position: absolute; right: 8px; top: 8px; min-height: 34px; padding: 2px 10px 0; border-radius: 99px;
  border: 2px solid var(--acc); background: #fff; font-weight: 800; font-size: 15px;
}
.all-done {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 8px; padding: 14px; border-radius: 22px; background: #fff7d6; font-size: 22px; font-weight: 800;
}
.all-done svg { width: 54px; height: 54px; }

.one { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 4px; }
.one-card {
  position: relative; width: min(100%, 520px); display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 16px 20px; border-radius: 34px; border: 4px solid var(--c, var(--acc)); background: var(--cs, #fff);
  box-shadow: 0 6px 0 var(--c, var(--acc));
}
.one-card.done { border-color: #9fdcb8; box-shadow: 0 6px 0 #9fdcb8, 0 0 0 8px var(--ok-soft); background: var(--ok-soft); }
.one-n { position: absolute; top: 12px; left: 14px; font-weight: 700; color: var(--muted); font-size: 18px; display: flex; align-items: center; gap: 6px; }
.one-n b { display: grid; place-items: center; width: 46px; height: 46px; padding-top: 3px; border-radius: 50%; background: var(--c, var(--tint)); color: var(--ink); font-size: 26px; }
.one-pic { position: relative; width: min(64vw, 40vh, 330px); aspect-ratio: 1; border: 0; background: none; padding: 0; }
.one-card.done .one-pic .ic { opacity: .4; filter: saturate(.5); }
.one-pic .step-check { top: 50%; }
.one-card.done .step-check { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.one-card.pop .step-check { animation: stamp .45s cubic-bezier(.3, 1.6, .5, 1); }
.one-label { font-size: clamp(26px, 7vw, 38px); font-weight: 800; text-align: center; line-height: 1.1; }
.one-actions { display: flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 520px); }
.one-actions .big-btn { flex: 1; max-width: 320px; }
.timer-pill { border-color: var(--acc); }

/* rows: like the printed chart — number, picture, name, box */
.rows { display: flex; flex-direction: column; gap: 12px; max-width: 760px; margin: 0 auto; }
.rstep-main {
  position: relative; width: 100%; display: flex; align-items: center; gap: 12px; min-height: 100px;
  padding: 10px 12px 10px 10px; border-radius: 26px; border: 3px solid var(--c); background: var(--cs);
  box-shadow: 0 4px 0 var(--c); text-align: left; transition: transform .1s, background-color .2s;
}
.rstep-main:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--c); }
.rs-n { flex: 0 0 auto; width: 52px; height: 52px; padding-top: 4px; border-radius: 50%; background: var(--c); display: grid; place-items: center; font-size: 30px; font-weight: 800; line-height: 1; }
.rs-pic { flex: 0 0 auto; width: 78px; height: 78px; transition: opacity .25s, filter .25s; }
.rs-label { flex: 1; min-width: 0; text-align: center; font-size: clamp(20px, 5.4vw, 28px); font-weight: 800; line-height: 1.1; }
.rs-box {
  flex: 0 0 auto; width: 54px; height: 54px; padding: 7px; border-radius: 14px; border: 3.5px solid var(--c);
  background: #fff; color: #fff; display: grid; place-items: center;
}
.rs-box svg { width: 100%; height: 100%; opacity: 0; transform: scale(.3); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.rstep.done .rstep-main { background: var(--ok-soft); border-color: #b5e7c9; box-shadow: 0 4px 0 #b5e7c9; }
.rstep.done .rs-n { background: #b5e7c9; }
.rstep.done .rs-pic { opacity: .4; filter: saturate(.5); }
.rstep.done .rs-label { color: #5d7a69; }
.rstep.done .rs-box { background: var(--ok); border-color: var(--ok-edge); }
.rstep.done .rs-box svg { opacity: 1; transform: none; }
.rstep.pop .rs-box svg { animation: stamp2 .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes stamp2 { from { transform: scale(.2) rotate(-25deg); opacity: 0; } }
.rstep.now .rstep-main { border-width: 4px; box-shadow: 0 4px 0 var(--c), 0 0 0 6px var(--cs), 0 0 0 9px var(--c); animation: breathe 2.8s ease-in-out infinite; }
.rstep .step-timer { top: auto; bottom: 8px; right: 82px; }
.rows .all-done { margin-top: 4px; }
@media (max-width: 420px) {
  .rstep-main { gap: 8px; min-height: 88px; padding: 8px 10px 8px 8px; }
  .rs-n { width: 42px; height: 42px; font-size: 25px; }
  .rs-pic { width: 64px; height: 64px; }
  .rs-box { width: 46px; height: 46px; padding: 5px; }
  .rstep .step-timer { right: 64px; bottom: 5px; min-height: 28px; font-size: 13px; padding: 1px 8px 0; }
}
@media (min-width: 700px) {
  .rs-pic { width: 92px; height: 92px; }
  .rstep-main { min-height: 116px; }
}

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  background: rgba(255, 248, 240, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .25s;
}
@keyframes fade { from { opacity: 0; } }
.done-card { position: relative; text-align: center; max-width: 520px; }
.done-star { width: min(48vw, 220px); aspect-ratio: 1; margin: 0 auto; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.done-card h2 { font-size: clamp(40px, 11vw, 60px); font-weight: 800; color: #e8578a; margin-top: 6px; }
.done-card p { font-size: 24px; margin: 4px 0 22px; }
.done-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.done-actions .big-btn { min-width: 220px; }
.done-fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.fx-star { position: absolute; bottom: -60px; width: calc(46px * var(--s, 1)); animation: rise 4.5s ease-out forwards; opacity: 0; }
@keyframes rise { 0% { transform: translateY(0) rotate(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-70vh) rotate(160deg); opacity: 0; } }

.timer-card { text-align: center; width: min(100%, 460px); }
.timer-ring { position: relative; width: min(72vw, 46vh, 300px); aspect-ratio: 1; margin: 0 auto; }
.timer-ring > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tr-bg { fill: #fff; stroke: var(--tint); stroke-width: 18; }
.tr-fg { fill: none; stroke: var(--acc); stroke-width: 18; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.timer-pic { position: absolute; inset: 22%; }
.timer-left { font-size: 52px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.timer-label { font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.timer-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 18px); z-index: 200;
  display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100vw - 24px));
  padding: 12px 14px 10px 18px; border-radius: 18px; background: var(--ink); color: #fff;
  box-shadow: 0 10px 30px rgba(30, 20, 50, .3); font-size: 16px;
  transform: translate(-50%, 20px); opacity: 0; transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-act { border: 0; background: #ffd862; color: var(--ink); font-weight: 800; border-radius: 99px; padding: 6px 14px 4px; min-height: 38px; }

/* ---------- parent pages ---------- */
.parent .bar { position: sticky; top: 0; z-index: 5; margin: 0 -16px; padding: calc(var(--safe-t) + 4px) 16px 6px; background: rgba(255, 248, 240, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.parent { padding-top: 0; }
.page { max-width: 780px; margin: 6px auto 0; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h3 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.card h3 .count { color: var(--muted); font-weight: 700; font-size: 18px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.sec-head h3 { margin: 0; }
.card > p.small { margin: 4px 0 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field.grow { flex: 1; margin: 0; min-width: 0; }
.lbl { font-weight: 700; font-size: 16px; }
.lbl small { font-weight: 500; color: var(--muted); }
input[type="text"], input[type="search"], select {
  width: 100%; min-height: 50px; padding: 10px 14px 8px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--field); font-size: 18px;
}
input[type="text"]:focus, input[type="search"]:focus, select:focus { border-color: var(--focus); background: #fff; outline: none; }
input[type="range"] { width: 100%; accent-color: var(--acc); }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.row-actions.left { justify-content: flex-start; }
.row-actions.wrap { flex-wrap: wrap; }

.switch { display: flex; align-items: center; gap: 14px; padding: 10px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { flex: 0 0 auto; position: relative; width: 54px; height: 32px; border-radius: 99px; background: #ddd3c4; transition: background .15s; }
.sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .sw { background: var(--ok); }
.switch input:checked + .sw::after { transform: translateX(22px); }
.switch input:focus-visible + .sw { outline: 3px solid var(--focus); outline-offset: 2px; }
.sw-t { display: flex; flex-direction: column; font-weight: 700; }
.sw-t small { font-weight: 500; color: var(--muted); font-size: 14.5px; }
.voice-box { border-top: 2px dashed var(--line); margin-top: 6px; padding-top: 4px; }

.segtxt { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.segtxt button {
  min-height: 44px; padding: 4px 16px 2px; border-radius: 99px; border: 2px solid var(--line); background: #fff; font-weight: 700;
}
.segtxt button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.lrows, .srows { display: flex; flex-direction: column; gap: 10px; }
.lrow, .srow {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 18px;
  background: #fff; border: 2px solid var(--line); transition: transform .18s, box-shadow .18s;
}
.sorting .lrow, .sorting .srow { transition: transform .18s; }
.lrow.dragging, .srow.dragging { z-index: 3; transition: none; box-shadow: 0 14px 30px rgba(59, 42, 90, .2); border-color: var(--focus); background: #fff; }
.handle {
  flex: 0 0 auto; width: 36px; height: 48px; display: grid; place-items: center; border: 0; background: none;
  color: #b9ab95; cursor: grab; touch-action: none; border-radius: 10px;
}
.handle:active { cursor: grabbing; color: var(--ink); }
.lrow-main { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; border: 0; background: none; text-align: left; padding: 2px; border-radius: 12px; }
.lrow-t { display: flex; flex-direction: column; min-width: 0; }
.lrow-t b { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow-t small { color: var(--muted); font-size: 14.5px; }
.pic.tinted, .pic-btn.tinted { background: var(--tint); }
.lrow .pic { flex: 0 0 auto; width: 56px; height: 56px; padding: 6px; border-radius: 16px; }
.add-btn {
  display: block; width: 100%; margin-top: 12px; min-height: 58px; border-radius: 18px;
  border: 2.5px dashed #d6c7af; background: transparent; font-weight: 800; font-size: 19px; color: var(--ink);
}
.add-btn:hover { background: #fffaf2; border-color: var(--acc); }

.edit-head { background: linear-gradient(180deg, var(--tint), #fff 70%); }
.eh-row { display: flex; align-items: flex-end; gap: 14px; }
.pic-btn {
  position: relative; flex: 0 0 auto; width: 58px; height: 58px; padding: 6px; border-radius: 16px;
  border: 2px solid var(--line); background: #fff;
}
.pic-btn.big { width: 88px; height: 88px; padding: 10px; border-radius: 22px; border-color: #fff; box-shadow: 0 3px 0 var(--acc); }
.pic-edit { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--tint); background: var(--acc); padding: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.srow .pic-btn { width: 56px; height: 56px; }
.s-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.s-label.s-label { min-height: 44px; padding: 6px 10px 4px; border-color: transparent; background: var(--field); font-weight: 700; }
.s-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.s-meta:empty { display: none; }
.mini-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 1px 10px 0; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font-size: 14px; font-weight: 700; }
.mini-chip.off { background: #f2ede6; color: var(--muted); }
.srow.is-hidden { background: #faf8f5; border-style: dashed; }
.srow.is-hidden .pic-btn .ic, .srow.is-hidden .s-label { opacity: .5; }
.srow.is-hidden .pic-btn { filter: grayscale(1); }
.empty-steps { padding: 24px 12px; text-align: center; color: var(--muted); border-radius: 18px; background: var(--field); }
.tips { margin: 0 0 6px; padding-left: 20px; }
.tips li { margin: 6px 0; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-bg { position: absolute; inset: 0; background: rgba(40, 28, 62, .38); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; background: #fff; border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 40px rgba(30, 20, 50, .2); transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .3, 1);
  outline: none;
}
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px 20px; }
.sheet-head::before { content: ''; position: absolute; top: 7px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 9px; background: #e3d9ca; }
.sheet-head h3 { flex: 1; font-size: 22px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 4px 20px 20px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 20px calc(var(--safe-b) + 12px); border-top: 2px solid #f3ece1; flex-wrap: wrap; }
.sheet-foot .muted { margin-right: auto; }
.small-sheet .sheet-body { padding-bottom: calc(var(--safe-b) + 20px); }
.sheet-text { margin: 0 0 14px; font-size: 17px; }
@media (min-width: 720px) {
  .sheet {
    left: 50%; top: 50%; bottom: auto; right: auto; width: min(560px, 92vw); max-height: 86vh;
    border-radius: 26px; transform: translate(-50%, -47%) scale(.97); opacity: 0; transition: transform .2s, opacity .2s;
  }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-head::before { display: none; }
  .wide .sheet { width: min(900px, 94vw); }
}
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 14px; background: none; text-align: left; font-weight: 700; font-size: 18px; }
.menu-item:hover { background: #faf5ee; }
.menu-item small { display: block; font-weight: 500; font-size: 14.5px; color: var(--muted); }
.menu-item.danger { color: var(--danger); }
.mi-ic { width: 30px; text-align: center; font-family: var(--emoji); font-size: 22px; }
.search { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin: 4px -20px 8px; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.big .chip { min-height: 50px; font-size: 18px; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 4px 14px 2px;
  border-radius: 99px; border: 2px solid var(--line); background: #fff; font-weight: 700; white-space: nowrap;
}
.chip .pic { width: 26px; height: 26px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.on .pic { background: #fff; border-radius: 8px; }
.sub { margin: 16px 0 8px; font-size: 17px; color: var(--muted); font-weight: 700; }
.big-choice {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px; margin-bottom: 8px;
  border-radius: 18px; border: 2px solid var(--line); background: #fff; text-align: left;
}
.big-choice.custom { border-color: var(--ok); background: var(--ok-soft); }
.big-choice .pic { flex: 0 0 auto; width: 56px; height: 56px; }
.big-choice b { display: block; font-size: 18px; }
.big-choice small { color: var(--muted); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tpl { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border-radius: 18px; border: 2px solid var(--line); background: #fff; }
.tpl .pic { width: 64px; height: 64px; padding: 6px; border-radius: 16px; }
.tpl small { color: var(--muted); }
.sugg-grid > p, .icon-grid > p { grid-column: 1 / -1; }
.sugg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.sugg {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px;
  border-radius: 16px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; line-height: 1.1;
}
.sugg .pic { width: 58px; height: 58px; }
.sugg.has { background: var(--ok-soft); border-color: #b5e7c9; }
.sg-t { min-height: 2.2em; display: grid; place-items: center; text-align: center; }
.sg-has { position: absolute; top: 4px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 13px; line-height: 23px; }
.sugg.pop { animation: popin .35s; }
@keyframes popin { 50% { transform: scale(1.08); } }
.tabs3 { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: #f4eee5; margin-bottom: 14px; }
.tabs3 button { flex: 1; min-height: 44px; border: 0; border-radius: 99px; background: none; font-weight: 700; }
.tabs3 button[aria-selected="true"] { background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.icon-pick { aspect-ratio: 1; padding: 8px; border-radius: 16px; border: 2px solid var(--line); background: #fff; }
.icon-pick.on, .icon-pick:hover { border-color: var(--focus); background: #f1f7ff; }
.emoji-own { display: flex; gap: 8px; margin-bottom: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 6px; }
.emo { aspect-ratio: 1; border: 2px solid transparent; border-radius: 14px; background: #faf6f0; font-family: var(--emoji); font-size: 30px; padding: 0; }
.emo:hover { border-color: var(--focus); }
.photo-box { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 6px 0; }
.photo-prev { width: 160px; height: 160px; border-radius: 22px; background: var(--field); padding: 10px; }
.file-btn { cursor: pointer; white-space: normal; text-align: center; }

/* print sheet */
.print-grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .print-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.print-opts .field { margin-top: 0; }
.opts { display: grid; gap: 8px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; border: 2px solid var(--line); background: #fff; text-align: left; font-weight: 700; }
.opt small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; }
.opt.on { border-color: var(--focus); background: #f1f7ff; box-shadow: inset 0 0 0 1px var(--focus); }
.opt-pic { flex: 0 0 auto; width: 40px; height: 40px; }
.print-preview { background: #f4eee5; border-radius: 18px; padding: 14px 10px 6px; position: sticky; top: 0; }
.pages { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 4px 8px; justify-content: safe center; }
.paper { flex: 0 0 auto; width: min(300px, 66vw); background: #fff; box-shadow: 0 6px 20px rgba(59, 42, 90, .15); border-radius: 4px; scroll-snap-align: center; }
.paper svg { display: block; width: 100%; height: auto; }

/* ---------- small screens / landscape ---------- */
@media (max-width: 420px) {
  .hold-btn .t { display: none; }
  .hold-btn { padding: 0; width: 46px; justify-content: center; }
  .hold-ring { left: 50%; transform: translate(-50%, -50%) rotate(-90deg); }
  .logo { font-size: 34px; }
  .logo-feet { width: 38px; height: 38px; }
  .run-title { font-size: 20px; }
  .run-title .pic { width: 34px; height: 34px; }
  #edit-try .t { display: none; }
}
@media (max-width: 719px) {
  .print-preview { order: -1; position: static; padding: 10px 6px 2px; }
  .paper { width: min(230px, 56vw); }
}
@media (max-width: 480px) {
  .run-title .pic { display: none; }
  .run-title { font-size: 21px; }
  .run-title #run-count { font-size: 14px; }
  .seg-btn { width: 36px; height: 38px; }
  .run .bar { gap: 8px; }
  .card { padding: 16px 12px; }
  .srow { gap: 2px; padding: 5px 4px; }
  .srow .handle { width: 26px; }
  .srow .round-btn.small { width: 38px; height: 38px; }
  .srow .pic-btn { width: 52px; height: 52px; }
  .s-label.s-label { padding: 6px 8px 4px; font-size: 17px; }
}
@media (max-width: 380px) {
  .run-title { font-size: 19px; }
  .seg-btn { width: 32px; }
  .track { gap: 4px; }
  .dot { min-width: 27px; }
  .grid { gap: 10px; }
  .step-main { padding: 12px 6px 10px; border-radius: 22px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .one { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; }
  .one-card { width: auto; flex-direction: row; gap: 18px; padding: 12px 24px; }
  .one-pic { width: min(38vh * 1.4, 220px); }
  .one-actions { width: auto; }
  .tile-pic { width: min(48%, 90px); }
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
  .hello { font-size: 28px; }
}
@media (min-width: 900px) {
  .tiles { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; }
}
@media (hover: hover) {
  .tile:hover, .step-main:hover { transform: translateY(-2px); }
  .step.now .step-main:hover { animation: none; }
}

/* ---------- calm mode & reduced motion ---------- */
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- printing ---------- */
#print-root { display: none; }
@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { background: #fff !important; min-height: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root svg.page { display: block; width: 210mm; height: 294mm; margin: 0 auto; break-after: page; page-break-after: always; }
  #print-root svg.page:last-child { break-after: auto; page-break-after: auto; }
}
