/* ───────────────────────────────────────────────────────────────
   Coinkie — "clay candy" design system
   Soft pastel clay surfaces, chunky rounded shapes, bouncy motion.
──────────────────────────────────────────────────────────────── */
:root {
  --font: "Nunito", "Varela Round", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;

  --pink: #FF8FAB; --pink-2: #FF6F91; --pink-soft: #FFE1EA;
  --mint: #7FD8BE; --mint-2: #4FC3A1; --mint-soft: #DDF6EE;
  --butter: #FFD166; --butter-soft: #FFF1C9;
  --lavender: #B8B5FF; --lavender-soft: #E8E7FF;
  --sky: #8ECAE6; --peach: #FFA07A;
  --red: #F25F5C;

  --bg: #FFF6EE;
  --bg-2: #FFEFE3;
  --surface: #FFFFFF;
  --surface-2: #FFF9F3;
  --ink: #2E2A3B;
  --ink-2: #6B6480;
  --ink-3: #A39DB5;
  --track: #F0E8EE;
  --line: #F2E6EC;
  --nav-bg: rgba(255, 250, 246, .85);

  --shadow-clay: 0 10px 24px -10px rgba(120, 60, 90, .22), inset 0 -4px 0 rgba(120, 60, 90, .06), inset 0 2px 0 rgba(255, 255, 255, .9);
  --shadow-soft: 0 6px 18px -8px rgba(120, 60, 90, .18);
  --shadow-pop: 0 18px 40px -14px rgba(255, 111, 145, .55);
  --radius: 24px; --radius-s: 16px; --radius-xs: 12px;
  --nav-h: 72px;
  --sidebar-w: 260px;
  --ease: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"], :root[data-theme="auto"].sys-dark {
  --bg: #1B1826; --bg-2: #221E31; --surface: #2A2540; --surface-2: #332D4B;
  --ink: #F6F1FA; --ink-2: #BDB4D1; --ink-3: #8B82A6; --track: #3C3555; --line: #3A3350;
  --nav-bg: rgba(34, 30, 49, .86);
  --pink-soft: #4A2A3C; --mint-soft: #1F3D36; --butter-soft: #4A3F22; --lavender-soft: #2F2C50;
  --shadow-clay: 0 12px 28px -12px rgba(0, 0, 0, .6), inset 0 -4px 0 rgba(0, 0, 0, .25), inset 0 2px 0 rgba(255, 255, 255, .06);
  --shadow-soft: 0 6px 18px -8px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; }
body { min-height: 100%; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; font-weight: 600; }
body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--pink-2); }
::selection { background: var(--pink-soft); }
svg { display: block; }

/* background decorations */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; }
.bg-blobs span:nth-child(1) { width: 320px; height: 320px; background: var(--pink); top: -120px; right: -80px; }
.bg-blobs span:nth-child(2) { width: 280px; height: 280px; background: var(--mint); bottom: 10%; left: -120px; animation-delay: -5s; }
.bg-blobs span:nth-child(3) { width: 240px; height: 240px; background: var(--butter); bottom: -80px; right: 20%; animation-delay: -9s; }
.sys-dark .bg-blobs span, [data-theme="dark"] .bg-blobs span { opacity: .22; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(18px, -24px) scale(1.08); } }

/* ───────── Layout ───────── */
#app { min-height: 100dvh; }
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: calc(16px + var(--sat)) 16px calc(var(--nav-h) + 24px + var(--sab)); max-width: 720px; margin: 0 auto; width: 100%; }
.page { animation: page-in .38s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.topbar h1 { font-size: 26px; }
.topbar .sub { color: var(--ink-2); font-size: 14px; }

/* mobile bottom nav */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + var(--sab)); padding-bottom: var(--sab);
  background: var(--nav-bg); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-3); font-size: 11px; font-weight: 800; height: 100%; justify-content: center; transition: color .2s, transform .2s var(--ease); position: relative; }
.tab:active { transform: scale(.9); }
.tab.active { color: var(--pink-2); }
.tab.active::before { content: ""; position: absolute; top: 6px; width: 36px; height: 36px; border-radius: 14px; background: var(--pink-soft); z-index: -1; animation: pop .3s var(--ease); }
.tab svg { width: 24px; height: 24px; }
.tab-fab { display: flex; align-items: center; justify-content: center; }
.fab { width: 58px; height: 58px; border-radius: 22px; background: linear-gradient(145deg, var(--pink), var(--pink-2)); color: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow-pop), inset 0 -4px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .35); transform: translateY(-14px); transition: transform .25s var(--ease); }
.fab:active { transform: translateY(-14px) scale(.9); }
.fab svg { width: 28px; height: 28px; }

/* desktop */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .sidebar { display: flex; flex-direction: column; gap: 6px; width: var(--sidebar-w); padding: 24px 18px; position: sticky; top: 0; height: 100dvh; border-right: 1px solid var(--line); background: var(--nav-bg); backdrop-filter: blur(18px); }
  .brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-size: 24px; font-weight: 900; letter-spacing: -.02em; }
  .brand .mascot { --size: 44px; }
  .side-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; color: var(--ink-2); font-weight: 800; transition: background .2s, color .2s, transform .2s var(--ease); }
  .side-link:hover { background: var(--surface-2); color: var(--ink); transform: translateX(3px); }
  .side-link.active { background: var(--pink-soft); color: var(--pink-2); }
  .side-link svg { width: 22px; height: 22px; }
  .side-add { margin-top: 10px; }
  .side-foot { margin-top: auto; padding: 10px; color: var(--ink-3); font-size: 12px; }
  .main { max-width: 1080px; padding: 28px 36px 60px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .span-2 { grid-column: span 2; }
  .topbar h1 { font-size: 32px; }
}
@media (min-width: 1240px) { .main { max-width: 1180px; } }

/* ───────── Cards & surfaces ───────── */
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-clay); margin-bottom: 16px; position: relative; }
.card.tight { padding: 14px; }
.card.flat { box-shadow: none; background: var(--surface-2); }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 15px; color: var(--ink-2); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.card-title .link { text-transform: none; letter-spacing: 0; }
.hero { background: linear-gradient(135deg, #FF9FBA 0%, #FF7FA3 55%, #FFB380 100%); color: #fff; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .18); right: -70px; top: -90px; }
.hero .label { opacity: .9; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hero .big { font-size: 38px; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.hero .pill { background: rgba(255, 255, 255, .22); }
.stat-row { display: flex; gap: 10px; }
.stat { flex: 1; background: var(--surface-2); border-radius: var(--radius-s); padding: 12px; }
.stat .k { font-size: 12px; color: var(--ink-2); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.stat .v { font-size: 20px; font-weight: 900; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero .stat { background: rgba(255, 255, 255, .18); }
.hero .stat .k { color: rgba(255, 255, 255, .85); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 800; color: var(--ink-2); }
.pill.pink { background: var(--pink-soft); color: var(--pink-2); }
.pill.mint { background: var(--mint-soft); color: var(--mint-2); }
.pill.butter { background: var(--butter-soft); color: #B4841B; }
.pill.lav { background: var(--lavender-soft); color: #6F68D8; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 14px; font-weight: 800; color: var(--ink-2); white-space: nowrap; transition: transform .2s var(--ease), background .2s, color .2s; border: 2px solid transparent; }
.chip:active { transform: scale(.94); }
.chip.active { background: var(--ink); color: var(--bg); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }

.muted { color: var(--ink-2); }
.tiny { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; }
.center { text-align: center; }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--mint-2); } .neg { color: var(--pink-2); }
.link { color: var(--pink-2); font-weight: 800; font-size: 14px; }
.empty { text-align: center; padding: 26px 12px; color: var(--ink-2); }
.empty .mascot { margin: 0 auto 8px; }
.divider { height: 1px; background: var(--line); margin: 10px 0; }

/* ───────── Buttons ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 20px; border-radius: 18px; font-weight: 900; font-size: 16px; transition: transform .2s var(--ease), box-shadow .2s, filter .2s; user-select: none; }
.btn:active { transform: scale(.95); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: linear-gradient(145deg, var(--pink), var(--pink-2)); color: #fff; box-shadow: 0 10px 22px -10px rgba(255, 111, 145, .7), inset 0 -4px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .3); }
.btn-mint { background: linear-gradient(145deg, var(--mint), var(--mint-2)); color: #fff; box-shadow: 0 10px 22px -10px rgba(79, 195, 161, .7), inset 0 -4px 0 rgba(0, 0, 0, .12), inset 0 2px 0 rgba(255, 255, 255, .3); }
.btn-ghost { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .04); }
.btn-danger { background: linear-gradient(145deg, #FF7B79, var(--red)); color: #fff; box-shadow: 0 10px 22px -10px rgba(242, 95, 92, .7), inset 0 -4px 0 rgba(0, 0, 0, .12); }
.btn-sm { padding: 9px 14px; font-size: 14px; border-radius: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); transition: transform .2s var(--ease), background .2s; flex: none; }
.icon-btn:active { transform: scale(.88); }
.icon-btn.plain { background: transparent; }
.icon-btn svg { width: 22px; height: 22px; }

/* ───────── Forms ───────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 800; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.field-hint { font-size: 12px; color: var(--ink-3); }
.input { width: 100%; padding: 14px 16px; border-radius: 16px; border: 2px solid transparent; background: var(--surface-2); outline: none; font-weight: 700; font-size: 16px; transition: border-color .2s, box-shadow .2s, background .2s; appearance: none; -webkit-appearance: none; color: var(--ink); }
.input:focus { border-color: var(--pink); background: var(--surface); box-shadow: 0 0 0 4px var(--pink-soft); }
.input.error { border-color: var(--red); }
.input::placeholder { color: var(--ink-3); font-weight: 600; }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
textarea.input { resize: vertical; min-height: 70px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; background: transparent; }
.input-wrap .icon-btn:active { transform: translateY(-50%) scale(.88); }
.amount-input { font-size: 44px; font-weight: 900; text-align: center; letter-spacing: -.03em; background: transparent; border: 0; width: 100%; outline: none; color: var(--ink); padding: 6px 0; font-variant-numeric: tabular-nums; }
.amount-input::placeholder { color: var(--ink-3); }
.amount-box { text-align: center; padding: 10px 0 4px; }
.amount-box .cur { font-size: 20px; color: var(--ink-3); font-weight: 900; }
.amount-box.expense .amount-input { color: var(--pink-2); }
.amount-box.income .amount-input { color: var(--mint-2); }
.amount-box.transfer .amount-input { color: #6F68D8; }
.quick-amounts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.quick-amounts .chip { padding: 6px 12px; font-size: 13px; }

.segmented { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg { flex: 1; padding: 10px 8px; border-radius: 12px; font-weight: 800; color: var(--ink-2); font-size: 14px; transition: background .25s, color .25s, transform .2s var(--ease), box-shadow .25s; white-space: nowrap; }
.seg.active { background: var(--seg, var(--surface)); color: var(--ink); box-shadow: var(--shadow-soft); transform: scale(1.02); }
.seg.active[style*="--seg"] { color: #fff; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-bottom: 14px; }
.cat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 18px; background: var(--surface-2); font-size: 11px; font-weight: 800; color: var(--ink-2); transition: transform .2s var(--ease), background .2s, box-shadow .2s; border: 2px solid transparent; text-align: center; line-height: 1.15; }
.cat-item .emoji-badge { width: 38px; height: 38px; font-size: 19px; }
.cat-item:active { transform: scale(.92); }
.cat-item.active { background: var(--surface); border-color: var(--c); box-shadow: 0 8px 18px -10px var(--c); color: var(--ink); transform: scale(1.05); }
.emoji-badge { display: inline-grid; place-items: center; border-radius: 40%; background: color-mix(in srgb, var(--c) 28%, var(--surface)); flex: none; line-height: 1; box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--c) 45%, transparent); }
.toggle { position: relative; width: 52px; height: 32px; border-radius: 999px; background: var(--track); transition: background .25s; flex: none; }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.toggle.on { background: var(--mint-2); }
.toggle.on::after { transform: translateX(20px); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.swatch { width: 32px; height: 32px; border-radius: 12px; border: 3px solid transparent; transition: transform .2s var(--ease); }
.swatch.active { border-color: var(--ink); transform: scale(1.12); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 14px; max-height: 190px; overflow-y: auto; padding: 2px; }
.emoji-opt { font-size: 22px; height: 44px; border-radius: 12px; background: var(--surface-2); transition: transform .2s var(--ease); display: grid; place-items: center; }
.emoji-opt.active { background: var(--pink-soft); transform: scale(1.1); }
.date-chips { display: flex; gap: 8px; margin-bottom: 14px; }
.date-chips input[type="date"] { flex: 1; }

/* ───────── Lists ───────── */
.list { display: flex; flex-direction: column; gap: 6px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 6px 6px; font-size: 13px; font-weight: 900; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.tx { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-soft); transition: transform .2s var(--ease), background .2s; animation: pop-in .35s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 30ms); text-align: left; width: 100%; }
.tx:active { transform: scale(.98); }
.tx .t { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .s { font-size: 12px; color: var(--ink-3); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.row-item:last-child { border-bottom: 0; }
.row-item .t { font-weight: 800; }
.row-item .s { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.budget-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.budget-item:last-child { border-bottom: 0; }
.hbar { height: 10px; border-radius: 999px; background: var(--track); overflow: hidden; margin-top: 8px; }
.hbar-fill { height: 100%; border-radius: 999px; transition: width .8s var(--ease-out); animation: grow-x .8s var(--ease-out) both; transform-origin: left; }
@keyframes grow-x { from { transform: scaleX(0); } }
.acc-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.acc-strip::-webkit-scrollbar { display: none; }
.acc-card { min-width: 150px; padding: 14px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-clay); flex: none; text-align: left; transition: transform .2s var(--ease); border-top: 5px solid var(--c); }
.acc-card:active { transform: scale(.96); }
.acc-card .n { font-size: 13px; color: var(--ink-2); font-weight: 800; margin-top: 8px; }
.acc-card .b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.goal-card { display: flex; gap: 14px; align-items: center; }
.goal-card .ring-wrap { flex: none; }

/* ───────── Charts ───────── */
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.bar { animation: grow-y .7s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); transform-origin: bottom; transform-box: fill-box; transition: opacity .2s; opacity: .85; }
.bar-sel { opacity: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .15)); }
@keyframes grow-y { from { transform: scaleY(0); } }
.bar-label { font-size: 11px; font-weight: 800; fill: var(--ink-3); font-family: var(--font); }
.bar-label.sel { fill: var(--ink); }
.donut-wrap { position: relative; margin: 0 auto; }
.donut-slice { transition: stroke-width .2s, opacity .2s; cursor: pointer; animation: fade .6s ease both; animation-delay: calc(var(--i) * 60ms); }
.donut-slice:hover { stroke-width: 32; }
@keyframes fade { from { opacity: 0; } }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center .v { font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.donut-center .k { font-size: 11px; color: var(--ink-3); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.ring-wrap { position: relative; }
.ring-fill { transition: stroke-dashoffset .9s var(--ease-out); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.area-line { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.2s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.area-fill { animation: fade .9s ease both; animation-delay: .3s; }
.area-dot { animation: pop .4s var(--ease) both; animation-delay: .9s; }
.legend { display: flex; flex-direction: column; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend-item .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }

/* ───────── Mascot ───────── */
.mascot { position: relative; width: var(--size); display: inline-block; }
.mascot svg { width: var(--size); height: var(--size); overflow: visible; }
.m-body { transform-origin: 100px 170px; animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scaleY(1) scaleX(1); } 50% { transform: scaleY(1.025) scaleX(.985); } }
.m-shadow { transform-origin: 100px 178px; animation: shadow 3.2s ease-in-out infinite; }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.94); opacity: .8; } }
.m-eye { animation: blink 4.6s infinite; transform-box: fill-box; transform-origin: center; }
.m-eye-r { animation-delay: .05s; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
.m-ear { transform-box: fill-box; transform-origin: bottom center; animation: ear 5s ease-in-out infinite; }
.m-ear-r { animation-delay: -2.4s; }
@keyframes ear { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(-10deg); } 96% { transform: rotate(6deg); } }
.m-tail { transform-box: fill-box; transform-origin: left center; animation: tail 2.4s ease-in-out infinite; }
@keyframes tail { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(14deg); } }
.m-brow { opacity: 0; transition: opacity .3s; }
.m-sparks, .m-zzz { opacity: 0; transition: opacity .3s; }
.mood-worried .m-brow { opacity: 1; }
.mood-worried .m-brow-l { transform: rotate(14deg); transform-box: fill-box; transform-origin: center; }
.mood-worried .m-brow-r { transform: rotate(-14deg); transform-box: fill-box; transform-origin: center; }
.mood-worried .m-mouth { d: path("M86 150 q14 -8 28 0"); }
.mood-chill .m-mouth { d: path("M88 148 q12 5 24 0"); }
.mood-party .m-sparks { opacity: 1; animation: twinkle 1.2s ease-in-out infinite; }
.mood-party .m-body { animation: bounce .7s var(--ease) infinite; }
.mood-party .m-mouth { d: path("M82 146 q18 18 36 0"); }
.mood-sleepy .m-zzz { opacity: 1; animation: zz 2.4s ease-in-out infinite; }
.mood-sleepy .m-eye { animation: none; transform: scaleY(.12); }
.mood-sleepy .m-mouth { d: path("M92 150 q8 4 16 0"); }
@keyframes twinkle { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px) scaleX(.97) scaleY(1.04); } }
@keyframes zz { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-10px); } }
.mascot.jump .m-body { animation: jump .7s var(--ease); }
@keyframes jump { 0% { transform: translateY(0); } 35% { transform: translateY(-22px) scaleX(.95) scaleY(1.08); } 70% { transform: translateY(0) scaleX(1.06) scaleY(.94); } 100% { transform: none; } }
.mascot.wiggle .m-body { animation: wiggle .5s ease; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.speech { position: relative; background: var(--surface); border-radius: 18px; padding: 10px 14px; font-size: 14px; font-weight: 800; box-shadow: var(--shadow-soft); margin-top: 6px; animation: pop .4s var(--ease) both; max-width: 260px; }
.speech::before { content: ""; position: absolute; top: -8px; left: 28px; width: 16px; height: 16px; background: var(--surface); transform: rotate(45deg); border-radius: 3px; }
.mascot-row { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.mascot-row .speech { margin: 0 0 24px; flex: 1; }
.mascot-row .speech::before { top: auto; bottom: 10px; left: -7px; }

/* ───────── Sheets ───────── */
.sheet-back { position: fixed; inset: 0; z-index: 100; background: rgba(40, 20, 40, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .3s; }
.sheet-back.open { background: rgba(40, 20, 40, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.sheet { width: 100%; max-width: 560px; max-height: calc(100dvh - 24px - var(--sat)); background: var(--bg); border-radius: 28px 28px 0 0; transform: translateY(100%); transition: transform .38s var(--ease-out); display: flex; flex-direction: column; padding-bottom: var(--sab); box-shadow: 0 -10px 40px rgba(0, 0, 0, .15); }
.sheet-back.open .sheet { transform: translateY(0); }
.sheet-large { height: calc(100dvh - 24px - var(--sat)); }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--track); margin: 10px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 18px 6px; flex: none; }
.sheet-title { font-size: 20px; }
.sheet-body { padding: 8px 18px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
@media (min-width: 700px) {
  .sheet-back { align-items: center; }
  .sheet { border-radius: 28px; max-height: calc(100dvh - 60px); transform: translateY(30px) scale(.97); opacity: 0; transition: transform .3s var(--ease-out), opacity .25s; }
  .sheet-back.open .sheet { transform: none; opacity: 1; }
  .sheet-large { height: auto; max-height: calc(100dvh - 60px); }
  .sheet-grip { display: none; }
}
.sheet-confirm .sheet-body { padding-top: 0; }

/* ───────── Toasts ───────── */
.toast-host { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px + var(--sab)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toast-host { bottom: 24px; } }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 16px; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .4); transform: translateY(20px) scale(.95); opacity: 0; transition: transform .3s var(--ease), opacity .25s; max-width: 480px; }
.toast.show { transform: none; opacity: 1; }
.toast-success { background: var(--mint-2); color: #fff; }
.toast-error { background: var(--red); color: #fff; }
.toast-action { color: inherit; text-decoration: underline; font-weight: 900; }
.confetti { position: fixed; inset: 0; z-index: 300; pointer-events: none; width: 100vw; height: 100vh; }

/* ───────── Auth ───────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 32px; padding: 28px 24px; box-shadow: var(--shadow-clay); animation: page-in .5s var(--ease-out); }
.auth-card .mascot { display: block; margin: -70px auto 6px; }
.auth h1 { font-size: 30px; text-align: center; letter-spacing: -.02em; }
.auth .tag { text-align: center; color: var(--ink-2); margin: 4px 0 20px; font-size: 14px; }
.auth .foot { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 18px; }
.strength { display: flex; gap: 4px; margin-top: 6px; }
.strength span { flex: 1; height: 5px; border-radius: 3px; background: var(--track); transition: background .3s; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; background: var(--mint-soft); border-radius: 16px; padding: 12px; font-size: 13px; color: var(--ink-2); margin-top: 16px; }
.privacy-note svg { flex: none; color: var(--mint-2); margin-top: 1px; }
.err { color: var(--red); font-size: 13px; font-weight: 800; margin-top: -6px; margin-bottom: 10px; min-height: 1em; animation: shake .4s; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.avail { font-size: 12px; font-weight: 800; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.splash { min-height: 100dvh; display: grid; place-items: center; }

/* ───────── Settings ───────── */
.setting { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.setting:last-child { border-bottom: 0; }
.setting .t { font-weight: 800; }
.setting .s { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.setting .ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.setting .ic svg { width: 20px; height: 20px; }
.user-chip { display: flex; align-items: center; gap: 12px; }
.avatar { width: 48px; height: 48px; border-radius: 18px; background: linear-gradient(145deg, var(--lavender), var(--sky)); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 20px; text-transform: uppercase; flex: none; }

/* ───────── Misc ───────── */
.search { position: relative; margin-bottom: 10px; }
.search .input { padding-left: 44px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.period-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.period-nav h2 { font-size: 18px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 14px; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 900; font-variant-numeric: tabular-nums; }
.offline-badge { position: fixed; top: calc(10px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 50; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags .pill { padding: 4px 10px; font-size: 12px; }
kbd { font-family: inherit; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
