/* Support mini app. Two themes: data-theme="dark" (deep, near black) and "light". */
:root, :root[data-theme="dark"] {
  --bg: #07090c;
  --bar: #0c0f14;
  --card: #11151b;
  --card-2: #181d25;
  --field: #12171e;
  --field-focus: #161c25;
  --hover: rgba(255, 255, 255, .035);
  --press: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .065);
  --text: #eef2f6;
  --text-2: #d3dae2;
  --muted: #7a8693;
  --muted-2: #4d5763;
  --accent: #5aa7ff;
  --accent-soft: rgba(90, 167, 255, .13);
  --btn: #3b86f7;
  --btn-2: #2c6be0;
  --btn-glow: rgba(59, 134, 247, .3);
  --in: #141920;
  --in-meta: #687482;
  --out: linear-gradient(165deg, #2e6ae0 0%, #2655c2 100%);
  --out-tail: #2655c2;
  --out-fg: #ffffff;
  --out-meta: rgba(255, 255, 255, .62);
  --out-link: #d5e8ff;
  --out-quote-bg: rgba(255, 255, 255, .13);
  --out-quote-bar: #d5e8ff;
  --tick-read: #bfe0ff;
  --service-bg: rgba(18, 23, 30, .78);
  --service-fg: #dbe3eb;
  --glow-1: rgba(70, 140, 255, .13);
  --glow-2: rgba(130, 100, 255, .08);
  --dots: rgba(255, 255, 255, .03);
  --green: #3fcf6e;
  --amber: #f5a742;
  --red: #f2555a;
  --red-text: #ff7d80;
  --red-soft: rgba(242, 85, 90, .14);
  --overlay: rgba(0, 0, 0, .62);
  --float-bg: rgba(22, 27, 35, .97);
  --skel-a: #0f1318;
  --skel-b: #1a2029;
  --photo-bg: #10151c;
  --star-off: #2b333e;
  --grab: rgba(255, 255, 255, .16);
  --shadow: 0 1px 1.5px rgba(0, 0, 0, .45);
  --float-shadow: 0 14px 44px rgba(0, 0, 0, .55);
  --cat-alpha: .5;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f6;
  --bar: #ffffff;
  --card: #ffffff;
  --card-2: #edf1f6;
  --field: #f0f3f7;
  --field-focus: #ffffff;
  --hover: rgba(15, 23, 32, .03);
  --press: rgba(15, 23, 32, .06);
  --line: rgba(15, 23, 32, .08);
  --text: #0f1720;
  --text-2: #2b3642;
  --muted: #6a7684;
  --muted-2: #a0a9b3;
  --accent: #2b7de0;
  --accent-soft: rgba(43, 125, 224, .1);
  --btn: #3a8cf2;
  --btn-2: #2b76dc;
  --btn-glow: rgba(43, 125, 224, .25);
  --in: #ffffff;
  --in-meta: #8994a1;
  --out: linear-gradient(165deg, #e2f1ff 0%, #d2e8ff 100%);
  --out-tail: #d2e8ff;
  --out-fg: #0f1720;
  --out-meta: #5b8cc4;
  --out-link: #1b66c4;
  --out-quote-bg: rgba(43, 125, 224, .12);
  --out-quote-bar: #2b7de0;
  --tick-read: #2b7de0;
  --service-bg: rgba(64, 82, 104, .5);
  --service-fg: #ffffff;
  --glow-1: rgba(43, 125, 224, .12);
  --glow-2: rgba(150, 120, 255, .09);
  --dots: rgba(15, 23, 32, .045);
  --green: #24b358;
  --amber: #e38a12;
  --red: #e5484d;
  --red-text: #d93a40;
  --red-soft: rgba(229, 72, 77, .1);
  --overlay: rgba(15, 23, 32, .38);
  --float-bg: rgba(255, 255, 255, .98);
  --skel-a: #e3e8ee;
  --skel-b: #f4f6f9;
  --photo-bg: #dde3ea;
  --star-off: #cdd5de;
  --grab: rgba(15, 23, 32, .16);
  --shadow: 0 1px 2px rgba(15, 23, 32, .12);
  --float-shadow: 0 14px 44px rgba(15, 23, 32, .18);
  --cat-alpha: .9;
  color-scheme: light;
}
:root {
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --app-h: 100%;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* theme switch: a circle grows from the button (View Transitions), else a quick cross-fade */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-fade, .theme-fade * { transition: background-color .35s, color .35s, border-color .35s, box-shadow .35s !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  font: 15px/1.38 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; }
.hidden { display: none !important; }

#app { position: fixed; left: 0; right: 0; top: 0; height: var(--app-h); overflow: hidden; }

/* ------------------------------------------------------------ boot */
.boot { position: absolute; inset: 0; display: grid; place-items: center; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
.btn .spinner { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------- views */
.view {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden; will-change: transform;
}
.view.enter { animation: viewIn .32s var(--ease) both; }
.view.leave { animation: viewOut .32s var(--ease) both; pointer-events: none; }
.view.enter-back { animation: viewBackIn .32s var(--ease) both; }
.view.leave-back { animation: viewBackOut .28s var(--ease) both; pointer-events: none; z-index: 2; }
@keyframes viewIn { from { transform: translateX(100%); box-shadow: -20px 0 40px rgba(0, 0, 0, .35); } to { transform: none; } }
@keyframes viewOut { to { transform: translateX(-28%); filter: brightness(.7); } }
@keyframes viewBackIn { from { transform: translateX(-28%); filter: brightness(.7); } to { transform: none; filter: none; } }
@keyframes viewBackOut { from { transform: none; } to { transform: translateX(100%); } }
.view.fade { animation: fadeIn .35s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } }

.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: 0; height: 0; }

/* top bar */
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px;
  background: var(--bar); border-bottom: 1px solid var(--line); position: relative; z-index: 3;
}
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 13px; color: var(--muted); }
.icon-btn {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  color: var(--muted); transition: background .15s, color .15s, transform .15s;
}
.icon-btn:active { background: var(--press); transform: scale(.92); }
.icon-btn svg { width: 24px; height: 24px; }
.back-btn { margin-left: -8px; color: var(--text); }

/* theme button: sun / moon */
.theme-btn { position: relative; color: var(--text-2); background: var(--card-2); width: 38px; height: 38px; overflow: hidden; }
.theme-btn svg { position: absolute; inset: 7px; width: 24px; height: 24px; transition: transform .5s var(--spring), opacity .3s; }
.theme-btn .sun { color: #f5b301; }
:root[data-theme="dark"] .theme-btn .sun, :root:not([data-theme]) .theme-btn .sun { transform: rotate(-90deg) scale(.4); opacity: 0; }
:root[data-theme="light"] .theme-btn .moon { transform: rotate(90deg) scale(.4); opacity: 0; }
.hero .theme-btn { position: absolute; top: 14px; right: 14px; z-index: 2; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------- premium emoji */
.pe {
  --s: 20px; display: inline-block; width: var(--s); height: var(--s); flex: none;
  vertical-align: -0.22em; position: relative; line-height: 1;
}
.pe > svg { opacity: 0; transition: opacity .25s; }
.pe.ready > svg { opacity: 1; }
.pe.fb { font-size: calc(var(--s) * .86); text-align: center; line-height: var(--s); }
.pe.tint svg [fill]:not([fill="none"]) { fill: currentColor; }
.pe.tint svg [stroke]:not([stroke="none"]) { stroke: currentColor; }

/* ---------------------------------------------------------- avatar */
.ava {
  --a: 54px; position: relative; width: var(--a); height: var(--a); flex: none; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: calc(var(--a) * .38);
}
.ava > img, .ava > .ava-in { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ava > .ava-in { display: grid; place-items: center; }
.ava .dot {
  position: absolute; right: 0; bottom: 0; width: calc(var(--a) * .26); height: calc(var(--a) * .26);
  min-width: 11px; min-height: 11px; border-radius: 50%; border: 2.5px solid var(--bar); background: var(--green);
  transform: scale(0); transition: transform .3s var(--spring);
}
.ava .dot.on { transform: scale(1); }
.ava.tava { background: var(--cat-bg, var(--card-2)); box-shadow: inset 0 0 0 1px var(--line); }
.ava.tava .badge {
  position: absolute; right: -1px; bottom: -1px; width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid var(--bg); background: var(--muted-2);
}
.ava.tava .badge.new { background: var(--amber); }
.ava.tava .badge.work { background: var(--green); }
.g0 { background: linear-gradient(160deg, #ff885e, #ff516a); }
.g1 { background: linear-gradient(160deg, #ffcd6a, #ffa85c); }
.g2 { background: linear-gradient(160deg, #82b1ff, #665fff); }
.g3 { background: linear-gradient(160deg, #a0de7e, #54cb68); }
.g4 { background: linear-gradient(160deg, #53edd6, #28c9b7); }
.g5 { background: linear-gradient(160deg, #72d5fd, #2a9ef1); }
.g6 { background: linear-gradient(160deg, #e0a2f3, #d669ed); }
.c-tokens { --cat-bg: radial-gradient(circle at 30% 25%, rgba(114, 213, 253, .32), rgba(42, 158, 241, .1)); }
.c-balance { --cat-bg: radial-gradient(circle at 30% 25%, rgba(160, 222, 126, .3), rgba(84, 203, 104, .08)); }
.c-emoji { --cat-bg: radial-gradient(circle at 30% 25%, rgba(255, 205, 106, .3), rgba(255, 168, 92, .08)); }
.c-bug { --cat-bg: radial-gradient(circle at 30% 25%, rgba(255, 136, 94, .3), rgba(255, 81, 106, .08)); }
.c-idea { --cat-bg: radial-gradient(circle at 30% 25%, rgba(255, 220, 120, .28), rgba(102, 95, 255, .08)); }
.c-other { --cat-bg: radial-gradient(circle at 30% 25%, rgba(130, 177, 255, .3), rgba(214, 105, 237, .08)); }

/* ----------------------------------------------------------- quote */
.quote {
  position: relative; padding: 7px 30px 8px 12px; border-radius: 6px; overflow: hidden;
  background: var(--q-bg, var(--accent-soft)); color: inherit; font-size: 14.5px; line-height: 1.4;
  white-space: pre-wrap; word-wrap: break-word;
}
.quote::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--q-bar, var(--accent)); }
.quote::after {
  content: ""; position: absolute; top: 6px; right: 7px; width: 13px; height: 13px; opacity: .85;
  background: var(--q-bar, var(--accent));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.6 5C6.1 6.5 4 9.4 4 13.2V19h6.4v-6.4H7.2c0-2.3 1.2-4 3.4-5.1zm10 0c-3.5 1.5-5.6 4.4-5.6 8.2V19h6.4v-6.4h-3.2c0-2.3 1.2-4 3.4-5.1z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.6 5C6.1 6.5 4 9.4 4 13.2V19h6.4v-6.4H7.2c0-2.3 1.2-4 3.4-5.1zm10 0c-3.5 1.5-5.6 4.4-5.6 8.2V19h6.4v-6.4h-3.2c0-2.3 1.2-4 3.4-5.1z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.quote.plain::after { display: none; }
.quote.plain { padding-right: 12px; }
.quote b, .quote .q-name { display: block; font-weight: 600; color: var(--q-bar, var(--accent)); font-size: 13.5px; }
.quote.red { --q-bg: var(--red-soft); --q-bar: var(--red); }
.quote.green { --q-bg: rgba(63, 207, 110, .13); --q-bar: var(--green); }
.quote.amber { --q-bg: rgba(245, 167, 66, .13); --q-bar: var(--amber); }
.quote .pe { margin-right: 4px; }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 13px; font-weight: 600; font-size: 15.5px;
  background: var(--card-2); color: var(--text); transition: transform .15s, background .2s, opacity .2s, box-shadow .2s;
  position: relative; overflow: hidden; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--btn), var(--btn-2)); color: #fff; box-shadow: 0 8px 22px var(--btn-glow); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 55%);
}
.btn.danger { background: var(--red-soft); color: var(--red-text); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn .pe { --s: 22px; }

.bottom-bar {
  flex: none; padding: 10px 14px calc(10px + var(--safe-b)); background: var(--bar);
  border-top: 1px solid var(--line); position: relative; z-index: 3;
}

/* ------------------------------------------------------------- hero */
.hero { position: relative; padding: 18px 16px 14px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -80px -60px auto; height: 260px; pointer-events: none;
  background: radial-gradient(55% 65% at 22% 35%, var(--glow-1), transparent 70%),
              radial-gradient(45% 55% at 88% 12%, var(--glow-2), transparent 70%);
  animation: aurora 14s ease-in-out infinite alternate;
}
@keyframes aurora { to { transform: translate(18px, 10px) scale(1.06); } }
.hero-row { position: relative; display: flex; align-items: center; gap: 14px; padding-right: 44px; }
.hero .ava { --a: 62px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line); }
.hero .ava .dot { border-color: var(--bg); }
.hero-name { font-size: 19px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.hero-name .pe { --s: 22px; }
.status { font-size: 14px; color: var(--muted); margin-top: 2px; transition: color .2s; }
.status.online, .status.typing { color: var(--accent); }
.hero .quote { margin-top: 14px; }

.typing-dots { display: inline-flex; gap: 3px; margin-left: 3px; vertical-align: 2px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }

/* ---------------------------------------------------------- sections */
.section-title {
  display: flex; align-items: center; gap: 8px; padding: 16px 16px 6px; font-size: 13.5px; font-weight: 600;
  color: var(--accent); letter-spacing: .01em;
}
.section-title .pe { --s: 18px; }
.section-title .count { color: var(--muted); font-weight: 500; }

/* -------------------------------------------------------------- rows */
.rows { padding-bottom: 8px; }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 14px; text-align: left;
  position: relative; transition: background .15s;
}
.row:active { background: var(--press); }
.row::after { content: ""; position: absolute; left: 80px; right: 0; bottom: 0; height: 1px; background: var(--line); }
.row:last-child::after { display: none; }
.row-main { flex: 1; min-width: 0; }
.row-top, .row-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-title .tid { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: 14px; }
.row-time { flex: none; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 3px; }
.row-time svg { width: 16px; height: 16px; color: var(--accent); }
.row-sub { flex: 1; min-width: 0; color: var(--muted); font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row-sub .me { color: var(--text-2); }
.row-sub .pe { --s: 16px; margin-right: 3px; }
.row-subject { font-size: 14.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.row-right { flex: none; display: flex; align-items: center; min-height: 22px; }
.row-right .pe { animation: pop .45s var(--spring) both; margin: -5px -5px -5px 0; }
.count-badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--btn); color: #fff;
  font-size: 13px; font-weight: 600; display: grid; place-items: center; animation: pop .4s var(--spring) both;
}
.row.closed .row-title, .row.closed .ava { opacity: .7; }
.row.anim { animation: rowIn .45s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { transform: scale(0); } }

/* skeleton */
.skel { display: flex; align-items: center; gap: 12px; padding: 9px 14px; }
.skel i { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--skel-a) 0%, var(--skel-b) 50%, var(--skel-a) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skel .s-ava { width: 54px; height: 54px; border-radius: 50%; }
.skel .s-lines { flex: 1; display: grid; gap: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* empty */
.empty { padding: 34px 28px 20px; text-align: center; animation: fadeUp .5s var(--ease) both; }
.empty .pe { --s: 104px; animation: float 3.4s ease-in-out infinite; }
.empty h3 { margin: 16px 0 6px; font-size: 18px; font-weight: 650; }
.empty p { margin: 0 auto; max-width: 300px; color: var(--muted); font-size: 14.5px; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------- categories */
.page-head { padding: 18px 16px 6px; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 14px 20px; }
.cat {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
  text-align: left; padding: 14px 14px 13px; border-radius: 16px; background: var(--card);
  border: 1px solid var(--line); position: relative; overflow: hidden; box-shadow: var(--shadow);
  transition: transform .18s var(--ease), border-color .2s, background .2s;
  animation: fadeUp .45s var(--ease) both;
}
.cat::before { content: ""; position: absolute; inset: 0; background: var(--cat-bg); opacity: var(--cat-alpha); pointer-events: none; }
.cat > * { position: relative; }
.cat:active { transform: scale(.96); }
.cat .pe { --s: 40px; }
.cat-title { margin-top: 10px; font-weight: 650; font-size: 15.5px; }
.cat-sub { margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.3; }
.cat.wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.cat.wide .cat-title { margin-top: 0; }

/* ------------------------------------------------------------- form */
.form { padding: 6px 14px 18px; display: grid; gap: 14px; }
.chip {
  justify-self: start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px;
  border-radius: 20px; background: var(--card-2); font-size: 14px; font-weight: 600; transition: transform .15s;
}
.chip:active { transform: scale(.96); }
.chip .pe { --s: 22px; }
.chip svg { width: 14px; height: 14px; color: var(--muted); margin-left: 2px; }
.field { display: grid; gap: 6px; }
.field-label { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--muted); font-weight: 600; padding: 0 4px; }
.field-label .counter { font-weight: 500; font-variant-numeric: tabular-nums; transition: color .2s; }
.field-label .counter.warn { color: var(--amber); }
.input {
  width: 100%; border: 1.5px solid var(--line); outline: none; border-radius: 13px; background: var(--field);
  padding: 12px 14px; font-size: 16px; line-height: 1.4; transition: border-color .2s, background .2s, box-shadow .2s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { border-color: var(--accent); background: var(--field-focus); box-shadow: 0 0 0 4px var(--accent-soft); }
textarea.input { resize: none; min-height: 120px; max-height: 40vh; display: block; }
.form .quote .pe { --s: 18px; }
.note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 13.5px; padding: 0 4px; }
.note .pe { --s: 20px; margin-top: -1px; }

/* ------------------------------------------------------------- chat */
.chat-head { gap: 10px; padding: 0 8px 0 14px; cursor: default; }
.chat-head .ava { --a: 40px; }
.chat-head .ava .dot { border-color: var(--bar); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-name { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.chat-name span { overflow: hidden; text-overflow: ellipsis; }
.chat-name .pe { --s: 19px; }
.chat-head .status { font-size: 13.5px; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head.tap { cursor: pointer; }
.chat-head.tap:active .chat-head-text { opacity: .7; }

.pinned {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 12px 7px 14px;
  background: var(--bar); border-bottom: 1px solid var(--line); position: relative; z-index: 2;
}
.pinned-text { flex: 1; min-width: 0; padding-left: 10px; position: relative; }
.pinned-text::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 2.5px; border-radius: 2px; background: var(--accent); }
.pinned-title { font-size: 13.5px; font-weight: 600; color: var(--accent); }
.pinned-sub { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: 12.5px; font-weight: 600; background: var(--card-2); color: var(--muted); transition: background .3s, color .3s;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.new { background: rgba(245, 167, 66, .14); color: var(--amber); }
.pill.work { background: rgba(63, 207, 110, .14); color: var(--green); }
.pill.closed { background: var(--card-2); color: var(--muted); }
.pill-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13.5px; font-weight: 600; background: var(--btn); color: #fff; transition: transform .15s; }
.pill-btn:active { transform: scale(.95); }

.chat-bg { flex: 1; position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.chat-bg::before {
  content: ""; position: absolute; inset: -20%; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 10%, var(--glow-1), transparent 70%),
    radial-gradient(35% 30% at 90% 85%, var(--glow-2), transparent 70%);
  animation: aurora 18s ease-in-out infinite alternate;
}
.chat-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dots) 1px, transparent 1.3px);
  background-size: 22px 22px;
}
.chat-scroll { position: relative; z-index: 1; flex: 1; padding: 8px 0 6px; }
.msgs { display: flex; flex-direction: column; padding: 0 8px; min-height: 100%; justify-content: flex-end; }

.intro {
  align-self: center; margin: 10px auto 14px; width: min(300px, 86%); padding: 18px 16px 16px; text-align: center;
  border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--float-shadow);
  animation: fadeUp .5s var(--ease) both;
}
.intro .ava { --a: 64px; margin: 0 auto 10px; }
.intro .ava .pe { --s: 40px; }
.intro-title { font-weight: 650; font-size: 16px; }
.intro-sub { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.intro .quote { margin-top: 12px; text-align: left; font-size: 14px; }

.service { align-self: center; margin: 6px 0; max-width: 86%; text-align: center; }
.service span {
  display: inline-block; padding: 4px 11px; border-radius: 14px; font-size: 13.5px; font-weight: 500;
  color: var(--service-fg); background: var(--service-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.service.date { position: sticky; top: 6px; z-index: 1; }
.service.anim { animation: fadeUp .4s var(--ease) both; }
.unread-sep { align-self: stretch; margin: 8px -8px; padding: 5px; text-align: center; font-size: 13.5px; color: var(--accent); background: var(--accent-soft); }

.msg { display: flex; margin-top: 2px; max-width: 100%; }
.msg.first { margin-top: 8px; }
.msg.me { justify-content: flex-end; }
.bubble {
  position: relative; max-width: min(78%, 440px); padding: 6px 10px 7px; border-radius: 17px;
  background: var(--in); color: var(--text); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
  font-size: 15.5px; line-height: 1.36; box-shadow: var(--shadow);
  transition: transform .15s, filter .15s; user-select: text; -webkit-user-select: text;
}
.msg.me .bubble { background: var(--out); color: var(--out-fg); }
.msg.peer.tail .bubble { border-bottom-left-radius: 5px; }
.msg.me.tail .bubble { border-bottom-right-radius: 5px; }
.msg.tail .bubble::after { content: ""; position: absolute; bottom: 0; width: 10px; height: 16px; }
.msg.peer.tail .bubble::after { left: -6px; background: var(--in); clip-path: path("M10 0 C10 9 7 14 0 16 L10 16 Z"); }
.msg.me.tail .bubble::after { right: -6px; background: var(--out-tail); clip-path: path("M0 0 C0 9 3 14 10 16 L0 16 Z"); }
.msg.anim .bubble { animation: bubbleIn .38s var(--spring) both; }
.msg.me.anim .bubble { transform-origin: 100% 100%; }
.msg.peer.anim .bubble { transform-origin: 0 100%; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(14px) scale(.9); } }
.msg.flash .bubble { animation: flash 1s var(--ease); }
@keyframes flash { 30% { filter: brightness(1.35); } }
.bubble.pressed { transform: scale(.97); filter: brightness(1.08); }
.bubble a { color: var(--accent); text-decoration: none; }
.msg.me .bubble a { color: var(--out-link); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 2px; }
.bubble .quote { margin: 3px 0 4px; font-size: 14.5px; }
.msg.me .bubble .quote { --q-bg: var(--out-quote-bg); --q-bar: var(--out-quote-bar); }
.bubble .reply {
  display: block; margin: 2px 0 5px; padding: 4px 10px 5px 11px; border-radius: 6px; position: relative; overflow: hidden;
  background: var(--accent-soft); font-size: 14px; line-height: 1.3; cursor: pointer; white-space: nowrap;
}
.bubble .reply::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.msg.me .bubble .reply { background: var(--out-quote-bg); }
.msg.me .bubble .reply::before { background: var(--out-quote-bar); }
.reply .r-name { display: block; font-weight: 600; color: var(--accent); font-size: 13.5px; }
.msg.me .reply .r-name { color: var(--out-quote-bar); }
.reply .r-text { display: block; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.meta-gap { display: inline-block; width: 46px; height: 1px; }
.meta {
  position: absolute; right: 9px; bottom: 5px; display: flex; align-items: center; gap: 3px;
  font-size: 12px; color: var(--in-meta); white-space: nowrap; pointer-events: none;
}
.msg.me .meta { color: var(--out-meta); }
.meta svg { width: 16px; height: 16px; }
.meta .ticks { color: var(--out-meta); }
.meta .ticks.read { color: var(--tick-read); }
.bubble.media { padding: 3px; }
.bubble.media .photo { border-radius: 14px; }
.bubble.media.with-text .photo { border-radius: 14px 14px 6px 6px; }
.bubble.media .caption { padding: 5px 7px 3px; }
.bubble.media:not(.with-text) .meta {
  background: rgba(0, 0, 0, .45); color: #fff; padding: 2px 7px; border-radius: 10px; right: 9px; bottom: 9px;
}
.bubble.media:not(.with-text) .meta .ticks { color: #fff; }
.photo {
  position: relative; overflow: hidden; background: var(--photo-bg); cursor: zoom-in;
  width: var(--pw, 240px); max-width: 100%; aspect-ratio: var(--pr, 4 / 3); min-height: 90px;
}
.photo img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s; }
.photo img.loaded { opacity: 1; }
.photo .progress {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .35); transition: opacity .3s;
}
.photo .progress svg { width: 46px; height: 46px; }
.photo .progress circle { transition: stroke-dashoffset .2s; }
.msg.failed .bubble { filter: saturate(.6); }
.msg.failed .meta { color: var(--red) !important; }

.typing-row { display: flex; padding: 4px 8px 0; }
.typing-bubble {
  display: inline-flex; gap: 4px; padding: 11px 13px; border-radius: 17px 17px 17px 5px; background: var(--in);
  animation: bubbleIn .3s var(--spring) both; color: var(--muted); box-shadow: var(--shadow);
}
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .15s; }
.typing-bubble i:nth-child(3) { animation-delay: .3s; }

/* rating card */
.rate-card {
  align-self: center; margin: 12px auto 8px; width: min(320px, 90%); padding: 16px; border-radius: 20px; text-align: center;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--float-shadow); animation: fadeUp .5s var(--ease) both;
}
.rate-card h4 { margin: 0; font-size: 16px; font-weight: 650; }
.rate-card p { margin: 4px 0 12px; color: var(--muted); font-size: 13.5px; }
.stars-row { display: flex; justify-content: center; gap: 6px; }
.star-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; transition: transform .2s var(--spring), background .2s; }
.star-btn svg { width: 32px; height: 32px; color: var(--star-off); transition: color .2s, transform .3s var(--spring); }
.star-btn.on svg { color: #ffc23d; transform: scale(1.12); filter: drop-shadow(0 2px 8px rgba(255, 194, 61, .35)); }
.star-btn:active { transform: scale(.88); }
.rate-card .thanks { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; animation: pop .45s var(--spring) both; }
.rate-card .thanks .pe { --s: 30px; }

/* scroll down */
.fab-down {
  position: absolute; right: 12px; bottom: 12px; z-index: 3; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bar); color: var(--muted); box-shadow: var(--float-shadow);
  border: 1px solid var(--line); transform: scale(0); transition: transform .25s var(--spring);
}
.fab-down.show { transform: scale(1); }
.fab-down svg { width: 24px; height: 24px; }
.fab-down .count-badge { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); min-width: 20px; height: 20px; font-size: 12px; }

/* composer */
.reply-bar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 7px 8px 3px 14px; background: var(--bar);
  border-top: 1px solid var(--line); animation: slideUp .25s var(--ease) both;
}
.reply-bar > svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.reply-bar .rb-text { flex: 1; min-width: 0; padding-left: 10px; position: relative; font-size: 14px; }
.reply-bar .rb-text::before { content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 2.5px; border-radius: 2px; background: var(--accent); }
.reply-bar .rb-name { color: var(--accent); font-weight: 600; font-size: 13.5px; }
.reply-bar .rb-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } }
.composer {
  flex: none; display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px calc(6px + var(--safe-b)); background: var(--bar);
  border-top: 1px solid var(--line); position: relative; z-index: 2;
}
.reply-bar:not(.hidden) + .composer { border-top: 0; }
.composer .icon-btn { width: 44px; height: 44px; }
.attach { position: relative; }
.attach.locked { color: var(--muted-2); }
.attach .lock {
  position: absolute; right: 6px; bottom: 7px; width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bar);
}
.attach .lock svg { width: 11px; height: 11px; }
.attach.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: none; background: transparent; padding: 11px 6px;
  font-size: 16px; line-height: 22px; max-height: 154px; display: block;
}
.composer textarea::placeholder { color: var(--muted-2); }
.send-btn {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--muted-2);
  transition: color .2s, transform .25s var(--spring);
}
.send-btn svg { width: 26px; height: 26px; transition: transform .3s var(--spring); }
.send-btn.active { color: var(--accent); }
.send-btn.active svg { transform: rotate(0deg) scale(1.04); }
.send-btn:not(.active) svg { transform: rotate(-35deg) scale(.86); }
.send-btn:active { transform: scale(.88); }
.send-btn.fly svg { animation: fly .45s var(--ease); }
@keyframes fly { 45% { transform: translate(14px, -10px) scale(.6); opacity: 0; } 46% { transform: translate(-12px, 8px) scale(.6); opacity: 0; } 100% { transform: none; opacity: 1; } }

.closed-bar {
  flex: none; padding: 12px 14px calc(12px + var(--safe-b)); background: var(--bar); border-top: 1px solid var(--line);
  display: grid; gap: 10px; animation: slideUp .3s var(--ease) both;
}
.closed-bar .closed-text { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 14.5px; }
.closed-bar .pe { --s: 22px; }

/* ------------------------------------------------------- admin list */
.search { padding: 8px 12px 6px; background: var(--bar); }
.search-box { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 19px; background: var(--field); }
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15.5px; }
.search-box input::placeholder { color: var(--muted-2); }
.tabs { position: relative; display: flex; gap: 2px; padding: 4px 8px 0; background: var(--bar); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 10px 11px; font-size: 14.5px; font-weight: 600;
  color: var(--muted); transition: color .2s;
}
.tab.on { color: var(--accent); }
.tab .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px; display: grid; place-items: center; background: var(--card-2); color: var(--muted); }
.tab .n.hot { background: var(--btn); color: #fff; }
.tabs .ink { position: absolute; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); transition: left .3s var(--ease), width .3s var(--ease); }
.admin-row .ava { --a: 52px; }
.admin-row .row-sub { margin-top: 1px; }

/* -------------------------------------------------------- overlays */
#layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
#layer > * { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: var(--overlay); animation: fadeIn .25s both; }
.backdrop.out { animation: fadeOut .22s both; }
@keyframes fadeOut { to { opacity: 0; } }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; overflow-y: auto; background: var(--bar); color: var(--text);
  border-radius: 20px 20px 0 0; padding: 8px 14px calc(16px + var(--safe-b)); animation: sheetIn .34s var(--ease) both;
  box-shadow: var(--float-shadow);
}
.sheet.out { animation: sheetOut .24s var(--ease) both; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--grab); margin: 0 auto 10px; }
.sheet h3 { margin: 4px 4px 4px; font-size: 18px; font-weight: 650; }
.sheet .sheet-text { margin: 0 4px 14px; color: var(--muted); font-size: 14.5px; }
.sheet .actions { display: grid; gap: 8px; margin-top: 12px; }
.menu-list { display: grid; margin: 4px -14px 0; }
.menu-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; font-size: 16px; text-align: left; transition: background .15s; }
.menu-item:active { background: var(--press); }
.menu-item .pe { --s: 24px; color: var(--muted); }
.menu-item.red { color: var(--red-text); }
.menu-item.red .pe { color: var(--red-text); }

/* popover menu for a message */
.pop-back { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .2s both; }
.pop-back.out { animation: fadeOut .18s both; }
.pop-clone { position: absolute; margin: 0 !important; animation: fadeIn .15s both; }
.pop-clone.out { animation: fadeOut .16s both; }
.pop-clone .bubble { max-width: none; transform: scale(1.02); transition: none; }
.popover {
  position: absolute; min-width: 196px; padding: 6px 0; border-radius: 14px; background: var(--float-bg); color: var(--text);
  box-shadow: var(--float-shadow); animation: popIn .22s var(--spring) both; transform-origin: var(--o, 50% 0);
}
.popover.out { animation: popOut .16s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.82); } }
@keyframes popOut { to { opacity: 0; transform: scale(.9); } }
.popover .menu-item { padding: 10px 16px; font-size: 15.5px; gap: 12px; width: 100%; }
.popover .menu-item .pe { --s: 22px; }

/* user card */
.ucard { text-align: center; padding: 6px 4px 4px; }
.ucard .ava { --a: 84px; margin: 0 auto 10px; }
.ucard h3 { margin: 0; }
.ucard .u-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.ucard .u-sub button { color: var(--accent); }
.kv { display: grid; margin: 14px 0 0; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px solid var(--line); text-align: left; }
.kv > div { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv .pe { --s: 22px; color: var(--accent); }
.kv .k { flex: 1; color: var(--muted); font-size: 14.5px; }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.ucard .quote { margin-top: 12px; text-align: left; }

/* photo preview before sending */
.pick-img { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 14px; background: var(--photo-bg); margin: 4px 0 12px; }

/* viewer */
.viewer { position: absolute; inset: 0; background: rgba(0, 0, 0, .94); display: grid; place-items: center; animation: fadeIn .25s both; }
.viewer.out { animation: fadeOut .22s both; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; animation: zoomIn .3s var(--ease) both; touch-action: pinch-zoom; }
@keyframes zoomIn { from { transform: scale(.85); opacity: 0; } }
.viewer .icon-btn { position: absolute; top: 12px; right: 12px; color: #fff; background: rgba(255, 255, 255, .1); }

/* toast */
.toast {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: calc(100% - 28px); width: max-content;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; font-size: 14.5px;
  background: var(--float-bg); color: var(--text); border: 1px solid var(--line); box-shadow: var(--float-shadow);
  animation: toastIn .35s var(--spring) both; pointer-events: none !important;
}
.toast.out { animation: toastOut .25s var(--ease) both; }
.toast .pe { --s: 24px; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -20px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -12px); } }

/* full screen states: banned, error */
.state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 26px; animation: fadeUp .5s var(--ease) both; }
.state .pe { --s: 110px; margin-bottom: 14px; }
.state h2 { margin: 0 0 8px; font-size: 21px; }
.state p { margin: 0 0 16px; color: var(--muted); max-width: 320px; }
.state .quote { max-width: 340px; width: 100%; text-align: left; margin-bottom: 12px; }
.state code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; padding: 2px 7px; border-radius: 6px; background: var(--card-2); }

/* ----------------------------------------------------------- e-mail */
.hero-chips { position: relative; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip.mail-chip { max-width: 100%; min-width: 0; }
.chip .em { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .tag { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); padding: 1px 7px; border-radius: 9px; background: var(--hover); }
.chip.attn { background: var(--accent-soft); color: var(--accent); }
.chip.attn svg { color: var(--accent); }

.mail-hero { position: relative; height: 190px; display: grid; place-items: center; margin-top: 2px; }
.mail-hero::before {
  content: ""; position: absolute; inset: -40px -20px 0; pointer-events: none;
  background: radial-gradient(42% 55% at 50% 48%, var(--glow-1), transparent 72%),
              radial-gradient(30% 40% at 75% 20%, var(--glow-2), transparent 70%);
  animation: aurora 14s ease-in-out infinite alternate;
}
.plane-box { position: relative; width: 240px; height: 200px; flex: none; }
.plane-box svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plane-ph { width: 240px; }
.plane-fly { position: fixed; z-index: 70; pointer-events: none !important; }
.plane-box polygon { stroke-width: .7; stroke-linejoin: round; }
.plane-box svg { filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .28)); }
:root[data-theme="light"] .plane-box svg { filter: drop-shadow(0 8px 18px rgba(25, 60, 110, .2)); }
.plane-box .paper { transform-box: view-box; transform-origin: 120px 100px; }
.plane-box.idle .paper { animation: paperFloat 4.2s ease-in-out infinite; }
@keyframes paperFloat { 50% { transform: translateY(-6px) rotate(-1.6deg); } }
.plane-box .paper-shadow { transform-box: view-box; transform-origin: 120px 178px; transition: opacity .35s; }
.plane-box.idle .paper-shadow { animation: shadowFloat 4.2s ease-in-out infinite; }
.plane-box.flying .paper-shadow { opacity: 0; }
@keyframes shadowFloat { 50% { transform: scale(.86); opacity: .65; } }
.plane-box .hover { transform-box: view-box; transform-origin: 120px 104px; }
.plane-box.hovering .hover { animation: planeHover 1.3s ease-in-out infinite; }
@keyframes planeHover { 50% { transform: translate(2px, -6px) rotate(-3deg); } }
.plane-deco { transition: opacity .16s; }
.plane-box.folding .plane-deco { opacity: 0; }
.plane-box .stamp { fill: rgba(90, 167, 255, .16); stroke: #5aa7ff; stroke-width: 1.2; stroke-dasharray: 2 1.6; }
.plane-box .stamp-in { fill: #5aa7ff; opacity: .75; }
.plane-box .p-to { font: 600 6.5px -apple-system, "Segoe UI", Roboto, sans-serif; fill: #9aa6b3; letter-spacing: .02em; }
.plane-box .p-email { font: 600 7.6px -apple-system, "Segoe UI", Roboto, sans-serif; fill: #2b5fae; }
.plane-box .p-lines { stroke: #e3e9f0; stroke-width: 3.2; stroke-linecap: round; fill: none; }
.plane-box .p-sign { stroke: #b9c6d6; stroke-width: 1.5; stroke-linecap: round; fill: none; }
.plane-box .trail { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0 7.5; transition: opacity .45s; }

.mail-body { padding: 0 18px 22px; text-align: center; }
.scroll.mail-done { display: flex; flex-direction: column; justify-content: center; padding-bottom: 48px; }
.mail-body h2 { margin: 4px 0 8px; font-size: 23px; font-weight: 700; letter-spacing: -.01em; }
.mail-body .lead { margin: 0 auto 20px; max-width: 350px; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.mail-body .lead .em { color: var(--text); font-weight: 600; word-break: break-all; }
.mail-body .field, .mail-body .quote { text-align: left; }
.mail-body .quote { margin-top: 12px; font-size: 14px; }
.mail-body .quote .pe { --s: 18px; }
.stage-in { animation: stageIn .42s var(--ease) both; }
.stage-back { animation: stageBack .42s var(--ease) both; }
@keyframes stageIn { from { opacity: 0; transform: translateX(28px); } }
@keyframes stageBack { from { opacity: 0; transform: translateX(-28px); } }
.bottom-bar .skip { margin-top: 6px; height: 42px; font-weight: 600; }
.link-btn { color: var(--accent); font-weight: 600; padding: 2px 0; }
.link-btn:active { opacity: .6; }

.mail-field { position: relative; }
.mail-field .input { padding-left: 46px; padding-right: 46px; }
.mail-at { position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; margin-top: -11px; color: var(--muted); transition: color .2s; pointer-events: none; }
.mail-at svg { width: 22px; height: 22px; display: block; }
.mail-field:focus-within .mail-at { color: var(--accent); }
.mail-ok {
  position: absolute; right: 12px; top: 50%; width: 24px; height: 24px; margin-top: -12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--green); color: #fff; transform: scale(0); transition: transform .35s var(--spring);
  pointer-events: none;
}
.mail-ok svg { width: 15px; height: 15px; stroke-width: 3.2; }
.mail-field.valid .mail-ok { transform: scale(1); }
.mail-field.valid .input { border-color: rgba(63, 207, 110, .55); }
.mail-field.valid .input:focus { box-shadow: 0 0 0 4px rgba(63, 207, 110, .14); }
.mail-field.invalid .input { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.mail-field.invalid .mail-at { color: var(--red-text); }
.mail-field.shake { animation: shake .45s; }
.mail-msg { min-height: 22px; margin-top: 6px; padding: 0 4px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; text-align: left; }
.mail-msg[data-kind="err"] { color: var(--red-text); animation: fadeUp .25s var(--ease) both; }
.mail-msg[data-kind="err"] .pe { --s: 18px; }
.mail-msg.center { justify-content: center; text-align: center; }
.mail-fix {
  display: inline-flex; align-items: center; gap: 0; padding: 4px 11px; border-radius: 14px; font-size: 13.5px; white-space: pre;
  background: var(--accent-soft); color: var(--accent); animation: pop .35s var(--spring) both;
}
.mail-fix b { font-weight: 700; }

.mail-letter .pe { --s: 96px; animation: letterIn .6s var(--spring) both; }
.mail-letter.bump .pe { animation: letterBump .55s var(--spring); }
@keyframes letterIn { from { transform: translateY(26px) scale(.4); opacity: 0; } }
@keyframes letterBump { 40% { transform: translateY(-10px) scale(1.08); } }

.otp { position: relative; display: flex; justify-content: center; gap: 10px; margin: 4px auto 6px; width: max-content; cursor: text; }
.otp-cell {
  --i: 0; position: relative; width: 58px; height: 66px; border-radius: 16px; display: grid; place-items: center;
  background: var(--field); border: 1.5px solid var(--line); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: border-color .2s, background .25s, box-shadow .2s, color .2s; transition-delay: calc(var(--i) * 60ms);
}
.otp-cell.active { border-color: var(--accent); background: var(--field-focus); box-shadow: 0 0 0 4px var(--accent-soft); transition-delay: 0s; }
.otp-cell .caret { position: absolute; width: 2px; height: 30px; border-radius: 1px; background: var(--accent); opacity: 0; }
.otp-cell.active .caret { animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
.otp-cell.pop span { animation: digitIn .32s var(--spring) both; }
@keyframes digitIn { from { transform: translateY(10px) scale(.5); opacity: 0; } }
.otp.checking .otp-cell { animation: otpWave .9s ease-in-out infinite; animation-delay: calc(var(--i) * 110ms); border-color: var(--accent); }
@keyframes otpWave { 30% { transform: translateY(-6px); } 60% { transform: none; } }
.otp.ok .otp-cell { border-color: var(--green); background: rgba(63, 207, 110, .13); color: var(--green); animation: okPop .4s var(--spring) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes okPop { 50% { transform: scale(1.1); } }
.otp.err { animation: shake .45s; }
.otp.err .otp-cell { border-color: var(--red); background: var(--red-soft); color: var(--red-text); transition-delay: 0s; }
.otp-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; outline: none; background: transparent;
  color: transparent; caret-color: transparent; font-size: 16px; padding: 0;
}
.otp-input::selection { background: transparent; }
.resend { margin-top: 10px; min-height: 24px; font-size: 14.5px; color: var(--muted); display: flex; justify-content: center; align-items: center; }
.resend b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 4px; }
.mail-body .spam { margin-top: 18px; animation: fadeUp .5s var(--ease) both; }

.done-mark { position: relative; width: 132px; height: 132px; }
.done-mark svg { width: 132px; height: 132px; overflow: visible; display: block; }
.done-mark .bg { fill: rgba(63, 207, 110, .13); transform-box: fill-box; transform-origin: center; animation: pop .55s var(--spring) both; }
.done-mark .ring { fill: none; stroke: var(--green); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327;
  transform-box: fill-box; transform-origin: center; transform: rotate(-90deg); animation: draw .65s .1s var(--ease) forwards; }
.done-mark .tick { fill: none; stroke: var(--green); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 72; stroke-dashoffset: 72; animation: draw .4s .55s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.confetti i {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 11px; border-radius: 2px; background: var(--c); opacity: 0;
  animation: confetti 1.1s calc(.5s + var(--d)) cubic-bezier(.15, .7, .3, 1) both;
}
@keyframes confetti {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0) scale(.6); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--r)) scale(1); }
}

.mail-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.mail-card .pe { --s: 32px; }
.mc-text { min-width: 0; text-align: left; }
.mc-text .em { font-weight: 600; font-size: 15.5px; word-break: break-all; }
.mc-ok { display: flex; align-items: center; gap: 3px; margin-top: 1px; font-size: 13px; color: var(--green); }
.mc-ok svg { width: 15px; height: 15px; }
.switch-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 4px 4px; text-align: left; }
.sr-text { flex: 1; min-width: 0; }
.sr-title { font-size: 15.5px; font-weight: 600; }
.sr-sub { margin-top: 1px; font-size: 13px; color: var(--muted); }
.switch { position: relative; flex: none; width: 50px; height: 30px; border-radius: 15px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); transition: background .25s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .32s var(--spring);
}
.switch.on { background: var(--green); box-shadow: none; }
.switch.on::after { transform: translateX(20px); }
.kv .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 640px) {
  #app { max-width: 640px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
