:root {
  /* Light is the house look: warm paper, ink lettering, the orange of Texu's line. */
  --bg: #f2f0ea;
  --panel: #fbfaf6;
  --panel-2: #ebe8e0;
  --hover: #e2ded4;
  --line: #d9d4c8;
  --text: #0d0e11;
  --soft: #4f4c45;
  --accent: #c65332;
  --accent-hover: #b2472a;
  --accent-fill: #bc4b2b;
  --accent-ink: #fffaf5;
  --accent-text: #a9432a;
  --spider: #c65332;
  --plus: #237a4b;
  --minus: #b8382a;
  --shadow: 0 24px 60px rgba(60, 40, 20, .16);
  --scrim: rgba(13, 14, 17, .35);
  --radius: 14px;
  /* The tools' colours in charts (checked for colour-blind readers against --panel, both themes). */
  --tool-chat: #2a78d6; --tool-image: #eb6834; --tool-video: #1baf7a;
  --tool-speech: #eda100; --tool-music: #e87ba4; --tool-transcribe: #008300;
  color-scheme: light;
}
/* Dark: ink background, paper lettering, the spider turns yellow (the dark logo). */
:root[data-theme="dark"] {
  --bg: #0d0e11;
  --panel: #15171c;
  --panel-2: #1c1f26;
  --hover: #242833;
  --line: #2a2e37;
  --text: #f2f0ea;
  --soft: #c9c6bd;
  --accent: #ffcf5c;
  --accent-hover: #ffd977;
  --accent-fill: #ffcf5c;
  --accent-ink: #1a1405;
  --accent-text: #ffcf5c;
  --spider: #ffcf5c;
  --plus: #74e0a4;
  --minus: #ff8a7a;
  --shadow: 0 24px 60px rgba(0, 0, 0, .5);
  --scrim: rgba(5, 6, 8, .6);
  --tool-chat: #3987e5; --tool-image: #d95926; --tool-video: #199e70;
  --tool-speech: #c98500; --tool-music: #d55181; --tool-transcribe: #008300;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* The type grows with the window, so a 2560 px screen is filled instead of showing a small island. */
html { font-size: clamp(15px, 0.45vw + 9px, 21px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Manrope has Latin and Cyrillic; Chinese falls through to the system's CJK face. */
  font-family: Manrope, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
/* The logo and Texu are put in inline, so their two layers take the theme's colours. */
.logo { display: block; height: clamp(2rem, 2.1vw, 2.65rem); aspect-ratio: 1752 / 683; }
.rail .logo { height: clamp(2rem, 2.25vw, 2.75rem); margin: .1rem 0 .2rem; }
[data-logo] svg { display: block; width: 100%; height: 100%; }
[data-logo] .ink { fill: var(--text); }
[data-logo] .line { fill: var(--spider); stroke: var(--spider); transition: fill .3s ease, stroke .3s ease; }
[data-logo] .line-s { fill: none; stroke: var(--spider); transition: stroke .3s ease; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  border: 0; border-radius: 12px; padding: .8rem 1.3rem; font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .12s ease, background-color .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent-fill); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.link-btn { background: none; border: 0; color: var(--soft); padding: .3rem 0; font-weight: 600; }
.link-btn:hover { color: var(--text); }

/* The language picker: a plain native select, so it works with keyboards and screen readers. */
.lang {
  appearance: none; background: var(--panel-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a867c'/%3E%3C/svg%3E") no-repeat right .75rem center;
  border: 1px solid var(--line); border-radius: 10px; padding: .4rem 2rem .4rem .8rem; font-weight: 700; color: var(--text); cursor: pointer;
}
.lang:hover { background-color: var(--hover); }
.lang:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang option { background: var(--panel); color: var(--text); }
.top-right { display: flex; align-items: center; gap: 1.2rem; }
.tabs-end { margin: 0 0 .5rem auto; align-self: center; display: flex; align-items: center; gap: .8rem; }
#account-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

/* Chinese reads better without the tight Latin headline spacing. */
:lang(zh) h1, :lang(zh) h2, :lang(zh) .starters h3 { letter-spacing: 0; }
:lang(zh) h1 { line-height: 1.2; }
/* Spanish and French headlines are a third longer; a smaller size keeps them to three lines. */
:lang(es) h1, :lang(fr) h1 { font-size: clamp(2rem, 3vw, 3.7rem); }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: .45rem 1rem; border-radius: 9px; font-weight: 700; color: var(--soft); }
.seg button.on { background: var(--text); color: var(--bg); }

/* ---------- landing ---------- */
.landing { max-width: 112rem; margin: 0 auto; padding: 1.4rem clamp(1rem, 4vw, 4rem) 4rem; }
.top { display: flex; justify-content: space-between; align-items: center; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(2rem, 5vw, 6rem); align-items: center; padding: clamp(2.5rem, 7vh, 6rem) 0 3rem; }
h1 { font-size: clamp(2.2rem, 3.6vw, 4.4rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 1.2rem; font-weight: 800; }
.lead { font-size: 1.15rem; color: var(--soft); max-width: 34em; margin: 0 0 2rem; }
.signin { display: flex; gap: .6rem; max-width: 34rem; margin-bottom: .8rem; }
.signin input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; font-size: 1rem; }
.signin input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.signin-state { margin-top: 1rem; padding: 1rem 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 34rem; animation: drop .35s cubic-bezier(.2,.9,.3,1.2); }
.signin-state a { color: var(--accent-text); word-break: break-all; }

.demo { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 1.2rem; min-height: 26rem; display: flex; flex-direction: column; }
.demo-bar { display: flex; justify-content: space-between; align-items: center; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.demo-model { font-weight: 800; font-size: 1.05rem; display: inline-block; }
.demo-model.roll { animation: roll .45s ease; }
.demo-price { background: var(--panel-2); border-radius: 999px; padding: .25rem .8rem; font-weight: 700; font-size: .9rem; }
.demo-body { flex: 1; display: flex; flex-direction: column; gap: .8rem; padding: 1.1rem 0; }
.demo-foot { display: flex; justify-content: space-between; align-items: baseline; padding-top: .9rem; border-top: 1px solid var(--line); }
.demo-foot strong { font-size: 1.4rem; }
.bubble { max-width: 88%; padding: .75rem 1rem; border-radius: 16px; animation: rise .3s ease both; }
.bubble.me { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 5px; font-weight: 600; }
.bubble.ai { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 5px; }
.bubble.demo-pic { width: 58%; aspect-ratio: 1; padding: 0; background: linear-gradient(160deg, #f6b35b 0%, #e2725b 38%, #3b4a7a 72%, #1b2340 100%); animation: develop 1.4s ease both; }
.tag { align-self: flex-start; background: var(--accent-fill); color: var(--accent-ink); font-weight: 800; border-radius: 8px; padding: .2rem .6rem; font-size: .9rem; animation: drop .45s cubic-bezier(.2,.9,.3,1.4) both; }

.board { margin-top: 1rem; }
.board-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
h2 { font-size: 1.6rem; margin: 0; letter-spacing: -0.02em; }
.board-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.price-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .2rem; animation: deal .4s cubic-bezier(.2,.8,.3,1) both; }
.price-card .by { color: var(--soft); font-weight: 600; font-size: .9rem; }
.price-card .name { font-weight: 800; font-size: 1.1rem; }
.price-card .for { color: var(--soft); font-size: .95rem; }
.price-card .amount { margin-top: .6rem; font-size: 1.5rem; font-weight: 800; }
.price-card .amount small { font-size: .85rem; font-weight: 600; color: var(--soft); margin-left: .25rem; }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 2.5rem; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: flex; flex-direction: column; gap: .3rem; }
.fact strong { font-size: 1.15rem; }
.fact span { color: var(--soft); }

/* ---------- app ---------- */
.app { display: grid; grid-template-columns: clamp(15rem, 18vw, 22rem) 1fr; height: 100vh; height: 100dvh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 1.1rem; display: flex; flex-direction: column; gap: 1rem; min-height: 0; }
.convs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; margin: 0 -.4rem; }
.conv { display: flex; align-items: center; gap: .4rem; border-radius: 10px; padding: .55rem .6rem; color: var(--soft); text-decoration: none; font-weight: 600; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.conv span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv:hover { background: var(--panel-2); color: var(--text); }
.conv.on { background: var(--panel-2); color: var(--text); }
.conv .del { opacity: 0; color: var(--soft); padding: 0 .3rem; }
.conv:hover .del { opacity: 1; }
.wallet { border-top: 1px solid var(--line); padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.wallet-row { display: flex; justify-content: space-between; align-items: baseline; }
.wallet-row strong { font-size: 1.35rem; }
.bump { animation: bump .5s ease; }

.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; gap: .3rem; padding: .9rem clamp(1rem, 3vw, 3rem) 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs > button { white-space: nowrap; }
.tabs > button { background: none; border: 0; padding: .6rem 1rem .8rem; font-weight: 700; color: var(--soft); border-bottom: 3px solid transparent; }
.tabs > button.on { color: var(--text); border-bottom-color: var(--accent); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 1rem clamp(1rem, 3vw, 3rem) 1.2rem; overflow: hidden; }
.pane[data-pane="spending"], .pane[data-pane="margins"], .pane[data-pane="pictures"], .pane[data-pane="video"], .pane[data-pane="voice"], .pane[data-pane="music"] { overflow-y: auto; }

.model-pick { position: relative; align-self: flex-start; z-index: 5; }
.model-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .9rem; display: flex; align-items: baseline; gap: .7rem; font-weight: 800; }
.model-btn small { font-weight: 700; color: var(--accent-text); }
.model-btn::after { content: ''; width: .45rem; height: .45rem; border-right: 2px solid var(--soft); border-bottom: 2px solid var(--soft); transform: translateY(-.15rem) rotate(45deg); margin-left: .2rem; }
.model-menu { position: absolute; top: calc(100% + .5rem); left: 0; width: min(46rem, 80vw); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: .6rem; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; box-shadow: var(--shadow); }
.model-opt { text-align: left; background: none; border: 1px solid transparent; border-radius: 12px; padding: .7rem .8rem; display: grid; grid-template-columns: 1fr auto; gap: 0 .6rem; animation: deal .3s cubic-bezier(.2,.8,.3,1) both; }
.model-opt:hover { background: var(--panel-2); }
.model-opt.on { border-color: var(--accent); }
.model-opt b { font-weight: 800; }
.model-opt i { font-style: normal; color: var(--soft); grid-column: 1; font-size: .92rem; }
.model-opt em { font-style: normal; font-weight: 800; color: var(--accent-text); grid-row: 1 / span 2; grid-column: 2; align-self: center; }

.thread { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1.1rem; padding: 1.4rem 0; max-width: 60rem; width: 100%; margin: 0 auto; }
.msg { display: flex; flex-direction: column; gap: .35rem; animation: rise .25s ease both; }
.msg.user { align-items: flex-end; }
.msg .body { padding: .85rem 1.1rem; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; max-width: 92%; }
.msg.user .body { background: var(--text); color: var(--bg); border-bottom-right-radius: 5px; font-weight: 600; }
.msg.assistant .body { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg .meta { font-weight: 700; font-size: .88rem; color: var(--soft); display: flex; gap: .6rem; padding: 0 .3rem; }
.msg .meta .cost { color: var(--accent-text); }
.msg .meta .cost.land { animation: drop .45s cubic-bezier(.2,.9,.3,1.4) both; }
.msg.error .body { border-color: var(--minus); }
.caret::after { content: ''; display: inline-block; width: .5em; height: 1em; background: var(--accent); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s steps(2) infinite; }

.starters { margin: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; width: 100%; max-width: 60rem; }
.starter { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; font-weight: 600; min-height: 6.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: .6rem; animation: deal .4s cubic-bezier(.2,.8,.3,1) both; }
.starter:hover { border-color: var(--accent); }
.starter small { color: var(--accent-text); font-weight: 800; }

.composer { display: flex; gap: .6rem; align-items: flex-end; max-width: 60rem; width: 100%; margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: .5rem .5rem .5rem 1rem; }
.composer textarea { flex: 1; background: none; border: 0; resize: none; max-height: 14rem; padding: .55rem 0; font-size: 1rem; outline: none; }
.composer .send { white-space: nowrap; }
.composer .send.stop { background: var(--text); color: var(--bg); }

/* ---------- pictures ---------- */
.pic-form { display: flex; flex-direction: column; gap: .9rem; max-width: 70rem; }
.pic-form textarea { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; resize: vertical; font-size: 1.05rem; }
.pic-models { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.pic-model { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .1rem; }
.pic-model.on { border-color: var(--accent); background: var(--panel-2); }
.pic-model b { font-weight: 800; }
.pic-model i { font-style: normal; color: var(--soft); font-size: .92rem; }
.pic-model em { font-style: normal; color: var(--accent-text); font-weight: 800; margin-top: .3rem; }
.pic-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; margin-top: 1.4rem; }
.shot { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; animation: deal .35s ease both; }
.shot img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--panel-2); }
.shot img.develop { animation: develop 1.1s ease both; }
.shot figcaption { padding: .6rem .8rem; display: flex; justify-content: space-between; gap: .6rem; font-size: .9rem; }
.shot figcaption span { color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot figcaption b { color: var(--accent-text); }
.shot.wait { aspect-ratio: 1; justify-content: center; align-items: center; position: relative; }
.shot.wait::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 16%, transparent), transparent); transform: translateX(-100%); animation: sweep 1.4s ease-in-out infinite; }
.shot.wait p { margin: 0; font-weight: 700; color: var(--soft); }

/* ---------- video, voice, music ---------- */
.gen-opts { display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; }
.opt { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.opt-label { font-weight: 800; color: var(--soft); }
.gen-note { color: var(--soft); font-weight: 600; max-width: 40rem; }
.frame-chip { display: inline-flex; align-items: center; gap: .4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .25rem .4rem .25rem .25rem; }
.frame-chip img { width: 2.6rem; height: 2.6rem; object-fit: cover; border-radius: 7px; }
.frame-chip button { background: none; border: 0; font-size: 1.2rem; color: var(--soft); }
label.btn { cursor: pointer; }
.media-list { grid-template-columns: repeat(auto-fill, minmax(22rem, 1fr)); }
.video-shot video, .video-shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: #000; }
.video-shot video.develop, .video-shot img.develop { animation: develop 1.1s ease both; }
.video-shot.wait, .video-shot.failed { aspect-ratio: auto; min-height: 14rem; justify-content: center; align-items: center; }
.shot-fail { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.5rem 1rem .5rem; }
.shot-fail p { margin: 0; font-weight: 700; color: var(--soft); }
.texu-fail { width: 6rem; }
.sounds { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.4rem; max-width: 70rem; }
.sound { display: grid; grid-template-columns: minmax(16rem, 1.2fr) 1fr auto; gap: 1.2rem; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1.1rem; animation: deal .35s ease both; }
.sound.fresh { border-color: var(--accent); }
.sound.wait { grid-template-columns: auto 1fr; }
.sound.wait p { margin: 0; font-weight: 700; color: var(--soft); }
.sound .texu-wait { width: 5rem; }
.sound-meta { display: flex; flex-direction: column; min-width: 0; }
.sound-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sound-sub { color: var(--soft); font-size: .9rem; font-weight: 700; }
.tool-empty { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 4rem 1rem; text-align: center; }
.tool-empty p { font-weight: 800; font-size: 1.2rem; margin: 0; }

/* ---------- spending & margins ---------- */
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; display: flex; flex-direction: column; animation: deal .35s ease both; }
.chip b { font-size: 1.15rem; }
.ledger { width: 100%; border-collapse: collapse; max-width: 70rem; }
.ledger th { text-align: left; color: var(--soft); font-weight: 700; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.ledger td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger .plus { color: var(--plus); font-weight: 800; }
.ledger .minus { font-weight: 700; }
.ledger tr { animation: rise .25s ease both; }
/* The Spending tab (web/spending.js). */
.spend { display: flex; flex-direction: column; gap: 1rem; max-width: 84rem; width: 100%; }
.sp-loading { height: 12rem; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.sp-head { display: grid; grid-template-columns: minmax(13rem, .8fr) minmax(17rem, 1fr) minmax(22rem, 1.5fr); gap: 1rem; }
.sp-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: .45rem; min-width: 0; animation: deal .35s ease both; }
.sp-card h3 { margin: 0; font-size: 1.05rem; }
.sp-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.sp-label { color: var(--soft); font-weight: 700; }
.sp-big { font-size: 2.3rem; letter-spacing: -0.02em; line-height: 1.1; }
.sp-sub { color: var(--soft); }
.sp-pay { align-self: flex-start; margin-top: auto; display: inline-flex; align-items: center; gap: .4rem; }
.sp-seg button { padding: .35rem .75rem; }
.sp-invite { background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 9%, var(--panel)), var(--panel) 70%); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.sp-row:has(.sp-invite-ico) { justify-content: flex-start; }
.sp-invite-ico { width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; background: var(--accent-fill); color: var(--accent-ink); }
.sp-invite-ico .i { width: 1.2rem; height: 1.2rem; }
.sp-invite-t { font-size: 1.15rem; }
.sp-invite-d { margin: 0; color: var(--soft); max-width: 38rem; }
.sp-link-row { display: flex; gap: .5rem; align-items: center; }
.sp-link { flex: 1; min-width: 0; font-weight: 600; }
.sp-link-row .btn { white-space: nowrap; display: inline-flex; align-items: center; gap: .4rem; }
.sp-ref-stats { display: flex; gap: 1.6rem; margin-top: .2rem; }
.sp-stat { display: flex; flex-direction: column; }
.sp-stat b { font-size: 1.25rem; }
.sp-stat small { color: var(--soft); }
.sp-friends summary { cursor: pointer; color: var(--soft); font-weight: 700; }
.sp-friend { display: grid; grid-template-columns: 1fr auto auto 6rem; gap: .8rem; padding: .35rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.sp-friend small { color: var(--soft); }
.sp-friend b { text-align: right; color: var(--plus); }
.sp-friend.off { opacity: .55; }
.sp-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.sp-key { display: inline-flex; align-items: center; gap: .4rem; color: var(--soft); font-weight: 600; }
.sw { width: .7rem; height: .7rem; border-radius: 3px; display: inline-block; flex: none; }
.sw.plus { background: none; box-shadow: inset 0 0 0 2px var(--plus); border-radius: 50%; }
.t-chat { background: var(--tool-chat); } .t-image { background: var(--tool-image); } .t-video { background: var(--tool-video); }
.t-speech { background: var(--tool-speech); } .t-music { background: var(--tool-music); } .t-transcribe { background: var(--tool-transcribe); }
.sp-plot { position: relative; height: clamp(10rem, 22vh, 15rem); margin: 1.6rem 0 0; border-bottom: 1px solid var(--line); }
.sp-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.sp-grid span { position: absolute; left: 0; bottom: .2rem; font-size: .78rem; color: var(--soft); white-space: nowrap; background: var(--panel); padding-right: .4rem; z-index: 1; pointer-events: none; }
.sp-bars { position: absolute; inset: 0; touch-action: pan-y; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; }
.sp-col { border: 0; background: none; padding: 0 1px; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; border-radius: 4px 4px 0 0; min-width: 0; }
.sp-col.hot { background: color-mix(in srgb, var(--text) 6%, transparent); }
.sp-col:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sp-bar { width: 100%; max-width: 2.6rem; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 4px 4px 0 0; overflow: hidden; transform-origin: bottom; animation: sp-grow .5s cubic-bezier(.2,.8,.3,1) both; }
.sp-bar i { display: block; min-height: 1px; flex-basis: 0; }
@keyframes sp-grow { from { transform: scaleY(0); } }
.sp-tip { position: absolute; top: .4rem; z-index: 3; min-width: 12rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: .6rem .75rem; display: flex; flex-direction: column; gap: .25rem; pointer-events: none; font-size: .9rem; transform: translateX(calc(var(--half, 0px) + .5rem)); }
.sp-tip[hidden] { display: none; }
.sp-tip.flip { transform: translateX(calc(-100% - var(--half, 0px) - .5rem)); }
/* After the first draw only the bars move again (a new period); the cards stay put. */
.sp-quiet .sp-card, .sp-quiet .sp-item, .sp-quiet tr { animation: none; }
.sp-tip-row { display: flex; align-items: center; gap: .45rem; }
.sp-tip-row em { margin-left: auto; font-style: normal; font-weight: 700; padding-left: 1rem; white-space: nowrap; }
.sp-tip-row.sum { border-top: 1px solid var(--line); padding-top: .3rem; margin-top: .1rem; font-weight: 700; }
.sp-axis { position: relative; height: 1.6rem; color: var(--soft); font-size: .82rem; }
.sp-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; top: .35rem; }
.sp-axis span:first-child { transform: none; left: 0 !important; }
.sp-axis span:last-child { transform: translateX(-100%); left: 100% !important; }
.sp-split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sp-list { display: flex; flex-direction: column; }
.sp-item { display: flex; align-items: center; gap: .65rem; padding: .55rem .4rem; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; color: inherit; font: inherit; border-radius: 0; animation: rise .25s ease both; }
.sp-item:last-child { border-bottom: 0; }
button.sp-item { cursor: pointer; }
button.sp-item:hover, .sp-item.on { background: var(--panel-2); border-radius: 8px; }
.sp-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sp-meter { flex: 1; min-width: 3rem; height: .5rem; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.sp-meter i { display: block; height: 100%; border-radius: 4px; }
.sp-val { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sp-pct { width: 2.6rem; text-align: right; color: var(--soft); }
.sp-runs { color: var(--soft); white-space: nowrap; margin-left: auto; }
.sp-runs + .sp-val { margin-left: .8rem; min-width: 6rem; text-align: right; }
.sp-filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.sp-filters .chip { flex-direction: row; padding: .35rem .8rem; font-weight: 700; color: var(--soft); cursor: pointer; animation: none; }
.sp-filters .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sp-history .ledger { max-width: none; }
.sp-what { display: inline-flex; align-items: center; gap: .5rem; }
.sp-more { align-self: center; margin-top: .4rem; }
.sp-empty { color: var(--soft); margin: .6rem 0; }
@media (max-width: 1200px) { .sp-head { grid-template-columns: 1fr 1fr; } .sp-invite { grid-column: 1 / -1; } }
@media (max-width: 700px) {
  .sp-head, .sp-split { grid-template-columns: 1fr; }
  .sp-big { font-size: 1.9rem; }
  .sp-link-row { flex-wrap: wrap; }
  .sp-link { flex-basis: 100%; }
  .sp-link-row .btn { flex: 1; justify-content: center; }
  .sp-history .ledger thead { display: none; }
  .sp-history .ledger tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .6rem; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  .sp-history .ledger td { border: 0; padding: 0; }
  .sp-history .ledger td:first-child { grid-row: 2; font-size: .8rem; color: var(--soft); padding-left: 1.2rem; }
  .sp-history .ledger td:nth-child(2) { grid-row: 1; min-width: 0; }
  .sp-history .ledger td.num { grid-row: 1 / 3; align-self: center; white-space: normal; max-width: 9rem; }
  .sp-what { align-items: flex-start; }
  .sp-what .sw { margin-top: .4em; }
  .sp-friend { grid-template-columns: 1fr auto 5rem; }
  .sp-runs { display: none; }
  .sp-runs + .sp-val { min-width: 0; }
  .sp-friend > small:first-of-type { display: none; }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .8rem; margin-bottom: 1.2rem; max-width: 70rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.kpi b { display: block; font-size: 1.7rem; }

/* ---------- account & toast ---------- */
.account { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 20; }
.account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 1.4rem; width: min(26rem, 92vw); display: flex; flex-direction: column; gap: .8rem; animation: drop .3s cubic-bezier(.2,.9,.3,1.2); }
.account-card h3 { margin: 0 0 .3rem; font-size: 1.3rem; }
.acc-row { display: flex; justify-content: space-between; gap: 1rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 700; padding: .75rem 1.2rem; border-radius: 12px; z-index: 30; animation: drop .3s ease; max-width: 90vw; }

/* ---------- theme switch and Texu ---------- */
.theme-pick button { padding: .4rem .85rem; }
.demo { position: relative; }
/* Texu stands on the top edge of the live example and waves, as the spider sits on the logo's r. */
.texu-hello { position: absolute; right: 34%; bottom: calc(100% - .9rem); width: clamp(6.5rem, 8vw, 9.5rem); animation: descend 1.2s cubic-bezier(.3, 1.35, .5, 1) .5s both; z-index: 2; }
.starters-head { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 1.1rem; margin: 0 0 .5rem; }
.starters-head h3 { margin: 0 0 .4rem; font-size: 1.8rem; letter-spacing: -0.02em; }
.texu-empty { width: 7rem; flex: none; animation: drop .55s cubic-bezier(.2, .9, .3, 1.3) both; }
/* While an answer is on its way, Texu walks with its thread; it leaves when the first words land. */
.texu-wait { width: 6.5rem; }
.msg.waiting .body { display: none; }
.shot.wait .texu-wait { width: 8rem; margin-bottom: .6rem; position: relative; }

/* ---------- motion: each kind of thing has its own ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes deal { from { opacity: 0; transform: translateY(14px) rotate(-1.5deg) scale(.97); } }
@keyframes drop { from { opacity: 0; transform: translateY(-10px) scale(.9); } }
@keyframes roll { 0% { transform: translateY(0); opacity: 1; } 45% { transform: translateY(-60%); opacity: 0; } 55% { transform: translateY(60%); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes bump { 30% { transform: scale(1.12); color: var(--accent-text); } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes develop { from { filter: saturate(0) brightness(1.6) contrast(.6); opacity: .3; } }
@keyframes sweep { to { transform: translateX(100%); } }
@keyframes descend { from { transform: translateY(-3.5rem); opacity: 0; } 50% { opacity: 1; } }
@keyframes walk { 50% { transform: translateX(.4rem) rotate(2.5deg); } }

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

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .board-grid, .pic-models { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; height: auto; min-height: 100dvh; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  /* Theme and language get their own row above the tabs, so the row never runs off a phone. */
  .tabs { flex-wrap: wrap; row-gap: 0; }
  .tabs > button { padding: .6rem .75rem .8rem; }
  .tabs-end { order: -1; width: 100%; justify-content: flex-end; margin: 0 0 .3rem; flex-wrap: wrap; gap: .45rem; min-width: 0; }
  .tabs-end .lang { padding: .35rem 1.7rem .35rem .6rem; background-position: right .55rem center; }
  .tabs { min-width: 0; }
  .work { min-width: 0; }
  .top-right { gap: .7rem; }
  .theme-pick button { padding: .35rem .6rem; }
  .convs { max-height: 9rem; }
  .starters { grid-template-columns: 1fr; }
  .model-menu { grid-template-columns: 1fr; width: calc(100vw - 2rem); }
  .signin { flex-direction: column; }
  .pane { overflow: visible; }
  .thread { min-height: 50vh; }
}
.example { opacity: .92; }
.example figcaption b, .sound.example .sound-sub { color: var(--soft); }
.cur-slot { display: inline-flex; }
.cur-pick button { min-width: 2.3rem; padding: .4rem .7rem; font-weight: 800; }

/* The "no connection" screen of the installed app (offline.html). */
.offline-page { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, sans-serif; }
.offline { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 1rem; padding: 2rem 1.2rem; }
.offline h1 { margin: 0; font-size: 1.8rem; }
.offline p { margin: 0; max-width: 28rem; color: var(--soft); line-height: 1.5; }
.offline section { display: flex; flex-direction: column; gap: .4rem; max-width: 30rem; }
.offline section + section { opacity: .75; font-size: .92rem; }
.offline section + section h1 { font-size: 1.1rem; }

/* The dollars beside a price in tokens: a small pale hint (ui.usdHints). */
small.usd { font-size: .72em; font-weight: 600; color: var(--soft); opacity: .85; letter-spacing: 0; white-space: nowrap; }
.btn small.usd, .why-btn small.usd, .tile-tag small.usd, .tg-b small.usd { color: inherit; opacity: .75; }
.why-fig small.usd { font-size: .36em; align-self: flex-end; margin-bottom: .35em; }
.prices td small.usd { display: block; }
