@font-face { font-family: "Bricolage"; src: url(bg.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url(fig.woff2) format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #15172a; --rail: #10121f; --surface: #1e2138; --raised: #272b47; --line: #323757;
  --text: #f1f2fa; --text-2: #b9bdd6; --muted: #868baa;
  --accent: #98a4ff; --accent-ink: #12142a; --warm: #ffb994;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --seq-0: #252945; --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #b7d3f6;
  --good: #0ca30c; --critical: #e66767;
  --display: "Bricolage", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f0f7; --rail: #e6e5f0; --surface: #ffffff; --raised: #f4f4fa; --line: #dcdbe8;
  --text: #181a2e; --text-2: #474b66; --muted: #6d7190;
  --accent: #4551d1; --accent-ink: #ffffff; --warm: #b4532a;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --seq-0: #e9e8f2; --seq-1: #b7d3f6; --seq-2: #6da7ec; --seq-3: #3987e5; --seq-4: #1c5cab; --seq-5: #0d366b;
  --critical: #d03b3b;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 650; letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
h1 { font-size: 2.4rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1rem; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: .86rem; }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: .6rem 1.1rem; font-weight: 650; }
.btn.quiet { background: var(--raised); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.small { padding: .3rem .7rem; font-size: .86rem; }

/* ---------- import screen ---------- */
.landing { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.landing-copy { padding: clamp(2rem, 7vw, 6rem); display: flex; flex-direction: column; justify-content: center; gap: 1.4rem; }
.landing-copy h1 { font-size: clamp(2.6rem, 5.4vw, 4.6rem); font-weight: 700; letter-spacing: -0.035em; max-width: 12ch; }
.landing-copy p { color: var(--text-2); max-width: 46ch; margin: 0; font-size: 1.05rem; }
.landing-drop { background: var(--rail); display: grid; place-items: center; padding: 2rem; }
.drop { width: min(440px, 100%); border: 2px dashed var(--line); border-radius: 28px; padding: 2.6rem 2rem; text-align: center; background: var(--surface); transition: border-color .15s, transform .15s; }
.drop.over { border-color: var(--accent); transform: scale(1.015); }
.drop h2 { margin-bottom: .5rem; }
.drop p { color: var(--muted); margin: 0 0 1.4rem; }
.drop label.check { display: flex; gap: .6rem; align-items: flex-start; text-align: left; margin-top: 1.4rem; color: var(--text-2); font-size: .9rem; }
.bubbles { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-top: .6rem; }
.bubble { background: var(--surface); border-radius: 18px 18px 18px 6px; padding: .55rem .95rem; color: var(--text-2); font-size: .95rem; }
.bubble:nth-child(2) { margin-left: 2.2rem; } .bubble:nth-child(3) { margin-left: .8rem; }
.progress { width: 100%; height: 8px; border-radius: 99px; background: var(--raised); overflow: hidden; margin: 1.2rem 0 .7rem; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; width: 0; transition: width .2s; }
.error { color: var(--critical); margin-top: 1rem; }
@media (max-width: 820px) { .landing { grid-template-columns: 1fr; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.rail { background: var(--rail); padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: .2rem; overflow-y: auto; }
.me { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1.1rem; }
.me b { display: block; font-family: var(--display); font-size: 1.05rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { color: var(--muted); font-size: .85rem; }
.rail a.nav { display: flex; justify-content: space-between; align-items: baseline; padding: .5rem .75rem; border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.rail a.nav:hover { background: var(--surface); color: var(--text); }
.rail a.nav.on { background: var(--raised); color: var(--text); font-weight: 650; }
.rail a.nav small { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.rail .foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
main { overflow-y: auto; height: 100%; }
.page { padding: 2.2rem clamp(1.2rem, 3.5vw, 3rem) 4rem; max-width: 1180px; }
.page > header { margin-bottom: 1.8rem; }
.page > header p { color: var(--text-2); margin: .5rem 0 0; max-width: 70ch; }
section.block { margin-top: 2.4rem; }
section.block > h2 { margin-bottom: .3rem; }
section.block > p.sub { color: var(--muted); margin: 0 0 1rem; max-width: 72ch; }
.panel { background: var(--surface); border-radius: 18px; padding: 1.3rem 1.4rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 .rank { grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr) auto; }
.panel > h3 { margin-bottom: .9rem; }
.panel > h3 small { display: block; font: 400 .85rem var(--body); color: var(--muted); letter-spacing: 0; margin-top: .25rem; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; overflow-x: auto; padding: .5rem; align-items: center; }
  .rail .me span, .rail .foot, .rail a.nav small { display: none; } .me { padding: 0 .5rem 0 0; }
  .rail a.nav { white-space: nowrap; }
}

/* ---------- avatars ---------- */
.av { --s: 36px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  font: 650 calc(var(--s) * .42)/1 var(--display); color: #fff; position: relative; }
.av.sq { border-radius: 30%; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.6rem 1rem; }
.stat b { display: block; font: 650 2rem/1.05 var(--display); letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: .9rem; }
.hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.6rem; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); font-weight: 700; letter-spacing: -0.035em; }
.hero p { margin: .5rem 0 0; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.chip { background: var(--raised); border-radius: 99px; padding: .15rem .7rem; font-size: .84rem; color: var(--text-2); }

/* ---------- calendar heatmap ---------- */
.cal-year { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) 5.5rem; align-items: center; gap: .6rem; margin-bottom: .55rem; }
.cal-year > b { font-family: var(--display); font-size: 1rem; }
.cal-year > span { text-align: right; color: var(--muted); font-size: .86rem; font-variant-numeric: tabular-nums; }
.cal-year svg { width: 100%; height: auto; display: block; }
.cal-year rect { rx: 2.5px; }
.cal-year rect:hover { stroke: var(--text); stroke-width: 1.5px; }
.legend { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .84rem; margin-top: .9rem; }
.legend i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }

/* ---------- bars ---------- */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--line); position: relative; }
.bars .bar { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.bars .bar i { display: block; width: 100%; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 0; }
.bars .bar:hover i { filter: brightness(1.25); }
.bars .max { position: absolute; top: -2px; left: 0; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.axis { display: flex; gap: 2px; font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.axis span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.rank { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto; gap: .35rem .8rem; align-items: center; }
.rank.wide { grid-template-columns: minmax(0, 16rem) minmax(0, 1fr) auto; }
.rank .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .5rem; }
.rank .l a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; } .rank .l a:hover { text-decoration: underline; }
.rank .b { height: 10px; } .rank .b i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank .v { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: .9rem; }
.rank img.e { width: 22px; height: 22px; object-fit: contain; }
.hm { display: grid; grid-template-columns: 2.4rem repeat(24, minmax(0, 1fr)); gap: 2px; font-size: .76rem; color: var(--muted); }
.hm i { aspect-ratio: 1; border-radius: 3px; min-height: 10px; }
.hm span { align-self: center; } .hm span.h { text-align: center; }
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--text); color: var(--bg); padding: .3rem .6rem; border-radius: 8px; font-size: .84rem; font-weight: 500; white-space: nowrap; box-shadow: 0 6px 20px #0006; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: .45rem .8rem .45rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: default; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text); }
td { padding: .5rem .8rem .5rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); vertical-align: middle; max-width: 26rem; overflow: hidden; text-overflow: ellipsis; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.who { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.who div { min-width: 0; } .who b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { background: none; border: 1px solid var(--line); border-radius: 99px; padding: .25rem .85rem; color: var(--text-2); }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
input.search { width: 100%; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; }
input.search::placeholder { color: var(--muted); }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.4rem; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- messages ---------- */
.msgs { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: 100%; }
.chanlist { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: color-mix(in srgb, var(--rail) 50%, var(--bg)); }
.chanlist .top { padding: 1rem .8rem .6rem; display: flex; flex-direction: column; gap: .6rem; }
.chanlist .tabs { margin: 0; } .chanlist .tabs button { font-size: .84rem; padding: .15rem .65rem; }
.chanlist .list { overflow-y: auto; padding: 0 .4rem 1rem; flex: 1; }
.chan { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; border-radius: 10px; width: 100%; background: none; border: 0; text-align: left; }
.chan:hover { background: var(--surface); } .chan.on { background: var(--raised); }
.chan .t { min-width: 0; flex: 1; } .chan .t b { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan .t small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan .c { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread > header { padding: .9rem 1.4rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .8rem; }
.thread > header div { min-width: 0; flex: 1; } .thread > header h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread > header small { color: var(--muted); }
.scroll { overflow-y: auto; flex: 1; padding: 1rem 1.4rem 2rem; }
.day { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .82rem; font-weight: 600; margin: 1.3rem 0 .5rem; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.m { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: .2rem; padding: .12rem .4rem; border-radius: 8px; }
.m:hover { background: var(--surface); } .m.hit { background: color-mix(in srgb, var(--warm) 22%, transparent); }
.m time { white-space: nowrap; color: var(--muted); font-size: .76rem; padding-top: .22rem; font-variant-numeric: tabular-nums; }
.m .c { white-space: pre-wrap; overflow-wrap: anywhere; }
.m .c code { background: var(--raised); border-radius: 5px; padding: .05rem .3rem; font-size: .88em; }
.m .c pre { background: var(--raised); border-radius: 8px; padding: .6rem .8rem; overflow-x: auto; margin: .3rem 0; }
.m .c img.e { width: 1.4em; height: 1.4em; vertical-align: -0.3em; object-fit: contain; }
.m .c .mention { background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 4px; padding: 0 .2rem; }
.m .att { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.m .att img, .m .att video { max-width: min(360px, 100%); max-height: 300px; border-radius: 10px; display: block; background: var(--raised); }
.m .att a.file { background: var(--raised); border-radius: 8px; padding: .3rem .7rem; font-size: .88rem; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more { display: block; margin: .6rem auto; }
.empty { color: var(--muted); padding: 3rem 1rem; text-align: center; }
.result { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .7rem .2rem; }
.result:hover { background: var(--surface); } .result small { color: var(--muted); display: block; margin-bottom: .15rem; }
.result mark { background: color-mix(in srgb, var(--warm) 45%, transparent); color: inherit; border-radius: 3px; }
@media (max-width: 760px) { .msgs { grid-template-columns: 1fr; } .msgs.open .chanlist, .msgs:not(.open) .thread { display: none; } }

/* ---------- misc ---------- */
.gifs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
.gifs a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--raised); }
.gifs img, .gifs video { width: 100%; height: 100%; object-fit: cover; display: block; }
details.tree { margin-left: 1rem; } details.tree > summary { cursor: pointer; color: var(--text-2); }
.tree .leaf { margin-left: 1rem; overflow-wrap: anywhere; } .tree .k { color: var(--accent); } .tree .s { color: var(--warm); }
.note { background: var(--raised); border-radius: 12px; padding: .7rem 1rem; color: var(--text-2); font-size: .92rem; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.gifs .gone { display: grid; place-items: center; height: 100%; padding: .6rem; text-align: center; font-size: .82rem; color: var(--muted); }

/* ---------- servers, account pictures, support ---------- */
a.plain { color: inherit; text-decoration: none; display: block; } a.plain:hover b { text-decoration: underline; }
.who.big { display: inline-flex; gap: 1rem; align-items: center; }
.srvcat { font: 650 .78rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 1.1rem 0 .3rem; }
.srvchan { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: .8rem; align-items: baseline; padding: .22rem 0; }
.srvchan .n { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srvchan small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srvchan a { font-size: .88rem; white-space: nowrap; }
.emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .9rem .5rem; }
.emojis figure { margin: 0; text-align: center; min-width: 0; }
.emojis img { width: 48px; height: 48px; object-fit: contain; display: block; margin: 0 auto .3rem; }
.emojis figcaption { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emojis .gone { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto .3rem; background: var(--raised); border-radius: 10px; color: var(--muted); }
.avatars { display: flex; flex-wrap: wrap; gap: .8rem; }
.avatars img { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; display: block; background: var(--raised); }
.ticket { display: flex; flex-direction: column; gap: .9rem; }
.say { max-width: min(46rem, 88%); align-self: flex-start; }
.say.mine { align-self: flex-end; }
.say small { color: var(--muted); display: block; margin-bottom: .25rem; } .say.mine small { text-align: right; }
.say > div { background: var(--raised); border-radius: 16px 16px 16px 5px; padding: .7rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.say.mine > div { background: color-mix(in srgb, var(--accent) 24%, var(--surface)); border-radius: 16px 16px 5px 16px; }
@media (max-width: 760px) { .srvchan { grid-template-columns: minmax(0, 1fr) auto; } .srvchan small { display: none; } }
