/* =========================================================================
   Design tokens
   ========================================================================= */
:root {
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --surface-2: #F4F2F8;
  --text: #1D1B26;
  --text-2: #5F5B6E;
  --text-3: #9592A3;
  --border: #ECEAF1;
  --accent: #7468C8;
  --accent-strong: #5D51B3;
  --accent-soft: #EEECFA;
  --accent-soft-2: #E2DFF6;
  --success: #4E9D7E;
  --success-soft: #E6F3EE;
  --warn: #B98436;
  --warn-soft: #FBF3E6;
  --danger: #C2554F;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(29, 27, 38, .04), 0 4px 16px rgba(29, 27, 38, .04);
  --shadow-up: 0 -4px 20px rgba(29, 27, 38, .06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* =========================================================================
   Layout
   ========================================================================= */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-t)) 16px calc(var(--tabbar-h) + 28px + var(--safe-b));
}
.page { animation: fadeUp .35s var(--ease) both; }
.no-anim .page, .no-anim .rest-bar { animation: none !important; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* =========================================================================
   Typography
   ========================================================================= */
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.title { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.h3 { font-size: 17px; font-weight: 600; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin: 28px 4px 10px; }

/* =========================================================================
   Cards
   ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card.hero {
  background: linear-gradient(150deg, #8A7FD6 0%, #6E62C2 100%);
  color: #fff;
  border: 0;
}
.card.hero .muted { color: rgba(255, 255, 255, .78); }
.card.note { background: var(--warn-soft); border-color: transparent; box-shadow: none; color: #6E5223; }
.card.ok { background: var(--success-soft); border-color: transparent; box-shadow: none; color: #2E6B53; }
.card.link { display: block; transition: transform .15s var(--ease); }
.card.link:active { transform: scale(.985); }

.meta { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
  font-size: 13px; font-weight: 600;
}
.tag.grey { background: var(--surface-2); color: var(--text-2); }
.tag.on-hero { background: rgba(255, 255, 255, .18); color: #fff; }
.tag.green { background: var(--success-soft); color: var(--success); }

/* =========================================================================
   Buttons & chips
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 16px; font-weight: 600; font-size: 16px;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s var(--ease), background .2s, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.white { background: #fff; color: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--accent-strong); }
.btn.outline { background: transparent; border: 1.5px solid var(--border); }
.btn.danger { background: #FBECEB; color: var(--danger); }
.btn.lg { min-height: 56px; font-size: 17px; border-radius: 18px; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.block { display: flex; width: 100%; }
.btn.icon { width: 44px; min-height: 44px; padding: 0; border-radius: 14px; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 42px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 15px; font-weight: 500; color: var(--text-2);
  transition: all .18s var(--ease);
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }

.back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-2); font-weight: 500; font-size: 15px; margin: -4px 0 14px -4px; padding: 4px;
}
.back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================================
   Dashboard
   ========================================================================= */
.greet { margin-bottom: 20px; }
.progress-ring { position: relative; width: 92px; height: 92px; flex: none; }
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.progress-ring .bg { stroke: rgba(255, 255, 255, .22); }
.progress-ring .fg { stroke: #fff; stroke-dasharray: 100; transition: stroke-dashoffset .8s var(--ease); }
.progress-ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 22px; line-height: 1; }
.progress-ring .val small { display: block; font-size: 11px; font-weight: 500; opacity: .8; margin-top: 3px; }

.bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }
.card.hero .bar { background: rgba(255, 255, 255, .22); }
.card.hero .bar > i { background: #fff; }

.next-illu { width: 76px; height: 76px; border-radius: 18px; background: var(--accent-soft); flex: none; display: grid; place-items: center; }
.next-illu .illu { width: 64px; height: 64px; }

.cal { display: grid; grid-template-columns: 54px repeat(7, 1fr); gap: 6px; align-items: center; }
.cal .lbl { font-size: 12px; font-weight: 600; color: var(--text-3); }
.cal .dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); padding-bottom: 2px; }
.cal .dow.today { color: var(--accent-strong); }
.cal-cell {
  aspect-ratio: 1; border-radius: 12px; display: grid; place-items: center;
  font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--text-3);
  position: relative;
}
.cal-cell.rest { background: transparent; }
.cal-cell.rest::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--border); position: absolute; }
.cal-cell.workout { background: var(--accent-soft); color: var(--accent-strong); }
.cal-cell.next { background: var(--surface); border: 2px solid var(--accent); color: var(--accent-strong); }
.cal-cell.done { background: var(--accent); color: #fff; }
.cal-cell.done svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.quote { font-size: 17px; font-weight: 500; line-height: 1.45; letter-spacing: -.005em; }

/* =========================================================================
   Lists
   ========================================================================= */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; width: 100%; text-align: left; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-item:active { background: var(--surface-2); }
.list-item .chev { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2; flex: none; }
.thumb { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); flex: none; display: grid; place-items: center; }
.thumb .illu { width: 44px; height: 44px; }
.num {
  width: 36px; height: 36px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 15px;
}
.num.done { background: var(--accent); color: #fff; }
.li-title { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.li-sub { font-size: 13.5px; color: var(--text-2); }

.stage-list { counter-reset: stage; }
.stage-row { display: flex; gap: 14px; align-items: center; padding: 12px 0; }
.stage-row + .stage-row { border-top: 1px solid var(--border); }

.rules { list-style: none; padding: 0; }
.rules li { position: relative; padding-left: 26px; margin: 8px 0; font-size: 15px; color: var(--text-2); }
.rules li::before {
  content: ''; position: absolute; left: 4px; top: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-soft-2); box-shadow: 0 0 0 3px var(--accent-soft);
}
ol.steps { padding: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding-left: 38px; margin: 12px 0; font-size: 15px; }
ol.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 13px; display: grid; place-items: center;
}

details.acc { border-top: 1px solid var(--border); }
details.acc:first-of-type { border-top: 0; }
details.acc summary {
  list-style: none; cursor: pointer; padding: 16px 2px; font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after {
  content: ''; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg); transition: transform .2s; margin-right: 6px;
}
details.acc[open] summary::after { transform: rotate(-135deg); }
details.acc .acc-body { padding: 0 2px 16px; color: var(--text-2); font-size: 15px; }

/* =========================================================================
   Illustrations
   ========================================================================= */
.illu { display: block; }
.illu-fig { fill: none; stroke: var(--text); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.illu-fig circle { fill: var(--text); stroke: none; }
.illu-eq { fill: none; stroke: #B9B5C8; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.illu-motion { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 4 5; }
.hero-illu {
  background: linear-gradient(180deg, var(--accent-soft) 0%, #F7F6FC 100%);
  border-radius: var(--radius); display: grid; place-items: center; padding: 18px;
}
.hero-illu .illu { width: 100%; max-width: 220px; height: auto; aspect-ratio: 1; }
.hero-illu.small .illu { max-width: 150px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; font-weight: 500; }

/* =========================================================================
   Stats
   ========================================================================= */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.stat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--text-2); }

.spark { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.spark i { width: 8px; border-radius: 3px; background: var(--accent-soft-2); }
.spark i:last-child { background: var(--accent); }

/* =========================================================================
   Inputs
   ========================================================================= */
.field { display: block; }
.field input[type=text] {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1.5px solid var(--border);
  padding: 0 14px; background: var(--surface); font-size: 16px;
}
.field input:focus { outline: none; border-color: var(--accent); }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border); transition: .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); transition: .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }

/* =========================================================================
   Tab bar
   ========================================================================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .88); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--text-3); transition: color .2s;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent-strong); }
body.in-session .tabbar { display: none; }

/* =========================================================================
   Active workout (session)
   ========================================================================= */
body.in-session .app { padding-top: 0; padding-bottom: calc(190px + var(--safe-b)); }
.s-head {
  position: sticky; top: 0; z-index: 10; margin: 0 -16px; padding: calc(12px + var(--safe-t)) 16px 12px;
  background: rgba(250, 249, 247, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.s-head .btn.icon { background: var(--surface); border: 1px solid var(--border); }
.s-stage { font-size: 13px; font-weight: 600; color: var(--accent-strong); }
.s-title { font-size: 15px; font-weight: 600; }
.seg { display: flex; gap: 4px; margin-top: 12px; }
.seg i { flex: 1; height: 5px; border-radius: 99px; background: var(--border); overflow: hidden; position: relative; }
.seg i b { position: absolute; inset: 0; width: 0; background: var(--accent); border-radius: inherit; transition: width .4s var(--ease); }

.s-body { padding-top: 8px; }
.s-body .page { animation: fadeUp .3s var(--ease) both; }
.ex-name { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.target { font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--accent-strong); line-height: 1.15; }

.s-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.s-foot-inner { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; }
.s-foot .btn.primary { flex: 1; }

/* Set rows */
.sets { display: flex; flex-direction: column; gap: 8px; }
.setrow {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  min-height: 60px; padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1.5px solid var(--border);
  transition: background .2s, border-color .2s;
}
.setrow .check {
  width: 30px; height: 30px; border-radius: 10px; border: 2px solid var(--accent-soft-2); flex: none;
  display: grid; place-items: center; transition: all .2s var(--ease);
}
.setrow .check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.setrow.checked { background: var(--accent-soft); border-color: transparent; }
.setrow.checked .check { background: var(--accent); border-color: var(--accent); animation: pop .3s var(--ease); }
.setrow.checked .check svg { opacity: 1; }
.setrow.warm { border-style: dashed; }
.setrow .set-t { font-weight: 600; }
.setrow .set-s { font-size: 13px; color: var(--text-2); }

/* Weight stepper */
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button {
  width: 52px; height: 52px; border-radius: 16px; background: var(--surface-2); font-size: 24px; font-weight: 500; color: var(--accent-strong); flex: none;
}
.stepper button:active { transform: scale(.94); }
.stepper .kg-wrap { flex: 1; position: relative; }
.stepper input {
  width: 100%; height: 52px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface);
  text-align: center; font-size: 24px; font-weight: 700; padding-right: 34px; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; border-color: var(--accent); }
.stepper .unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-weight: 600; }

/* Timer ring */
.timer { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.ring { position: relative; width: 220px; height: 220px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring .ring-bg { stroke: var(--accent-soft); }
.ring .ring-fg { stroke: var(--accent); stroke-dasharray: 100; transition: stroke-dashoffset .3s linear; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-time { font-size: 52px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-label { margin-top: 8px; font-size: 14px; color: var(--text-2); font-weight: 500; }
.ring.small { width: 170px; height: 170px; }
.ring.small .ring-time { font-size: 40px; }
.timer-ctrls { display: flex; gap: 10px; width: 100%; }
.timer-ctrls .btn { flex: 1; }
.ring.finished .ring-fg { stroke: var(--success); }

/* Rest bar */
.rest-bar {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 16;
  max-width: 488px; margin: 0 auto;
  background: var(--text); color: #fff; border-radius: 20px; padding: 12px 12px 12px 18px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(29, 27, 38, .25);
  animation: fadeUp .3s var(--ease) both;
}
.rest-bar .rt { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.rest-bar .rl { font-size: 12px; opacity: .7; font-weight: 500; }
.rest-bar .btn { background: rgba(255, 255, 255, .14); color: #fff; }
.rest-bar .bar { background: rgba(255, 255, 255, .15); height: 4px; margin-top: 4px; }
.rest-bar .bar > i { background: var(--accent-soft-2); transition: width .3s linear; }

/* Sides */
.sides { display: flex; gap: 8px; }
.side {
  flex: 1; padding: 10px; border-radius: 14px; text-align: center; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border); color: var(--text-2);
}
.side.current { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.side.done { background: var(--success-soft); border-color: transparent; color: var(--success); }

.choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice button {
  border: 1.5px solid var(--border); background: var(--surface); border-radius: 16px; padding: 10px 6px 12px;
  font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.choice button .illu { width: 54px; height: 54px; }
.choice button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

/* Summary */
.done-badge {
  width: 96px; height: 96px; border-radius: 32px; margin: 12px auto 18px;
  background: var(--accent); display: grid; place-items: center; animation: pop .5s var(--ease) both;
  box-shadow: 0 12px 30px rgba(116, 104, 200, .35);
}
.done-badge svg { width: 46px; height: 46px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================================
   Sheet & toast
   ========================================================================= */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(29, 27, 38, .38); animation: fade .25s both; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  max-width: 560px; margin: 0 auto;
  background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 16px calc(24px + var(--safe-b));
  animation: slideUp .35s var(--ease) both;
}
.sheet-panel::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(100%); } }

.toast {
  position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translate(-50%, -150%);
  z-index: 60; background: var(--text); color: #fff; padding: 12px 18px; border-radius: 16px;
  font-size: 15px; font-weight: 500; max-width: calc(100% - 32px); text-align: center;
  transition: transform .35s var(--ease); pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* =========================================================================
   Password gate
   ========================================================================= */
html.locked .app, html.locked .tabbar { visibility: hidden; }
html.locked body { overflow: hidden; }
.gate {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center; padding: 24px 16px;
  transition: opacity .3s var(--ease);
}
.gate.gate-out { opacity: 0; }
.gate-card { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.gate-icon { margin: 0 auto 8px; border-radius: 18px; box-shadow: 0 10px 28px rgba(116, 104, 200, .3); }
.gate-input {
  width: 100%; min-height: 54px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface);
  padding: 0 16px; font-size: 17px; text-align: center; margin-top: 8px;
}
.gate-input:focus { outline: none; border-color: var(--accent); }
.gate-error { min-height: 20px; font-size: 14px; color: var(--danger); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

@media (min-width: 560px) {
  .app { padding-top: calc(32px + var(--safe-t)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
