/* V: silver, white and purple. Calm surfaces, one character with all the personality. */
:root {
  --bg: #f2f1f7; --bg-2: #e8e6f0; --surface: #ffffff; --surface-2: #f8f7fc;
  --line: #e3e1ec; --line-2: #cfcbdf;
  --ink: #1c1530; --ink-2: #3a3150; --muted: #6a6483; --faint: #9a95ae;
  --purple: #6a3fd6; --purple-2: #8460ec; --purple-ink: #3f2390; --purple-soft: #f0eaff; --purple-line: #d5c8ff;
  --silver: linear-gradient(165deg, #ffffff 0%, #ececf3 55%, #d4d3e0 100%);
  --danger: #c3365a; --danger-soft: #fdeef2;
  --shadow-1: 0 1px 2px rgba(28, 21, 48, .06), 0 1px 1px rgba(28, 21, 48, .03);
  --shadow-2: 0 2px 6px rgba(28, 21, 48, .05), 0 14px 34px rgba(28, 21, 48, .09);
  --shadow-3: 0 24px 70px rgba(28, 21, 48, .22);
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.3, 1.35, .5, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; overflow: hidden;
  background: linear-gradient(180deg, #f8f7fc 0, var(--bg) 360px) var(--bg);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 8px; }
input, select, textarea { font: inherit; color: inherit; }
svg { flex: none; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 22px 10px;
  background: rgba(255, 255, 255, .78); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px;
  background: var(--silver); border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(63, 35, 144, .12);
  color: var(--purple); font: 700 19px/1 var(--font-display);
}
.brand-name { font: 650 19px/1 var(--font-display); letter-spacing: -.01em; }
.topbar-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #9fd3b9; transition: background .3s; }
.sync-dot.busy { background: var(--purple-2); animation: breathe 1s ease-in-out infinite alternate; }
.sync-dot.off { background: var(--danger); }
@keyframes breathe { from { opacity: .4; } to { opacity: 1; } }

/* ---------- buttons and controls ---------- */
.btn, .icon-btn, .send-btn, .switch button, .tabbar button, .chip-btn, .focus-row button, .add-day, .mcell, .nav button, .check { position: relative; overflow: hidden; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border-radius: 11px; font: 600 15px/1.2 var(--font-display); letter-spacing: .005em;
  transition: transform .18s var(--ease-spring), box-shadow .2s, background .2s, border-color .2s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.96); transition-duration: .08s; }
.btn.primary { color: #fff; background: linear-gradient(180deg, #7a51e8, #6034cd); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 16px rgba(96, 52, 205, .26); }
.btn.primary:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 24px rgba(96, 52, 205, .32); }
.btn.ghost { background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow-1); }
.btn.ghost:hover { border-color: var(--purple-line); box-shadow: var(--shadow-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: #f0b7c6; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.file-btn { cursor: pointer; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--muted); transition: background .15s, color .15s, transform .15s var(--ease-spring); }
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 22px; height: 22px; }
#settings-btn:hover svg { transform: rotate(60deg); }
#settings-btn svg { transition: transform .5s var(--ease-out); }
.link-btn { color: var(--purple); font-size: 14px; font-weight: 700; padding: 4px 2px; transition: color .15s; }
.link-btn:hover { color: var(--purple-ink); text-decoration: underline; text-underline-offset: 3px; }

.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .16; transform: scale(0); animation: ripple .6s var(--ease-out) forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* segmented switch with a sliding pill */
.switch { position: relative; display: inline-flex; padding: 3px; border-radius: 13px; background: var(--bg-2); border: 1px solid var(--line); }
.switch button { z-index: 1; padding: 7px 16px; border-radius: 10px; font-weight: 700; font-size: 14.5px; color: var(--muted); transition: color .2s; white-space: nowrap; }
.switch button:hover { color: var(--ink); }
.switch button[aria-selected="true"], .switch button[aria-current="page"] { color: var(--ink); }
.switch-ind { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 10px; background: var(--surface); box-shadow: 0 1px 3px rgba(28, 21, 48, .12), 0 0 0 1px var(--line); transition: transform .38s var(--ease-spring), width .38s var(--ease-spring); }
.page-switch button[aria-current="page"] { color: var(--purple-ink); }

/* ---------- pages ---------- */
.pages { flex: 1; min-height: 0; position: relative; }
.page { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.page.enter { animation: pageIn .4s var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* planner */
.wrap { max-width: 1120px; margin: 0 auto; padding: 38px 40px calc(140px + var(--safe-b)); }
.hub-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; }
.hub-title h1 { margin: 0; font: 700 clamp(32px, 4.2vw, 50px)/1.02 var(--font-display); letter-spacing: -.025em; }
.hub-title p { margin: 8px 0 0; color: var(--muted); font-size: 16.5px; }
.hub-actions, .btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hub-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 26px 0 20px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav button[data-nav="-1"], .nav button[data-nav="1"] { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); transition: background .15s, color .15s, transform .15s var(--ease-spring); }
.nav button[data-nav="-1"]:hover, .nav button[data-nav="1"]:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.nav button[data-nav="-1"]:active, .nav button[data-nav="1"]:active { transform: scale(.9); }
.nav button svg { width: 18px; height: 18px; }
#nav-label { min-width: 150px; text-align: center; font: 600 16px var(--font-display); }
.nav .link-btn { margin-left: 8px; }
.hub-body.swap { animation: pageIn .35s var(--ease-out); }

.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; }
.side { position: sticky; top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px 8px; box-shadow: var(--shadow-1); }
.side .section { margin: 0 0 10px; }
.side .tasks { border: 0; box-shadow: none; border-radius: 0; background: none; }
.side .task { padding: 9px 2px; }

.section { margin: 0 0 30px; }
.section h3 { margin: 0 0 10px; font: 650 19px/1.2 var(--font-display); letter-spacing: -.01em; display: flex; gap: 8px; align-items: center; }
.section h3 .count { font: 700 12px/1 var(--font-body); color: var(--muted); background: var(--bg-2); border-radius: 6px; padding: 4px 7px; }
.section.overdue h3 { color: var(--danger); }
.section.overdue h3 .count { background: var(--danger-soft); color: var(--danger); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section > .help { color: var(--faint); margin: 0; padding: 4px 2px; }

.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-1); overflow: hidden; }
.task { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-top: 1px solid var(--line); transition: background .15s; }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); }
.check { width: 24px; height: 24px; flex: none; border-radius: 8px; border: 2px solid var(--cat); background: #fff; transition: transform .2s var(--ease-spring), background .2s, box-shadow .2s; }
.check:hover { transform: scale(1.12); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat) 16%, transparent); }
.check:active { transform: scale(.9); }
.task.done .check { background: var(--cat); }
.task.done .check::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.task.just-done .check { animation: checkPop .5s var(--ease-spring); }
@keyframes checkPop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.task-main { flex: 1; text-align: left; display: flex; flex-direction: column; min-width: 0; padding: 1px 0; transition: transform .2s var(--ease-out); }
.task:hover .task-main { transform: translateX(3px); }
.task-title { font-weight: 700; overflow-wrap: anywhere; }
.tt { background: linear-gradient(currentColor, currentColor) 0 58% / 0 1.6px no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-size .35s var(--ease-out), color .3s; }
.task.done .tt { background-size: 100% 1.6px; color: var(--faint); }
.task.done .task-title { font-weight: 400; }
.task-meta { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.task-meta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cat); flex: none; }
.cat-school { --cat: #7a4ee8; } .cat-business { --cat: #c0870f; } .cat-personal { --cat: #2f8a63; } .cat-health { --cat: #d0477a; }

.empty { padding: 40px 0; max-width: 48ch; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font: 700 26px/1.2 var(--font-display); letter-spacing: -.015em; margin-bottom: 8px; }

/* week */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px 10px; min-height: 200px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow-1); transition: transform .2s var(--ease-out), box-shadow .2s; }
.day:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.day.today { border-color: var(--purple-line); box-shadow: 0 0 0 3px var(--purple-soft), var(--shadow-1); }
.day header { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; padding: 0 2px; }
.day .dow { color: var(--muted); font-size: 13px; font-weight: 700; }
.day .dnum { font: 700 19px/1 var(--font-display); padding: 4px 0; }
.day.today .dnum { color: #fff; background: var(--purple); border-radius: 9px; padding: 4px 7px; }
.day .add-day { margin-left: auto; width: 28px; height: 28px; border-radius: 9px; color: var(--faint); font-size: 19px; line-height: 1; transition: background .15s, color .15s, transform .3s var(--ease-spring); }
.day .add-day:hover { background: var(--purple-soft); color: var(--purple); transform: rotate(90deg); }
.day .tasks { border: 0; box-shadow: none; background: none; border-radius: 0; overflow: visible; }
.day .task { padding: 6px 2px; gap: 8px; border-top: 0; align-items: flex-start; border-radius: 8px; }
.day .check { width: 19px; height: 19px; margin-top: 2px; border-radius: 6px; }
.day .task.done .check::after { left: 5px; top: 1.5px; width: 4.5px; height: 9px; }
.day .task-title { font-size: 14px; overflow-wrap: break-word; hyphens: auto; }
.day .task-meta { font-size: 12px; }
.day .task-meta::before { display: none; }
.day .task:hover .task-main { transform: none; }

/* month */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mhead { font-size: 12.5px; color: var(--muted); font-weight: 700; text-align: center; padding: 4px 0; }
.mcell { min-height: 100px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 7px; text-align: left; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: transform .18s var(--ease-out), box-shadow .18s, border-color .18s; }
.mcell:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.mcell:active { transform: scale(.97); }
.mcell.out { background: transparent; box-shadow: none; opacity: .5; }
.mcell.sel { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.mnum { font: 700 13.5px/1 var(--font-display); padding: 3px 0; align-self: flex-start; }
.mcell.today .mnum { color: #fff; background: var(--purple); border-radius: 7px; padding: 3px 6px; }
.mchip { display: block; font-size: 11.5px; line-height: 1.35; padding: 2px 6px; border-radius: 5px; color: var(--ink-2); background: color-mix(in srgb, var(--cat) 11%, #fff); border-left: 3px solid var(--cat); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mchip.done { opacity: .5; text-decoration: line-through; }
.mmore { font-size: 11px; color: var(--muted); }
.mdots { display: none; }
.mdot { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }
.day-detail { margin-top: 26px; }

/* ---------- chat page ---------- */
.chat-wrap { max-width: 780px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; padding: 28px 28px 0; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; font: 700 28px/1.1 var(--font-display); letter-spacing: -.02em; }
.focus-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.focus-row button { font-size: 13.5px; font-weight: 700; padding: 6px 12px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; transition: transform .18s var(--ease-spring), border-color .15s, color .15s, background .15s; }
.focus-row button:hover { color: var(--ink); transform: translateY(-1px); }
.focus-row button:active { transform: scale(.94); }
.focus-row button[aria-pressed="true"] { color: var(--purple-ink); border-color: var(--purple-line); background: var(--purple-soft); }

.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 14px 14px; margin: 0 -12px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 84%; padding: 11px 15px; border-radius: 18px; overflow-wrap: anywhere; line-height: 1.5; }
.msg p { margin: 0 0 .55em; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: .3em 0 .55em; padding-left: 1.3em; }
.msg code { background: var(--bg-2); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.msg pre { background: var(--bg-2); padding: 10px; border-radius: 10px; overflow-x: auto; margin: .4em 0; }
.msg a { color: var(--purple); }
.msg.v { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 6px; box-shadow: var(--shadow-1); }
.msg.v em, .bubble em { color: var(--purple); font-style: italic; }
.msg.me { align-self: flex-end; color: #fff; background: linear-gradient(180deg, #7a51e8, #6236cf); border-top-right-radius: 6px; box-shadow: 0 6px 16px rgba(96, 52, 205, .18); }
.msg.err { align-self: stretch; max-width: none; background: var(--danger-soft); border: 1px solid #f3c3d0; color: #8f1f3f; font-size: 14.5px; }
.msg.new { animation: msgIn .4s var(--ease-spring); }
.msg.me.new { transform-origin: 100% 100%; } .msg.v.new { transform-origin: 0 100%; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.action { font-size: 12.5px; font-weight: 700; color: var(--purple-ink); background: var(--purple-soft); border: 1px solid var(--purple-line); padding: 2px 9px; border-radius: 7px; }
.thinking { display: flex; gap: 5px; padding: 15px 17px; }
.thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--purple-2); animation: dot 1s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: .15s; } .thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-4px); } }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-btn { border: 1px solid var(--line-2); padding: 7px 13px; border-radius: 11px; font-size: 14px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); transition: transform .18s var(--ease-spring), border-color .15s, color .15s, background .15s; }
.chip-btn:hover { border-color: var(--purple-line); color: var(--purple-ink); background: var(--purple-soft); transform: translateY(-2px); }
.chip-btn:active { transform: scale(.95); }

.composer { padding: 10px 0 calc(18px + var(--safe-b)); }
.chat-form { display: flex; align-items: flex-end; gap: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 6px; box-shadow: var(--shadow-2); transition: border-color .2s, box-shadow .2s; }
.chat-form:focus-within { border-color: var(--purple-line); box-shadow: 0 0 0 4px var(--purple-soft), var(--shadow-2); }
.chat-form textarea { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; padding: 9px 6px; max-height: 160px; outline: none; line-height: 1.4; font-size: 16px; }
.chat-form textarea::placeholder { color: var(--faint); }
.send-btn { width: 42px; height: 42px; border-radius: 13px; color: #fff; background: linear-gradient(180deg, #7a51e8, #6034cd); display: grid; place-items: center; transition: transform .18s var(--ease-spring), opacity .2s; }
.send-btn:hover { transform: translateY(-1px) scale(1.04); }
.send-btn:active { transform: scale(.9); }
.send-btn:disabled { opacity: .4; cursor: default; transform: none; }
.send-btn svg { width: 20px; height: 20px; }
#mic-btn.listening { color: var(--danger); background: var(--danger-soft); animation: breathe .8s ease-in-out infinite alternate; }

/* ---------- phone tab bar ---------- */
.tabbar { display: none; }

/* ---------- V's speech bubble ---------- */
.bubble {
  position: fixed; left: 0; top: 0; z-index: 31; width: max-content; max-width: min(300px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 12px 15px 6px;
  font-size: 15.5px; line-height: 1.42; box-shadow: var(--shadow-2), 0 0 0 4px rgba(255, 255, 255, .6);
  animation: bubbleIn .35s var(--ease-spring);
}
@keyframes bubbleIn { from { opacity: 0; scale: .85; } to { opacity: 1; scale: 1; } }
.bubble::before { content: ""; position: absolute; width: 12px; height: 12px; background: var(--surface); border: 1px solid var(--line-2); transform: rotate(45deg); }
.bubble[data-side="right"]::before { left: -7px; top: 22px; border-top: 0; border-right: 0; }
.bubble[data-side="left"]::before { right: -7px; top: 22px; border-bottom: 0; border-left: 0; }
.bubble[data-side="top"]::before { bottom: -7px; left: var(--tail-x, 50%); margin-left: -6px; border-top: 0; border-left: 0; }
.bubble[data-side="bottom"]::before { top: -7px; left: var(--tail-x, 50%); margin-left: -6px; border-bottom: 0; border-right: 0; }
.bubble[data-side="right"] { transform-origin: 0 30px; } .bubble[data-side="left"] { transform-origin: 100% 30px; }
.bubble p { margin: 0 0 4px; min-height: 1.4em; }
.bubble-actions { display: flex; gap: 14px; justify-content: flex-end; }

/* ---------- V on the page ---------- */
.v-sprite { position: fixed; left: 0; top: 0; z-index: 30; width: 112px; pointer-events: none; will-change: transform; }
.v-tilt { transform-origin: 50% 40%; }
.mascot { pointer-events: auto; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent; border-radius: 30px; transition: scale .25s var(--ease-spring); }
.mascot:hover { scale: 1.07; }
.mascot:active { scale: .95; }
.v-sprite.dragging .mascot { cursor: grabbing; scale: 1.12; }
.mascot svg { width: 100%; height: auto; display: block; overflow: visible; }
body.locked .v-sprite, body.locked .bubble { display: none !important; }

/* faces and moods */
.v-eyes, .v-mouth, .fx, .fx-check, .fx-glitch, .fx-ring { display: none; }
.mood-idle .eyes-open, .mood-talking .eyes-open, .mood-concerned .eyes-open,
.mood-hyped .eyes-happy, .mood-smug .eyes-smug, .mood-sleepy .eyes-closed,
.mood-surprised .eyes-wide, .mood-annoyed .eyes-annoyed { display: inline; }
.mood-idle .mouth-smile, .mood-talking .mouth-open, .mood-hyped .mouth-grin,
.mood-smug .mouth-smirk, .mood-concerned .mouth-worry, .mood-sleepy .mouth-o,
.mood-surprised .mouth-o, .mood-annoyed .mouth-flat { display: inline; }
.mood-hyped .fx-sparkles, .mood-sleepy .fx-zzz, .mood-concerned .fx-sweat { display: inline; }
.is-talking .v-mouth { display: none !important; }
.is-talking .mouth-open { display: inline !important; }
/* hovering over her when she's relaxed makes her happy */
.v-sprite.hovered .mood-idle .eyes-open { display: none; }
.v-sprite.hovered .mood-idle .eyes-happy { display: inline; }
.v-sprite.hovered .mood-idle .v-arm-r { transform: rotate(-120deg); }
.v-sprite.dragging .v-arm-l { transform: rotate(140deg); }
.v-sprite.dragging .v-arm-r { transform: rotate(-140deg); }

.v-float { animation: float 3.4s ease-in-out infinite alternate; }
@keyframes float { from { transform: translateY(0); } to { transform: translateY(-8px); } }
.v-pad, .v-pad2 { animation: pad 3.4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes pad { from { transform: scale(1); } to { transform: scale(.8); opacity: .6; } }
.v-flame { transform-box: fill-box; transform-origin: 50% 0%; animation: flame .18s ease-in-out infinite alternate; }
.v-flame.f2 { animation-duration: .22s; } .v-flame.f3 { animation-duration: .26s; }
@keyframes flame { from { transform: scaleY(.7); opacity: .75; } to { transform: scaleY(1.15); opacity: 1; } }
.v-sprite.moving .v-flame { animation-name: flameFast; animation-duration: .1s; }
@keyframes flameFast { from { transform: scaleY(1.2); } to { transform: scaleY(1.75); } }
.v-sprite.moving .v-float { animation-play-state: paused; }
.v-char { transform-box: fill-box; transform-origin: 50% 100%; }
.v-tail { transform-box: fill-box; transform-origin: 0% 8%; animation: sway 3.2s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
.v-sprite.moving .v-tail { animation-duration: .5s; }
.v-bow { transform-box: fill-box; transform-origin: center; animation: bow 4s ease-in-out infinite alternate; }
@keyframes bow { from { transform: translate(66px, 44px) rotate(-5deg); } to { transform: translate(66px, 44px) rotate(5deg); } }
.v-orb { transform-box: fill-box; transform-origin: center; animation: orb 2.4s ease-in-out infinite alternate; }
@keyframes orb { from { transform: scale(.92); filter: drop-shadow(0 0 1px #b9a0ff); } to { transform: scale(1.12); filter: drop-shadow(0 0 6px #b9a0ff); } }
.v-led { animation: led 1.8s steps(2) infinite; } .v-led.l2 { animation-delay: .9s; }
@keyframes led { 0% { opacity: 1; } 100% { opacity: .25; } }
.eyes-open { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.eye-look { transform: translate(var(--lx, 0px), var(--ly, 0px)); transition: transform .25s ease-out; }
.mouth-open { transform-box: fill-box; transform-origin: center; }
.mood-talking .mouth-open, .is-talking .mouth-open { animation: talk .17s ease-in-out infinite alternate; }
@keyframes talk { from { transform: scaleY(.4); } to { transform: scaleY(1.1); } }
.v-face { transition: opacity .25s; }
.mood-sleepy .v-face { opacity: .7; }
.brow-l, .brow-r { transform-box: fill-box; transform-origin: center; transition: transform .3s; }
.mood-concerned .brow-l { transform: rotate(-14deg) translateY(-1px); }
.mood-concerned .brow-r { transform: rotate(14deg) translateY(-1px); }
.mood-smug .brow-r { transform: translateY(-3px) rotate(-8deg); }
.mood-smug .brow-l { transform: translateY(1px); }
.mood-hyped .brow-l, .mood-hyped .brow-r { transform: translateY(-3px); }
.mood-sleepy .brow-l, .mood-sleepy .brow-r { transform: translateY(2px); }
.mood-surprised .brow-l, .mood-surprised .brow-r { transform: translateY(-6px); }
.mood-annoyed .brow-l { transform: rotate(14deg) translateY(2px); }
.mood-annoyed .brow-r { transform: rotate(-14deg) translateY(2px); }

.v-arm { transform-box: fill-box; transition: transform .3s var(--ease-spring); }
.v-arm-l { transform-origin: 100% 0%; } .v-arm-r { transform-origin: 0% 0%; }
.mood-hyped .v-arm-r { animation: wave .45s ease-in-out 4 alternate; transform: rotate(-128deg); }
@keyframes wave { from { transform: rotate(-106deg); } to { transform: rotate(-146deg); } }
.mood-hyped .v-hop { animation: hop .55s ease-out 2; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-12px); } }
.mood-concerned .v-hop { animation: fret 2.4s ease-in-out infinite; }
@keyframes fret { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(2px); } }
.mood-sleepy .v-float { animation-duration: 5.5s; }
.mood-sleepy .v-flame { animation-duration: .6s; }
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.1s ease-in-out infinite alternate; }
.fx-sparkles g:nth-child(2) .spark { animation-delay: .35s; } .fx-sparkles g:nth-child(3) .spark { animation-delay: .7s; }
@keyframes twinkle { from { transform: scale(.4) rotate(0); opacity: .5; } to { transform: scale(1.1) rotate(45deg); opacity: 1; } }
.fx-zzz text { animation: zzz 2.4s ease-in-out infinite; opacity: 0; }
.fx-zzz text:nth-child(2) { animation-delay: .5s; } .fx-zzz text:nth-child(3) { animation-delay: 1s; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(8px, -12px); } }

/* thinking */
.is-thinking .fx-think { display: inline; }
.is-thinking .eye-look { transform: translate(5px, -6px); }
.is-thinking .v-orb { animation-duration: .45s; }
.td { animation: td 1.2s infinite; transform-box: fill-box; transform-origin: center; }
.td.d2 { animation-delay: .2s; } .td.d3 { animation-delay: .4s; }
@keyframes td { 0%, 60%, 100% { opacity: .25; transform: scale(.7); } 30% { opacity: 1; transform: scale(1.2); } }

/* one-off actions */
.act-cheer .fx-confetti, .act-cheer .fx-check { display: inline; }
.act-cheer .v-hop { animation: hop2 .7s ease-out 2; }
@keyframes hop2 { 0%, 100% { transform: translateY(0) rotate(0); } 35% { transform: translateY(-16px) rotate(-4deg); } 70% { transform: translateY(-4px) rotate(3deg); } }
.act-cheer .v-arm-l { animation: cheerL .3s ease-in-out infinite alternate; transform: rotate(150deg); }
.act-cheer .v-arm-r { animation: cheerR .3s ease-in-out infinite alternate; transform: rotate(-150deg); }
@keyframes cheerL { from { transform: rotate(135deg); } to { transform: rotate(165deg); } }
@keyframes cheerR { from { transform: rotate(-135deg); } to { transform: rotate(-165deg); } }
.act-cheer .v-face { animation: faceHide 1.7s both; }
@keyframes faceHide { 0%, 6% { opacity: 1; } 14%, 62% { opacity: 0; } 82%, 100% { opacity: 1; } }
.act-cheer .fx-check { transform-box: fill-box; transform-origin: center; animation: checkMark 1.7s both; }
@keyframes checkMark { 0%, 6% { opacity: 0; transform: scale(.3); } 20% { opacity: 1; transform: scale(1.15); } 30% { transform: scale(1); } 62% { opacity: 1; } 80%, 100% { opacity: 0; } }
.cf { transform-box: fill-box; transform-origin: center; opacity: 0; }
.act-cheer .cf { animation: confetti 1.5s ease-out both; }
@keyframes confetti {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  12% { opacity: 1; }
  55% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) + 110px)) rotate(calc(var(--r) * 1.6)) scale(.9); }
}
.act-write .fx-note { display: inline; }
.act-write .note-body { transform-box: fill-box; transform-origin: 50% 100%; animation: notePop 1.7s both; }
@keyframes notePop { 0% { transform: rotate(7deg) scale(0); } 14% { transform: rotate(7deg) scale(1.1); } 22%, 80% { transform: rotate(7deg) scale(1); } 100% { transform: rotate(7deg) scale(0); } }
.act-write .ln { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .3s ease-out forwards; }
.act-write .ln.l1 { animation-delay: .3s; } .act-write .ln.l2 { animation-delay: .6s; } .act-write .ln.l3 { animation-delay: .9s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.act-write .pen { animation: scribble .22s ease-in-out 7 alternate; }
@keyframes scribble { from { transform: translate(-3px, 2px); } to { transform: translate(3px, -2px); } }
.act-write .v-arm-r { animation: bobR .22s ease-in-out 7 alternate; }
@keyframes bobR { from { transform: rotate(4deg); } to { transform: rotate(-6deg); } }
.act-write .eye-look { transform: translate(5px, 6px); }
.act-search .fx-search, .act-search .fx-ping { display: inline; }
.act-search .lens { animation: sweep 1.3s ease-in-out infinite alternate; }
@keyframes sweep { from { transform: translate(-34px, 4px); } to { transform: translate(34px, -4px); } }
.act-search .eye-look { animation: lookAround 1.3s ease-in-out infinite alternate; }
@keyframes lookAround { from { transform: translateX(-5px); } to { transform: translateX(5px); } }
.fx-ping .p1, .fx-ping .p2 { transform-box: fill-box; transform-origin: center; animation: ping 1.2s ease-out infinite; }
.fx-ping .p2 { animation-delay: .6s; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.act-alert .fx-alert { display: inline; transform-box: fill-box; transform-origin: 50% 100%; animation: alertPop .5s ease-out both, wobble .4s ease-in-out .5s 3 alternate; }
@keyframes alertPop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes wobble { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.act-alert .v-char { animation: nudge .15s linear 6; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(2px); } }
.act-boop .v-char { animation: squish .45s ease-out; }
@keyframes squish { 0% { transform: scale(1); } 25% { transform: scale(1.1, .86); } 55% { transform: scale(.95, 1.07); } 100% { transform: scale(1); } }
.act-boop .fx-ring { display: inline; transform-box: fill-box; transform-origin: center; animation: ringOut .55s ease-out both; }
@keyframes ringOut { from { transform: scale(.4); opacity: 1; } to { transform: scale(7); opacity: 0; } }
.act-wave .v-arm-r { animation: wave .35s ease-in-out 4 alternate; transform: rotate(-128deg); }
.act-spin .v-hop { animation: spin .9s var(--ease-out); }
@keyframes spin { 0% { transform: rotate(0) translateY(0); } 40% { transform: rotate(200deg) translateY(-6px); } 100% { transform: rotate(360deg) translateY(0); } }
.act-oops .fx-glitch, .act-oops .fx-q, .act-oops .fx-sweat { display: inline; }
.act-oops .v-face { animation: glitch .5s steps(2) 2; }
@keyframes glitch { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(5px) skewX(6deg); } 75% { transform: translateX(-2px); } 100% { transform: translateX(0); } }
.act-oops .fx-glitch { animation: bars .25s steps(2) 4; }
@keyframes bars { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(14px); opacity: .4; } }

/* ---------- dialogs ---------- */
dialog.sheet { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 20px; padding: 0; width: min(500px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-3); }
dialog.sheet.wide { width: min(620px, calc(100vw - 24px)); }
dialog.sheet[open] { animation: dlgIn .32s var(--ease-spring); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
dialog.sheet::backdrop { background: rgba(28, 21, 48, .28); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet form, .sheet .sheet-inner { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.sheet .step { display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font: 700 25px/1.15 var(--font-display); letter-spacing: -.015em; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field legend { font-size: 13.5px; color: var(--ink-2); font-weight: 700; padding: 0; margin-bottom: 6px; }
.field > span { margin-bottom: 0; }
.field input, .field select, .field textarea, .note-add input, .lock-card input, .import-item input, .import-item select {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 11px; width: 100%; min-width: 0; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b9b4cf; }
.field input:focus, .field select:focus, .field textarea:focus, .note-add input:focus, .lock-card input:focus, .import-item input:focus, .import-item select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 4px var(--purple-soft); }
.field textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 14px; font-weight: 700; color: var(--ink-2); transition: border-color .15s, background .15s, transform .18s var(--ease-spring); }
.seg span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--cat); }
.seg label:hover span { transform: translateY(-1px); border-color: var(--cat); }
.seg input:checked + span { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 10%, #fff); box-shadow: 0 0 0 1px var(--cat); }
.seg input:focus-visible + span { outline: 2px solid var(--purple); outline-offset: 2px; }
.check-field { display: flex; gap: 9px; align-items: center; cursor: pointer; }
.check-field input { width: 18px; height: 18px; accent-color: var(--purple); }
.sheet-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.spacer { flex: 1; }
.help { font-size: 14px; color: var(--muted); margin: 0; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; font-weight: 700; }

.file-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 24px; text-align: center; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.file-drop:hover, .file-drop:focus-within { border-color: var(--purple); background: var(--purple-soft); }
.file-drop strong { font: 650 18px var(--font-display); overflow-wrap: anywhere; }
.import-list { list-style: none; margin: 0; padding: 0; max-height: 52dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.import-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); transition: opacity .2s; }
.import-item.off { opacity: .5; }
.import-item > input[type=checkbox] { width: 20px; height: 20px; margin-top: 9px; accent-color: var(--purple); }
.ii-fields { display: grid; grid-template-columns: 1.2fr 1fr .9fr; gap: 6px; min-width: 0; }
.ii-fields .ii-title { grid-column: 1 / -1; }
.import-item input, .import-item select { padding: 7px 9px; font-size: 15px; }
.ii-notes { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.ii-warn { grid-column: 1 / -1; font-size: 12.5px; color: var(--danger); font-weight: 700; }

.set-section { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.set-section h3 { margin: 0; font: 650 17px var(--font-display); }
.push-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.push-opts label { cursor: pointer; position: relative; }
.push-opts input { position: absolute; opacity: 0; pointer-events: none; }
.push-opts span { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--line-2); border-radius: 11px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); transition: transform .18s var(--ease-spring), border-color .15s, background .15s; }
.push-opts label:hover span { transform: translateY(-1px); border-color: var(--purple-line); }
.push-opts input:checked + span { border-color: var(--purple); color: var(--purple-ink); background: var(--purple-soft); box-shadow: 0 0 0 1px var(--purple); }
.push-opts input:focus-visible + span { outline: 2px solid var(--purple); outline-offset: 2px; }
.notes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notes-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; }
.notes-list li span { flex: 1; overflow-wrap: anywhere; }
.notes-list li button { color: var(--faint); font-size: 13px; font-weight: 700; }
.notes-list li button:hover { color: var(--danger); }
.note-add { display: flex; gap: 8px; }

/* ---------- passcode screen ---------- */
.lock { position: fixed; inset: 0; z-index: 50; background: radial-gradient(620px 420px at 50% 24%, rgba(132, 96, 236, .16), transparent 70%), var(--bg); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.lock-card { width: min(400px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lock-card img { width: 108px; height: 108px; border-radius: 28px; box-shadow: var(--shadow-2), 0 0 0 1px var(--line); animation: float 3.4s ease-in-out infinite alternate; }
.lock-card h2 { margin: 10px 0 0; font: 700 30px/1.1 var(--font-display); letter-spacing: -.02em; }
.lock-card p { margin: 0; color: var(--muted); }
.lock-card form { display: flex; gap: 8px; width: 100%; margin-top: 10px; }
.lock-card input { flex: 1; }
.lock-setup { margin-top: 10px; text-align: left; background: var(--surface); border: 1px solid #f3c3d0; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.lock-setup ul { margin: 6px 0; padding-left: 18px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1000px) {
  .today-grid { grid-template-columns: 1fr; gap: 6px; }
  .side { position: static; }
  .week-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; }
  .page-switch { display: none; }
  .tabbar { display: flex; background: rgba(255, 255, 255, .92); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border-radius: 12px; color: var(--faint); font-size: 12px; font-weight: 700; transition: color .2s, transform .15s var(--ease-spring); }
  .tabbar button svg { width: 24px; height: 24px; padding: 2px 12px; box-sizing: content-box; border-radius: 999px; transition: background .25s; }
  .tabbar button.active { color: var(--purple); }
  .tabbar button.active svg { background: var(--purple-soft); }
  .tabbar button:active { transform: scale(.92); }
  .wrap { padding: 22px 16px calc(130px + var(--safe-b)); }
  .hub-title h1 { font-size: 31px; }
  .hub-title p { font-size: 15px; }
  .hub-actions { width: 100%; }
  .hub-actions .btn { flex: 1; padding: 10px 12px; font-size: 14.5px; }
  .hub-bar { margin: 18px 0 14px; }
  .views { width: 100%; } .views button { flex: 1; }
  .nav { width: 100%; justify-content: space-between; }
  #nav-label { min-width: 0; }
  .week-grid { grid-template-columns: 1fr; gap: 8px; }
  .day { min-height: 0; }
  .day:hover { transform: none; }
  .month-grid { gap: 3px; }
  .mcell { min-height: 56px; padding: 5px; border-radius: 9px; }
  .mchip, .mmore { display: none; }
  .mdots { display: flex; gap: 3px; flex-wrap: wrap; }
  .chat-wrap { padding: 14px 12px 0; }
  .chat-head h2 { font-size: 22px; }
  .msg { max-width: 90%; }
  .ii-fields { grid-template-columns: 1fr 1fr; }
  .ii-fields .ii-kind { grid-column: 1 / -1; }
  .push-opts { grid-template-columns: repeat(2, 1fr); }
  .v-sprite { width: 80px; }
  .bubble { font-size: 15px; max-width: min(260px, calc(100vw - 24px)); padding: 10px 13px 4px; }
}
@media (max-width: 380px) {
  .row2 { grid-template-columns: 1fr; }
}
@media (hover: none) {
  .btn:hover, .chip-btn:hover, .mcell:hover, .day:hover, .focus-row button:hover, .send-btn:hover { transform: none; }
  .task:hover .task-main { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
