/* CastBay website: the app's look (dark, purple accent, rounded, soft glow). */
:root {
  --bg: #0b0910;
  --bg-raised: #15121d;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.09);
  --text: #f2f0f7;
  --text-2: rgba(242, 240, 247, 0.72);
  --text-3: rgba(242, 240, 247, 0.5);
  --accent: #a48bf5;
  --accent-strong: #6750a4;
  --accent-glow: rgba(164, 139, 245, 0.35);
  --header-bg: rgba(11, 9, 16, 0.72);
  --line: rgba(255, 255, 255, 0.06);
  /* The page colour as r, g, b, for the veil over the hero artwork. */
  --veil: 11, 9, 16;
  --radius: 18px;
  --max: 1120px;
  color-scheme: dark;
}

/* Light, chosen with the theme button or following the system (site.js sets data-theme). */
:root[data-theme="light"] {
  --bg: #f7f5fb;
  --bg-raised: #efebf6;
  --card: #ffffff;
  --card-border: rgba(27, 21, 40, 0.1);
  --text: #1b1528;
  --text-2: rgba(27, 21, 40, 0.72);
  --text-3: rgba(27, 21, 40, 0.55);
  --accent: #6750a4;
  --accent-glow: rgba(103, 80, 164, 0.25);
  --header-bg: rgba(247, 245, 251, 0.8);
  --line: rgba(27, 21, 40, 0.08);
  --veil: 247, 245, 251;
  color-scheme: light;
}

/* The header wordmark: white lettering on dark, dark lettering on light. */
.brand .wm-light { display: none; }
:root[data-theme="light"] .brand .wm-dark { display: none; }
:root[data-theme="light"] .brand .wm-light { display: block; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 28px; height: 84px; }
/* A single-language wordmark; its fonts aren't on every system. */
.brand { display: flex; align-items: center; }
.brand img { width: 250px; height: 60px; object-fit: contain; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { color: var(--text-2); font-size: 15px; white-space: nowrap; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav-cta {
  background: var(--accent-strong); color: #fff; border-radius: 999px;
  padding: 7px 16px; font-size: 14px; font-weight: 600; white-space: nowrap; flex: none;
}
.nav-cta:hover { text-decoration: none; box-shadow: 0 6px 20px var(--accent-glow); }
/* On a phone it would squeeze the wordmark; the hero's own button is just below. */
@media (max-width: 600px) { .top .nav-cta { display: none; } .top .theme { margin-left: auto; } }
/* Below this the mark, five links and the two buttons don't fit a line: the links fold into a
   menu under the three-line button, which opens them as a panel below the header. */
.menu-btn { display: none; }
@media (max-width: 920px) {
  .nav { display: none; }
  .nav-cta { margin-left: auto; }
  .menu-btn {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 38px; height: 38px; padding: 0 8px; border: 0; background: none; cursor: pointer; flex: none;
  }
  .menu-btn span { display: block; height: 2px; border-radius: 1px; background: var(--text); transition: transform .25s, opacity .25s; }
  /* Open: the three lines turn into a cross. */
  .top.menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .top.menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  .top.menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .top.menu-open .nav {
    display: flex; flex-direction: column; gap: 0; margin: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    padding: 8px 24px 16px; background: var(--bg-raised); border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
  }
  .top.menu-open .nav a { padding: 14px 0; font-size: 17px; color: var(--text); border-bottom: 1px solid var(--line); }
  .top.menu-open .nav a:last-child { border-bottom: 0; }
}
/* The link to the same page in the other language. */
.lang {
  border: 1px solid var(--card-border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 6px 14px; font-size: 14px;
  white-space: nowrap;
}
.lang:hover { border-color: var(--accent); text-decoration: none; }

/* Dark/light: the moon shows in light, the sun in dark, turning as they swap (as on weenas.com). */
.theme {
  position: relative; width: 34px; height: 34px; padding: 0; border: 0; background: none;
  color: var(--text-2); cursor: pointer; flex: none;
}
.theme:hover { color: var(--accent); }
.theme svg {
  position: absolute; top: 50%; left: 50%; width: 22px; height: 22px;
  transform: translate(-50%, -50%); transition: transform .3s, opacity .3s;
}
.theme .sun { transform: translate(-50%, -50%) scale(0) rotate(90deg); opacity: 0; }
:root[data-theme="dark"] .theme .moon { transform: translate(-50%, -50%) scale(0) rotate(-90deg); opacity: 0; }
:root[data-theme="dark"] .theme .sun { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }

/* Buttons, in the app's pill style */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 28px; border-radius: 999px; font-weight: 600; font-size: 17px;
  border: 2px solid transparent; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent-strong); color: #fff; box-shadow: 0 8px 30px var(--accent-glow); }
.btn-primary:hover { border-color: #fff; box-shadow: 0 10px 40px var(--accent-glow); }
.btn-ghost { background: var(--card); color: var(--text); border-color: var(--card-border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn svg { width: 20px; height: 20px; }

/* Hero: the launch artwork under a dark veil, like the app's home screen */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: url("hero.jpg") center / cover no-repeat;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(var(--veil), 0.94) 0%, rgba(var(--veil), 0.75) 45%, rgba(var(--veil), 0.35) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 30%);
}
.hero .wrap { position: relative; z-index: 1; padding-top: 120px; padding-bottom: 140px; }
.eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .04em; font-size: 15px; margin: 0 0 14px; }
.eyebrow.slogan { font-size: clamp(17px, 2vw, 20px); letter-spacing: .02em; }
.hero h1 { font-size: clamp(38px, 6vw, 64px); line-height: 1.12; margin: 0 0 20px; max-width: 13em; letter-spacing: -0.01em; text-wrap: balance; }
/* Chinese headings break at spaces and punctuation, not inside a word ("声|音"); a run too
   long for the line still breaks. */
.hero h1:lang(zh) { word-break: keep-all; overflow-wrap: anywhere; }
.hero p.lead { font-size: clamp(17px, 2.1vw, 20px); color: var(--text-2); max-width: 34em; margin: 0 0 36px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.note { color: var(--text-3); font-size: 14px; margin-top: 18px; }
/* The problem report's ID on the feedback page (site.js shows it when the URL carries one). */
.report-id { background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 16px; }
.report-id strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.15em; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.chip {
  font-size: 13px; color: var(--text-2); padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-border);
}

/* Sections */
section { padding: 88px 0; scroll-margin-top: 84px; } /* clear the sticky header when jumping to #anchors */
section.alt { background: var(--bg-raised); }
.section-head { max-width: 40em; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.2; margin: 0 0 12px; text-wrap: balance; }
.section-head p { color: var(--text-2); margin: 0; }

/* Screenshots: two a row, one on phones; each opens full size over the page (site.js). */
.shots { display: grid; gap: 28px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shots figure { margin: 0; }
.shots img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--card-border); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.shots figcaption { margin-top: 12px; color: var(--text-2); font-size: 15px; }
@media (max-width: 760px) { .shots { grid-template-columns: 1fr; } }
.shots a { cursor: zoom-in; }
/* A screenshot opened over the page (site.js): the whole screen, dimmed, a click closes it. */
.lightbox { max-width: none; max-height: none; width: 100vw; height: 100vh; margin: 0; padding: 24px 16px; border: 0; background: transparent; cursor: zoom-out; box-sizing: border-box; }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.lightbox::backdrop { background: rgba(5, 4, 8, 0.88); }
.lightbox img { max-width: min(100%, 1920px); max-height: calc(100vh - 110px); width: auto; height: auto; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.lightbox p { margin: 0; max-width: 900px; color: #e8e4f0; font-size: 15px; text-align: center; }
html.lightbox-open { overflow: hidden; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 26px; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: rgba(164, 139, 245, 0.45); transform: translateY(-2px); }
.card h3 { margin: 14px 0 8px; font-size: 19px; }
.card p { margin: 0; color: var(--text-2); font-size: 15.5px; }
.icon {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(164, 139, 245, 0.28), rgba(103, 80, 164, 0.28));
  color: var(--accent);
}
.icon svg { width: 24px; height: 24px; }

/* Steps */
.steps { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); counter-reset: step; }
.step { position: relative; padding: 28px 26px 26px; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-strong); color: #fff; font-weight: 700; margin-bottom: 14px;
  box-shadow: 0 0 0 6px rgba(103, 80, 164, 0.18);
}
.step h3 { margin: 0 0 8px; font-size: 18px; }
.step p { margin: 0; color: var(--text-2); font-size: 15.5px; }

/* Two ways to cast */
.ways { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ways ul { margin: 12px 0 0; padding-left: 20px; color: var(--text-2); font-size: 15.5px; }
.ways li { margin: 6px 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 1px 7px; margin-left: 8px; vertical-align: 2px; }

/* FAQ */
.faq { max-width: 820px; }
.faq-more { margin: 22px 0 0; font-weight: 600; }
details {
  background: var(--card); border: 1px solid var(--card-border); border-radius: 14px;
  padding: 0 22px; margin-bottom: 12px;
}
details[open] { border-color: rgba(164, 139, 245, 0.4); }
summary { cursor: pointer; list-style: none; padding: 18px 28px 18px 0; font-weight: 600; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 0; top: 14px; font-size: 22px; color: var(--accent); }
details[open] summary::after { content: "–"; }
details p { margin: 0 0 18px; color: var(--text-2); font-size: 15.5px; }

/* Open source */
.oss { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.oss p { color: var(--text-2); max-width: 40em; margin: 8px 0 0; }
/* The community cards are links as a whole. */
a.card { display: flex; flex-direction: column; color: inherit; }
/* Four, or two by two, or one under another: never three and a lone one. */
.community { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .community { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .community { grid-template-columns: 1fr; } }
a.card:hover { text-decoration: none; }
a.card .more { display: inline-block; margin-top: auto; padding-top: 14px; color: var(--accent); font-size: 14.5px; font-weight: 600; }
/* Under the download buttons: the other ways to get CastBay. */
.channels { color: var(--text-3); font-size: 14px; margin-top: 14px; }
.channels a { color: var(--text-2); }

/* Footer */
footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--text-3); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; }
footer a { color: var(--text-2); }
footer .links { display: flex; gap: 20px; flex-wrap: wrap; }

/* Legal pages */
.doc { max-width: 780px; padding-top: 64px; padding-bottom: 80px; }
.doc h1 { font-size: 38px; margin: 0 0 6px; }
.doc .date { color: var(--text-3); margin: 0 0 36px; }
.doc h2 { font-size: 21px; margin: 36px 0 10px; }
.doc h3 { font-size: 17px; margin: 22px 0 6px; }
.doc code { font-size: .92em; }
.doc p, .doc li { color: var(--text-2); }
/* Tables in documents (the compatibility list): scroll sideways on phones rather than squeeze. */
.doc table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 15px; }
.doc th, .doc td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--card-border); color: var(--text-2); vertical-align: top; }
.doc th { color: var(--text); font-weight: 600; white-space: nowrap; }
.doc td:first-child { color: var(--text); white-space: nowrap; }
/* Phones: each row becomes a block, its first cell as a heading and the others under it, each
   named after its column (site.js copies the header into data-label), so nothing hides off
   the edge in a sideways scroll nobody notices. */
@media (max-width: 600px) {
  .doc table, .doc tbody, .doc tr, .doc td { display: block; width: auto; }
  .doc thead { display: none; }
  .doc tr { padding: 12px 0; border-bottom: 1px solid var(--card-border); }
  .doc td { border: 0; padding: 2px 0; white-space: normal; }
  .doc td:first-child { font-weight: 600; white-space: normal; margin-bottom: 2px; }
  .doc td[data-label]:not(:first-child)::before { content: attr(data-label) "："; color: var(--text-3); }
  :root:not([lang="zh-CN"]) .doc td[data-label]:not(:first-child)::before { content: attr(data-label) ": "; }
}

/* The changelog: each release's date beside its version. */
.release-date { font-size: 15px; font-weight: 400; color: var(--text-3); margin-left: 10px; }
.doc section.release { padding: 0; margin-top: 36px; }
.release h2 { scroll-margin-top: 100px; }
.checksum { font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.checksum code, .verify code { font-size: 12.5px; overflow-wrap: anywhere; }
.verify { margin: 0 0 12px; padding: 12px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); }
.verify summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.verify p { font-size: 15px; }
/* The 404 page: English, then Chinese. */
.not-found { min-height: 55vh; }
.not-found p + h1 { margin-top: 48px; }

/* Anchored headings clear the sticky header. */
.doc h2, .doc h3 { scroll-margin-top: 100px; }

/* A document's table of contents: a sidebar that stays in view on wide screens, a folded
   list under the title on narrow ones. */
.doc.has-toc { max-width: 1120px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; }
.doc.has-toc .doc-body { max-width: 780px; min-width: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; color: var(--text-3); font-size: 14px; line-height: 1.45; padding: 5px 0 5px 12px; border-left: 2px solid var(--card-border); }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc .toc-3 a { padding-left: 24px; font-size: 13px; }
.toc a[aria-current] { color: var(--accent); border-left-color: var(--accent); }
.toc-side { position: sticky; top: 108px; align-self: start; max-height: calc(100vh - 132px); overflow-y: auto; }
.toc-title { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); margin: 0 0 10px 14px; }
.toc-inline { display: none; margin: -12px 0 28px; padding: 12px 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--card-border); }
.toc-inline summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.toc-inline ol { margin-top: 10px; }
@media (max-width: 960px) {
  .doc.has-toc { display: block; max-width: 780px; }
  .toc-side { display: none; }
  .toc-inline { display: block; }
}

@media (max-width: 720px) {
  .top:not(.menu-open) .nav { display: none; }
  .top .wrap { gap: 12px; height: 72px; }
  .brand img { width: 200px; height: 48px; } /* leaves room for the language button on phones */
  .theme { margin-left: auto; }
  .hero .wrap { padding-top: 72px; padding-bottom: 96px; }
  .hero::after { background: linear-gradient(0deg, var(--bg) 0%, rgba(var(--veil), 0.85) 60%, rgba(var(--veil), 0.7) 100%); }
  section { padding: 64px 0; }
  .btn { padding: 13px 22px; font-size: 16px; }
}

/* The private statistics page (/stats). */
.stats-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.stats-card { flex: 1 1 150px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 18px; }
.stats-card span { display: block; color: var(--text-3); font-size: 14px; }
.stats-card strong { font-size: 30px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.stats-section { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 18px; min-width: 0; }
.stats-section h2 { font-size: 17px; margin: 0 0 10px; }
.stats-row { display: grid; grid-template-columns: minmax(0, 9em) 1fr auto; align-items: center; gap: 10px; font-size: 14px; margin: 5px 0; }
.stats-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.stats-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.stats-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.stats-n { font-variant-numeric: tabular-nums; min-width: 2.5em; text-align: right; }
/* Its list of problem reports (on phones, rows become blocks like the site's other tables). */
.stats-reports { margin: 0 0 14px; }
.stats-reports table { width: 100%; border-collapse: collapse; font-size: 14px; }
@media (min-width: 601px) {
  .stats-reports th, .stats-reports td { text-align: left; padding: 6px 10px 6px 0; white-space: nowrap; border-bottom: 1px solid var(--line); }
}
.stats-reports th { color: var(--text-3); font-weight: 500; }
.stats-reports td a { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
