/* Prata: one stylesheet, design tokens on :root, light and dark. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --sunken: #f1f3f6;
  --hover: #eef0f4;
  --text: #111318;
  --text-2: #3f4550;
  --muted: #646b78;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --accent: #4353ff;
  --accent-hover: #3241f0;
  --accent-soft: rgb(67 83 255 / 0.09);
  --accent-softer: rgb(67 83 255 / 0.05);
  --accent-text: #ffffff;
  --link: #3343e8;
  --success: #0f7a55;
  --success-soft: rgb(15 122 85 / 0.1);
  --danger: #c8291f;
  --danger-soft: rgb(200 41 31 / 0.08);
  --warning: #935400;
  --warning-soft: rgb(196 120 0 / 0.1);
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow:
    0 1px 2px rgb(16 24 40 / 0.04), 0 4px 16px -4px rgb(16 24 40 / 0.06);
  --shadow-pop: 0 1px 2px rgb(16 24 40 / 0.08), 0 1px 1px rgb(16 24 40 / 0.04);
  --ring: 0 0 0 3px rgb(67 83 255 / 0.28);

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 14px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    sans-serif;
  color-scheme: light;
}

/* Dark: the system's choice, unless Settings says light; or Settings says dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0f;
    --surface: #14161b;
    --surface-2: #181a20;
    --sunken: #0f1115;
    --hover: #1d2027;
    --text: #eceef2;
    --text-2: #c3c8d2;
    --muted: #8d95a3;
    --border: #252830;
    --border-strong: #353a45;
    --accent: #4f5ff5;
    --accent-hover: #6170ff;
    --accent-soft: rgb(111 126 255 / 0.16);
    --accent-softer: rgb(111 126 255 / 0.08);
    --link: #929dff;
    --success: #3fcf95;
    --success-soft: rgb(63 207 149 / 0.12);
    --danger: #ff6b61;
    --danger-soft: rgb(255 107 97 / 0.12);
    --warning: #f0b45a;
    --warning-soft: rgb(240 180 90 / 0.12);
    --shadow-sm: none;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.02) inset;
    --shadow-pop: 0 1px 2px rgb(0 0 0 / 0.5);
    --ring: 0 0 0 3px rgb(111 126 255 / 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0c0f;
  --surface: #14161b;
  --surface-2: #181a20;
  --sunken: #0f1115;
  --hover: #1d2027;
  --text: #eceef2;
  --text-2: #c3c8d2;
  --muted: #8d95a3;
  --border: #252830;
  --border-strong: #353a45;
  --accent: #4f5ff5;
  --accent-hover: #6170ff;
  --accent-soft: rgb(111 126 255 / 0.16);
  --accent-softer: rgb(111 126 255 / 0.08);
  --link: #929dff;
  --success: #3fcf95;
  --success-soft: rgb(63 207 149 / 0.12);
  --danger: #ff6b61;
  --danger-soft: rgb(255 107 97 / 0.12);
  --warning: #f0b45a;
  --warning-soft: rgb(240 180 90 / 0.12);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.02) inset;
  --shadow-pop: 0 1px 2px rgb(0 0 0 / 0.5);
  --ring: 0 0 0 3px rgb(111 126 255 / 0.4);
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
[hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.25;
}
h1 {
  font-size: 2rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}
h2 {
  font-size: 1.0625rem;
  font-weight: 620;
}
h3 {
  font-size: 0.9375rem;
  font-weight: 620;
}
p {
  margin: 0;
}
a {
  color: var(--link);
  text-underline-offset: 2px;
}
code,
kbd {
  font-family: var(--mono);
  font-size: 0.86em;
}
code {
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  overflow-wrap: anywhere;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  padding: 0 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  line-height: 1.4;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.8125rem;
}
.grow {
  flex: 1;
}
.error {
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
}
.error:empty {
  display: none;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: var(--s3);
  top: -100px;
  z-index: 10;
  background: var(--surface);
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
}
.skip:focus {
  top: var(--s3);
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.noscript {
  text-align: center;
  padding: var(--s6);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.row {
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Icons ---------- */

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
svg.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.button svg.icon,
button svg.icon {
  width: 16px;
  height: 16px;
}

/* ---------- The brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  border-radius: var(--r);
}
/* The app icon (icon/icon.svg, served as icon.svg; the favicon is favicon.svg): the mouth with a sound wave. */
.brand-mark {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
}
.brand-name {
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-by {
  color: var(--muted);
  font-size: 0.8125rem;
  white-space: nowrap;
}

/* ---------- The credits ---------- */

.credits {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.credits.low {
  color: var(--warning);
}
.topbar-credits {
  font-size: 0.8125rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  white-space: nowrap;
}
.topbar-credits.low {
  background: var(--warning-soft);
}
.discount-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 620;
  text-decoration: none;
  width: fit-content;
}

/* ---------- The shell: a sidebar, and the content ---------- */

body {
  --sidebar: 236px;
}
/* The React root (frontend.tsx) adds no box: the shell and the welcome page stay children of the body's flex layout. */
#root {
  display: contents;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  flex: 1;
}
.shell[hidden] {
  display: none;
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  height: 100vh;
  height: 100dvh;
  padding: 14px 10px 10px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 4px;
}
.sidebar .drawer-close {
  display: none;
}
.credit-box {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: 0 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}
.credit-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}
.credit-line .icon {
  color: var(--accent);
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 520;
  text-decoration: none;
  transition:
    background-color 0.12s,
    color 0.12s;
}
.side-nav a .icon {
  color: var(--muted);
  transition: color 0.12s;
}
.side-nav a:hover {
  background: var(--hover);
  color: var(--text);
}
.side-nav a[aria-current] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 620;
}
.side-nav a[aria-current] .icon {
  color: var(--accent);
}
/* "Generate" is a heading for its two pages; it is current when one of them is. */
.side-nav a.nav-item[data-route="generate"][aria-current] {
  background: none;
  color: var(--text);
}
.side-nav a.nav-item[data-route="generate"][aria-current] .icon {
  color: var(--accent);
}
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 4px 19px;
  padding-left: 9px;
  border-left: 1px solid var(--border);
}
.nav-sub a {
  min-height: 30px;
  padding: 4px 10px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-group-label {
  margin: 14px 10px 6px;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.side-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.side-legal {
  display: flex;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.75rem;
}
.side-legal a {
  color: var(--muted);
  text-decoration: none;
}
.side-legal a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* The account: a round avatar with the first letter of the email. */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, var(--accent));
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 650;
  text-transform: uppercase;
  line-height: 1;
}
.avatar.lg {
  width: 44px;
  height: 44px;
  font-size: 1.125rem;
}
.user-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  box-shadow: none;
  text-align: left;
  font-weight: 500;
}
.user-button:hover,
.user-button[aria-expanded="true"] {
  background: var(--hover);
  border-color: transparent;
}
.user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.user-email {
  overflow: hidden;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-sub {
  font-size: 0.75rem;
}
.avatar-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  box-shadow: none;
}
.avatar-button:hover {
  background: var(--hover);
}
.avatar-button.signed-out {
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}
.icon-button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

/* The account menu: from the avatar in the sidebar or the top bar. */
.menu-pop {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: 260px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow:
    0 12px 32px -8px rgb(16 24 40 / 0.24),
    0 2px 6px rgb(16 24 40 / 0.08);
  animation: pop 0.12s ease-out;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}
.menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
}
.menu-head > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.menu-head b {
  overflow: hidden;
  font-size: 0.875rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--sunken);
  font-size: 0.8125rem;
}
.menu-pop > a,
.menu-pop > button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}
.menu-pop > a .icon,
.menu-pop > button .icon {
  color: var(--muted);
}
.menu-pop > a:hover,
.menu-pop > button:hover,
.menu-pop > a:focus-visible,
.menu-pop > button:focus-visible {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: none;
}
.menu-pop > a:hover .icon,
.menu-pop > button:hover .icon,
.menu-pop > a:focus-visible .icon,
.menu-pop > button:focus-visible .icon {
  color: inherit;
}
.menu-pop > button[data-action="logout"] {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: none;
}
main.content {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  width: min(100% - 64px, 980px);
  margin: var(--s6) auto var(--s5);
  flex: 1;
  outline: none;
}
.flow {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

/* Each part of the page shows in its modes (data-for, a list). */
#view-app:not([data-mode="single"])
  [data-for~="single"]:not([data-for~="batch"]),
#view-app:not([data-mode="batch"])
  [data-for~="batch"]:not([data-for~="single"]),
#view-app:not([data-mode="single"]):not([data-mode="batch"])
  [data-for~="single"][data-for~="batch"],
#view-app:not([data-mode="single"]):not([data-mode="batch"]) #speech-form,
#view-app:not([data-mode="home"]) [data-for~="home"],
#view-app:not([data-mode="library"]) [data-for~="library"],
#view-app:not([data-mode="apps"]) [data-for~="apps"],
#view-app:not([data-mode="settings"]) [data-for~="settings"],
#view-app:not([data-mode^="admin-"]) #admin-view,
#view-app:not([data-mode="admin-users"]) .page-head[data-for="admin-users"],
#view-app:not([data-mode="admin-codes"]) .page-head[data-for="admin-codes"],
#view-app:not([data-mode="admin-settings"])
  .page-head[data-for="admin-settings"],
#view-app[data-mode="single"] .mode-hint[data-for="batch"],
#view-app[data-mode="batch"] .mode-hint[data-for="single"] {
  display: none !important;
}
[data-feature][data-off] {
  display: none !important;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s3) var(--s4);
  flex-wrap: wrap;
  margin-bottom: var(--s1);
}
.page-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.page-title h1 {
  font-size: 1.625rem;
  font-weight: 680;
  letter-spacing: -0.025em;
}
.mode-hint {
  font-size: 0.9375rem;
}
.mode-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 14px;
}

/* A narrower window: a rail of icons. */
@media (max-width: 879px) and (min-width: 640px) {
  body {
    --sidebar: 64px;
  }
  .sidebar {
    align-items: center;
    padding: 12px 8px;
  }
  .sidebar-top {
    padding: 2px 0 4px;
  }
  .sidebar .brand-name,
  .nav-label,
  .nav-sub,
  .credit-box,
  .side-legal,
  .user-text,
  .nav-group-label {
    display: none;
  }
  .side-nav,
  .side-foot {
    width: 100%;
    align-items: center;
  }
  .side-nav a {
    justify-content: center;
    width: 44px;
    min-height: 40px;
    padding: 0;
  }
  .side-nav a.nav-item[data-route="generate"][aria-current] {
    background: var(--accent-soft);
  }
  .nav-group {
    align-items: center;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .user-button {
    justify-content: center;
    width: 44px;
    padding: 6px 0;
  }
  main.content {
    width: min(100% - 40px, 980px);
    margin-top: var(--s5);
  }
}

/* A phone, or a narrow app window: a top bar, and the sidebar as a drawer. */
@media (max-width: 639px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: var(--s2);
    height: 54px;
    padding: 0 8px 0 6px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(14px);
    backdrop-filter: saturate(1.6) blur(14px);
  }
  .topbar .brand-name {
    font-size: 0.9375rem;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgb(0 0 0 / 0.2);
  }
  .shell.drawer-open .sidebar {
    transform: none;
  }
  .sidebar .drawer-close {
    display: grid;
  }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgb(10 12 16 / 0.35);
  }
  .side-nav a {
    min-height: 42px;
  }
  main.content {
    width: min(100% - 32px, 980px);
    margin-top: var(--s4);
  }
  .page-title h1 {
    font-size: 1.375rem;
  }
  .page-head .mode-switch {
    width: 100%;
  }
  .page-head .mode-switch button {
    flex: 1;
    justify-content: center;
  }
}
@media (min-width: 640px) {
  .scrim {
    display: none !important;
  }
}

/* ---------- Logged out ---------- */

.welcome {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.welcome[hidden] {
  display: none;
}
.welcome-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  min-height: 64px;
}
.welcome-links {
  display: flex;
  align-items: center;
  gap: var(--s4);
  font-size: 0.875rem;
}
.welcome-links a {
  color: var(--muted);
  text-decoration: none;
}
.welcome-links a:hover {
  color: var(--text);
}
.yours {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: var(--s3) var(--s4);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: var(--r);
  background: var(--success-soft);
  font-size: 0.875rem;
}
.yours .icon {
  color: var(--success);
  margin-top: 2px;
}
.login-legal {
  border-top: 1px solid var(--border);
  padding-top: var(--s3);
}
.invite-note {
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  background: var(--warning-soft);
  color: var(--text);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-width: 0;
}
.card-title {
  margin-bottom: calc(var(--s1) * -1);
}

/* ---------- Login ---------- */

main.login {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: var(--s7);
  align-items: center;
  width: min(100% - 32px, 1040px);
  margin: 7vh auto var(--s6);
  flex: 1;
  outline: none;
}
main.login[hidden] {
  display: none;
}
.login-intro {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.login-intro h1 {
  max-width: 14em;
  text-wrap: balance;
}
.lead {
  font-size: 1.0625rem;
  color: var(--text-2);
  max-width: 34em;
}
.features {
  list-style: none;
  margin: var(--s1) 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.features li {
  position: relative;
  padding-left: 28px;
  color: var(--text-2);
}
.features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.9' stroke='%23fff' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 14px no-repeat,
    var(--accent);
}
.features b {
  color: var(--text);
  font-weight: 600;
}
.price {
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
  color: var(--text-2);
  font-size: 0.9375rem;
}
.price b {
  color: var(--text);
}
.login-card {
  padding: var(--s6);
  gap: var(--s4);
}
.code-input {
  font-family: var(--mono);
  font-size: 1.25rem !important;
  letter-spacing: 0.3em;
  text-align: center;
}
@media (max-width: 800px) {
  main.login {
    grid-template-columns: 1fr;
    gap: var(--s5);
    margin-top: var(--s5);
  }
  .login-intro h1 {
    font-size: 1.625rem;
  }
  .login-card {
    padding: var(--s5);
  }
}

/* ---------- Form controls ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
}
.field-label {
  font-weight: 560;
  font-size: 0.875rem;
  color: var(--text);
}
legend.field-label {
  padding: 0;
  margin-bottom: var(--s2);
}
.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-left: 4px;
}
.field-help {
  color: var(--muted);
  font-size: 0.75rem;
}
/* A button in a line of text: "Native German voices: Lena and Jonas." */
button.link,
button.link:hover:not(:disabled) {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: inherit;
  font-weight: 560;
  color: var(--accent, var(--text));
  text-decoration: underline;
  text-underline-offset: 2px;
}
.field output {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
}
.hint {
  color: var(--text-2);
  background: var(--accent-softer);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r);
  padding: var(--s2) var(--s3);
  margin-top: var(--s2);
}
input,
select,
textarea {
  font: inherit;
  font-size: 0.9375rem;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  padding: 8px 12px;
  width: 100%;
  min-height: 38px;
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text) 25%);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--sunken);
  color: var(--muted);
  cursor: not-allowed;
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5' stroke='%23808796' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  text-overflow: ellipsis;
  cursor: pointer;
}
textarea {
  resize: vertical;
  line-height: 1.55;
}
input[type="range"] {
  padding: 0;
  min-height: 24px;
  border: none;
  background: none;
  accent-color: var(--accent);
  box-shadow: none;
  cursor: pointer;
}
input[type="range"]:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
  cursor: pointer;
}
label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-2);
  cursor: pointer;
}
label.check input {
  margin-top: 2px;
}

/* ---------- Buttons ---------- */

button,
.button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 560;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r);
  padding: 0 14px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition:
    background-color 0.12s,
    border-color 0.12s,
    color 0.12s,
    box-shadow 0.12s;
}
button svg,
.button svg {
  width: 15px;
  height: 15px;
  flex: none;
}
button:hover:not(:disabled),
.button:hover {
  background: var(--hover);
}
button:active:not(:disabled) {
  transform: translateY(0.5px);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
button.primary:hover:not(:disabled),
.button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.primary:disabled {
  opacity: 0.45;
}
button.ghost,
.button.ghost {
  background: none;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}
button.ghost:hover:not(:disabled),
.button.ghost:hover {
  background: var(--hover);
  color: var(--text);
}
.danger-text {
  color: var(--danger) !important;
}
button.sm,
.button.sm,
select.sm {
  min-height: 30px;
  font-size: 0.8125rem;
}
button.sm,
.button.sm {
  padding: 0 10px;
}
select.sm {
  width: auto;
  padding: 2px 28px 2px 10px;
  background-position: right 8px center;
}
button.lg {
  min-height: 42px;
  padding: 0 20px;
  font-size: 0.9375rem;
}
button.block {
  width: 100%;
}
.icon-btn {
  width: 30px;
  min-height: 30px;
  padding: 0;
}
.file-button {
  position: relative;
}
.file-button:focus-within {
  box-shadow: var(--ring);
}
.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Segmented controls ---------- */

.segmented,
.mode-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 100%;
  width: fit-content;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented button,
.mode-switch button {
  border: 1px solid transparent;
  background: none;
  box-shadow: none;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 540;
}
.segmented button:hover:not(:disabled),
.mode-switch button:hover:not(:disabled) {
  background: none;
  color: var(--text);
}
.segmented button[aria-pressed="true"],
.mode-switch button[aria-pressed="true"] {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}
.segmented.sm button {
  min-height: 26px;
  padding: 0 10px;
  font-size: 0.8125rem;
}
.segmented .n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ---------- One line ---------- */

#text {
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 110px;
}
.count {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.count.over {
  color: var(--danger);
}
.action-bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding-top: var(--s4);
  border-top: 1px solid var(--border);
}
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-2);
  font-size: 0.875rem;
}
.kbd-hint {
  margin-left: auto;
}
.kbd-hint kbd {
  font-size: 0.75rem;
}
@media (hover: none) {
  .kbd-hint {
    display: none;
  }
}

/* ---------- The voice block ---------- */

.voice-block {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-width: 0;
}
#single-voice-slot,
#batch-voice-slot {
  display: contents;
}
#batch-voice-slot .voice-block {
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
}
.voice-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  padding-top: var(--s4);
}
.file-pick {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 38px;
  min-width: 0;
  cursor: pointer;
}
.file-pick .button {
  flex: none;
}
.file-pick .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-pick:focus-within .button {
  box-shadow: var(--ring);
}
details.more {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 var(--s4);
  background: var(--surface-2);
}
details.more[open] {
  padding-bottom: var(--s4);
}
details > summary {
  cursor: pointer;
  list-style: none;
  border-radius: var(--r);
}
details > summary::-webkit-details-marker {
  display: none;
}
details.more > summary,
details.guide > summary {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 40px;
  font-size: 0.875rem;
  font-weight: 560;
}
details.more > summary::before,
details.guide > summary::before,
.tools summary::after {
  content: "";
  width: 14px;
  height: 14px;
  flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4l4 4-4 4' stroke='%23808796' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: transform 0.15s;
}
details[open] > summary::before,
.tools details[open] summary::after {
  transform: rotate(90deg);
}
@media (max-width: 640px) {
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Batch steps ---------- */

.step-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}
.step-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step-num {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: -2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--link);
  font-variant-numeric: tabular-nums;
}
.step-num.done {
  background: var(--accent);
  color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.2 2.2 4.8-4.9' stroke='%23fff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 16px;
  background-position: center;
  background-repeat: no-repeat;
}
.step-head .count {
  padding-top: 2px;
}
.dropzone {
  position: relative;
}
#script {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  tab-size: 18;
  white-space: pre;
  overflow-x: auto;
  min-height: 150px;
  background: var(--surface-2);
}
.drop-hint {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--link);
  font-weight: 600;
  pointer-events: none;
}
.dropzone.dragging .drop-hint {
  display: grid;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
.problems {
  list-style: none;
  margin: 0;
  padding: var(--s3) var(--s4);
  font-size: 0.8125rem;
  border-radius: var(--r);
  background: var(--warning-soft);
  display: grid;
  gap: 4px;
}
.problems li {
  padding-left: 20px;
  position: relative;
  color: var(--text-2);
}
.problems li::before {
  content: "!";
  position: absolute;
  left: 0;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  color: #fff;
  background: var(--warning);
}
.problems li.error {
  color: var(--danger);
}
.problems li.error::before {
  background: var(--danger);
}
.problems li.error-free::before {
  display: none;
}
details.guide {
  border-top: 1px solid var(--border);
  padding-top: var(--s2);
  margin-top: calc(var(--s1) * -1);
}
.guide-body {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  font-size: 0.875rem;
  color: var(--text-2);
  padding: var(--s2) 0 var(--s1) 22px;
}
.guide-table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.guide-table table {
  border-collapse: collapse;
  font-size: 0.8125rem;
  width: 100%;
}
.guide-table th,
.guide-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
.guide-table th {
  background: var(--sunken);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.75rem;
}
.guide-table tr:last-child td {
  border-bottom: none;
}
.guide-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 4px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: var(--s5) var(--s4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
}
#lines-body {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
fieldset.chips {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}
label.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 10px;
  min-height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 540;
  cursor: pointer;
  user-select: none;
  background: var(--surface);
  transition:
    background-color 0.12s,
    border-color 0.12s;
}
label.chip:has(input:checked) {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
label.chip:has(input:focus-visible) {
  box-shadow: var(--ring);
}
label.chip input:focus-visible {
  box-shadow: none;
}
.chip .n {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip code {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
}

/* Tables of lines: the preview, and the results of a batch. */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
}
.preview-wrap {
  max-height: 340px;
}
.batch-wrap {
  max-height: min(70vh, 720px);
}
table.lines {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}
table.lines th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 560;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  white-space: nowrap;
}
table.lines td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.lines tbody tr:last-child td {
  border-bottom: none;
}
table.lines tbody tr:hover td {
  background: var(--accent-softer);
}
.file-name {
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--text);
}
.file-name .dir {
  color: var(--muted);
}
.preview td.c-text,
.batch td.c-text {
  color: var(--text-2);
  min-width: 200px;
}
.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.voice-tag {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--text-2);
}
.voice-tag.default {
  color: var(--muted);
}
.preview td.c-char {
  white-space: nowrap;
  font-weight: 540;
}
.sub {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* Characters and their voices */
.characters-block {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.characters {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.character {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: var(--s3);
  align-items: center;
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.character:first-child {
  border-top: none;
}
.character-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.character-name .sub {
  font-weight: 400;
}
.character-detail {
  min-width: 0;
}
.character-clone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s2);
  align-items: center;
}
.character-clone .file-pick {
  min-height: 38px;
}
.character-clone .file-pick .muted {
  max-width: 120px;
}
@media (max-width: 720px) {
  .character {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }
  .character-clone {
    grid-template-columns: 1fr;
  }
  .character-clone .file-pick .muted {
    max-width: none;
  }
}

/* The plan of a batch */
.plan {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.plan-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.stat {
  padding: var(--s3) var(--s4);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  background: var(--surface-2);
}
.stat:first-child {
  border-left: none;
}
.stat-value {
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
}
.stat-detail {
  color: var(--text-2);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plan-note {
  font-size: 0.8125rem;
  color: var(--text-2);
}
.plan-warning {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  background: var(--warning-soft);
  color: var(--text);
  font-size: 0.875rem;
}
@media (max-width: 640px) {
  .plan-stats {
    grid-template-columns: 1fr 1fr;
  }
  .stat:nth-child(3) {
    border-left: none;
  }
  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}

/* ---------- Results: one line ---------- */

.results {
  display: flex;
  flex-direction: column;
}
.result {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) 0;
  border-top: 1px solid var(--border);
}
.result:first-child {
  border-top: none;
  padding-top: 0;
}
.result:last-child {
  padding-bottom: 0;
}
.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.result-meta b {
  color: var(--text);
  font-weight: 600;
}
.result-meta .dot::before {
  content: "·";
  margin-right: 6px;
}
.result-text {
  color: var(--text-2);
  font-size: 0.9375rem;
}
/* A long text: its first lines, the rest is in the file. */
.result-text.long {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  white-space: pre-line;
}
.result.fresh {
  animation: fresh 0.5s ease-out;
}
@keyframes fresh {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
audio {
  width: 100%;
  height: 40px;
}

/* ---------- Results: a batch ---------- */

.batch-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  flex-wrap: wrap;
}
.batch-heading {
  display: flex;
  gap: var(--s3);
  flex: 1;
  min-width: 220px;
}
.batch-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#batch-summary {
  font-variant-numeric: tabular-nums;
}
.batch-actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}
.meter {
  display: flex;
  height: 6px;
  border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
  border: 1px solid var(--border);
}
.meter span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.3s ease;
}
.meter-done {
  background: var(--accent);
}
.meter-failed {
  background: var(--danger);
}
.table-tools {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
#play-all[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--link);
}
table.batch td {
  vertical-align: middle;
}
table.batch td.c-play {
  width: 46px;
  padding-right: 0;
}
table.batch td.c-file {
  white-space: nowrap;
}
table.batch td.c-state {
  white-space: nowrap;
  width: 1%;
}
table.batch td.c-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}
.c-actions .actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
table.batch tr.playing td {
  background: var(--accent-soft) !important;
}
.play {
  width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
}
.play svg {
  width: 13px;
  height: 13px;
}
.play[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.play[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--accent-hover);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 560;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.badge.running {
  background: var(--accent-soft);
  color: var(--link);
}
.badge.running::before {
  display: none;
}
.badge.running .spinner {
  width: 10px;
  height: 10px;
  border-width: 1.5px;
}
.badge.done {
  background: var(--success-soft);
  color: var(--success);
}
.badge.failed {
  background: var(--danger-soft);
  color: var(--danger);
}
.why {
  display: block;
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 4px;
}
.kept {
  color: var(--success) !important;
}

@media (max-width: 720px) {
  .batch-actions {
    width: 100%;
  }
  .batch-actions button {
    flex: 1;
  }
  .table-wrap.batch-wrap,
  .table-wrap.preview-wrap {
    border: none;
    border-radius: 0;
    background: none;
  }
  .table-wrap.preview-wrap {
    max-height: 420px;
  }
  .table-wrap.batch-wrap {
    max-height: 75vh;
  }
  #script {
    white-space: pre-wrap;
    tab-size: 4;
  }
  #voice-block .segmented {
    width: 100%;
  }
  #voice-block .segmented button {
    flex: 1;
    padding: 0 6px;
  }
  table.lines thead {
    display: none;
  }
  table.lines,
  table.lines tbody {
    display: block;
  }
  table.lines tbody tr {
    display: grid;
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: var(--s2);
    background: var(--surface);
    overflow: hidden;
  }
  table.lines td {
    border: none;
    padding: 4px 12px;
    min-width: 0 !important;
  }
  table.lines tbody tr:hover td {
    background: none;
  }
  table.preview tr {
    grid-template-columns: 1fr auto;
    padding: 6px 0;
  }
  table.preview td.c-file {
    grid-column: 1;
  }
  table.preview td.c-char {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  table.preview td.c-voice {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
  }
  table.preview td.c-text {
    grid-column: 1 / -1;
  }
  table.preview td.c-file {
    grid-row: 1 / span 2;
  }
  table.batch tr {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "play file state"
      "play text text"
      "actions actions actions";
    padding: 8px 0;
  }
  table.batch tr.playing {
    border-color: var(--accent);
  }
  table.batch td.c-play {
    grid-area: play;
    width: auto;
    padding-right: 0;
  }
  table.batch td.c-file {
    grid-area: file;
    white-space: normal;
  }
  table.batch td.c-text {
    grid-area: text;
  }
  table.batch td.c-state {
    grid-area: state;
    width: auto;
  }
  table.batch td.c-actions {
    grid-area: actions;
    width: auto;
    text-align: left;
  }
  table.batch td.c-actions:empty {
    display: none;
  }
  .file-name {
    white-space: normal;
    word-break: break-all;
  }
}

/* ---------- Plugin, app and command line ---------- */

.tools-sub {
  margin-top: -4px;
}
.tools-body,
.api-part {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  color: var(--text-2);
}
.download {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.download-intel {
  flex-basis: 100%;
}
.token-box {
  display: flex;
  gap: var(--s2);
  align-items: center;
}
code.token {
  flex: 1;
  display: block;
  word-break: break-all;
  padding: var(--s2) var(--s3);
  font-size: 0.8125rem;
  border-radius: var(--r);
}

/* ---------- Footer ---------- */

.footer {
  width: min(100% - 32px, 960px);
  margin: 0 auto var(--s6);
}
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  padding: var(--s4) var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 0.875rem;
}
.cta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 640px) {
  .card {
    padding: var(--s4);
    border-radius: 12px;
  }
  .brand-by {
    display: none;
  }
  .action-bar > button {
    flex: 1 1 auto;
  }
  .cta {
    padding: var(--s4);
  }
  .cta .button {
    width: 100%;
  }
}
.play[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}
.play[aria-disabled="true"]:hover {
  background: var(--surface);
}
.card,
.voice-title {
  scroll-margin-top: 80px;
}
.segmented .n.bad {
  color: var(--danger);
  font-weight: 650;
}
@media (max-width: 640px) {
  .kbd-hint {
    display: none;
  }
}

/* The session ended: a bar at the top of the app. */
.session-ended {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius, 12px);
  color: var(--text);
}
.session-ended span {
  flex: 1;
  min-width: 200px;
}

/* ---------- QA fixes ---------- */

/* A visible focus on every control. An outline, because some buttons set box-shadow: none for their look. */
button:focus-visible,
a:focus-visible,
summary:focus-visible,
.button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Long file names wrap: no horizontal scroll of the page, and the state and actions stay in view. */
.problems,
.problems li {
  min-width: 0;
  overflow-wrap: anywhere;
}
table.batch td.c-file,
table.preview td.c-file {
  white-space: normal;
  max-width: 280px;
}
table.batch td.c-file .file-name,
table.preview td.c-file .file-name {
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 720px) {
  /* The file name has the whole width; the character and the voice go under it. */
  table.preview td.c-file {
    grid-column: 1 / -1;
    grid-row: 1;
    max-width: none;
  }
  table.preview td.c-char {
    grid-column: 1;
    grid-row: 2;
    text-align: left;
  }
  table.preview td.c-voice {
    grid-column: 2;
    grid-row: 2;
  }
  table.preview td.c-text {
    grid-row: 3;
  }
  table.batch td.c-file {
    max-width: none;
  }
}

/* ---------- Library, voices, translation ---------- */

.results-head,
.lib-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3, 12px);
  flex-wrap: wrap;
}
.rate-select {
  width: auto;
  padding: 4px 8px;
  font-size: 0.8125rem;
}
.lib-sub {
  font-size: 0.875rem;
  margin: var(--s4, 16px) 0 var(--s2, 8px);
  color: var(--muted);
  font-weight: 600;
}
.lib-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.lib-row {
  display: flex;
  align-items: center;
  gap: var(--s3, 12px);
  padding: 10px 0;
  border-top: 1px solid var(--border);
  min-width: 0;
}
.lib-row:first-child {
  border-top: none;
}
.lib-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.lib-title {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.lib-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.lib-meta,
.lib-main .muted {
  overflow-wrap: anywhere;
}
.lib-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.lib-batches {
  display: grid;
  gap: 8px;
}
.lib-batch {
  border: 1px solid var(--border);
  border-radius: var(--r, 10px);
  padding: 10px 14px;
}
.lib-batch summary {
  cursor: pointer;
  list-style: none;
  display: flex;
}
.lib-batch summary::-webkit-details-marker {
  display: none;
}
.lib-batch-name {
  font-weight: 600;
}
.lib-batch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 4px;
}
.lib-search {
  margin-bottom: 8px;
}
.lib-upload {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
button.danger {
  color: var(--danger);
}
.translate {
  display: grid;
  gap: 8px;
  margin-top: var(--s4, 16px);
  padding-top: var(--s4, 16px);
  border-top: 1px solid var(--border);
}
.translate-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.batch-name {
  margin-bottom: var(--s3, 12px);
}
@media (max-width: 640px) {
  .lib-row {
    flex-direction: column;
    align-items: stretch;
  }
  .lib-actions {
    flex-wrap: wrap;
  }
}

/* In the app and the plugin (a web view): the page is the app. */
.in-app #download,
.in-app .footer .cta,
.in-app .skip {
  display: none !important;
}

/* ---------- The footer, under the content ---------- */

.footer {
  width: min(100% - 64px, 980px);
}
.footer-legal {
  display: flex;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  flex-wrap: wrap;
  margin-top: var(--s3);
  padding: 0 var(--s1);
}
.footer-legal a {
  color: var(--muted);
}
@media (max-width: 639px) {
  .footer {
    width: min(100% - 32px, 980px);
  }
}

/* ---------- Settings ---------- */

/* Two columns on a wide window; the cards flow down each column, so short ones leave no holes. */
.settings-grid {
  columns: 2 360px;
  column-gap: var(--s4);
}
.settings-grid > .card {
  gap: var(--s3);
  break-inside: avoid;
  margin-bottom: var(--s4);
}
.account-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
}
.account-who {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.account-who b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.balance {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.balance-value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.balance-unit {
  color: var(--muted);
  font-weight: 550;
}
.redeem {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: var(--s3);
  border-top: 1px solid var(--border);
}
.input-row {
  display: flex;
  gap: var(--s2);
}
.input-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  text-transform: uppercase;
}
.input-row input::placeholder {
  text-transform: none;
  font-family: inherit;
}
.ok-text {
  color: var(--success);
  font-weight: 550;
}
details.history {
  border-top: 1px solid var(--border);
  padding-top: var(--s3);
}
details.history > summary {
  font-size: 0.875rem;
  font-weight: 560;
}
.credit-log {
  margin-top: var(--s3);
}
.checks {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--text-2);
}
.checks li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.checks .icon {
  margin-top: 2px;
  color: var(--success);
}
.yours-card {
  background:
    linear-gradient(160deg, var(--success-soft), transparent 60%),
    var(--surface);
}
.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s2) 0;
}
.pref-row + .pref-row {
  border-top: 1px solid var(--border);
  padding-top: var(--s3);
}
.pref-row > div:first-child {
  flex: 1 1 220px;
}
.legal-links {
  display: flex;
  gap: var(--s4);
  flex-wrap: wrap;
}
.legal-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---------- Admin ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sunken);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 560;
  white-space: nowrap;
}
.pill.ok {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}
.pill.warn {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning);
}
.pill.accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.pill.off {
  color: var(--muted);
  text-decoration: line-through;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: var(--s3) var(--s4);
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.list-bar {
  display: flex;
  align-items: center;
  gap: var(--s2) var(--s3);
  flex-wrap: wrap;
}
.list-bar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
}
.data-wrap {
  overflow-x: auto;
  margin: 0 calc(var(--s5) * -1);
  padding: 0 var(--s5);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
table.data td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tr:last-child td {
  border-bottom: none;
}
table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.data tr.open > td {
  background: var(--accent-softer);
}
table.data tr.detail > td {
  padding: 0;
  background: var(--surface-2);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.who .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}
.who-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.who-email {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.chips-inline {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.detail-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--s4) var(--s5);
  padding: var(--s4) var(--s4) var(--s5);
}
.detail-body h3 {
  margin-bottom: var(--s2);
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.feature-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px var(--s3);
  padding: 6px 0;
  font-size: 0.875rem;
}
.feature-row + .feature-row {
  border-top: 1px solid var(--border);
}
.feature-row .muted {
  display: block;
  font-size: 0.75rem;
}
.feature-row > span:first-child {
  flex: 1 1 180px;
  min-width: 0;
}
.feature-row > .segmented {
  flex: none;
  overflow: visible;
}
.topup {
  display: grid;
  grid-template-columns: minmax(0, 96px) minmax(0, 1fr) auto;
  gap: var(--s2);
  align-items: center;
}
@media (max-width: 520px) {
  .topup {
    grid-template-columns: 1fr;
  }
}
.mini-log {
  display: grid;
  gap: 4px;
  margin: var(--s3) 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
}
.mini-log li {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
}
.amount-plus {
  color: var(--success);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.amount-minus {
  color: var(--danger);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
code.code {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--sunken);
  white-space: nowrap;
}
.code-made {
  display: flex;
  align-items: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s3) var(--s4);
  border: 1px dashed color-mix(in srgb, var(--success) 50%, transparent);
  border-radius: var(--r);
  background: var(--success-soft);
}
.code-made code {
  font-size: 1.125rem;
  padding: 2px 8px;
  background: var(--surface);
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--s6) var(--s4);
  color: var(--muted);
  text-align: center;
}
.empty-state .icon {
  width: 28px;
  height: 28px;
  color: var(--border-strong);
}
.empty-state b {
  color: var(--text);
}
/* A switch: a checkbox that looks like the toggles of macOS and iOS. */
input.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: none;
  min-height: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color 0.15s;
}
input.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}
input.switch:checked {
  background: var(--success);
}
input.switch:checked::after {
  transform: translateX(14px);
}
/* "Wwise folders" and its switch, next to the sample rate of downloads. */
.lib-rate {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}
.wwise-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--s2);
}
.radio-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
}
.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-softer);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.radio-card input[type="radio"] {
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 3px 0 0;
  padding: 0;
  box-shadow: none;
  accent-color: var(--accent);
}
.radio-card span {
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
}
.example {
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  background: var(--sunken);
  font-size: 0.8125rem;
  color: var(--text-2);
}
.save-bar {
  position: sticky;
  bottom: var(--s3);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
@media (max-width: 640px) {
  .data-wrap {
    margin: 0 calc(var(--s4) * -1);
    padding: 0 var(--s4);
  }
  table.data.stack-sm thead {
    display: none;
  }
  table.data.stack-sm tr:not(.detail) {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px var(--s3);
    padding: var(--s3) 0;
    border-bottom: 1px solid var(--border);
  }
  table.data.stack-sm tr:not(.detail) > td {
    padding: 0;
    border: none;
  }
  table.data.stack-sm tr:not(.detail) > td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font-size: 0.75rem;
  }
  table.data.stack-sm td.first {
    grid-column: 1 / -1;
  }
  table.data.stack-sm td.num {
    text-align: left;
  }
  table.data.stack-sm tr.detail {
    display: block;
  }
  table.data.stack-sm tr.detail > td {
    display: block;
  }
}

/* ---------- The legal pages (src/legal.ts) ---------- */

.legal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 60px;
  padding: 0 max(16px, calc((100% - 820px) / 2));
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
}
.legal-nav {
  display: flex;
  align-items: center;
  gap: var(--s4);
  font-size: 0.875rem;
}
.legal-nav a:not(.button) {
  color: var(--muted);
  text-decoration: none;
}
.legal-nav a[aria-current] {
  color: var(--text);
  font-weight: 600;
}
main.legal {
  width: min(100% - 32px, 760px);
  margin: var(--s6) auto;
  flex: 1;
}
.legal-doc {
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1.65;
}
.legal-doc h1 {
  margin: 4px 0 var(--s4);
  color: var(--text);
  font-size: 2.25rem;
}
.legal-doc h2 {
  margin: var(--s6) 0 var(--s2);
  color: var(--text);
  font-size: 1.1875rem;
  scroll-margin-top: 80px;
}
.legal-doc p,
.legal-doc ul {
  margin: 0 0 var(--s3);
}
.legal-doc ul {
  padding-left: 1.25em;
}
.legal-doc li + li {
  margin-top: 6px;
}
.legal-doc b {
  color: var(--text);
}
.legal-doc .lead {
  max-width: none;
  font-size: 1.125rem;
}
.legal-kicker {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.legal-highlight {
  margin: var(--s5) 0;
  padding: var(--s4) var(--s5);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  border-radius: var(--r-lg);
  background: var(--success-soft);
}
.legal-highlight h2 {
  margin: 0 0 var(--s2);
}
.legal-highlight ul {
  margin: 0;
}
.consent-quote {
  margin: var(--s3) 0;
  padding: var(--s3) var(--s4);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--accent-softer);
  color: var(--text);
  font-weight: 500;
}
.legal-table {
  overflow-x: auto;
  margin: var(--s3) 0 var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.legal-table table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.5;
}
.legal-table th,
.legal-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.legal-table th {
  background: var(--sunken);
  color: var(--text);
  font-weight: 600;
}
.legal-table tr:last-child td {
  border-bottom: none;
}
mark.todo {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 600;
}
.legal-foot {
  display: flex;
  justify-content: center;
  gap: var(--s4);
  flex-wrap: wrap;
  padding: var(--s5) 16px var(--s6);
  border-top: 1px solid var(--border);
}
@media (max-width: 560px) {
  .legal-head .brand-name,
  .legal-nav .button {
    display: none;
  }
  .legal-doc h1 {
    font-size: 1.75rem;
  }
}

/* ---------- In the app (the web view of the macOS app and the plugin) ---------- */
/* The page is the app: macOS sizes (13 px text), a source-list sidebar, the arrow cursor, no selection of chrome. */

.in-app body {
  font-size: 13px;
}
.in-app .sidebar {
  background: var(--app-sidebar, #f1f1f3);
  -webkit-user-select: none;
  user-select: none;
  padding-top: 12px;
}
.in-app .side-nav a,
.in-app .user-button,
.in-app button,
.in-app .button,
.in-app summary,
.in-app label {
  cursor: default;
}
.in-app .side-nav a {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}
.in-app .side-nav a[aria-current] {
  background: rgb(0 0 0 / 0.08);
  color: var(--text);
}
.in-app .nav-sub a {
  min-height: 26px;
}
.in-app .credit-box {
  background: rgb(255 255 255 / 0.55);
}
.in-app main.content {
  margin-top: var(--s5);
}
.in-app .page-title h1 {
  font-size: 1.375rem;
}
.in-app .card {
  border-radius: 10px;
  padding: 18px 20px;
}
.in-app .footer {
  margin-bottom: var(--s4);
}
@media (prefers-color-scheme: dark) {
  .in-app:not([data-theme="light"]) .sidebar {
    --app-sidebar: #232428;
  }
  .in-app:not([data-theme="light"]) .side-nav a[aria-current] {
    background: rgb(255 255 255 / 0.1);
  }
  .in-app:not([data-theme="light"]) .credit-box {
    background: rgb(255 255 255 / 0.04);
  }
}
.in-app[data-theme="dark"] .sidebar {
  --app-sidebar: #232428;
}
.in-app[data-theme="dark"] .side-nav a[aria-current] {
  background: rgb(255 255 255 / 0.1);
}

/* ---------- The device login (prata login, Claude) ---------- */
main.device {
  display: grid;
  place-items: center;
  flex: 1;
  padding: var(--s5) var(--s4) var(--s7);
}
.device-card {
  width: min(100%, 460px);
  padding: var(--s6);
  gap: var(--s4);
  text-align: center;
  align-items: center;
}
.device-card h1 {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.3;
}
.device-card .checks {
  text-align: left;
  width: 100%;
}
.device-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.device-icon .icon {
  width: 26px;
  height: 26px;
}
.device-icon.ok {
  background: var(--success-soft);
  color: var(--success);
}
.device-code {
  margin: 0;
  padding: var(--s3) var(--s5);
  border-radius: var(--r);
  background: var(--sunken);
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  user-select: all;
}
.device-actions {
  justify-content: center;
  width: 100%;
}
.device-actions button {
  min-width: 120px;
}

/* ---------- Plans (Settings) ---------- */
.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s3);
}
.plan {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.plan.current {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
}
.plan-price small {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}
.plan button {
  margin-top: auto;
}
.subscription {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  background: var(--accent-softer);
  border: 1px solid var(--accent-soft);
}

/* ---------- Use with Claude (Settings) ---------- */
.claude-prompt {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--sunken);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.steps {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: var(--s1);
}

/* ---------- Money next to credits (Admin) ---------- */
.money {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mini-log .money,
.field-help .money {
  display: inline;
}

/* ---------- The preview of an email, before it is sent ---------- */
.email-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px -12px rgb(16 24 40 / 0.35);
}
.email-dialog::backdrop {
  background: rgb(10 12 16 / 0.5);
}
.email-dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s5);
}
.email-dialog h2 {
  margin: 0;
  font-size: 1.125rem;
}
.email-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s1) var(--s3);
  margin: 0;
  font-size: 0.875rem;
}
.email-meta dt {
  color: var(--muted);
}
.email-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.email-frame {
  width: 100%;
  height: min(58dvh, 620px);
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #f6f7f9;
}
.email-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-end;
  align-items: center;
}
.email-dialog-actions .grow {
  flex: 1;
}
.card-title .icon {
  width: 18px;
  height: 18px;
  margin-right: var(--s2);
  vertical-align: -3px;
  color: var(--accent);
}
.sub-title {
  margin: var(--s2) 0 0;
  font-size: 0.9375rem;
}

/* The welcome page: each language and its ready voices. */
.languages {
  margin-top: var(--s1);
}
.languages h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.languages ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
  gap: 6px 16px;
}
.languages li {
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
  min-width: 0;
}
.languages li b {
  color: var(--text);
  font-weight: 600;
}
.languages li span {
  color: var(--muted);
  font-size: 0.8125rem;
}

/* The previews of the ready voices (previews.ts): a chip for each name, and a round button next to the speaker. */
.voice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.voice-chip {
  min-height: 26px;
  padding: 0 9px 0 7px;
  gap: 5px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  box-shadow: none;
}
.voice-chip svg {
  width: 10px;
  height: 10px;
}
.voice-chip:hover:not(:disabled) {
  color: var(--text);
}
.voice-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.select-play {
  display: flex;
  gap: 8px;
  align-items: center;
}
.select-play select {
  flex: 1;
  min-width: 0;
}
.select-play .play {
  flex: none;
}

/* ---------- Home: the start checklist and the links ---------- */
.home {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  max-width: 760px;
}
.start {
  gap: var(--s3);
}
.start-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}
.start-head .card-title {
  margin: 0;
}
.start-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
}
.start-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width 0.3s ease;
}
.start-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.start-step {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
}
.start-step[data-open] {
  background: var(--surface);
  border-color: var(--border-strong);
}
.start-step-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: var(--s3) var(--s4);
  border: 0;
  border-radius: inherit;
  background: none;
  box-shadow: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  font-weight: 400;
  justify-content: flex-start;
  white-space: normal;
  min-height: 0;
  height: auto;
  cursor: pointer;
}
.start-step-head:hover:not(:disabled) {
  background: var(--hover);
}
.start-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 650;
}
.start-step[data-done] .start-mark {
  border-color: transparent;
  background: var(--success);
  color: #fff;
}
.start-mark .icon {
  width: 16px;
  height: 16px;
}
.start-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.start-step[data-done] .start-text b {
  color: var(--text-2);
}
.start-chevron {
  flex: none;
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.start-step[data-open] .start-chevron {
  transform: rotate(90deg);
}
.start-body {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: 0 var(--s4) var(--s4) calc(var(--s4) + 28px + var(--s3));
  color: var(--text-2);
}
.start-body[hidden] {
  display: none;
}
.mac-only {
  margin: 0;
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  background: var(--warning-soft);
  color: var(--warning);
}
.home-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--s3);
}
.home-link {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
}
.home-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.home-link > .icon {
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}
.home-link > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-title.with-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}
.card-title.with-pill > span:first-child {
  display: inline-flex;
  align-items: center;
}
.card-title .pill .icon {
  width: 12px;
  height: 12px;
  margin: 0;
  vertical-align: 0;
  color: inherit;
}
@media (max-width: 640px) {
  .start-body {
    padding-left: var(--s4);
  }
}

/* ---------- Team (Settings) ---------- */
.team-head {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.team-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
}
.team-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.team-who b {
  font-weight: 500;
  overflow-wrap: anywhere;
}
.team-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-left: auto;
}

/* The Reviews card of the Library, before the first review (library.tsx, ReviewsStart). */
.lib-review-start {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
}
.lib-review-start ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-2);
}
.lib-review-prompt {
  margin: 0;
  padding: var(--s2) var(--s3);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-softer);
  font-size: 0.875rem;
  color: var(--text);
}

/* The link of a review that "Share for review" made on a batch (library.tsx, SharedLink). */
.lib-shared {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin: var(--s2) 0;
  padding: var(--s3);
  border-radius: var(--r);
  background: var(--success-soft);
}
.lib-shared p {
  margin: 0;
}
.lib-shared input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
