/* TGDesk — shared site styles. Colors live on :root; dark follows the OS unless a toggle sets data-theme. */

:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --bg-2: #e7e1d4;
  --surface: #fbf9f4;
  --ink: #1c1915;
  --muted: #5e584e;
  --faint: #6f6a60;
  --line: #e3dcd0;
  --line-strong: #d2c8b6;
  --accent: #b8431f;
  --accent-ink: #8d3214;
  --accent-soft: #f4e3d6;
  --on-accent: #fff;
  --glow: #efe6d6;
  --shadow: 0 24px 60px rgba(48, 32, 16, .10), 0 1px 2px rgba(48, 32, 16, .05);
  --sheen: rgba(255, 255, 255, .7);
  --window: #f6f3ed;
  --window-bar: #efeae2;
  --rail: #ebe4d8;
  --chat: #fbf9f4;
  --out: #1c1915;
  --out-ink: #f6f3ed;
  --paper: #fffcf8;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "WenQuanYi Zen Hei", sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Liberation Serif", "Nimbus Roman", Georgia, "Songti SC", "AR PL UMing CN", "AR PL UMing HK", PMingLiU, "Noto Serif CJK SC", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", "Liberation Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12110f;
    --bg-2: #221f1b;
    --surface: #1b1a17;
    --ink: #f4f0e7;
    --muted: #c4bcae;
    --faint: #9a9286;
    --line: #2e2b26;
    --line-strong: #413d36;
    --accent: #e39464;
    --accent-ink: #f2c09a;
    --accent-soft: #2e241c;
    --on-accent: #2a140c;
    --glow: #2a2118;
    --shadow: 0 24px 60px rgba(0, 0, 0, .40);
    --sheen: rgba(255, 255, 255, .05);
    --window: #191816;
    --window-bar: #201e1b;
    --rail: #141311;
    --chat: #141311;
    --out: #edd9c6;
    --out-ink: #1c1915;
    --paper: #f7f4ee;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12110f;
  --bg-2: #221f1b;
  --surface: #1b1a17;
  --ink: #f4f0e7;
  --muted: #c4bcae;
  --faint: #9a9286;
  --line: #2e2b26;
  --line-strong: #413d36;
  --accent: #e39464;
  --accent-ink: #f2c09a;
  --accent-soft: #2e241c;
  --on-accent: #2a140c;
  --glow: #2a2118;
  --shadow: 0 24px 60px rgba(0, 0, 0, .40);
  --sheen: rgba(255, 255, 255, .05);
  --window: #191816;
  --window-bar: #201e1b;
  --rail: #141311;
  --chat: #141311;
  --out: #edd9c6;
  --out-ink: #1c1915;
  --paper: #f7f4ee;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.65 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(880px 380px at 8% -12%, var(--glow), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img { max-width: 100%; }

a { color: var(--accent-ink); text-underline-offset: .18em; }
.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 8;
  background: var(--ink);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus { top: 8px; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 14px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -.03em;
  font-size: 1.05rem;
}
.mark { width: 22px; height: 22px; flex: none; display: block; }
.mark-front { fill: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
  padding: 4px 0;
}
nav a:hover { color: var(--ink); }
nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -1.5px 0 var(--accent); }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.langs { display: flex; align-items: center; }
.langs a {
  color: var(--faint);
  text-decoration: none;
  font-size: .8rem;
  margin-left: 12px;
}
.langs a:hover { color: var(--ink); }
.theme {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.theme:hover { border-color: var(--accent); color: var(--accent-ink); }
.theme svg { width: 15px; height: 15px; display: block; }
.theme .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme .icon-sun { display: block; }
}
:root[data-theme="dark"] .theme .icon-moon { display: none; }
:root[data-theme="dark"] .theme .icon-sun { display: block; }

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
}
body.doc main { width: min(42rem, calc(100% - 40px)); }
#content { scroll-margin-top: 72px; }

h1 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.08;
  font-size: clamp(2rem, 4vw, 3rem);
  margin: 6px 0 14px;
  text-wrap: balance;
}
body.home h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.15rem);
  max-width: 13em;
  margin-top: 0;
}
.kicker {
  margin: 6px 0 12px;
  font-size: .84rem;
  font-weight: 650;
  color: var(--accent-ink);
}
.lead {
  margin: 0;
  max-width: 40rem;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: .9rem;
}
.facts li { display: flex; align-items: center; gap: 8px; }
.facts li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.cta {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 22px 0 0;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: .94rem;
  line-height: 1.45;
}
.pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
  animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.label {
  margin: 40px 0 0;
  font-size: .8rem;
  font-weight: 650;
  color: var(--faint);
}
body.home .label { margin-top: 64px; }
.specs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  counter-reset: spec;
  max-width: 44rem;
}
.specs li {
  counter-increment: spec;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: 12px;
  row-gap: .35rem;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.specs li::before {
  content: counter(spec, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .05em;
  color: var(--accent);
  padding-top: .45rem;
}
.specs h2 { grid-column: 2; grid-row: 1; }
.specs p { grid-column: 2; grid-row: 2; min-width: 0; }
.specs h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0 0 .35rem;
}
.specs p { margin: 0; color: var(--muted); }

main > h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.7rem;
  letter-spacing: -.02em;
  margin: 48px 0 0;
}
body.home main > h2,
body.home details { max-width: 44rem; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details + details { margin-top: 0; }
main > h2 + details { margin-top: 8px; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--faint); font-weight: 400; }
details[open] summary::after { content: "–"; }
summary:hover { color: var(--accent-ink); }
details p { margin: 8px 0 2px; color: var(--muted); }

.site { border-top: 1px solid var(--line); }
.site .bar { display: block; padding: 26px 0 48px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 14px; }
.foot-nav a { color: var(--muted); text-decoration: none; font-size: .92rem; }
.foot-nav a:hover { color: var(--ink); }
.fine { margin: 0 0 8px; color: var(--muted); font-size: .8rem; line-height: 1.55; max-width: 68ch; }
.copy { margin: 0; color: var(--faint); font-size: .78rem; }

/* Product window */
.stage { margin: 28px 0 0; container-type: inline-size; }
.stage figcaption { margin: 12px 0 0; max-width: 42rem; color: var(--muted); font-size: .92rem; }
.window {
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--window);
  box-shadow: var(--shadow), inset 0 1px 0 var(--sheen);
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  user-select: none;
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.chrome {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 42px;
  padding: 0 12px;
  background: var(--window-bar);
  border-bottom: 1px solid var(--line);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.dots i:nth-child(1) { background: #c4a39a; }
.dots i:nth-child(2) { background: #d2c4a4; }
.dots i:nth-child(3) { background: #b7c3b4; }
.chrome-title { font-size: 12px; font-weight: 650; color: var(--muted); letter-spacing: -.01em; }
.chrome-search {
  justify-self: end;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--faint);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 10px;
}
.app {
  display: grid;
  grid-template-columns: 72px 248px minmax(0, 1fr);
  min-height: 500px;
}
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  background: var(--rail);
  border-right: 1px solid var(--line);
}
.acct { position: relative; }
.av {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.acct.on .av { box-shadow: 0 0 0 2px var(--rail), 0 0 0 4px var(--accent); }
.acct.paused { opacity: .42; }
.badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.av[data-h="MC"] { background: #4a342c; color: #f6efe9; }
.av[data-h="NW"] { background: #6a4a30; color: #f8f1e8; }
.av[data-h="SK"] { background: #2c463c; color: #eef4f0; }
.av[data-h="AR"] { background: #3a4452; color: #eef2f6; }
.av[data-h="HB"] { background: #5a3e3a; color: #f6eeec; }
.pip { width: 6px; height: 6px; border-radius: 50%; }
.pip[data-h="MC"] { background: #b55a38; }
.pip[data-h="NW"] { background: #8a6234; }
.pip[data-h="SK"] { background: #3e6b52; }

.inbox {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.inbox-h { padding: 12px 12px 6px; }
.inbox-h strong { font-size: 13px; letter-spacing: -.01em; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pills span {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 99px;
  color: var(--muted);
}
.pills span.on { background: var(--ink); color: var(--bg); }
.threads { list-style: none; margin: 0; padding: 4px 8px 12px; }
.row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  grid-template-areas: "pip who time" "pip prev time";
  column-gap: 8px;
  row-gap: 1px;
  padding: 8px;
  border-radius: 8px;
}
.row.on { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pip { grid-area: pip; align-self: center; }
.who { grid-area: who; min-width: 0; }
.who b, .who small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who b { font-size: 13px; font-weight: 500; color: var(--muted); }
.row.hot .who b { font-weight: 650; color: var(--ink); }
.who small { font-size: 11px; color: var(--faint); }
.row time {
  grid-area: time;
  align-self: start;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.row.hot time { color: var(--accent-ink); }
.prev {
  grid-area: prev;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat { display: flex; flex-direction: column; min-width: 0; background: var(--chat); }
.chat-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.chat-h b { display: block; font-size: 13.5px; font-weight: 650; }
.chat-h small { display: block; color: var(--faint); font-size: 11.5px; }
.local {
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 3px 7px;
  white-space: nowrap;
}
.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}
.thread > :not(.out) { max-width: 460px; }
.shot {
  width: fit-content;
  max-width: 100%;
  background: var(--bg-2);
  border-radius: 12px;
  padding: 12px;
}
.paper {
  width: 220px;
  max-width: 100%;
  background: var(--paper);
  color: #1c1915;
  border-radius: 8px;
  padding: 12px 12px 10px;
  box-shadow: 0 8px 20px rgba(40, 28, 16, .08);
}
.paper-top { display: flex; gap: 5px; margin-bottom: 10px; }
.paper-top i { height: 6px; border-radius: 99px; background: #e4ddd2; display: block; }
.paper-top i:first-child { width: 46px; background: #d8cfc2; }
.paper-top i:nth-child(2) { width: 22px; }
.paper-top i:nth-child(3) { width: 14px; }
.ln { display: block; height: 6px; border-radius: 99px; background: #ece6dc; margin: 6px 0; }
.w80 { width: 80%; }
.w55 { width: 55%; }
.w70 { width: 72%; }
.sum {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #ece6dc;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
}
.ocr, .tr { display: flex; gap: 8px; align-items: baseline; }
.ocr {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
}
.tr {
  margin: 8px 0 0;
  padding: 8px 10px;
  background: var(--accent-soft);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}
.tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  flex: none;
}
.orig { margin: 0; font-size: 14px; line-height: 1.45; }
.out { align-self: flex-end; max-width: min(92%, 340px); }
.out .body {
  margin: 0;
  background: var(--out);
  color: var(--out-ink);
  border-radius: 12px 12px 4px 12px;
  padding: 8px 11px;
  font-size: 13.5px;
  line-height: 1.45;
}
.note { margin: 5px 0 0; font-size: 11px; color: var(--faint); text-align: right; }
.composer {
  margin: 0 12px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--faint);
  background: var(--surface);
}
.hint { color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .04em; flex: none; }

@container (max-width: 860px) {
  .chrome-search { display: none; }
  .app { grid-template-columns: 1fr; min-height: 0; }
  .rail {
    flex-direction: row;
    justify-content: flex-start;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    overflow-x: auto;
  }
  .inbox { border-right: 0; border-bottom: 1px solid var(--line); }
  .threads { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; }
}
@container (max-width: 560px) {
  .threads { grid-template-columns: 1fr; }
  .paper { width: 100%; }
}

@media (max-width: 720px) {
  nav { width: 100%; }
  body.home h1 { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

article h2{font-family:var(--serif);font-weight:500;font-size:1.45rem;letter-spacing:-.02em;line-height:1.25;margin:2rem 0 .6rem}
article h3{font-size:1.05rem;margin:1.35rem 0 .35rem}
article p{margin:.8rem 0}
article ul,article ol{padding-left:1.15rem}
article li{margin:.35rem 0}
.table-scroll{overflow-x:auto;margin:1.1rem 0 1.4rem}
article table{border-collapse:collapse;width:100%;margin:0;font-size:.92rem}
article th,article td{border-bottom:1px solid var(--line);padding:.65rem .7rem;text-align:left;vertical-align:top}
article th{font-size:.72rem;letter-spacing:.04em;text-transform:uppercase;color:var(--faint);font-weight:650}
article code{font-family:var(--mono);font-size:.88em;background:var(--bg-2);padding:.08em .35em;border-radius:4px;overflow-wrap:anywhere}
.meta{color:var(--faint);font-size:.85rem}
.crumbs{font-size:.82rem;color:var(--faint);margin:0 0 1rem}
.crumbs a{color:var(--muted);text-decoration:none}
.crumbs a:hover{color:var(--ink)}
.posts{list-style:none;padding:0;margin:1.25rem 0 0}
.posts li{padding:1.1rem 0;border-top:1px solid var(--line)}
.posts li:last-child{border-bottom:1px solid var(--line)}
.posts h2{font-family:var(--serif);font-weight:500;font-size:1.4rem;letter-spacing:-.02em;line-height:1.25;margin:0 0 .3rem}
.posts h2 a{color:var(--ink);text-decoration:none}
.posts h2 a:hover{color:var(--accent-ink)}
.posts p{margin:.15rem 0;color:var(--muted)}
article .cta{margin-top:1.5rem}
