:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #23262b; --muted: #6b7078; --line: #e4e2db;
  --accent: #2f6f6a; --accent-ink: #ffffff; --accent-soft: #e0eeec;
  --good: #2e7d4f; --bad: #b3402f; --mid: #a3741a;
  --good-bg: #e3f2e8; --bad-bg: #f8e4df; --mid-bg: #f6ecd5;
  --hm0: #ebe9e2; --hm1: #bfdcd8; --hm2: #86bdb6; --hm3: #4d9a92; --hm4: #2f6f6a;
  --jp: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --shu: #c8452f;            /* vermilion seal; celebration only, never for errors */
  --sakura-1: #f4b6c2; --sakura-2: #f9d1d9; --sakura-3: #e88fa2;
  --shadow: 0 1px 2px rgba(35,38,43,.06), 0 4px 12px rgba(35,38,43,.05);
  --d-fast: 120ms; --d-base: 200ms; --d-slow: 360ms;
  --e-out: cubic-bezier(.2,.8,.2,1);
  --e-in: cubic-bezier(.4,0,1,1);
  --e-spring: cubic-bezier(.34,1.56,.64,1);
  --nav-h: 0px;              /* height of the mobile bottom nav */
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) { :root { --shu: #e8806c; --shadow: none; } }
@media (max-width: 640px) { :root { --nav-h: 58px; } }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191c; --card: #202327; --ink: #e6e6e3; --muted: #9a9fa6; --line: #33373d;
    --accent: #6fb7ae; --accent-ink: #10201e; --accent-soft: #263835;
    --good: #7cc99a; --bad: #e58a78; --mid: #dcb261;
    --good-bg: #1f3328; --bad-bg: #3a2420; --mid-bg: #382f1b;
    --hm0: #2a2d32; --hm1: #2f4a47; --hm2: #3f6d67; --hm3: #55998f; --hm4: #78c2b7;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
.jp, .front-big, .front-pattern { font-family: var(--jp); }
a { color: var(--accent); }
h2 { font-size: 1.4rem; margin: 1rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
h4 { margin: .8rem 0 .3rem; font-size: .95rem; }
code { background: var(--accent-soft); padding: 0 .3em; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
kbd { font: inherit; font-size: .75em; border: 1px solid currentColor; border-radius: 4px; padding: 0 .35em; opacity: .6; }

.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: .4rem 1rem; }
.brand { font-family: var(--jp); font-weight: 700; white-space: nowrap; }
.brand span:not(.brand-jp) { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: .3rem; }
nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav a { text-decoration: none; color: var(--muted); padding: .4rem .7rem; border-radius: 999px; white-space: nowrap; font-size: .92rem; position: relative; }
nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav .lbl { border: 0; padding: 0; margin: 0; font-size: inherit; color: inherit; border-radius: 0; }
nav .ico { display: none; font-family: var(--jp); font-weight: 700; font-size: 18px; line-height: 1.1; }
.gear { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -.4rem -.5rem -.4rem 0; border-radius: 50%; color: var(--muted); text-decoration: none; font-size: 1.35rem; line-height: 1; }
.gear.on { background: var(--accent-soft); color: var(--accent); }
.gear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .gear:hover { color: var(--accent); } }
.badge { display: inline-block; margin-left: .3rem; min-width: 18px; height: 18px; border-radius: 9px; background: var(--shu); color: #fff; font-size: 11px; line-height: 18px; text-align: center; padding: 0 4px; vertical-align: 1px; }
.b-row .b-ico { font-size: 1.4rem; width: 2rem; text-align: center; flex: none; }
@media (max-width: 640px) {
  .top { position: static; min-height: 48px; padding: .3rem 1rem; }
  .gear { margin-left: auto; }
  nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding: 0 0 var(--safe-b); gap: 0; background: var(--card); border-top: 1px solid var(--line); z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; flex: none; }
  nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 0; padding: 0; font-size: 11px; min-width: 0; }
  nav a.on { background: none; }
  nav a.on::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--accent); border-radius: 0 0 2px 2px; }
  nav .ico { display: block; }
  nav .lbl { font-size: 11px; }
  .badge { position: absolute; top: 4px; left: 50%; margin: 0 0 0 6px; }
  main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 3rem); }
}

/* ---- P0 shared components ---- */
/* focus (session) mode: no header, no nav, no nav height */
body[data-session] { --nav-h: 0px; }
body[data-session] .top, body[data-session] nav { display: none; }
body[data-session] main { padding-bottom: calc(var(--safe-b) + 2rem); }
.sess-top { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: .6rem; padding: .4rem 0; background: var(--bg); }
.sess-x { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--muted); font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; margin-left: -.6rem; }
.sess-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .sess-x:hover { background: var(--accent-soft); color: var(--accent); } }
.sess-title { flex: none; font-weight: 600; }
.sess-prog { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; }
.sess-prog .pbar { flex: 1; }
.sess-left { flex: none; font-size: .85rem; color: var(--muted); white-space: nowrap; }
/* sticky bottom action bar for focus screens */
.sess-bar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); margin-top: 14px; padding: 10px 0 8px; background: linear-gradient(to top, var(--bg) 75%, transparent); z-index: 12; }
.sess-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px - var(--safe-b)); }
/* primary call-to-action: one per screen */
.cta { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 52px; padding: .7rem 1.2rem; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 1.05rem; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.cta:hover { filter: brightness(1.05); }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.cta.ghost { background: var(--card); color: var(--accent); min-height: 44px; font-size: 1rem; font-weight: 500; }
.cta:disabled { opacity: .6; cursor: default; }
html[data-fx="on"] .cta { transition: transform var(--d-fast) var(--e-out), filter var(--d-fast); }
html[data-fx="on"] .cta:active:not(:disabled) { transform: scale(.98); }
/* horizontally scrolling chip row (buttons); (.chips/.chip are the older checkbox chips) */
.chiprow { display: flex; gap: .4rem; overflow-x: auto; flex-wrap: nowrap; padding: .2rem 0; margin: .4rem 0; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.fchip { flex: none; min-height: 40px; padding: .3rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.fchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.fchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .fchip:not(.on):hover { border-color: var(--accent); } }
/* one static status line (role="status"); always visible, independent of fx */
.statusline { min-height: 1.6em; margin: .3rem 0; font-size: .92rem; color: var(--muted); }
.statusline.ok { color: var(--good); } .statusline.bad { color: var(--bad); }

main { max-width: 860px; margin: 0 auto; padding: 0 1rem 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; margin: .8rem 0; box-shadow: var(--shadow); }
.card.center, .center { text-align: center; }
.empty { text-align: center; padding: 1.6rem 1rem; color: var(--muted); }
.empty[data-kanji]::before { content: attr(data-kanji); display: block; font: 700 4rem/1.1 var(--jp); color: var(--line); margin-bottom: .4rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.good { color: var(--good); } .bad { color: var(--bad); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.row.nowrap { flex-wrap: nowrap; }

.btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: .55rem 1rem; border-radius: 10px; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.big { padding: .9rem 2rem; font-size: 1.05rem; }
.btn.small { padding: .35rem .8rem; font-size: .85rem; min-height: 36px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .opt:focus-visible, .gl:focus-visible, .b-row:focus-visible, nav a:focus-visible, .close:focus-visible, .toast-act:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: coarse) {
  .btn.small, .gl { min-height: 40px; }
  .wk input { width: 1.5rem; height: 1.5rem; } .wk { gap: 6px; }
  .chip span { min-width: 2.6rem; padding: .45rem 0; }
  .check input, .deckrow input { width: 1.25rem; height: 1.25rem; vertical-align: middle; }
}

input[type=text], input[type=search], input[type=number], input[type=date], select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 100%;
}
input[type=search] { width: 100%; }
.form label { display: flex; flex-direction: column; gap: .25rem; margin: .6rem 0; font-size: .92rem; color: var(--muted); }
.form.inline { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.form.inline label { margin: 0; }
.form.inline input { width: 9rem; }
.check { display: block; padding: .3rem 0; }
.num { width: 5rem; }

/* dashboard */
.heat { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; }
.hm { aspect-ratio: 1; border-radius: 4px; background: var(--hm0); }
.hm.l1 { background: var(--hm1); } .hm.l2 { background: var(--hm2); } .hm.l3 { background: var(--hm3); } .hm.l4 { background: var(--hm4); }
ul { padding-left: 1.2rem; margin: .3rem 0; }

/* review */
.flash { padding: 1.4rem 1rem; }
.face { text-align: center; }
.face.back { text-align: left; }
.front-big { font-size: clamp(5rem, 22vw, 8rem); line-height: 1.1; }
.front-pattern { font-size: clamp(1.8rem, 8vw, 2.8rem); font-weight: 500; padding: 1rem 0; }
.front-sub { color: var(--muted); font-size: .85rem; }
.hv { font-size: 2rem; font-weight: 700; color: var(--accent); text-align: center; letter-spacing: .02em; }
.mean { text-align: center; font-size: 1.1rem; margin-bottom: .6rem; }
.mean.big { font-size: 1.3rem; font-weight: 600; }
.readings { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin: .6rem 0; }
.lbl { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; margin-right: .3rem; }
.gform { margin: .5rem 0; }
.note { background: var(--accent-soft); border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; font-size: .95rem; }
.examples { list-style: none; padding: 0; margin: .8rem 0 0; }
.examples li { padding: .55rem 0; border-top: 1px dashed var(--line); }
.examples .w { font-size: 1.15rem; }
.examples .r { color: var(--muted); font-size: .9rem; }
.examples .ehv { font-size: .8rem; color: var(--accent); font-weight: 600; }
.examples .em { font-size: .92rem; }
.hl { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 .15em; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.grades.one { display: flex; justify-content: center; }
.grade { display: flex; flex-direction: column; align-items: center; padding: .6rem .2rem; font-weight: 600; }
.grade .iv { font-size: .75rem; font-weight: 400; color: var(--muted); }
.grade.again { color: var(--bad); } .grade.good { color: var(--good); } .grade.hard { color: var(--mid); } .grade.easy { color: var(--accent); }
.done-mark { font-size: 3rem; }
.tag { display: inline-block; font-size: .72rem; padding: 0 .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.ref { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tag.now { background: var(--accent); color: var(--accent-ink); }
.st { font-size: .72rem; padding: 0 .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.st-mature { color: var(--good); border-color: var(--good); } .st-young { color: var(--accent); border-color: var(--accent); } .st-learn { color: var(--mid); border-color: var(--mid); }

/* browse */
.filters .row { margin-bottom: 0; }
.tag.leech { background: var(--bad-bg); color: var(--bad); }
.blist { display: flex; flex-direction: column; gap: .4rem; }
.b-row { display: flex; align-items: center; gap: .8rem; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .5rem .8rem; cursor: pointer; width: 100%; }
.b-row:hover { border-color: var(--accent); }
.b-main.big { font-size: 2.2rem; width: 3rem; text-align: center; flex: none; }
.b-main.pat { font-size: 1.1rem; font-weight: 500; width: 8rem; flex: none; word-break: break-all; }
.b-info { flex: 1; min-width: 0; }
.b-meta { display: flex; flex-direction: column; gap: .2rem; align-items: flex-end; flex: none; }
@media (max-width: 480px) { .b-main.pat { width: 5.5rem; } }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--card); border-radius: 16px; max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 1.2rem; position: relative; }
.close { position: absolute; right: .2rem; top: .2rem; width: 44px; height: 44px; border: 0; background: none; font-size: 1.8rem; line-height: 1; color: var(--muted); cursor: pointer; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 30; pointer-events: none; }
.toast { position: static; pointer-events: auto; background: var(--ink); color: var(--bg); padding: .6rem 1.1rem; border-radius: 999px; max-width: min(90vw, 480px); display: flex; align-items: center; gap: .8rem; }
.toast.ok { border-left: 4px solid var(--good); } .toast.warn { border-left: 4px solid var(--mid); }
.toast-act { font: inherit; font-weight: 600; background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: .2rem .3rem; min-height: 32px; }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: 16px 16px 0 0; max-height: 85vh; padding-bottom: calc(1.2rem + var(--safe-b)); }
}

/* quiz */
.bar, .pbar { height: 8px; background: var(--hm0); border-radius: 99px; overflow: hidden; }
.bar i, .pbar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(var(--p, 1)); }
.q-prompt { text-align: center; font-size: 1.1rem; margin: .8rem 0 1.2rem; }
.qkanji { font-size: 3.5rem; line-height: 1.2; }
.qhv { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.qsent { font-size: 1.3rem; }
.q-hint { text-align: center; margin-top: .8rem; font-size: .88rem; }
.opts { display: grid; gap: .5rem; }
.opt { font: inherit; text-align: left; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); cursor: pointer; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--accent); } }
.bigopt { font-size: 1.3rem; }
.opt.right { background: var(--good-bg); border-color: var(--good); }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); }
.opt:disabled { color: var(--ink); cursor: default; }
.fb { margin: .8rem 0; padding: .5rem .8rem; border-radius: 8px; }
.fb.ok { background: var(--good-bg); color: var(--good); } .fb.bad { background: var(--bad-bg); color: var(--bad); }
.score { font-size: 3rem; font-weight: 700; color: var(--accent); }
.wrong-list { list-style: none; padding: 0; }
.wrong-list li { padding: .6rem 0; border-top: 1px dashed var(--line); }
.wrong-list .q-prompt { margin: 0 0 .2rem; text-align: left; }
.wrong-list .qkanji { font-size: 2rem; }

/* roadmap & progress */
.warn { padding: .7rem 1rem; border-radius: 10px; margin: .8rem 0; }
.warn.bad { background: var(--bad-bg); color: var(--bad); } .warn.mid { background: var(--mid-bg); color: var(--mid); } .warn.ok { background: var(--good-bg); color: var(--good); }
.tblwrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.week { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--hm2); border-radius: 10px; padding: .5rem .8rem; margin: .4rem 0; }
.week.P2 { border-left-color: #c9a227; } .week.P3 { border-left-color: #c2603f; } .week.P4 { border-left-color: #6b5fb5; }
.week.current { box-shadow: 0 0 0 2px var(--accent); }
.week summary { cursor: pointer; }
.prow { margin: .4rem 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: .5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.chip span { display: block; min-width: 2.1rem; text-align: center; padding: .2rem 0; border: 1px solid var(--line); border-radius: 6px; font-size: .82rem; }
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.book { margin: .8rem 0; }
.weeks { display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin-top: .3rem; }
.wk { display: flex; align-items: center; gap: 2px; }
.wl { font-size: .72rem; color: var(--muted); width: 1.4rem; }
.wk input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }

/* vocab, reading */
.front-word { font-size: clamp(2.6rem, 12vw, 4.5rem); line-height: 1.2; padding: .6rem 0; font-family: var(--jp); }
.front-read { font-size: 1.2rem; color: var(--muted); }
.front-vi { font-size: 1.6rem; font-weight: 600; padding: 1rem 0; text-align: center; }
.vread { text-align: center; font-size: 1.5rem; }
.hv.small { font-size: 1.1rem; margin: .2rem 0; } .hv.left { text-align: left; }
.rhead { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.rtext { font-size: 1.25rem; line-height: 2.4; margin: .6rem 0; }
.rtext p { margin: 0 0 .8rem; }
.rtext .tk { cursor: pointer; border-radius: 3px; }
.rtext .tk:hover { background: var(--accent-soft); }
.rtext rt { font-size: .55em; color: var(--muted); }
.rtext.nofuri rt, #qs.nofuri rt { display: none; }
.rtitle { font-size: 1.3rem; line-height: 2; }
/* legacy popovers scoped by id so the shared "pop" animation class (J.fx.play(el,'pop')) never picks up their look */
#pop, #glinfo { background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin: .6rem 0; }
#pop .pw, #glinfo .pw { font-size: 1.3rem; font-weight: 600; }
#glinfo { margin-bottom: .8rem; }
.trans { background: var(--bg); border-radius: 10px; padding: .6rem .8rem; margin-top: .6rem; }
.chips2 { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.gl { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: .25rem .7rem; }
.gl:hover { border-color: var(--accent); }
.rq { margin: 1rem 0; } .qtext { margin-bottom: .4rem; }
.why { margin-top: .4rem; font-size: .92rem; }
.dgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
@media (max-width: 560px) { .dgrid { grid-template-columns: 1fr; } }
.deckrow{display:flex;justify-content:space-between;gap:.5rem;flex-wrap:wrap}

/* ---- Phase 1: shared effects (all animations gated by html[data-fx="on"]) ---- */
.opt.right::after { content: '✓'; float: right; color: var(--good); font-weight: 700; }
.opt.wrong::after { content: '✕'; float: right; color: var(--bad); }
@media (hover: hover) {
  .b-row:hover, .gl:hover { background: var(--accent-soft); }
}
.hanko { position: absolute; top: 12px; right: 12px; width: 64px; height: 64px; border: 3px solid var(--shu); border-radius: 50%; color: var(--shu); font: 700 28px/58px var(--jp); text-align: center; transform: rotate(-12deg); opacity: .9; pointer-events: none; }
.hanko.two { font-size: 20px; }
.hanko.sm { width: 34px; height: 34px; font-size: 16px; line-height: 30px; border-width: 2px; top: 6px; right: 6px; }

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { 50% { transform: scale(1.15); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes ov-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes hanko-in { from { opacity: 0; transform: rotate(-12deg) scale(1.6); } }
@keyframes bar-in { from { transform: scaleX(0); } }

html[data-fx="on"] #main.fx-enter { animation: page-in 160ms var(--e-out); }
html[data-fx="on"] .pop { animation: pop 240ms var(--e-out); }
html[data-fx="on"] .shake { animation: shake 300ms var(--e-out); }
html[data-fx="on"] .hanko-in { animation: hanko-in 320ms var(--e-spring); }
html[data-fx="on"] .toast { animation: toast-in 180ms var(--e-out); }
html[data-fx="on"] .toast.out { opacity: 0; transform: translateY(8px); transition: opacity 150ms, transform 150ms; animation: none; }
html[data-fx="on"] .overlay { animation: ov-in 150ms linear; }
html[data-fx="on"] .overlay.closing { opacity: 0; transition: opacity 120ms linear; animation: none; }
html[data-fx="on"] .modal { animation: modal-in 180ms var(--e-out); }
@media (max-width: 640px) { html[data-fx="on"] .modal { animation: sheet-in 220ms var(--e-out); } }
html[data-fx="on"] .bar i, html[data-fx="on"] .pbar i { transition: transform var(--d-slow) var(--e-out); }
html[data-fx="on"] #main.fx-enter .pbar i { animation: bar-in 500ms var(--e-out) backwards; }
html[data-fx="on"] .btn, html[data-fx="on"] .opt, html[data-fx="on"] .gl, html[data-fx="on"] .b-row, html[data-fx="on"] nav a {
  transition: transform var(--d-fast) var(--e-out), background-color var(--d-fast), border-color var(--d-fast);
}
html[data-fx="on"] .btn:active:not(:disabled), html[data-fx="on"] .opt:active:not(:disabled), html[data-fx="on"] .gl:active, html[data-fx="on"] .b-row:active, html[data-fx="on"] nav a:active { transform: scale(.97); }

/* safety net: keep at end of file */
html[data-fx="off"] *, html[data-fx="off"] *::before, html[data-fx="off"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important;
  transition-duration: .01ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
