/* LIFE.EXE design system — refined dark horror.
   One set of tokens, one set of components. Performance rules:
   - no backdrop-filter except the tab bar
   - animate only transform/opacity
   - content-visibility on long lists */

@font-face { font-family: "LifePixel"; src: url(../assets/pixel.woff) format("woff"); font-display: swap; }

:root {
  --bg: #070708;
  --s1: #0e0e10;
  --s2: #151518;
  --s3: #1c1c21;
  --line: rgba(255, 255, 255, .065);
  --line2: rgba(255, 255, 255, .12);
  --tx: #ededef;
  --tx2: #a3a3ad;
  --tx3: #6c6c76;
  --red: #e0173f;
  --red2: #ff4d6d;
  --redd: #3a0612;
  --glow: rgba(224, 23, 63, .38);
  --ok: #43d17a;
  --okd: rgba(67, 209, 122, .12);
  --warn: #f2b13d;
  --warnd: rgba(242, 177, 61, .12);
  --blue: #6aa8ff;
  --r1: 10px; --r2: 16px; --r3: 22px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, monospace;
  --px: "LifePixel", var(--mono);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 68px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.3, 1.4, .5, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--tx);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
/* one static atmospheric glow; painted once, never animated */
body::before {
  content: ""; position: fixed; inset: -20vh -20vw auto; height: 70vh; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 55% at 50% 0%, rgba(224, 23, 63, .13), transparent 70%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
:focus-visible { outline: 2px solid var(--red2); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--red); color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
#top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: linear-gradient(var(--bg) 60%, transparent);
}
.logo { font: 18px/1 var(--px); letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.logo b { color: var(--red); font-weight: inherit; }
.logo svg { width: 22px; height: 22px; filter: drop-shadow(0 0 6px var(--glow)); }
#top .sp { flex: 1; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tx3); }
.sync-dot.ok { background: var(--ok); } .sync-dot.busy { background: var(--warn); } .sync-dot.err { background: var(--red); }

#app { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; padding: 4px 16px calc(var(--tab-h) + 36px + var(--safe-b)); }
.view { animation: vin .28s var(--ease) both; }
@keyframes vin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- tab bar ---------- */
#tabs {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + var(--safe-b)); width: min(440px, calc(100% - 24px)); height: var(--tab-h);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(16, 16, 19, .78); border: 1px solid var(--line2); border-radius: 26px;
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
}
.tab {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--tx3); font: 600 10.5px/1 var(--sans); letter-spacing: .02em;
  transition: color .2s;
}
.tab svg { width: 23px; height: 23px; transition: transform .25s var(--spring); }
.tab:active svg { transform: scale(.86); }
.tab.on { color: var(--tx); }
.tab.on svg { color: var(--red2); filter: drop-shadow(0 0 6px var(--glow)); }
.tab.ai { position: relative; }
.tab.ai .orb {
  width: 50px; height: 50px; margin-top: -26px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #2a0710, #0b0b0d 70%); border: 1px solid rgba(224, 23, 63, .55);
  box-shadow: 0 0 0 5px var(--bg), 0 0 22px var(--glow); transition: transform .25s var(--spring);
}
.tab.ai:active .orb { transform: scale(.9); }
.tab.ai .orb .mask { width: 34px; height: 34px; }
.tab.ai.on .orb { border-color: var(--red2); box-shadow: 0 0 0 5px var(--bg), 0 0 30px rgba(255, 77, 109, .6); }

@media (min-width: 960px) {
  #tabs { left: 20px; top: 50%; bottom: auto; transform: translateY(-50%); width: 76px; height: auto; grid-template-columns: 1fr; grid-auto-rows: 72px; padding: 8px 0; }
  .tab.ai .orb { margin-top: 0; box-shadow: 0 0 22px var(--glow); }
  #app { padding-bottom: 48px; }
}

/* ---------- type ---------- */
.eyebrow { font: 600 11px/1.2 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--tx3); }
.eyebrow.red { color: var(--red2); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.h-page { font: 26px/1.1 var(--px); letter-spacing: .03em; margin: 6px 0 2px; }
.h-page b { color: var(--red); font-weight: inherit; }
.sub { color: var(--tx2); font-size: 13.5px; }
.muted { color: var(--tx3); }
.mono { font-family: var(--mono); }
.num { font: 650 28px/1.05 var(--sans); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.num.sm { font-size: 20px; }
.pos { color: var(--ok); } .neg { color: var(--red2); } .wn { color: var(--warn); }

/* ---------- layout ---------- */
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 2px 10px; }
.section-h .eyebrow { color: var(--tx2); }
.link { background: none; border: 0; color: var(--red2); font: 600 13px var(--sans); padding: 4px 0; }

/* ---------- cards ---------- */
.card { position: relative; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r3); padding: 16px; }
.card.tap { width: 100%; text-align: left; color: inherit; transition: transform .2s var(--spring), border-color .2s; }
.card.tap:active { transform: scale(.985); }
.card.tap:hover { border-color: var(--line2); }
.card.flat { background: transparent; }
.card.glow { border-color: rgba(224, 23, 63, .28); background: radial-gradient(120% 100% at 0% 0%, rgba(224, 23, 63, .09), transparent 55%), var(--s1); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tile { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r2); padding: 14px; min-width: 0; }
.tile .eyebrow { margin-bottom: 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 13px; border: 1px solid var(--line2); background: var(--s2); color: var(--tx); font-weight: 600; font-size: 14px;
  transition: transform .18s var(--spring), background .2s, border-color .2s; white-space: nowrap;
}
.btn:hover { background: var(--s3); }
.btn:active { transform: scale(.96); }
.btn.pri { background: var(--red); border-color: transparent; color: #fff; box-shadow: 0 6px 20px rgba(224, 23, 63, .3); }
.btn.pri:hover { background: #ee2049; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--tx2); }
.btn.ghost:hover { background: var(--s2); color: var(--tx); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red2); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }
.ib { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--s2); border: 1px solid var(--line); color: var(--tx2); flex: none; transition: transform .18s var(--spring), color .2s; }
.ib:active { transform: scale(.9); }
.ib:hover { color: var(--tx); }
.ib svg { width: 19px; height: 19px; }
.ib.sm { width: 32px; height: 32px; border-radius: 10px; }
.ib.sm svg { width: 16px; height: 16px; }
.ib.bare { background: none; border-color: transparent; }

/* chips + segmented */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--tx2); font-size: 13px; font-weight: 600; transition: all .2s; }
.chip.on { background: var(--tx); color: #0b0b0d; border-color: var(--tx); }
.chip .ct { margin-left: 6px; opacity: .55; font-variant-numeric: tabular-nums; }
.seg { display: flex; background: var(--s1); border: 1px solid var(--line); border-radius: 14px; padding: 3px; gap: 2px; }
.seg button { flex: 1; height: 36px; border: 0; border-radius: 11px; background: none; color: var(--tx3); font-weight: 600; font-size: 13px; transition: all .2s; }
.seg button.on { background: var(--s3); color: var(--tx); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }

/* ---------- lists ---------- */
.list { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r3); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; min-height: 56px; position: relative; }
.item + .item { border-top: 1px solid var(--line); }
.item .t { font-weight: 550; overflow-wrap: anywhere; }
.item .m { color: var(--tx3); font-size: 12.5px; margin-top: 1px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item.done .t { color: var(--tx3); text-decoration: line-through; text-decoration-color: var(--tx3); }
.item.btnish { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; color: inherit; }
.item.btnish:first-child { border-top: 0; }
.item.btnish:hover { background: var(--s2); }
.list.cv .item { content-visibility: auto; contain-intrinsic-size: auto 56px; }
.chev { color: var(--tx3); width: 16px; height: 16px; flex: none; }
.ava { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--s2); color: var(--tx2); flex: none; }
.ava svg { width: 18px; height: 18px; }
.ava.red { background: var(--redd); color: var(--red2); }
.ava.ok { background: var(--okd); color: var(--ok); }
.ava.wn { background: var(--warnd); color: var(--warn); }

/* tags */
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font: 600 11px/1 var(--mono); letter-spacing: .02em; background: var(--s3); color: var(--tx2); }
.tag.red { background: var(--redd); color: var(--red2); }
.tag.ok { background: var(--okd); color: var(--ok); }
.tag.wn { background: var(--warnd); color: var(--warn); }

/* check circle */
.ck { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--tx3); background: none; display: grid; place-items: center; padding: 0; transition: border-color .2s, background .2s, transform .2s var(--spring); }
.ck svg { width: 14px; height: 14px; color: #fff; opacity: 0; transform: scale(.4); transition: all .25s var(--spring); }
.ck:active { transform: scale(.85); }
.ck.on { background: var(--red); border-color: var(--red); box-shadow: 0 0 12px var(--glow); }
.ck.on svg { opacity: 1; transform: none; }
.ck.hi { border-color: var(--red2); }
.ck.sq { border-radius: 8px; }

/* progress */
.bar { height: 6px; background: var(--s3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--red); transform-origin: left; transition: width .5s var(--ease); }
.bar.ok > i { background: var(--ok); } .bar.wn > i { background: var(--warn); }
.ring { --p: 0; --c: var(--red); width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--s3) 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 59%); mask: radial-gradient(circle, transparent 58%, #000 59%); }
.ringwrap { position: relative; display: grid; place-items: center; flex: none; }
.ringwrap > span { position: absolute; font: 700 12px var(--mono); }

/* week dots for habits */
.wk { display: flex; gap: 5px; }
.wk i { width: 9px; height: 9px; border-radius: 3px; background: var(--s3); }
.wk i.on { background: var(--red); box-shadow: 0 0 6px var(--glow); }
.wk i.today { outline: 1px solid var(--tx3); outline-offset: 1px; }

/* ---------- forms ---------- */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tx3); margin: 0 0 7px 2px; }
.in, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 13px; border: 1px solid var(--line2); background: var(--s2); color: var(--tx); outline: none;
  transition: border-color .2s, background .2s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(255, 77, 109, .6); background: var(--s3); }
.field input[type=checkbox] { width: auto; min-height: 0; }
.err { color: var(--red2); font-size: 13px; min-height: 18px; }
.toggle { position: relative; width: 46px; height: 28px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle i { position: absolute; inset: 0; border-radius: 99px; background: var(--s3); border: 1px solid var(--line2); transition: background .2s; pointer-events: none; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--tx2); transition: transform .25s var(--spring), background .2s; }
.toggle input:checked + i { background: var(--red); border-color: transparent; }
.toggle input:checked + i::after { transform: translateX(18px); background: #fff; }

/* ---------- sheet (bottom drawer on phones, centred on desktop) ---------- */
dialog.sheet {
  position: fixed; inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: 92dvh; padding: 0;
  border: 1px solid var(--line2); border-bottom: 0; border-radius: 26px 26px 0 0; background: #101013; color: var(--tx);
  overflow: hidden; display: flex; flex-direction: column;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet[open] { animation: sheetIn .32s var(--ease); }
dialog.sheet.out { animation: sheetOut .22s var(--ease) forwards; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .62); animation: fade .25s; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.sheet-grab { width: 38px; height: 5px; border-radius: 9px; background: var(--line2); margin: 10px auto 2px; flex: none; }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 8px 18px 12px; flex: none; }
.sheet-h h3 { flex: 1; font-size: 18px; }
.sheet-b { padding: 4px 18px calc(18px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-f { display: flex; gap: 10px; margin-top: 8px; }
.sheet-f .btn { flex: 1; }
@media (min-width: 700px) {
  dialog.sheet { inset: 0; margin: auto; border-radius: 24px; border-bottom: 1px solid var(--line2); height: fit-content; }
  dialog.sheet[open] { animation: popIn .25s var(--ease); }
  dialog.sheet.out { animation: fadeOut .18s forwards; }
  @keyframes popIn { from { opacity: 0; transform: scale(.96); } }
  @keyframes fadeOut { to { opacity: 0; transform: scale(.97); } }
  .sheet-grab { display: none; }
}

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 26px + var(--safe-b)); width: min(420px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: #1a1a1f; border: 1px solid var(--line2); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: tin .3s var(--spring); font-size: 14px; }
.toast.out { animation: tout .2s forwards; }
.toast .grow b { display: block; }
.toast .btn { min-height: 32px; }
@keyframes tin { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes tout { to { opacity: 0; transform: translateY(8px); } }

/* ---------- A-90 mascot ---------- */
.mask { position: relative; width: 112px; height: 112px; flex: none; }
.mask .face { position: absolute; inset: 0; background: #e9e9eb; -webkit-mask: url(../assets/a90-mask.png) center/contain no-repeat; mask: url(../assets/a90-mask.png) center/contain no-repeat; }
.mask .eye { position: absolute; width: 8.5%; height: 8.5%; margin: -4.25% 0 0 -4.25%; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px 2px var(--glow); transform: translate(var(--ex, 0), var(--ey, 0)); transition: transform .12s linear; }
.mask .eye.l { left: 26.9%; top: 31.4%; } .mask .eye.r { left: 75.3%; top: 26.3%; }
.mask.live .face { animation: breathe 6s ease-in-out infinite; }
.mask.live .eye { animation: blink 9s steps(1) infinite; }
@keyframes breathe { 50% { transform: scale(1.03); } }
@keyframes blink { 0%, 61%, 64%, 100% { opacity: 1; } 62% { opacity: 0; } }
.mask.sm { width: 30px; height: 30px; }
.mask.sm .eye { box-shadow: 0 0 4px 1px var(--glow); }

/* ---------- home ---------- */
.hero { display: flex; gap: 16px; align-items: center; padding: 18px; }
.hero .mask { width: 92px; height: 92px; }
.hero .day { font: clamp(26px, 8vw, 36px)/1.1 var(--px); letter-spacing: .02em; white-space: nowrap; margin-top: 4px; }
.hero .day small { font: 600 12px var(--mono); color: var(--tx3); letter-spacing: .1em; margin-left: 6px; }
.hero .line { font: 14px/1.45 var(--mono); color: #f2d6dc; margin-top: 6px; }
.capture { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 18px; background: var(--s1); border: 1px solid var(--line2); transition: border-color .2s; }
.capture:focus-within { border-color: rgba(255, 77, 109, .55); box-shadow: 0 0 0 4px rgba(224, 23, 63, .08); }
.capture input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 42px; font-size: 15px; }
.capture input::placeholder { color: var(--tx3); }
.capture .ib { background: var(--s3); }
.capture .ib.go { background: var(--red); color: #fff; border-color: transparent; }
.capture .ib.rec { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(224, 23, 63, .0), 0 0 0 0 rgba(224, 23, 63, .4); } 0% { box-shadow: 0 0 0 0 rgba(224, 23, 63, .5); } }
.brief { display: flex; flex-direction: column; gap: 2px; }
.brief .bi { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.brief .bi + .bi { border-top: 1px solid var(--line); }
.brief .bi .ava { width: 32px; height: 32px; border-radius: 10px; }
.brief .bi b { font-weight: 600; }
.brief .bi .sub { font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r2); padding: 14px; text-align: left; color: inherit; transition: transform .2s var(--spring); }
.stat:active { transform: scale(.97); }
.stat .eyebrow { margin-bottom: 10px; display: flex; justify-content: space-between; }
.stat .num { font-size: 24px; }
.stat .sub { font-size: 12px; margin-top: 4px; }
.spark { width: 100%; height: 34px; margin-top: 8px; overflow: visible; }

/* insights */
.ins { display: flex; gap: 12px; align-items: flex-start; }
.ins + .ins { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ins .big { font: 700 20px var(--mono); min-width: 58px; color: var(--red2); }
.ins.ok .big { color: var(--ok); }

/* empty */
.empty { text-align: center; padding: 34px 18px; color: var(--tx3); }
.empty svg { width: 34px; height: 34px; margin: 0 auto 10px; opacity: .6; }
.empty b { display: block; color: var(--tx2); margin-bottom: 4px; }

/* ---------- A-90 chat ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - 210px); }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 8px 0 16px; }
.msg-u { align-self: flex-end; max-width: 86%; background: var(--s3); border: 1px solid var(--line); padding: 10px 14px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-a { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.msg-a .body { flex: 1; min-width: 0; overflow-wrap: anywhere; line-height: 1.55; }
.msg-a .body p { margin: 0 0 8px; } .msg-a .body ul { margin: 0 0 8px; padding-left: 20px; }
.msg-a .body code { background: var(--s3); border-radius: 5px; padding: 1px 5px; font: 13px var(--mono); }
.acts { margin-top: 10px; border: 1px solid rgba(224, 23, 63, .3); border-radius: 16px; padding: 12px; background: rgba(224, 23, 63, .04); }
.acts .a { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.acts .a svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--red2); }
.composer { position: sticky; bottom: calc(var(--tab-h) + 22px + var(--safe-b)); z-index: 5; padding-top: 10px; background: linear-gradient(transparent, var(--bg) 35%); }
.composer .box { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 24px; background: var(--s2); border: 1px solid var(--line2); }
.composer textarea { flex: 1; min-width: 0; border: 0; background: none; outline: none; resize: none; min-height: 24px; max-height: 150px; padding: 9px 0; line-height: 1.4; }
.composer .send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--tx); color: #000; display: grid; place-items: center; flex: none; transition: transform .2s var(--spring); }
.composer .send:disabled { background: var(--s3); color: var(--tx3); }
.composer .send svg { width: 18px; height: 18px; }
@media (min-width: 960px) { .composer { bottom: 12px; } }
.sugs { display: grid; gap: 8px; width: 100%; }
.sug { text-align: left; padding: 12px 14px; border-radius: 16px; background: var(--s1); border: 1px solid var(--line); color: var(--tx); display: flex; gap: 12px; align-items: center; transition: transform .2s var(--spring), border-color .2s; }
.sug:hover { border-color: var(--line2); }
.sug:active { transform: scale(.98); }
.sug .ava { width: 32px; height: 32px; }
.dots { display: inline-flex; gap: 4px; padding: 8px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--tx3); animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 30% { opacity: 1; background: var(--red2); } 0%, 60%, 100% { opacity: .35; } }

/* parsed quick-add preview */
.parsed .item { padding: 11px 12px; min-height: 0; }

/* calendar strip */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dayc { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; border-radius: 14px; background: none; border: 1px solid transparent; color: var(--tx2); }
.dayc .w { font: 600 10px var(--mono); letter-spacing: .08em; color: var(--tx3); text-transform: uppercase; }
.dayc .n { font: 650 16px var(--sans); }
.dayc .d { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.dayc .d.on { background: var(--red2); }
.dayc.on { background: var(--s2); border-color: var(--line2); color: var(--tx); }
.dayc.today .n { color: var(--red2); }

/* calm mode = no motion */
body.calm *, body.calm *::before, body.calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* inline icons inside metadata rows */
.item .m svg, .sub svg.chev { display: inline-block; vertical-align: -2px; width: 13px; height: 13px; margin-right: 2px; }

/* ---------- skull jump-scare (original) ---------- */
#sk { position: fixed; inset: 0; z-index: 99; display: none; align-items: center; justify-content: center; background: rgba(14, 0, 3, .88); pointer-events: none; }
#sk.on { display: flex; animation: skb .65s linear 1 forwards; }
#sk.has { background: rgba(75, 0, 12, .92); }
@keyframes skb { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#sk svg { width: min(72vmin, 520px); height: auto; filter: drop-shadow(0 0 16px #d0153a); animation: skp .65s steps(1) 1 forwards; }
#sk .cimg { width: min(80vmin, 560px); height: auto; filter: drop-shadow(0 0 16px #d0153a); animation: skp .65s steps(1) 1 forwards; }
#sk .cimg.inv { filter: invert(1) drop-shadow(0 0 16px #d0153a); }
@keyframes skp { 0% { transform: scale(.25); clip-path: inset(0); } 12% { transform: scale(1.2) translateX(-12px); clip-path: inset(0 0 55% 0); } 24% { transform: scale(1.4) translate(14px, -6px) skewX(8deg); clip-path: inset(40% 0 0 0); } 38% { transform: scale(1.3) translate(-8px, 4px) skewX(-6deg); clip-path: inset(0); } 55% { transform: scale(1.5) translateX(10px); clip-path: inset(20% 0 30% 0); } 70% { transform: scale(1.6); clip-path: inset(0); } 100% { transform: scale(1.8) translateY(-10px); clip-path: inset(0); } }
body.skm #app { animation: tear .3s steps(3) 2; }
@keyframes tear { 33% { transform: translateX(-6px); filter: drop-shadow(4px 0 #d0153a); } 66% { transform: translateX(5px); filter: drop-shadow(-4px 0 #4aa3ff); } }
.logo img.lg-img { width: 22px; height: 22px; object-fit: contain; filter: drop-shadow(0 0 6px var(--glow)); }
body.calm #sk { display: none !important; }

/* ---------- lock room (original) ---------- */
#lk { position: fixed; inset: 0; z-index: 95; background: #000; display: flex; align-items: center; justify-content: center; padding: 20px; font-family: var(--px); font-weight: 400; font-synthesis: none; overflow: auto; color: #fff; }
#lk .lkb { position: relative; z-index: 2; width: min(380px, 100%); text-align: center; }
#lk .stop { display: inline-block; width: 96px; height: 96px; filter: drop-shadow(0 0 16px #d0153a); animation: stopfl 2.6s infinite; }
#lk .stop.simg { position: relative; overflow: hidden; border-radius: 6px; }
#lk .stop.simg.hand { border-radius: 0; overflow: visible; }
#lk .stop.simg img { image-rendering: pixelated; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
#lk .stop.simg img.base { position: relative; filter: contrast(1.3) brightness(.92); }
#lk.blocked .stop img.base { filter: invert(1) contrast(1.3); } /* inverted look only during lockout */
#lk.ok { background: radial-gradient(circle at 50% 45%, #27dc3c, #0a8a18); }
#lk.ok .stop { animation: none; filter: drop-shadow(0 0 14px #7dff8a) drop-shadow(0 0 26px #1fd13a); }
#lk.ok #lt.thx { color: #fff; text-shadow: 0 0 10px #8dff9a, 0 0 26px #1fd13a, 0 0 44px #1fd13a; }
@keyframes stopfl { 0%, 91%, 100% { filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #d0153a); } 92% { filter: drop-shadow(0 0 2px #fff); } 94% { filter: drop-shadow(0 0 22px #fff) drop-shadow(0 0 30px #d0153a); } 96% { filter: drop-shadow(0 0 1px #000); } }
#lt { font-size: 16px; letter-spacing: .12em; margin: 10px 0 6px; min-height: 28px; }
#lt.thx { font-size: 32px; letter-spacing: .22em; }
#lp { height: 8px; margin: 10px 0; background: #2a0008; }
#lp i { display: block; height: 100%; width: 0; background: #d0153a; }
#lf { min-height: 20px; color: var(--tx2); font-size: 16px; }
#lk .dots { display: flex; gap: 10px; justify-content: center; min-height: 22px; margin: 12px 0; }
#lk .dots i { width: 14px; height: 14px; border-radius: 50%; background: #d0153a; }
#lk .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0; }
#lk .pad button { width: 58px; height: 58px; justify-self: center; font: 400 18px var(--px); background: #16090c; border: 1px solid #5a0016; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#lk .pad button:active { background: #3a0010; }
#lk .pad button:disabled { opacity: .35; }
#lk .er { min-height: 1.4em; margin: 6px 0; font-size: 16px; color: #ff6d86; }
#lk .lkx { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#lk .lkbtn { font: 15px var(--px); letter-spacing: .08em; padding: 9px 16px; border-radius: 999px; border: 1px solid #5a0016; background: #16090c; color: #fff; }
#lk .lkbtn.p { background: #d0153a; border-color: #d0153a; }
#lk.shake .lkb { animation: shk .4s steps(4); }
@keyframes shk { 25% { transform: translateX(-10px); } 50% { transform: translateX(9px); } 75% { transform: translateX(-6px); } }
#lk .swarm { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
#lk .swarm .ic { position: absolute; opacity: 0; animation: icpop .2s ease-out forwards; }
#lk .swarm .ic .stop { width: 100%; height: 100%; display: block; animation: none; }
@keyframes icpop { 60% { opacity: 1; scale: 1.15; } 100% { opacity: 1; scale: 1; } }
#lk .flashr { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; mix-blend-mode: screen; }
#lk .flashr.on { opacity: .95; transition: opacity .03s; }
#lk .flashr.rd { background: #d0153a; mix-blend-mode: normal; }
@media (prefers-reduced-motion: reduce) { #lk .stop, #lk.shake .lkb { animation: none !important; } #lk .swarm, #lk .flashr { display: none !important; } }
/* money */
.bal { font: 700 clamp(30px, 9vw, 40px)/1.05 var(--sans); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.catbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 12px 0 10px; background: var(--s3); }
.catbar i { display: block; height: 100%; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.legend span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.legend i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.amt { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* splash */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 45%, #2a0510, var(--bg) 70%); transition: opacity .35s; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .logo { font-size: 40px; flex-direction: column; gap: 14px; }
#splash .logo svg { width: 64px; height: 64px; }

/* =================================================================== */
/* v1.1 layout: sidebar (desktop) · rail (wide) · palette · texture     */
/* =================================================================== */
#side, #rail { display: none; }
.h-page { text-shadow: 0 0 18px rgba(224, 23, 63, .25); }
.card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03); }

/* texture: painted once, never animated */
#fx { position: fixed; inset: 0; z-index: 6; pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(0,0,0,.55) 100%),
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
body.calm #fx { display: none; }

/* phone: search field + More grid */
.search-wide { width: 100%; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--s1); color: var(--tx3); font-size: 14px; }
.search-wide svg { width: 18px; height: 18px; }
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mtile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 12px; border-radius: var(--r2); background: var(--s1); border: 1px solid var(--line); color: var(--tx); font-weight: 600; font-size: 13.5px; transition: transform .2s var(--spring), border-color .2s; }
.mtile:active { transform: scale(.96); }
.mtile svg, .mtile .mask { width: 22px; height: 22px; color: var(--red2); }
.mtile em { position: absolute; top: 10px; right: 10px; font: 700 11px var(--mono); font-style: normal; color: #fff; background: var(--red); border-radius: 99px; padding: 1px 7px; }

/* ⌘K palette */
#pal { position: fixed; inset: 0; z-index: 97; background: rgba(0, 0, 0, .6); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 14px 14px; animation: fade .15s; }
.pal-box { width: min(620px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: #101013; border: 1px solid var(--line2); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(224, 23, 63, .12); }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.pal-in svg { width: 18px; height: 18px; color: var(--tx3); }
.pal-in input { flex: 1; height: 54px; background: none; border: 0; outline: none; font-size: 16px; }
kbd { font: 600 11px var(--mono); color: var(--tx3); border: 1px solid var(--line2); border-radius: 6px; padding: 2px 6px; }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-g { font: 600 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--tx3); padding: 10px 10px 4px; }
.pal-r { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: none; border: 0; text-align: left; color: var(--tx); font-size: 14px; }
.pal-r svg { width: 17px; height: 17px; color: var(--tx3); flex: none; }
.pal-r .muted { font-size: 12px; white-space: nowrap; }
.pal-r.on, .pal-r:hover { background: var(--s3); }
.pal-r.on svg { color: var(--red2); }

/* A-90 chats panel: slide-out on phone, fixed column on desktop */
.ai-head { display: flex; align-items: center; gap: 8px; margin: 2px 0 6px; }
.ai-title { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-side { position: fixed; z-index: 92; top: 0; bottom: 0; left: 0; width: min(86vw, 320px); display: flex; flex-direction: column; gap: 10px; padding: calc(14px + var(--safe-t)) 12px calc(14px + var(--safe-b)); background: #0b0b0e; border-right: 1px solid var(--line2); transform: translateX(calc(-100% - 24px)); visibility: hidden; transition: transform .28s var(--ease), visibility 0s .28s; }
.aiw.open .ai-side { visibility: visible; transition: transform .28s var(--ease), visibility 0s; }
.ai-bk { position: fixed; inset: 0; z-index: 91; background: rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity .25s; }
.aiw.open .ai-side { transform: none; box-shadow: 12px 0 40px rgba(0, 0, 0, .6); }
.aiw.open .ai-bk { opacity: 1; pointer-events: auto; }
.ai-side-h { display: flex; align-items: center; justify-content: space-between; color: var(--tx3); font-size: 12px; }
.ai-search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 11px; background: var(--s1); border: 1px solid var(--line); }
.ai-search svg { width: 15px; height: 15px; color: var(--tx3); }
.ai-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13.5px; }
.ai-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.ch { display: flex; align-items: center; border-radius: 9px; }
.ch:hover, .ch.on { background: var(--s2); }
.ch.on { box-shadow: inset 2px 0 0 var(--red); border-radius: 0 9px 9px 0; }
.ch-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px; border: 0; background: none; color: var(--tx2); font-size: 13.5px; text-align: left; }
.ch.on .ch-t { color: #fff; }
.ch-t span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pin { width: 13px; height: 13px; color: var(--red2); flex: none; }
.ch-acts { display: none; padding-right: 2px; }
.ch-acts .ib { width: 26px; height: 26px; }
.ch-acts .ib svg { width: 14px; height: 14px; }
.ch:hover .ch-acts, .ch.on .ch-acts { display: flex; }
@media (hover: none) { .ch-acts { display: flex; } .ch:not(.on) .ch-acts .ib:not([data-a="cdel"]) { display: none; } }

/* desktop: sidebar + wide content */
@media (min-width: 960px) {
  #top, #tabs { display: none !important; }
  #side { display: flex; flex-direction: column; position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 236px; padding: 18px 12px 14px; background: #0a0a0c; border-right: 1px solid var(--line); }
  #app { margin-left: 236px; max-width: none; padding: 28px clamp(20px, 3vw, 44px) 60px; }
  #app > div { max-width: 860px; margin: 0 auto; }
  #toasts { bottom: 24px; left: calc(50% + 118px); }
  .sb-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 16px; }
  .sb-top .logo { background: none; border: 0; color: var(--tx); font-size: 17px; padding: 0; }
  .sb-search { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px; margin-bottom: 14px; border-radius: 11px; border: 1px solid var(--line2); background: var(--s1); color: var(--tx3); font-size: 13px; }
  .sb-search svg { width: 16px; height: 16px; }
  .sb-search span { flex: 1; text-align: left; }
  .sb-nav { flex: 1; overflow-y: auto; scrollbar-width: none; }
  .sb-g { font: 600 10.5px var(--mono); letter-spacing: .16em; color: var(--tx3); padding: 14px 10px 6px; }
  .sb-i { width: 100%; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--tx2); font-size: 14px; font-weight: 550; text-align: left; transition: background .15s, color .15s; }
  .sb-i svg { width: 18px; height: 18px; flex: none; }
  .sb-i .mask { width: 20px; height: 20px; }
  .sb-i span { flex: 1; }
  .sb-i em { font: 700 11px var(--mono); font-style: normal; color: var(--red2); }
  .sb-i .sb-lock { width: 13px; height: 13px; color: var(--tx3); }
  .sb-i:hover { background: var(--s2); color: var(--tx); }
  .sb-i.on { background: linear-gradient(90deg, rgba(224, 23, 63, .16), transparent 80%); color: #fff; box-shadow: inset 2px 0 0 var(--red); border-radius: 0 9px 9px 0; }
  .sb-i.on svg { color: var(--red2); filter: drop-shadow(0 0 5px var(--glow)); }
  .sb-foot { font-size: 11px; color: var(--tx3); padding: 10px 10px 0; letter-spacing: .06em; }
  .subnav { display: none !important; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .composer { bottom: 12px; }
  body[data-route="ai"] #app { padding-left: 0; padding-right: 0; padding-top: 0; }
  body[data-route="ai"] #app > div { max-width: none; }
  .aiw { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100dvh; }
  .ai-side { position: sticky; top: 0; height: 100dvh; width: auto; transform: none; visibility: visible; z-index: 1; padding: 20px 12px 14px; box-shadow: none !important; }
  .ai-x, .ai-menu, .ai-bk { display: none !important; }
  .ai-main { width: 100%; max-width: 820px; margin: 0 auto; padding: 18px clamp(16px, 3vw, 36px) 0; min-height: 100dvh; }
}
/* wide: A-90 rail on the right */
@media (min-width: 1240px) {
  body:not([data-route="ai"]) #rail { display: flex; flex-direction: column; position: fixed; z-index: 20; right: 0; top: 0; bottom: 0; width: 300px; padding: 22px 18px; background: #0b0b0e; border-left: 1px solid var(--line); overflow-y: auto; }
  body:not([data-route="ai"]) #app { margin-right: 300px; }
  body:not([data-route="ai"]) #toasts { left: calc(50% - 32px); }
  .rl-h { display: flex; align-items: center; gap: 10px; }
  .rl-h .mask { width: 30px; height: 30px; }
  .rl-line { font: 13px/1.5 var(--mono); color: #f2d6dc; margin-top: 12px; }
  .rl-i { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; margin: 0 -8px; width: calc(100% + 16px); border: 0; border-radius: 10px; background: none; color: inherit; text-align: left; }
  .rl-i:hover { background: var(--s2); }
  .rl-i .ava { width: 30px; height: 30px; border-radius: 9px; }
  .rl-i .ava svg { width: 15px; height: 15px; }
  .rl-i b { display: block; font-size: 13.5px; font-weight: 600; }
  .rl-i span span { display: block; font-size: 12px; color: var(--tx3); }
  .rl-ins { background: var(--s1); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
  .rl-ask { margin-top: auto; display: flex; gap: 6px; padding-top: 16px; }
  .rl-ask input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--s2); outline: none; }
  .rl-ask input:focus { border-color: rgba(255, 77, 109, .5); }
  .rl-ask button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; }
  .rl-ask button svg { width: 17px; height: 17px; }
}
