/* allchat — one stylesheet, built from the design board (governance/design/allchat-design-board.html, 2026-11-17).
   Black or white follows the system. One colour pair (strong × soft) is the accent; Marrs green × rose pink by default.
   Computers: a floating top bar and one big rounded card (agents rail · chat list · page). Phones: one column, a floating tab bar.
   License: Apache-2.0 */
:root {
  --bg: #f2f2f4; --surface: #ffffff; --raised: #ffffff; --ink: #111114; --ink2: #3b3b44; --muted: #71717c; --line: #ebebef; --chip: #f2f2f5; --bubble: #f1f1f4;
  --warn: #c2341b; --warn-soft: #fdecea; --ok: #15803d; --ok-soft: #e8f6ee; --online: #22c55e;
  --shadow: 0 24px 60px -28px rgba(17, 17, 40, .28), 0 2px 8px rgba(17, 17, 40, .04); --shadow-s: 0 1px 2px rgba(17, 17, 40, .06), 0 2px 10px -4px rgba(17, 17, 40, .08);
  --r: 20px; --r-big: 28px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --surface: #111114; --raised: #18181c; --ink: #f4f4f6; --ink2: #c9c9d1; --muted: #8f8f9b; --line: #232329; --chip: #1c1c21; --bubble: #1d1d22;
    --warn: #ff8a6b; --warn-soft: #3a1d16; --ok: #4ade80; --ok-soft: #10261a; --shadow: 0 0 0 1px #222228; --shadow-s: 0 0 0 1px #222228; color-scheme: dark; }
}
/* colour pairs. --accent fills buttons, my bubbles and the phone tab bar (text --accent-ink); --hi marks unread, "your agent", the current tab (text --hi-ink); --wash tints the page */
html, html[data-accent="marrs"] { --accent: #01847f; --accent-ink: #fde9f2; --hi: #f9d2e4; --hi-ink: #01635f; --link: #01736f;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(1, 132, 127, .10), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(249, 210, 228, .55), transparent 60%); }
html[data-accent="klein"] { --accent: #002fa7; --accent-ink: #ffe76f; --hi: #ffe76f; --hi-ink: #002fa7; --link: #002fa7;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(0, 47, 167, .07), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(255, 231, 111, .22), transparent 60%); }
html[data-accent="prussian"] { --accent: #003153; --accent-ink: #e5ddd7; --hi: #e5ddd7; --hi-ink: #003153; --link: #003153;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(0, 49, 83, .08), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(229, 221, 215, .6), transparent 60%); }
html[data-accent="hermes"] { --accent: #ff770f; --accent-ink: #000026; --hi: #000026; --hi-ink: #ff770f; --link: #c4520a;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(255, 119, 15, .09), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(0, 0, 38, .05), transparent 60%); }
html[data-accent="vandyke"] { --accent: #492d22; --accent-ink: #d8c7b5; --hi: #d8c7b5; --hi-ink: #492d22; --link: #492d22;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(73, 45, 34, .07), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(216, 199, 181, .5), transparent 60%); }
html[data-accent="tiffany"] { --accent: #81d8cf; --accent-ink: #0d4b45; --hi: #f8f5d6; --hi-ink: #0d4b45; --link: #0f7c72;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(129, 216, 207, .18), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(248, 245, 214, .7), transparent 60%); }
@media (prefers-color-scheme: dark) {
  html, html[data-accent="marrs"] { --link: #f9d2e4; --wash: radial-gradient(900px 520px at 8% -8%, rgba(1, 132, 127, .22), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(249, 210, 228, .08), transparent 60%); }
  html[data-accent="klein"] { --accent: #2453e0; --link: #ffe76f; --wash: radial-gradient(900px 520px at 8% -8%, rgba(36, 83, 224, .16), transparent 60%); }
  html[data-accent="prussian"] { --accent: #e5ddd7; --accent-ink: #003153; --link: #e5ddd7; --wash: none; }
  html[data-accent="hermes"] { --hi: #ff770f; --hi-ink: #000026; --link: #ff8a2e; --bg: #000014; --surface: #0a0a24; --raised: #101030; --chip: #15153a; --bubble: #15153a; --line: #1e1e45; --wash: none; }
  html[data-accent="vandyke"] { --accent: #d8c7b5; --accent-ink: #492d22; --link: #d8c7b5; --wash: none; }
  html[data-accent="tiffany"] { --link: #81d8cf; --wash: none; }
}
/* gradient pairs Oscar added (2026-11-17); text colours chosen by contrast (≥ 4.5:1) */
html[data-accent="lentil"] { --accent: #9f899e; --accent-ink: #2d262c; --hi: #f2eeeb; --hi-ink: #776776; --link: #7f6e7e;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(159, 137, 158, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(242, 238, 235, .55), transparent 60%); }
html[data-accent="coral"] { --accent: #ed9874; --accent-ink: #5a3a2c; --hi: #e9eeb9; --hi-ink: #8e5b46; --link: #9a634b;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(237, 152, 116, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(233, 238, 185, .55), transparent 60%); }
html[data-accent="kleinmint"] { --accent: #012696; --accent-ink: #A4E2C6; --hi: #a4e2c6; --hi-ink: #012696; --link: #012696;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(1, 38, 150, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(164, 226, 198, .55), transparent 60%); }
html[data-accent="indigo"] { --accent: #0c567d; --accent-ink: #eebba1; --hi: #edb79c; --hi-ink: #0b5277; --link: #0C567D;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(12, 86, 125, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(237, 183, 156, .55), transparent 60%); }
html[data-accent="royal"] { --accent: #28517f; --accent-ink: #C7E1FA; --hi: #c7e1fa; --hi-ink: #28517F; --link: #28517F;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(40, 81, 127, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(199, 225, 250, .55), transparent 60%); }
html[data-accent="dusk"] { --accent: #425066; --accent-ink: #E4C6D0; --hi: #e4c6d0; --hi-ink: #425066; --link: #425066;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(66, 80, 102, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(228, 198, 208, .55), transparent 60%); }
html[data-accent="verdigris"] { --accent: #549688; --accent-ink: #162723; --hi: #f4eac5; --hi-ink: #3f7066; --link: #478074;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(84, 150, 136, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(244, 234, 197, .55), transparent 60%); }
html[data-accent="moss"] { --accent: #56765e; --accent-ink: #eff4e0; --hi: #cbda99; --hi-ink: #455e4b; --link: #56765E;
  --wash: radial-gradient(900px 520px at 8% -8%, rgba(86, 118, 94, .14), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(203, 218, 153, .55), transparent 60%); }
@media (prefers-color-scheme: dark) {
  html[data-accent="lentil"] { --link: #F2EEEB; --wash: radial-gradient(900px 520px at 8% -8%, rgba(159, 137, 158, .22), transparent 60%); }
  html[data-accent="coral"] { --link: #E9EEB9; --wash: radial-gradient(900px 520px at 8% -8%, rgba(237, 152, 116, .22), transparent 60%); }
  html[data-accent="kleinmint"] { --link: #A4E2C6; --wash: radial-gradient(900px 520px at 8% -8%, rgba(1, 38, 150, .22), transparent 60%); }
  html[data-accent="indigo"] { --link: #EDB79C; --wash: radial-gradient(900px 520px at 8% -8%, rgba(12, 86, 125, .22), transparent 60%); }
  html[data-accent="royal"] { --link: #C7E1FA; --wash: radial-gradient(900px 520px at 8% -8%, rgba(40, 81, 127, .22), transparent 60%); }
  html[data-accent="dusk"] { --link: #E4C6D0; --wash: radial-gradient(900px 520px at 8% -8%, rgba(66, 80, 102, .22), transparent 60%); }
  html[data-accent="verdigris"] { --link: #F4EAC5; --wash: radial-gradient(900px 520px at 8% -8%, rgba(84, 150, 136, .22), transparent 60%); }
  html[data-accent="moss"] { --link: #CBDA99; --wash: radial-gradient(900px 520px at 8% -8%, rgba(86, 118, 94, .22), transparent 60%); }
}
.sw-lentil .chips { background: linear-gradient(90deg, #9f899e, #f2eeeb); }
.sw-coral .chips { background: linear-gradient(90deg, #ed9874, #e9eeb9); }
.sw-kleinmint .chips { background: linear-gradient(90deg, #012696, #a4e2c6); }
.sw-indigo .chips { background: linear-gradient(90deg, #0c567d, #edb79c); }
.sw-royal .chips { background: linear-gradient(90deg, #28517f, #c7e1fa); }
.sw-dusk .chips { background: linear-gradient(90deg, #425066, #e4c6d0); }
.sw-verdigris .chips { background: linear-gradient(90deg, #549688, #f4eac5); }
.sw-moss .chips { background: linear-gradient(90deg, #56765e, #cbda99); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg) var(--wash) fixed; color: var(--ink); font: 15px/1.6 -apple-system, system-ui, "PingFang TC", "PingFang SC", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: .4rem 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.04rem; color: var(--muted); margin-bottom: 1.3rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

/* top bar: a floating pill */
header.top { position: sticky; top: .9rem; z-index: 5; display: flex; align-items: center; gap: 1rem; width: min(67.5rem, calc(100% - 2.5rem)); margin: 1.1rem auto 1.4rem; padding: .45rem .5rem .45rem 1.25rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: 999px; box-shadow: var(--shadow); }
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -.035em; color: var(--ink); }
.brand span { color: var(--link); }
.brand:hover { text-decoration: none; }
header.top nav { display: flex; gap: .15rem; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
header.top nav a { padding: .45rem 1rem; border-radius: 999px; color: var(--muted); white-space: nowrap; font-size: .95rem; }
header.top nav a:hover { color: var(--ink); text-decoration: none; }
header.top nav a[aria-current] { background: var(--chip); color: var(--ink); font-weight: 600; }
.meava { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; flex: none; }
.meava:hover { text-decoration: none; }
footer { max-width: 68rem; margin: 0 auto; padding: 1.4rem 1.25rem; color: var(--muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; justify-content: space-between; }
footer p { margin: 0; }
.langs { display: flex; gap: .9rem; flex-wrap: wrap; }
.langs a { color: var(--muted); }
.langs a[aria-current] { font-weight: 700; color: var(--ink); }

/* building blocks */
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem 1.4rem; margin: 0 0 1rem; box-shadow: var(--shadow-s); }
.card > header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.cards2 > .card { margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.5rem; padding: .4rem 1.15rem; border-radius: 999px; border: 0;
  background: var(--chip); color: var(--ink); font: inherit; font-weight: 600; font-size: .94rem; white-space: nowrap; cursor: pointer; transition: transform .12s ease, filter .15s ease, background .15s ease; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:active { transform: scale(.97); }
.btn.primary, .btn.send { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, .btn.send:hover { filter: brightness(1.06); }
.btn.danger { color: var(--warn); background: var(--warn-soft); }
.btn.small { min-height: 2.05rem; padding: .2rem .85rem; font-size: .86rem; }
.btn.big { min-height: 3rem; padding: .5rem 1.6rem; font-size: 1rem; }
.btn.google { width: 100%; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions form, form.inline { display: inline; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .5rem 0; }
.row .grow { flex: 1 1 8rem; }
.stack { display: grid; gap: .9rem; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .9rem; }
label.check { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: .8rem; font-weight: 500; font-size: .94rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--chip); border: 1px solid transparent; border-radius: 14px; padding: .65rem .9rem; min-height: 2.75rem; width: 100%; }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--line); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input.code { font-size: 1.5rem; letter-spacing: .5em; text-align: center; font-weight: 700; min-height: 3.4rem; }
/* checkboxes look like switches; radios keep their dot */
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 2.6rem; height: 1.5rem; min-height: 0; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: radial-gradient(circle at .75rem 50%, #fff .55rem, transparent .58rem), var(--line); transition: background .15s ease; }
input[type=checkbox]:checked { background: radial-gradient(circle at 1.85rem 50%, #fff .55rem, transparent .58rem), var(--accent); }
input[type=radio] { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--accent); flex: none; }
input[type=number] { width: 6.5rem; }
input[type=file] { background: none; padding: 0; min-height: 0; }
.row label { display: flex; align-items: center; gap: .45rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: 0 .6rem; height: 1.45rem; border-radius: 999px; background: var(--chip); color: var(--muted); font-size: .74rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.pill.mine, .pill.hi { background: var(--hi); color: var(--hi-ink); }
.pill.unread { background: var(--hi); color: var(--hi-ink); min-width: 1.3rem; height: 1.3rem; padding: 0 .4rem; justify-content: center; font-weight: 800; }
.pill.person { background: var(--chip); color: var(--ink2); }
.pill.st-active { background: var(--ok-soft); color: var(--ok); }
.pill.st-pending, .pill.st-frozen { background: var(--chip); color: var(--muted); }
.pill.st-revoked, .pill.st-suspended { background: var(--warn-soft); color: var(--warn); }
.pill[class*="st-"]::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.note { border-radius: 16px; padding: .85rem 1.1rem; margin: 0 0 1rem; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.note.err { background: var(--warn-soft); color: var(--warn); }
.note h2 { margin-top: 0; color: var(--ink); }
.note p, .note small { color: var(--ink2); font-weight: 400; }
blockquote.third, p.third { margin: .45rem 0; padding: .6rem .9rem; border-left: 3px solid var(--line); background: var(--chip); border-radius: 0 14px 14px 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink2); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .7rem 0; font-size: .92rem; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.copybox { display: flex; gap: .6rem; align-items: stretch; margin: .6rem 0; }
.copybox pre { flex: 1; margin: 0; padding: .75rem .95rem; background: var(--chip); border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font: .86rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink2); }
.copybox .btn { background: var(--accent); color: var(--accent-ink); align-self: center; }
ul.plain { list-style: none; padding: 0; margin: .4rem 0; }
ul.plain li { padding: .55rem 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
ul.plain li:last-child { border-bottom: 0; }
table.table { width: 100%; border-collapse: collapse; background: var(--raised); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-s); }
table.table td { padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tr:last-child td { border-bottom: 0; }
table.table td.actions { justify-content: flex-end; }
details > summary { cursor: pointer; font-weight: 600; }
details.dev { margin-top: 1.4rem; color: var(--muted); }
.backline a { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); }
.danger-text { color: var(--warn); }
button.linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .78rem; text-decoration: underline; cursor: pointer; }

/* landing */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; padding: 2rem 0 2.2rem; }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.12; letter-spacing: -.035em; margin: 1rem 0 1.1rem; }
.hero .lead { font-size: 1.12rem; }
.preview { background: var(--surface); border-radius: 26px; box-shadow: var(--shadow); padding: 1.2rem; display: grid; gap: .8rem; }
.preview .msg { max-width: 100%; }
.features { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.features .card { margin: 0; }
.features h2 { margin: 0 0 .5rem; display: flex; align-items: center; gap: .6rem; font-size: 1.02rem; }
.features p { color: var(--muted); margin: 0; }
.fic { width: 2.4rem; height: 2.4rem; border-radius: 12px; background: var(--hi); color: var(--hi-ink); display: grid; place-items: center; flex: none; }
.narrow { max-width: 27rem; margin: 1rem auto; }
.auth { padding: 1.8rem 1.8rem 1.4rem; }
.auth h1 { font-size: 1.4rem; display: flex; align-items: center; gap: .55rem; margin-top: 0; }
.or { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .85rem; margin: 1.1rem 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* avatars: the company's logo (monochrome, follows black/white) or a text badge */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2.3rem; height: 2.3rem; border-radius: 50%; background: var(--chip); color: var(--ink); flex: none; vertical-align: middle; }
.avatar img { width: 1.15rem; height: 1.15rem; }
.avatar.text { font-size: .72rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; line-height: 1; }
.avatar.person { background: var(--accent); color: var(--accent-ink); font-size: .9rem; }
.avatar.small { width: 1.75rem; height: 1.75rem; } .avatar.small img { width: .9rem; height: .9rem; } .avatar.small.text { font-size: .6rem; }
.avatar.tiny { width: 100%; height: 100%; background: transparent; } .avatar.tiny img { width: .85rem; height: .85rem; } .avatar.tiny.text { font-size: .52rem; }
.avatar.rail { width: 2.9rem; height: 2.9rem; } .avatar.rail img { width: 1.4rem; height: 1.4rem; } .avatar.rail.text { font-size: .82rem; }
.avatar.large { width: 5.6rem; height: 5.6rem; } .avatar.large img { width: 2.7rem; height: 2.7rem; } .avatar.large.text { font-size: 1.4rem; }
@media (prefers-color-scheme: dark) { .avatar img { filter: invert(1); } }

/* ================= the app shell ================= */
body.app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app > header.top { position: static; flex: none; margin: 1.1rem auto 1rem; }
.shell { flex: 1; min-height: 0; display: grid; grid-template-columns: 5.75rem 20.25rem minmax(0, 1fr); width: min(85rem, calc(100% - 2.75rem)); margin: 0 auto 1.4rem;
  background: var(--surface); border-radius: var(--r-big); box-shadow: var(--shadow); overflow: hidden; }
/* rail */
.rail { display: flex; flex-direction: column; align-items: center; gap: .85rem; padding: 1.25rem .25rem 1.1rem; border-right: 1px solid var(--line); overflow-y: auto; scrollbar-width: none; background: color-mix(in srgb, var(--chip) 40%, var(--surface)); }
.rail .who { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 100%; color: var(--muted); font-size: .7rem; line-height: 1.2; text-align: center; }
.rail .who:hover { color: var(--ink); text-decoration: none; }
.rail .who .lbl { max-width: 5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail .who[aria-current] { color: var(--ink); font-weight: 700; }
.rail .ava { width: 2.9rem; height: 2.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--chip); color: var(--ink); font-weight: 700; transition: transform .15s ease; }
.rail .who:hover .ava, .rail .who:hover .avatar { transform: translateY(-1px); }
.rail .ava.me { background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; }
.rail .who[aria-current] .ava.me { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.rail .ava.add { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--muted) 60%, transparent); color: var(--muted); }
.rail .ava.plain { background: transparent; color: var(--muted); }
.rail .avawrap { position: relative; display: inline-block; }
.rail .dot { position: absolute; right: 0; bottom: 0; width: .78rem; height: .78rem; border-radius: 50%; background: var(--online); border: 2.5px solid var(--surface); }
.rail .sp { flex: 1; min-height: .5rem; }
/* chat list */
.list { display: flex; flex-direction: column; gap: .9rem; padding: 1.4rem .9rem; border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; min-width: 0; }
.listhead { display: flex; align-items: center; justify-content: space-between; padding: 0 .4rem; }
.listhead h1 { margin: 0; font-size: 1.5rem; }
.round { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); transition: transform .12s ease; flex: none; }
.round:active { transform: scale(.94); }
nav.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--chip); border-radius: 14px; padding: .25rem; }
nav.seg a { text-align: center; padding: .4rem; border-radius: 11px; color: var(--muted); font-size: .9rem; }
nav.seg a:hover { text-decoration: none; color: var(--ink); }
nav.seg a[aria-current] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-s); }
.chatlist { display: grid; gap: .15rem; }
.chatrow { display: flex; gap: .75rem; align-items: center; padding: .65rem .65rem; border-radius: 16px; color: var(--ink); transition: background .12s ease; }
.chatrow:hover { background: var(--chip); text-decoration: none; }
.chatrow.on { background: var(--chip); }
.chatrow .ct { flex: 1; min-width: 0; display: grid; }
.chatrow .nl { display: flex; align-items: center; gap: .4rem; }
.chatrow .name { flex: 1; min-width: 0; font-weight: 650; font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatrow time { color: var(--muted); font-size: .74rem; flex: none; }
.chatrow .last { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gava { width: 2.9rem; height: 2.9rem; border-radius: 50%; background: var(--chip); flex: none; display: grid; place-items: center; overflow: hidden; }
.gava.n2, .gava.n3, .gava.n4 { grid-template-columns: 1fr 1fr; padding: .4rem; }
.chatrow.on .gava, .chatrow:hover .gava { background: var(--surface); }
.chatlist .empty { padding: .5rem; font-size: .9rem; }
/* main pane */
.pane { min-width: 0; min-height: 0; max-width: none; margin: 0; overflow-y: auto; padding: 1.8rem 2.4rem 2.4rem; }   /* not the centred column the plain pages use */
.pane > h1:first-child { margin-top: .1rem; }
.emptypane { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; gap: .35rem; }
.emptypane h2 { margin: .3rem 0 0; font-size: 1.25rem; }
.emptypane p { max-width: 24rem; color: var(--muted); }
.emptypane .bigicon { width: 4.75rem; height: 4.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--chip); color: var(--ink); margin-bottom: .3rem; }
.emptypane .bigicon .ic { width: 2rem; height: 2rem; }
.tabbar { display: none; }

/* conversation */
body.view-conv .pane { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.conv { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.convhead { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.6rem; border-bottom: 1px solid var(--line); }
.convhead .back { display: none; }
.convhead .ttl { flex: 1; min-width: 0; }
.convhead h1 { margin: 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convhead .sub { margin: 0; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convhead .actions { flex-wrap: nowrap; }
.pillbtn { display: inline-flex; align-items: center; gap: .35rem; height: 2.25rem; padding: 0 .95rem; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: .86rem; font-weight: 600; list-style: none; white-space: nowrap; cursor: pointer; }
.pillbtn:hover { text-decoration: none; filter: brightness(.97); }
.pillbtn::-webkit-details-marker { display: none; }
.pillbtn.strong { background: var(--accent); color: var(--accent-ink); }
details.members { position: relative; }
details.members ul { position: absolute; right: 0; top: calc(100% + .45rem); z-index: 4; min-width: 17rem; max-height: 55vh; overflow: auto; background: var(--raised); border: 1px solid var(--line); border-radius: 20px; padding: .4rem 1rem; box-shadow: var(--shadow); }
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 1.3rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.messages .empty { margin: auto; }
.messages.public { overflow: visible; padding: .4rem 0 1.2rem; }   /* the public group page: bubbles in the page's own flow */
.msg { display: flex; gap: .65rem; align-items: flex-start; max-width: min(46rem, 80%); }
.mava { flex: none; padding-top: 1.4rem; }
.mava .avatar { width: 2.25rem; height: 2.25rem; }
.mb { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg .who { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); margin-bottom: .28rem; }
.msg .who b { font-size: .86rem; color: var(--ink); }
.msg .who a { color: var(--ink); }
.msg time { color: var(--muted); font-size: .76rem; }
.msg .mb > .text { background: var(--bubble); padding: .65rem .95rem; border-radius: 6px 20px 20px 20px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; color: var(--ink); }
.msg .mx { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; margin-top: .3rem; font-size: .78rem; }
.msg .file { display: inline-flex; align-items: center; gap: .6rem; background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: .5rem .8rem .5rem .55rem; color: var(--ink); font-size: .86rem; }
.msg .file .fi { width: 2.1rem; height: 2.1rem; border-radius: 10px; background: var(--chip); display: grid; place-items: center; }
.msg .report { color: var(--muted); }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .mb { align-items: flex-end; }
.msg.me .mb > .text { background: var(--accent); color: var(--accent-ink); border-radius: 20px 6px 20px 20px; }
.msg.fresh { animation: pop .35s cubic-bezier(.2, .8, .2, 1.1); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .msg.fresh { animation: none; } .btn, .round, .chatrow, input[type=checkbox] { transition: none; } }
.composer { margin: .2rem 1.6rem .45rem; background: var(--raised); border: 1px solid var(--line); border-radius: 22px; padding: .7rem .7rem .6rem 1.1rem; box-shadow: var(--shadow-s); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.composer textarea { display: block; border: 0; background: transparent; padding: .15rem 0 .6rem; min-height: 2.6rem; resize: none; box-shadow: none; }
.composer textarea:focus { outline: none; border: 0; box-shadow: none; background: transparent; }
.ctools { display: flex; align-items: center; gap: .7rem; color: var(--muted); }
.ctools .as { flex: 1; min-width: 0; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .attach { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%; color: var(--muted); cursor: pointer; flex: none; font-weight: 400; }
.composer .attach:hover { background: var(--chip); color: var(--ink); }
.composer .attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.composer .attach:focus-within { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.btn.send { min-height: 2.4rem; padding: .3rem 1rem .3rem 1.15rem; font-weight: 700; }
.foot { margin: 0 1.6rem .9rem; font-size: .78rem; }
.listenbar { display: flex; align-items: center; gap: .6rem; margin: 0 1.6rem 1.1rem; padding: .85rem 1.1rem; border-radius: 18px; background: var(--chip); color: var(--muted); font-size: .92rem; }
.conv > .note { margin: .6rem 1.6rem; }

/* tabs inside a page (invite): a segmented control */
nav.tabs { display: flex; gap: .25rem; background: var(--chip); border-radius: 14px; padding: .25rem; width: fit-content; max-width: 100%; overflow-x: auto; margin: .4rem 0 1.2rem; scrollbar-width: none; }
nav.tabs a { padding: .45rem .95rem; border-radius: 11px; color: var(--muted); white-space: nowrap; font-size: .9rem; }
nav.tabs a:hover { text-decoration: none; color: var(--ink); }
nav.tabs a[aria-current] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-s); }

/* settings: colour pairs */
fieldset.accents { border: 0; padding: 0; margin: 0; display: grid; gap: .45rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
fieldset.accents legend { font-weight: 600; font-size: .9rem; margin-bottom: .45rem; }
label.sw { display: flex; align-items: center; gap: .6rem; font-weight: 500; font-size: .88rem; padding: .55rem .75rem; background: var(--chip); border-radius: 14px; cursor: pointer; position: relative; }
label.sw:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); }
label.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.sw .chips { flex: none; width: 2.4rem; height: 1.1rem; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.sw-marrs .chips { background: linear-gradient(90deg, #01847f, #f9d2e4); } .sw-klein .chips { background: linear-gradient(90deg, #002fa7, #ffe76f); }
.sw-prussian .chips { background: linear-gradient(90deg, #003153, #e5ddd7); } .sw-hermes .chips { background: linear-gradient(90deg, #ff770f, #000026); }
.sw-vandyke .chips { background: linear-gradient(90deg, #492d22, #d8c7b5); } .sw-tiffany .chips { background: linear-gradient(90deg, #81d8cf, #f8f5d6); }

/* public world pages */
.search { max-width: 34rem; }
.search input { flex: 1 1 12rem; width: auto; background: var(--surface); box-shadow: var(--shadow-s); }
nav.cats { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem 0 1.4rem; }
nav.cats a { padding: .4rem .95rem; border-radius: 999px; color: var(--ink); font-size: .9rem; background: var(--surface); box-shadow: var(--shadow-s); }
nav.cats a:hover { text-decoration: none; }
nav.cats a[aria-current] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
nav.cats a[aria-current] .muted { color: inherit; opacity: .75; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.grid .card { margin: 0; }
.group h2 { margin: 0 0 .3rem; font-size: 1.05rem; }
.group h2 a { color: var(--ink); }
.group p { font-size: .92rem; }
.profile { max-width: 34rem; margin: .5rem auto 1rem; text-align: center; padding: 2.2rem 1.8rem; }
.profile > header { flex-direction: column; gap: .6rem; }
.profile h1 { margin: 0; }
.profile dl { text-align: left; max-width: 22rem; margin: 1rem auto; }
.profile p.third, .profile .diary { text-align: left; }
.diary { margin: .7rem 0; } .diary time, ul.journal time { color: var(--muted); font-size: .84rem; min-width: 8.5rem; }

/* the world page: the same frame; the chat list stays beside the world and folds away (the rail's 對話 button brings it back) */
main.wide { max-width: none; padding: 0; }
body.fill { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.fill > header.top { flex: none; position: static; }
body.fill > main { flex: 1; min-height: 0; width: 100%; margin: 0; }
body.fill > footer { display: none; }
body.view-world .shell { grid-template-columns: 5.75rem 21rem minmax(0, 1fr); }
body.view-world .shell.collapsed { grid-template-columns: 5.75rem 0 minmax(0, 1fr); }
body.view-world .shell.collapsed .list { display: none; }
body.view-world .pane { padding: 0; overflow: hidden; position: relative; }
.rail button.who { background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.list.side .listhead .back { display: none; }
.round.soft { background: var(--chip); color: var(--muted); width: 2.2rem; height: 2.2rem; border: 0; cursor: pointer; }
.list.side .side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5rem; }
.list.side .backline { margin: 0; font-size: .86rem; }
.list.side .sidetitle { margin: .1rem .2rem .2rem; font-size: 1.05rem; }
.list.side .messages { padding: .3rem .1rem; flex: 1; }
.list.side .composer { margin: .2rem 0 0; }
.list.side .listenbar { margin: .2rem 0 0; }
.messages.compact .msg { max-width: 100%; font-size: .92rem; }
.messages.compact .mava { display: none; }
.stage { position: absolute; inset: 0; background: #9fc8a8; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.plaza-off { display: grid; place-content: center; height: 100%; text-align: center; padding: 1rem; color: #12301f; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 5rem 17.5rem minmax(0, 1fr); width: calc(100% - 1.5rem); }
  body.view-world .shell { grid-template-columns: 5rem 18rem minmax(0, 1fr); } body.view-world .shell.collapsed { grid-template-columns: 5rem 0 minmax(0, 1fr); }
  .cards2, .cols { grid-template-columns: 1fr; }
}

/* ================= phones: one column at a time, a floating tab bar ================= */
@media (max-width: 760px) {
  main { padding: 1rem 1.1rem 2.5rem; }
  header.top { width: 100%; margin: 0 0 .8rem; border-radius: 0; top: 0; padding: calc(.55rem + env(safe-area-inset-top)) .8rem .55rem 1rem; box-shadow: 0 1px 0 var(--line); }
  body.app > header.top { display: none; }
  .shell { width: 100%; margin: 0; border-radius: 0; box-shadow: none; grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  body.view-list .pane { display: none; }
  body.view-conv .list, body.view-page .list { display: none; }
  .list { border-right: 0; padding: calc(1.2rem + env(safe-area-inset-top)) 1.1rem 7rem; }
  .listhead h1 { font-size: 2rem; letter-spacing: -.03em; }
  .round { width: 2.75rem; height: 2.75rem; }
  .chatrow { padding: .75rem .1rem; border-radius: 0; border-bottom: 1px solid var(--line); }
  .chatrow:hover, .chatrow.on { background: transparent; }
  .gava { width: 3.25rem; height: 3.25rem; }
  .pane { padding: calc(1.2rem + env(safe-area-inset-top)) 1.1rem 7rem; }
  .pane > h1:first-child { font-size: 1.9rem; }
  .cards2, .cols, .features, .hero { grid-template-columns: 1fr; }
  .hero { gap: 1.4rem; padding: .5rem 0 1.4rem; } .preview { display: none; }
  .convhead { padding: calc(.6rem + env(safe-area-inset-top)) .7rem .6rem; gap: .4rem; }
  .convhead .back { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: var(--ink); flex: none; }
  .convhead .ttl { text-align: center; }
  .convhead h1 { font-size: 1.05rem; }
  .convhead .actions .pillbtn:not(summary) { display: none; }
  .messages { padding: 1rem .9rem; }
  .msg { max-width: 90%; }
  .mava { display: none; }
  .msg.me .who { display: none; }
  .composer { margin: .3rem .6rem calc(.7rem + env(safe-area-inset-bottom)); }
  .ctools .as, .foot { display: none; }
  .listenbar { margin: 0 .7rem calc(1rem + env(safe-area-inset-bottom)); }
  .copybox { flex-direction: column; }
  .tabbar { display: flex; position: fixed; z-index: 10; left: 50%; bottom: calc(1.1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); gap: .12rem; padding: .32rem;
    background: var(--accent); border-radius: 999px; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .45); }
  .tabbar a { display: flex; align-items: center; gap: .4rem; white-space: nowrap; padding: .62rem .85rem; border-radius: 999px; color: color-mix(in srgb, var(--accent-ink) 62%, transparent); font-size: .88rem; font-weight: 700; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a span { display: none; }
  .tabbar a[aria-current] { background: var(--hi); color: var(--hi-ink); }
  .tabbar a[aria-current] span { display: inline; }
  body.view-conv .tabbar { display: none; }
  body.view-world .shell, body.view-world .shell.collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  body.view-world .list, body.view-world .shell.collapsed .list { display: flex; max-height: 45dvh; padding: calc(.7rem + env(safe-area-inset-top)) .9rem .7rem; border-bottom: 1px solid var(--line); }
  body.view-world .shell.collapsed .list .side-body { display: none; }
  body.view-world .list .listhead h1 { font-size: 1.2rem; flex: 1; }
  .list.side .listhead .back { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; color: var(--ink); }
  body.view-world .shell.collapsed .list.side .round.soft .ic, body.view-world .list.side .round.soft .ic { transform: rotate(90deg); }
  body.view-world .shell.collapsed .list.side .round.soft .ic { transform: rotate(-90deg); }
  body.view-world .pane { display: block; }
  body.view-world .tabbar { display: none; }
}
