/* ============ tokens ============ */
:root {
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #f1f0ea;
  --line: #e7e5dc;
  --line-2: #d9d6ca;
  --text: #1f2421;
  --muted: #6c716c;
  --dim: #9a9e98;
  --accent: #3f7d68;
  --accent-soft: color-mix(in oklab, var(--accent) 12%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 80%, black);
  --danger: #c25b52;
  --warn: #c27a2c;
  --shadow-sm: 0 1px 2px rgb(30 30 20 / .05), 0 1px 1px rgb(30 30 20 / .03);
  --shadow: 0 1px 2px rgb(30 30 20 / .04), 0 8px 24px -8px rgb(30 30 20 / .12);
  --shadow-lg: 0 24px 60px -16px rgb(20 20 10 / .28), 0 2px 6px rgb(20 20 10 / .06);
  --r: 14px;
  --r-sm: 10px;
  --display: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --sans: "DM Sans", ui-sans-serif, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --t: 220ms;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121314;
  --surface: #1a1c1d;
  --surface-2: #222526;
  --line: #2a2d2e;
  --line-2: #363a3b;
  --text: #ecebe6;
  --muted: #9b9f9a;
  --dim: #6d716d;
  --accent-soft: color-mix(in oklab, var(--accent) 22%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 60%, white);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -8px rgb(0 0 0 / .5);
  --shadow-lg: 0 24px 60px -12px rgb(0 0 0 / .7);
  color-scheme: dark;
}
[data-motion="reduced"] { --t: 0ms; }
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }

/* ============ base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; transition: background var(--t) var(--ease), color var(--t) var(--ease); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(26px, 3vw, 34px); font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
kbd { font: 500 11px/1 var(--sans); padding: 3px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.grow { flex: 1; }
.eyebrow { font: 700 11px/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ic { flex: none; }

/* ============ buttons ============ */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform 120ms var(--ease), background var(--t), border-color var(--t), box-shadow var(--t); white-space: nowrap; }
.btn:hover { border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 1px 2px rgb(0 0 0 / .1), inset 0 1px 0 rgb(255 255 255 / .15); }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.xl { height: 52px; padding: 0 30px; font-size: 16px; border-radius: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.btn-group .btn { height: 32px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); transition: background var(--t), color var(--t), transform 120ms; font-size: 18px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 7px; font-size: 16px; }
.icon-btn.lg { width: 48px; height: 48px; border-radius: 14px; }
.ghost-space { visibility: hidden; }
.link { color: var(--accent-ink); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

/* ============ layout ============ */
.app { display: grid; grid-template-columns: auto 1fr; height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 1px solid var(--line); background: color-mix(in oklab, var(--surface) 55%, var(--bg)); overflow-y: auto; overflow-x: hidden; white-space: nowrap; }
.brand-row { display: flex; align-items: center; gap: 4px; padding: 0 0 12px; }
.brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font: 800 18px var(--display); letter-spacing: -0.03em; padding: 4px 6px; border-radius: 10px; }
.logo { flex: none; color: var(--accent); transition: color var(--t), transform 400ms var(--spring); }
.brand:hover .logo { transform: rotate(-6deg) scale(1.06); }
.brand-name b { font-weight: 800; color: var(--accent); }
.search-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin-bottom: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 14px; transition: border-color var(--t); flex: none; }
.search-btn:hover { border-color: var(--line-2); }
.search-btn kbd { margin-left: auto; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; padding-left: calc(10px + var(--d, 0) * 14px); border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px; transition: background var(--t), color var(--t); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); animation: grow-y 300ms var(--ease); }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.nav-item .emoji { width: 18px; text-align: center; font-size: 14px; }
.nav-item.page.active::before { background: var(--c); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.nav-section { display: flex; align-items: center; justify-content: space-between; padding: 18px 10px 6px; font: 700 11px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.nav-empty { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 13px; border-radius: 9px; border: 1px dashed var(--line-2); }
.nav-empty:hover { color: var(--text); border-color: var(--accent); }
.sidebar-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 1px; }
.sidebar-foot .nav-item { width: 100%; text-align: left; }
.main { overflow-y: auto; position: relative; scroll-behavior: smooth; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; padding: 14px clamp(16px, 4vw, 44px); gap: 8px; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(12px); }
#menu-btn { display: none; }
.view { padding: 4px clamp(16px, 4vw, 44px) 120px; max-width: 1240px; margin: 0 auto; }
.view.enter { animation: view-in 420ms var(--ease); }
.scrim { display: none; }

/* theme switch crossfade */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 300ms; }

/* ============ cards & generic ============ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-sm); transition: background var(--t), border-color var(--t); }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h p { font-size: 13px; }
.page-h { margin: 8px 0 22px; }
.page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-emoji { font-size: 30px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in oklab, var(--c) 14%, var(--surface)); }
.crumbs { display: flex; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a:hover { color: var(--text); }
.pill { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.pri-high { background: color-mix(in oklab, var(--danger) 14%, transparent); color: var(--danger); }
.pri-low { background: var(--surface-2); color: var(--muted); }
.meter { height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width 700ms var(--ease); }
.empty-lg { text-align: center; padding: 56px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: rise 500ms var(--ease); }
.empty-lg .mascot { margin-bottom: 6px; }
.empty-sm { display: flex; align-items: center; gap: 12px; padding: 10px 4px; font-size: 14px; }

/* toolbar, chips, search */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 600; transition: all var(--t) var(--ease); text-transform: capitalize; }
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); min-width: 220px; transition: border-color var(--t), box-shadow var(--t); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; flex: 1; color: var(--text); min-width: 0; }

/* ============ tasks ============ */
.quick-add { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); margin-bottom: 10px; transition: border-color var(--t), background var(--t), box-shadow var(--t); }
.quick-add:focus-within { border-style: solid; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--accent); }
.quick-add input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); }
.quick-add.big { height: 50px; margin-bottom: 18px; background: var(--surface); }
.tasks { display: flex; flex-direction: column; gap: 2px; }
.task { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 8px; border-radius: 11px; transition: background var(--t), opacity 300ms, transform 300ms var(--ease); animation: rise 320ms var(--ease) both; }
.task:hover { background: var(--surface-2); }
.tasks .task:nth-child(2) { animation-delay: 25ms; } .tasks .task:nth-child(3) { animation-delay: 50ms; } .tasks .task:nth-child(4) { animation-delay: 75ms; } .tasks .task:nth-child(5) { animation-delay: 100ms; } .tasks .task:nth-child(n+6) { animation-delay: 120ms; }
.tick { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.8px solid var(--line-2); display: grid; place-items: center; transition: background 200ms var(--ease), border-color 200ms, transform 200ms var(--spring); }
.tick:hover { border-color: var(--accent); transform: scale(1.08); }
.tick svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 260ms var(--ease) 60ms; }
.task.done .tick { background: var(--accent); border-color: var(--accent); }
.task.done .tick svg { stroke-dashoffset: 0; }
.task.completing .tick { animation: pop 380ms var(--spring); }
.task-main { flex: 1; min-width: 0; text-align: left; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.task-title { font-weight: 500; position: relative; width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color 300ms; }
.task-title::after { content: ""; position: absolute; left: 0; top: 52%; height: 1.5px; width: 0; background: currentColor; transition: width 300ms var(--ease); }
.task.done .task-title { color: var(--dim); }
.task.done .task-title::after { width: 100%; }
.task.completing { animation: settle 380ms var(--ease) forwards; }
.task.removing { opacity: 0; transform: translateX(16px); }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.task-meta:empty { display: none; }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.overdue { color: var(--danger); font-weight: 600; }
.list-tag { color: color-mix(in oklab, var(--c) 75%, var(--text)); }
.row-del { opacity: 0; width: 32px; height: 32px; transition: opacity var(--t), background var(--t), color var(--t); }
.task:hover .row-del, .row-del:focus-visible { opacity: 1; }
.row-del:hover { color: var(--danger); }
.group { margin-bottom: 18px; }
.group h4 { display: flex; align-items: center; gap: 8px; font: 700 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 10px; }
.group h4 span, .group-toggle span { font-weight: 600; color: var(--dim); }
.group.overdue h4 { color: var(--danger); }
.group-toggle { display: flex; align-items: center; gap: 6px; font: 700 12px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.group-toggle:hover { color: var(--text); }
.group-toggle .ic { transition: transform 250ms var(--ease); }
.done-group.open .group-toggle .ic { transform: rotate(90deg); }
.subpages { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 18px; }
.subpage { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--c); transition: transform var(--t) var(--ease), box-shadow var(--t); }
.subpage:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.subpage .emoji { font-size: 20px; }
.subpage .muted { font-size: 12px; }

/* ============ dialogs ============ */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: rgb(15 15 10 / .38); backdrop-filter: blur(3px); animation: fade-in 200ms var(--ease); }
dialog.closing::backdrop { animation: fade-out 180ms var(--ease) forwards; }
.dialog { margin: auto; width: min(540px, calc(100vw - 24px)); }
.dialog.wide { width: min(720px, calc(100vw - 24px)); }
.dialog form { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: dialog-in 300ms var(--spring); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.dialog.closing form { animation: dialog-out 180ms var(--ease) forwards; }
.dialog header { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 22px 6px; gap: 12px; }
.dialog header h2 { overflow-wrap: anywhere; }
.dialog-body { padding: 12px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.dialog footer { display: flex; gap: 8px; padding: 14px 22px 20px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field > span em { font-style: normal; font-weight: 400; color: var(--dim); }
.field input:not([type=radio]):not([type=checkbox]):not([type=color]), .field select, .field textarea, .input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: 0; transition: border-color var(--t), box-shadow var(--t), background var(--t); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.field textarea { resize: vertical; min-height: 60px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; }
.shake { animation: shake 360ms; border-color: var(--danger) !important; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); gap: 2px; }
.seg label, .seg > button { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg > button { display: block; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all var(--t) var(--ease); white-space: nowrap; }
.seg input:checked + span, .seg > button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.seg.big > button { padding: 8px 18px; font-size: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch input, .emoji-grid input, .banner-pick input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); transition: transform 200ms var(--spring), box-shadow 200ms; }
.swatch span:hover { transform: scale(1.12); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); transform: scale(1.05); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid span { display: grid; place-items: center; height: 38px; border-radius: 10px; font-size: 18px; cursor: pointer; border: 1px solid transparent; transition: all 150ms; }
.emoji-grid span:hover { background: var(--surface-2); }
.emoji-grid input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.05); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; align-items: center; }

/* palette */
.palette { margin: 12vh auto auto; width: min(620px, calc(100vw - 24px)); background: var(--surface); border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden; animation: dialog-in 240ms var(--spring); }
.palette.closing { animation: dialog-out 150ms var(--ease) forwards; }
.pal-search { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-search input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
.palette ul { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; color: var(--muted); }
.palette li.sel { background: var(--accent-soft); color: var(--text); }
.palette li.empty { justify-content: center; padding: 28px; cursor: default; }
.pl { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl small { color: var(--dim); margin-left: 8px; }
.pk { font-size: 12px; }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); }

/* ============ buddy + toasts ============ */
.buddy { position: fixed; right: 22px; bottom: 18px; z-index: 30; cursor: pointer; user-select: none; display: flex; flex-direction: column; align-items: flex-end; }
.buddy[hidden] { display: none; }
.buddy-art { filter: drop-shadow(0 6px 10px rgb(0 0 0 / .12)); transition: transform 250ms var(--spring); }
.buddy:hover .buddy-art { transform: translateY(-3px) rotate(-3deg); }
.buddy-bubble { max-width: 220px; padding: 9px 13px; margin-bottom: 8px; border-radius: 14px 14px 4px 14px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px) scale(.9); transform-origin: bottom right; transition: opacity 220ms var(--ease), transform 300ms var(--spring); pointer-events: none; }
.buddy-bubble.show { opacity: 1; transform: none; }
.bounce { animation: hop 600ms var(--spring); }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in 320ms var(--spring); pointer-events: auto; }
.toast.out { animation: toast-out 240ms var(--ease) forwards; }
.toast-error { background: var(--danger); color: #fff; }
.toast-action { font-weight: 700; color: var(--bg); padding: 4px 10px; border-radius: 8px; background: color-mix(in oklab, var(--bg) 16%, transparent); }
.burst { position: fixed; pointer-events: none; z-index: 60; }
.burst i { position: absolute; width: 6px; height: 6px; border-radius: 2px; animation: burst 620ms var(--ease) forwards; }

/* ============ mascot animation ============ */
.mascot { overflow: visible; display: block; }
.mascot .m-body { animation: bob 2.6s ease-in-out infinite; transform-origin: 7px 9px; }
.mascot .m-eye { animation: blink 4.5s infinite; transform-origin: center 3px; transform-box: fill-box; }
.mood-happy .m-body { animation: jump 700ms var(--ease) infinite; }
.mood-happy .m-arm-l, .mood-wave .m-arm-r { animation: wave 500ms ease-in-out infinite alternate; transform-box: fill-box; transform-origin: right center; }
.mood-happy .m-arm-r { animation: wave 500ms ease-in-out infinite alternate-reverse; transform-box: fill-box; transform-origin: left center; }
.mood-focus .m-body { animation: bob 4s ease-in-out infinite; }
.mood-sleep .m-body { animation: breathe 3.4s ease-in-out infinite; }
.mood-sad .m-body { animation: none; transform: translateY(.6px); }
.m-z { animation: zzz 2.4s ease-in-out infinite; }
.mascot:hover .m-leg { animation: step 300ms steps(2) infinite; }
.mascot:hover .m-leg2 { animation-delay: 150ms; }

/* ---- tricks (random antics, see TRICKS in mascot.js). --tms = trick length ---- */
.mascot.trick .m-eye { animation: none; }
/* whole-sprite moves */
.mascot.trick-hop { animation: t-hop var(--tms) ease-in-out both; transform-origin: 50% 100%; }
.mascot.trick-flip { animation: t-flip var(--tms) ease-in-out both; transform-origin: 50% 60%; }
.mascot.trick-walk { animation: t-walk var(--tms) ease-in-out both; }
.mascot.trick-peek { animation: t-peek var(--tms) ease-in-out both; }
.mascot.trick-surprise { animation: t-jolt var(--tms) ease-out both; }
.trick-walk .m-leg, .trick-music .m-leg, .trick-headphones .m-leg { animation: step 200ms steps(2) infinite; }
.trick-walk .m-leg2, .trick-music .m-leg2, .trick-headphones .m-leg2 { animation-delay: 100ms; }
/* body moves */
.mascot.trick-spin .m-body { animation: t-spin var(--tms) ease-in-out both; transform-origin: 7px 4.5px; }
.mascot.trick-sneeze .m-body { animation: t-sneeze var(--tms) ease-in-out both; }
.mascot.trick-music .m-body { animation: t-sway 560ms ease-in-out 5 alternate both; }
.mascot.trick-headphones .m-body { animation: t-headbang 340ms ease-in-out infinite; }
.mascot.trick-party .m-body { animation: jump 700ms ease-in-out 3; }
.mascot.trick-shiver .m-body { animation: t-shiver 70ms linear infinite alternate; }
.mascot.trick-cookie .m-body { animation: t-nibble 240ms ease-in-out infinite alternate; }
.mascot.trick-tongue .m-body, .mascot.trick-think .m-body, .mascot.trick-wink .m-body { animation: t-tilt var(--tms) ease-in-out both; }
.mascot.trick-shades .m-body { animation: t-tilt var(--tms) ease-in-out reverse both; }
.mascot.trick-yawn .m-body { animation: t-tall var(--tms) ease-in-out both; }
.trick-yawn .m-arm-l, .trick-yawn .m-arm-r { animation: t-stretch var(--tms) ease-in-out both; }
.trick-wizard .m-arm-r { animation: wave 260ms ease-in-out infinite alternate; transform-box: fill-box; }
.trick-balloon .m-arm-r { transform: translateY(-1px); }
.m-look { animation: t-look var(--tms) ease-in-out both; }
/* props */
.m-drop { transform-box: fill-box; transform-origin: center bottom; animation: t-drop var(--tms) ease both; }
.m-tip { transform-box: fill-box; transform-origin: 10% 100%; animation: t-tip var(--tms) ease-in-out both; }
.m-tongue { transform-box: fill-box; transform-origin: center top; animation: t-blep var(--tms) ease both; }
.m-yawn { transform-box: fill-box; transform-origin: center top; animation: t-yawn var(--tms) ease-in-out both; }
.m-gum { transform-box: fill-box; transform-origin: center; animation: t-gum var(--tms) ease-in both; }
.m-cookie { transform-box: fill-box; transform-origin: center; animation: t-chomp var(--tms) steps(1, end) both; }
.m-pop { transform-box: fill-box; transform-origin: center bottom; animation: t-pop var(--tms) ease both; }
.m-balloon { transform-origin: 13px 3.6px; animation: t-balloon var(--tms) ease-in-out both; }
.m-conf { transform-box: fill-box; transform-origin: center; animation: t-conf 1100ms ease-out both; animation-delay: var(--dl, 0ms); }
.m-float { transform-box: fill-box; animation: t-float 1500ms ease-out both; animation-delay: var(--dl, 0ms); }
.m-twinkle { transform-box: fill-box; transform-origin: center; animation: t-twinkle 600ms ease-in-out infinite alternate both; animation-delay: var(--dl, 0ms); }

/* ============ keyframes ============ */
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }
@keyframes pop { 40% { transform: scale(1.3); } }
@keyframes settle { 60% { transform: translateX(4px); } 100% { opacity: .55; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.3) rotate(180deg); opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes bob { 50% { transform: translateY(-.5px); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-1.6px); } 55% { transform: translateY(-1.6px) scaleY(1.03); } 80% { transform: translateY(0) scaleY(.96); } }
@keyframes breathe { 50% { transform: scaleY(.96) translateY(.2px); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes wave { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(2px, -3px); } }
@keyframes step { 50% { transform: translateY(-.5px); } }
@keyframes t-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 18% { transform: translateY(2px) scale(1.08, .88); } 45% { transform: translateY(-26px) scale(.94, 1.08); } 70% { transform: translateY(0) scale(1.1, .88); } 84% { transform: translateY(-4px) scale(1, 1); } }
@keyframes t-flip { 0% { transform: translateY(0) rotate(0) scale(1, 1); } 15% { transform: translateY(3px) rotate(0) scale(1.08, .88); } 50% { transform: translateY(-34px) rotate(-200deg) scale(1, 1); } 75% { transform: translateY(0) rotate(-360deg) scale(1.1, .9); } 88% { transform: translateY(-3px) rotate(-360deg) scale(1, 1); } 100% { transform: translateY(0) rotate(-360deg) scale(1, 1); } }
@keyframes t-walk { 0%, 100% { transform: translateX(0); } 35%, 55% { transform: translateX(-96px); } }
@keyframes t-peek { 0%, 100% { transform: translateY(0); } 22%, 60% { transform: translateY(70px); } 72% { transform: translateY(-12px); } 82% { transform: translateY(3px); } 90% { transform: translateY(0); } }
@keyframes t-jolt { 0%, 45%, 100% { transform: translateY(0); } 18% { transform: translateY(-12px); } }
@keyframes t-spin { 0% { transform: rotate(0) scale(1); } 20% { transform: rotate(-25deg) scale(.94); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes t-sneeze { 0%, 100% { transform: rotate(0) scale(1, 1); } 20% { transform: rotate(-4deg) scale(1, 1.03); } 45% { transform: rotate(-9deg) scale(1.02, 1.07); } 52% { transform: rotate(10deg) scale(1.08, .88); } 66% { transform: rotate(-3deg) scale(1, 1); } 80% { transform: rotate(1deg) scale(1, 1); } }
@keyframes t-sway { from { transform: rotate(-7deg); } to { transform: rotate(7deg); } }
@keyframes t-headbang { 50% { transform: translateY(.7px) scaleY(.95); } }
@keyframes t-shiver { from { transform: translateX(-.35px); } to { transform: translateX(.35px); } }
@keyframes t-nibble { to { transform: translateY(-.45px) scaleY(1.02); } }
@keyframes t-tilt { 0%, 100% { transform: rotate(0); } 18%, 82% { transform: rotate(-7deg); } }
@keyframes t-tall { 0%, 100% { transform: scaleY(1); } 30%, 65% { transform: scaleY(1.07); } }
@keyframes t-stretch { 0%, 100% { transform: translateY(0); } 30%, 65% { transform: translateY(-2.6px); } }
@keyframes t-look { 0%, 12% { transform: translateX(0); } 20%, 44% { transform: translateX(-1px); } 54%, 78% { transform: translateX(1px); } 88%, 100% { transform: translateX(0); } }
@keyframes t-drop { 0% { transform: translateY(-7px); opacity: 0; } 14% { transform: translateY(.4px); opacity: 1; } 20%, 86% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-7px); opacity: 0; } }
@keyframes t-tip { 0%, 40%, 66%, 100% { transform: translateY(0) rotate(0); } 50%, 56% { transform: translateY(-1.8px) rotate(-16deg); } }
@keyframes t-blep { 0% { transform: scaleY(0); } 14% { transform: scaleY(1.2); } 22%, 84% { transform: scaleY(1); } 100% { transform: scaleY(0); } }
@keyframes t-yawn { 0%, 8% { transform: scaleY(0); } 32%, 64% { transform: scaleY(1); } 90%, 100% { transform: scaleY(0); } }
@keyframes t-gum { 0%, 8% { transform: scale(0); opacity: 1; } 76% { transform: scale(1); opacity: 1; } 80% { transform: scale(1.12); opacity: 1; } 83% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(0); opacity: 0; } }
@keyframes t-chomp { 0% { transform: scale(1); } 28% { transform: scale(.78); } 52% { transform: scale(.56); } 76% { transform: scale(.32); } 90%, 100% { transform: scale(0); } }
@keyframes t-pop { 0% { opacity: 0; transform: scale(.2) rotate(0); } 12% { opacity: 1; transform: scale(1.25) rotate(0); } 20% { transform: scale(1) rotate(0); } 42% { transform: scale(1) rotate(-12deg); } 62% { transform: scale(1) rotate(12deg); } 82% { opacity: 1; transform: scale(1) rotate(0); } 100% { opacity: 0; transform: scale(1) rotate(0); } }
@keyframes t-balloon { 0% { opacity: 0; transform: translate(0, 2px) rotate(0) scale(.5); } 14% { opacity: 1; transform: translate(0, 0) rotate(-6deg) scale(1); } 34% { transform: translate(0, 0) rotate(6deg) scale(1); } 54% { transform: translate(0, 0) rotate(-5deg) scale(1); } 70% { opacity: 1; transform: translate(0, 0) rotate(3deg) scale(1); } 100% { opacity: 0; transform: translate(6px, -18px) rotate(20deg) scale(1); } }
@keyframes t-conf { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 8% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(220deg); } }
@keyframes t-float { 0% { opacity: 0; transform: translate(0, 1px) scale(.5); } 15% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--x, 1px), -6px) scale(1); } }
@keyframes t-twinkle { 0% { opacity: 0; transform: scale(.3) rotate(0); } 100% { opacity: 1; transform: scale(1) rotate(45deg); } }
@keyframes hop { 30% { transform: translateY(-14px) scale(1.04, .96); } 55% { transform: translateY(0) scale(1.06, .92); } 75% { transform: translateY(-4px); } }
