/* Enjoyer HQ — a control panel in glass.
   Tokens follow shadcn/ui naming (background, card, muted, border, ring…) so components read the same way. */
:root {
  --background: #07080d;
  --foreground: #eceef3;
  --card: rgba(15, 17, 26, .6);
  --card-hi: rgba(255, 255, 255, .06);
  --popover: rgba(16, 18, 26, .94);
  --muted: rgba(255, 255, 255, .05);
  --muted-foreground: rgba(220, 224, 235, .6);
  --faint: rgba(220, 224, 235, .36);
  --secondary: rgba(255, 255, 255, .08);
  --secondary-hover: rgba(255, 255, 255, .13);
  --accent-bg: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .17);
  --input: rgba(6, 7, 12, .55);
  --ring: #8fa9cc;
  --blur: blur(22px) saturate(165%);

  /* the two sides of every argument */
  --warm: #e0915f;
  --rose: #c9784c;
  --cyan: #9db4d4;
  --violet: #8794b4;
  --primary: linear-gradient(180deg, #e69a6a, #d9864f);
  --primary-foreground: #1d0f06;
  --grad-cool: linear-gradient(90deg, #7f9cc0, #94a9c8);
  --grad-holo: linear-gradient(90deg, #e0915f, #e0915f);

  --ok: #7cc79a;
  --warn: #d9b65e;
  --bad: #e07a7a;
  --blue: #8fb3d9;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 8px;
  --side: 236px;
  --top: 56px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scrollbar-color: rgba(255, 255, 255, .16) transparent; }
body {
  margin: 0; min-height: 100vh; color: var(--foreground); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60vw 50vh at 15% 85%, rgba(190, 115, 75, .2), transparent 70%),
    radial-gradient(55vw 50vh at 85% 15%, rgba(90, 108, 150, .24), transparent 70%),
    var(--background);
  background-attachment: fixed;
}
::selection { background: rgba(224, 145, 95, .35); }
button, input, select, textarea { font: inherit; color: inherit; }
textarea.code, code, pre, kbd { font-family: var(--mono); }
textarea.code { font-size: 13px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .13); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .24); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* fields show focus with their own ring (box-shadow), never a second outline */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; opacity: 0; transition: opacity 1.6s var(--ease); }
#scene.ready { opacity: 1; }
.veil { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, rgba(4, 5, 9, .45), transparent 40%), radial-gradient(120% 90% at 60% 40%, transparent 55%, rgba(4, 5, 9, .5) 100%); }

/* --- glass: one recipe for every floating surface ------------------------------------ */
.sidebar, .panel, .card, .idea, .toast {
  position: relative;
  background: linear-gradient(160deg, var(--card-hi), rgba(255, 255, 255, .01) 55%), var(--card);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 20px 50px -30px rgba(0, 0, 0, .9);
}
/* lit edge: bright where the light hits, almost gone elsewhere */
.sidebar::before, .panel::before, .card::before, .idea::before, .toast::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(155deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .07) 30%, rgba(255, 255, 255, .04) 65%, rgba(135, 150, 185, .22));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* --- shell: sidebar + workspace ----------------------------------------------------------- */
.sidebar {
  position: fixed; z-index: 6; top: 12px; bottom: 12px; left: 12px; width: calc(var(--side) - 12px);
  display: flex; flex-direction: column; gap: 18px; padding: 16px 12px 12px; border-radius: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; font-weight: 750; font-size: 16px; letter-spacing: -.03em; white-space: nowrap; }
.brand span { margin-left: -5px; color: var(--warm); }
.brand .logo { width: 24px; height: 24px; flex: none; border-radius: 6px; }
.orb {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, #e0915f, #7f9cc0, #e0915f);
  box-shadow: inset 0 0 0 3px rgba(7, 8, 13, .6);
  animation: spin 9s linear infinite;
}
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 500; color: var(--faint); padding: 12px 10px 6px; }
.nav-label:first-of-type { padding-top: 0; }
.nav button {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; width: 100%; height: 36px;
  background: none; border: 0; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  color: var(--muted-foreground); font-weight: 500; transition: color .25s var(--ease), background .25s;
}
.nav button:hover { color: var(--foreground); background: rgba(255, 255, 255, .04); }
.nav button.active { color: var(--foreground); background: none; }
.nav svg, .motion-toggle svg, .icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav button.active svg { color: var(--warm); }
.nav .ind {
  position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: transform .45s var(--spring), width .45s var(--spring), height .45s var(--spring);
}
.nav .ind::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--primary); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.status { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 99px;
  background: var(--muted); color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--border);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.pill.on { color: var(--ok); }
.pill.on::before { background: var(--ok); animation: pulse 2.4s ease-in-out infinite; }
.pill.mock { color: var(--warn); }
.pill.mock::before { background: var(--warn); }
.motion-toggle {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: none; color: var(--muted-foreground); font-size: 12px; transition: all .25s var(--ease);
}
.motion-toggle:hover { color: var(--foreground); background: rgba(255, 255, 255, .04); }
.motion-toggle.on svg { color: var(--cyan); }
.motion-toggle.on svg circle:last-child { animation: pulse 2.4s ease-in-out infinite; transform-origin: center; }

.workspace { padding-left: var(--side); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 5; height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(7, 8, 13, .7), rgba(7, 8, 13, .25));
  -webkit-mask: linear-gradient(#000 75%, transparent); mask: linear-gradient(#000 75%, transparent);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-foreground); min-width: 0; }
.crumbs a, .crumbs button { color: inherit; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; transition: color .2s; }
.crumbs a:hover, .crumbs button:hover { color: var(--foreground); }
.crumbs .sep { color: var(--faint); }
.crumbs .here { color: var(--foreground); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main { padding: 4px 24px 80px; max-width: 1480px; }

/* --- page header ------------------------------------------------------------------------ */
h2 { font-size: 22px; font-weight: 650; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.025em; }
.sub { color: var(--muted-foreground); margin: 0 0 18px; font-size: 14px; max-width: 80ch; }
.sub b { color: var(--foreground); font-weight: 600; }

/* view entrance: a quick staggered rise when navigating */
#view[data-enter] > * { animation: rise .55s var(--ease) backwards; }
#view[data-enter] > :nth-child(2) { animation-delay: .04s; }
#view[data-enter] > :nth-child(3) { animation-delay: .08s; }
#view[data-enter] > :nth-child(n+4) { animation-delay: .12s; }
#view[data-enter] .grid > *, #view[data-enter] .idea-list > * { animation: rise .55s var(--ease) backwards; }
#view[data-enter] .grid > :nth-child(2), #view[data-enter] .idea-list > :nth-child(2) { animation-delay: .1s; }
#view[data-enter] .grid > :nth-child(3), #view[data-enter] .idea-list > :nth-child(3) { animation-delay: .14s; }
#view[data-enter] .grid > :nth-child(4), #view[data-enter] .idea-list > :nth-child(4) { animation-delay: .18s; }
#view[data-enter] .grid > :nth-child(n+5), #view[data-enter] .idea-list > :nth-child(n+5) { animation-delay: .22s; }

/* --- button (default = secondary; .primary, .outline, .ghost, .danger; .small, .icon-btn) ---- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px;
  background: var(--secondary); border: 0; border-radius: var(--radius-sm); padding: 0 14px; cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--border), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform .3s var(--spring), background .2s, box-shadow .2s, color .2s;
}
.btn:hover { background: var(--secondary-hover); box-shadow: inset 0 0 0 1px var(--border-strong), inset 0 1px 0 rgba(255, 255, 255, .1); }
.btn:active { transform: scale(.97); transition-duration: .08s; }
.btn.primary {
  background: var(--primary); color: var(--primary-foreground); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -1px 0 rgba(90, 40, 10, .22), 0 8px 22px -10px rgba(200, 120, 70, .8);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 10px 28px -10px rgba(200, 120, 70, .95); }
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .8s var(--ease);
}
.btn.primary::after { z-index: 0; mix-blend-mode: overlay; }
.btn.primary:hover::after { transform: translateX(120%); }
.btn.outline { background: transparent; }
.btn.outline:hover { background: var(--accent-bg); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: rgba(224, 122, 122, .12); box-shadow: inset 0 0 0 1px rgba(224, 122, 122, .4); }
/* destructive: the one solid red, only on confirm buttons that delete */
.btn.destructive { background: #b8504a; color: #fff1e4; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.destructive:hover { background: #c45a53; }
.btn.ghost { background: none; box-shadow: none; color: var(--muted-foreground); }
.btn.ghost:hover { color: var(--foreground); background: var(--accent-bg); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon-btn { width: 30px; height: 30px; padding: 0; }
.btn.on { color: var(--cyan); background: rgba(157, 180, 212, .1); box-shadow: inset 0 0 0 1px rgba(157, 180, 212, .45); }
.btn:disabled { cursor: progress; opacity: .7; transform: none; }
.btn:disabled::after { transform: none; animation: sweep 1.1s linear infinite; }

/* --- inputs ------------------------------------------------------------------------------- */
input, select, textarea {
  height: 36px; background: var(--input); border: 0; border-radius: var(--radius-sm); padding: 0 12px; outline: none; min-width: 0; font-size: 14px;
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow .2s, background .2s;
}
textarea { height: auto; padding: 9px 12px; width: 100%; resize: vertical; line-height: 1.55; }
input:hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
input:focus, select:focus, textarea:focus { background-color: rgba(8, 9, 15, .75); box-shadow: inset 0 0 0 1px rgba(157, 180, 212, .55), 0 0 0 3px rgba(157, 180, 212, .14); }
input::placeholder, textarea::placeholder { color: var(--faint); }
/* select: native menu, shadcn trigger (own chevron, room for it) */
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 34px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b0c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
}
select:hover { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eceef3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
optgroup { font-weight: 600; color: var(--muted-foreground); }
option, optgroup { background: #12141c; color: var(--foreground); }
/* checkbox: shadcn square with a drawn check */
input[type=checkbox] {
  -webkit-appearance: none; appearance: none; flex: none; width: 16px; height: 16px; margin: 0; padding: 0; border-radius: 4px; cursor: pointer;
  background: var(--input) center / 12px no-repeat; box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background-color .15s, box-shadow .15s;
}
input[type=checkbox]:hover { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
input[type=checkbox]:checked {
  background-color: var(--warm); box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231d0f06' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
input[type=checkbox]:focus-visible { box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px rgba(157, 180, 212, .3); }
input[type=checkbox]:focus { background-color: var(--input); }
input[type=checkbox]:checked:focus { background-color: var(--warm); }
label:has(> input[type=checkbox]) { cursor: pointer; user-select: none; }
/* number: no spinner arrows */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=datetime-local] { color-scheme: dark; }
input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; filter: invert(.85); }
input::-webkit-calendar-picker-indicator:hover { opacity: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; padding: 0; height: 20px; background: none; box-shadow: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -5px; border-radius: 50%; background: #ecd6c6;
  box-shadow: 0 0 0 4px rgba(135, 150, 185, .25), 0 0 14px rgba(135, 150, 185, .8); transition: transform .3s var(--spring);
}
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #ecd6c6; box-shadow: 0 0 14px rgba(135, 150, 185, .8); }
input[type=range]:hover::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]:focus { box-shadow: none; background: none; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted-foreground); font-weight: 500; }
kbd { font-size: 11px; padding: 1px 5px; border-radius: 5px; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border), inset 0 -1px 0 var(--border); color: var(--muted-foreground); }

/* --- layout primitives ---------------------------------------------------------------------- */
.panel { border-radius: var(--radius-lg); padding: 16px; }
.panel + .panel { margin-top: 12px; }
.panel-title { font-size: 13px; color: var(--foreground); font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; letter-spacing: -.005em; }
.panel-title .meta { font-weight: 400; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 160px; }
.stack { display: grid; gap: 12px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.meta { font-size: 12px; color: var(--muted-foreground); }
.spacer { margin-left: auto; }
.empty { color: var(--muted-foreground); padding: 36px; text-align: center; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--border); background: rgba(255, 255, 255, .02); }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { margin: 0; }

/* badge */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: 6px;
  background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); white-space: nowrap;
}
.chip button { background: none; border: 0; color: var(--muted-foreground); cursor: pointer; padding: 0 0 0 3px; font-size: 14px; line-height: 1; transition: color .2s, transform .3s var(--spring); }
.chip button:hover { color: var(--bad); transform: scale(1.3); }
.chip.hidden-card { color: var(--muted-foreground); background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 6px, transparent 6px 12px); }
.chip.draft { color: var(--muted-foreground); }
.chip.scheduled, .chip.live, .chip.done, .chip.failed { gap: 6px; }
.chip.scheduled::before, .chip.live::before, .chip.done::before, .chip.failed::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.scheduled { color: var(--warm); box-shadow: inset 0 0 0 1px rgba(224, 145, 95, .35); }
.chip.live { color: var(--ok); box-shadow: inset 0 0 0 1px rgba(124, 199, 154, .35); }
.chip.live::before { animation: pulse 1.6s ease-in-out infinite; }
.chip.done { color: var(--blue); box-shadow: inset 0 0 0 1px rgba(143, 179, 217, .3); }
.chip.failed { color: var(--bad); box-shadow: inset 0 0 0 1px rgba(224, 122, 122, .35); }
.chip.warm { color: #ecc2a4; background: rgba(224, 145, 95, .12); box-shadow: inset 0 0 0 1px rgba(224, 145, 95, .28); }
.chip.cool { color: #c4cde0; background: rgba(135, 150, 185, .13); box-shadow: inset 0 0 0 1px rgba(135, 150, 185, .3); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* segmented tabs (shadcn Tabs) */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius); background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1px var(--border); }
.seg button { height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--muted-foreground); cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: all .2s var(--ease); }
.seg button:hover { color: var(--foreground); }
.seg button.on { color: var(--foreground); background: rgba(255, 255, 255, .1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 2px 8px -2px rgba(0, 0, 0, .6); }
.seg .n { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* --- cards: tilt toward the pointer (vars set in app.js) ----------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; perspective: 1200px; }
.card {
  border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: left;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transition: transform .6s var(--ease), box-shadow .4s var(--ease);
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .1), transparent 45%);
}
button.card { cursor: pointer; border: 0; }
button.card:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 26px 60px -26px rgba(0, 0, 0, .95); }
button.card:hover::after { opacity: 1; }
button.card.tilting { transition: transform .12s linear, box-shadow .4s var(--ease); }
.card h3 { margin: 0; font-size: 15px; line-height: 1.3; letter-spacing: -.015em; font-weight: 600; }
.err { color: var(--bad); font-size: 12px; }
.warn { color: var(--warn); font-size: 12px; }

/* --- Ideas ---------------------------------------------------------------------------------- */
.ideas-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 16px; align-items: start; }
.roll { display: grid; gap: 12px; margin-bottom: 14px; }
.roll .dice { width: 18px; height: 18px; transition: transform .6s var(--spring); }
.roll .btn.primary:hover .dice { transform: rotate(90deg); }
.roll .btn.primary:disabled .dice { animation: spin .7s linear infinite; }
.idea-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.idea-list { display: grid; gap: 10px; }
.idea { border-radius: var(--radius-lg); padding: 14px 16px; display: grid; gap: 8px; transition: transform .35s var(--ease), opacity .35s var(--ease), box-shadow .3s; }
.idea:hover { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 22px 50px -28px rgba(0, 0, 0, .95); }
.idea.liked::after { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: var(--primary); }
.idea.disliked { opacity: .55; }
.idea.used { opacity: .78; }
.idea.leaving { opacity: 0; transform: translateX(24px) scale(.98); }
.idea h3 { margin: 0; font-size: 16px; font-weight: 620; letter-spacing: -.02em; line-height: 1.3; }
.idea .pitch { margin: 0; line-height: 1.55; color: rgba(238, 241, 255, .92); }
.idea .hook { margin: 0; font-size: 13px; color: var(--muted-foreground); display: flex; gap: 6px; }
.idea .hook::before { content: "⚔"; color: var(--warm); }
.idea .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding-top: 2px; }
.vote { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(0, 0, 0, .25); box-shadow: inset 0 0 0 1px var(--border); }
.vote button { width: 30px; height: 26px; border: 0; border-radius: 7px; background: none; cursor: pointer; color: var(--muted-foreground); display: grid; place-items: center; transition: all .25s var(--spring); }
.vote button:hover { color: var(--foreground); background: rgba(255, 255, 255, .07); transform: translateY(-1px); }
.vote .down svg { transform: scaleY(-1); }
.vote button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vote button.up.on { color: #1d0f06; background: var(--primary); }
.vote button.down.on { color: var(--bad); background: rgba(224, 122, 122, .15); }
.vote button.on svg { fill: currentColor; fill-opacity: .25; }
.vote button:active { transform: scale(.85); }

/* writers' room: a console */
.console { position: sticky; top: calc(var(--top) + 4px); height: calc(100vh - var(--top) - 20px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.console .head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; box-shadow: inset 0 -1px 0 var(--border); }
.console .head b { font-weight: 600; font-size: 13px; }
.console .dots { display: flex; gap: 5px; margin-right: 4px; }
.console .dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.console .dots i:first-child { background: var(--warm); }
.log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: rgba(4, 5, 9, .35); }
.line { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; animation: pop .35s var(--ease) both; }
.line .p { color: var(--faint); user-select: none; }
.line.user .p { color: var(--warm); }
.line.user .body { color: #f0d2bf; white-space: pre-wrap; word-wrap: break-word; }
.line.writer .p { color: var(--cyan); }
.line.sys .body { color: var(--faint); }
.line.err .body { color: var(--bad); }
.md { word-wrap: break-word; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 18px; }
.md li { margin: 2px 0; }
.md strong { color: #fff; }
.md code { background: rgba(255, 255, 255, .08); padding: 0 4px; border-radius: 4px; }
.line .idea { font-family: "Geist", ui-sans-serif, system-ui, sans-serif; font-size: 13px; margin-top: 10px; padding: 12px; }
.line .idea h3 { font-size: 14px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; color: var(--muted-foreground); }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); animation: blink 1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }
.suggest { display: flex; gap: 6px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.suggest button { flex: none; height: 26px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted-foreground); cursor: pointer; font-size: 12px; transition: all .2s; }
.suggest button:hover { color: var(--foreground); background: var(--secondary-hover); }
.prompt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: end; margin: 10px 12px 12px; padding: 6px 6px 6px 12px; border-radius: var(--radius); background: var(--input); box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow .2s; }
.prompt:focus-within { box-shadow: inset 0 0 0 1px rgba(157, 180, 212, .55), 0 0 0 3px rgba(157, 180, 212, .14); }
.prompt .p { font-family: var(--mono); color: var(--warm); padding-bottom: 7px; }
.prompt textarea { font-family: var(--mono); font-size: 13px; background: none; box-shadow: none; padding: 6px 0; resize: none; max-height: 160px; }
.prompt textarea:focus { box-shadow: none; background: none; }
.console .foot { display: flex; gap: 12px; padding: 0 14px 10px; font-size: 11px; color: var(--faint); }

/* --- Episodes ------------------------------------------------------------------------------- */
.brief { display: grid; gap: 10px; margin-bottom: 20px; }
.brief textarea { font-size: 15px; padding: 12px 14px; }
.ep { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.chatbox { position: sticky; top: calc(var(--top) + 4px); display: flex; flex-direction: column; height: calc(100vh - var(--top) - 66px); padding: 0; overflow: hidden; }
.chatbox .head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; font-size: 13px; box-shadow: inset 0 -1px 0 var(--border); }
.chatbox .head::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 2.4s ease-in-out infinite; }
.chatbox .msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; animation: pop .45s var(--ease) both; }
.msg.user { align-self: flex-end; background: linear-gradient(140deg, rgba(224, 145, 95, .26), rgba(224, 145, 95, .18)); box-shadow: inset 0 0 0 1px rgba(224, 160, 120, .26); border-bottom-right-radius: 4px; }
.msg.producer { align-self: flex-start; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); border-bottom-left-radius: 4px; }
#typing { animation: pop .4s var(--ease) both, breathe 1.2s ease-in-out infinite; }
.chatbox form { display: flex; gap: 8px; padding: 10px; box-shadow: inset 0 1px 0 var(--border); }
.chatbox form textarea { resize: none; }

/* the producer: slides in from the right; on wide screens it docks and the page makes room */
:root { --drawer: 400px; }
.chatbox.drawer {
  position: fixed; z-index: 7; top: 12px; right: 12px; bottom: 12px; height: auto; width: var(--drawer); border-radius: 18px;
  transform: translateX(calc(100% + 24px)); opacity: 0; visibility: hidden;
  transition: transform .45s var(--ease), opacity .3s var(--ease), visibility 0s .45s;
}
.chatbox.drawer.open { transform: none; opacity: 1; visibility: visible; transition: transform .45s var(--ease), opacity .3s var(--ease); }
.chatbox.drawer .head .meta { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chatbox.drawer .head .btn { flex: none; }
.chatbox.drawer form .btn { margin-left: auto; }
.workspace { transition: padding-right .45s var(--ease); }
@media (min-width: 1280px) { body.drawer-open .workspace { padding-right: calc(var(--drawer) + 12px); } }
@media (max-width: 1279px) { .chatbox.drawer { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), -20px 0 60px -10px rgba(0, 0, 0, .85); background: var(--popover); } }
@media (max-width: 760px) { .chatbox.drawer { top: 8px; right: 8px; bottom: 8px; width: calc(100vw - 16px); } }

/* Telegram-ish thread, recoloured as a dark viewing glass */
.thread {
  background: radial-gradient(120% 80% at 0% 0%, rgba(135, 150, 185, .09), transparent 60%), radial-gradient(100% 80% at 100% 100%, rgba(255, 110, 90, .07), transparent 60%), rgba(6, 7, 12, .55);
  border-radius: 12px; padding: 16px; display: grid; gap: 10px; box-shadow: inset 0 0 0 1px var(--border), inset 0 10px 40px rgba(0, 0, 0, .3);
}
.tmsg { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: start; min-width: 0; }
.thread > * { min-width: 0; }
#take.fresh .thread > * { animation: rise .5s var(--ease) backwards; }
#take.fresh .thread > :nth-child(2) { animation-delay: .05s; }
#take.fresh .thread > :nth-child(3) { animation-delay: .1s; }
#take.fresh .thread > :nth-child(4) { animation-delay: .15s; }
#take.fresh .thread > :nth-child(5) { animation-delay: .2s; }
#take.fresh .thread > :nth-child(6) { animation-delay: .25s; }
#take.fresh .thread > :nth-child(7) { animation-delay: .3s; }
#take.fresh .thread > :nth-child(n+8) { animation-delay: .35s; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 17px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .2), rgba(255, 255, 255, .03) 60%), rgba(24, 27, 38, .8);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .13);
}
.bubble { background: rgba(30, 34, 46, .55); border-radius: 14px 14px 14px 4px; padding: 8px 12px 9px; max-width: 580px; position: relative; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07); }
.bubble.post { background: linear-gradient(150deg, rgba(224, 145, 95, .14), rgba(135, 150, 185, .12)), rgba(30, 32, 44, .6); box-shadow: inset 0 0 0 1px rgba(224, 160, 120, .22); }
.bubble .from { font-size: 13px; font-weight: 600; color: var(--cyan); display: flex; gap: 8px; align-items: baseline; }
.bubble .from .no { color: var(--faint); font-weight: 400; font-size: 11px; font-variant-numeric: tabular-nums; }
.bubble .quote { border-left: 2px solid var(--violet); padding-left: 8px; margin: 4px 0; font-size: 12px; color: #aab3c8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble .txt { white-space: pre-wrap; line-height: 1.5; word-wrap: break-word; }
.bubble .txt a { color: var(--cyan); }
.bubble .txt code, .bubble .txt pre { background: rgba(0, 0, 0, .35); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }
.bubble .txt pre { padding: 10px; overflow-x: auto; }
.bubble .txt blockquote { border-left: 3px solid var(--violet); margin: 4px 0; padding-left: 9px; }
.bubble .tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 3px; opacity: 0; transform: translateY(-3px); transition: all .2s var(--ease); pointer-events: none; }
.bubble:hover .tools { opacity: 1; transform: none; pointer-events: auto; }
.bubble .tools button { background: rgba(10, 11, 17, .85); border: 0; border-radius: 6px; cursor: pointer; padding: 3px 8px; font-size: 12px; box-shadow: inset 0 0 0 1px var(--border); }
.bubble .tools button:hover { background: rgba(157, 180, 212, .2); }
.reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 5px; }
.reacts span { font-size: 12px; background: rgba(135, 150, 185, .16); border-radius: 99px; padding: 1px 8px; box-shadow: inset 0 0 0 1px rgba(135, 150, 185, .28); }
.sys { text-align: center; font-size: 12px; color: #aab3c8; }
.sys span { background: rgba(255, 255, 255, .05); padding: 3px 11px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--border); }
.cut { margin-top: 7px; font-size: 12px; color: var(--warn); border-radius: 8px; padding: 6px 9px; display: grid; gap: 3px; background: rgba(217, 182, 94, .07); box-shadow: inset 0 0 0 1px rgba(217, 182, 94, .22); animation: pop .35s var(--ease) both; }
.cut .rivals { color: var(--muted-foreground); }
.livestate { font-size: 11px; color: var(--muted-foreground); margin-top: 3px; }
.livestate.sent { color: var(--ok); }
.livestate.error { color: var(--bad); }
.hiddenline { color: var(--muted-foreground); font-style: italic; }

/* --- Cast ------------------------------------------------------------------------------------ */
.tile { gap: 12px; }
.tile .face {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-size: 24px; line-height: 1; border-radius: 12px;
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .26), rgba(255, 255, 255, .03) 60%), rgba(24, 27, 38, .7);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 10px 22px -10px rgba(135, 150, 185, .7);
  transition: transform .6s var(--spring);
}
.tile:hover .face { transform: scale(1.08) rotate(-6deg); }
.tile .row { gap: 12px; }
.bars { display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 82px 1fr; gap: 10px; align-items: center; font-size: 11px; color: var(--muted-foreground); }
.bar i { display: block; height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .07); position: relative; overflow: hidden; }
.bar i b { position: absolute; inset: 0 auto 0 0; background: var(--primary); border-radius: 99px; transform-origin: left; animation: grow 1s var(--ease) both .15s; }
.bar:nth-child(2) i b { background: var(--grad-cool); }
.bar:nth-child(4) i b { background: var(--violet); }
.slider { display: grid; grid-template-columns: 140px 1fr 32px; gap: 14px; align-items: center; font-size: 13px; }
.slider b { font-variant-numeric: tabular-nums; text-align: right; color: var(--cyan); }
.off { opacity: .5; filter: saturate(.4); }

/* --- Deck ------------------------------------------------------------------------------------ */
.deckrow { display: grid; grid-template-columns: 56px 190px 110px 1fr auto; gap: 8px; align-items: center; padding: 3px; border-radius: 10px; transition: background .2s; }
.deckrow:hover { background: rgba(255, 255, 255, .025); }
.deckrow input[name=emoji] { font-size: 16px; text-align: center; }
.kind-head { margin: 18px 0 6px; font-size: 12px; color: var(--muted-foreground); font-weight: 600; display: flex; align-items: center; gap: 12px; text-transform: capitalize; }
.kind-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

table.check { border-collapse: collapse; width: 100%; font-size: 13px; }
table.check td, table.check th { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.check th { color: var(--muted-foreground); font-weight: 500; font-size: 12px; }

/* --- Usage ---------------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.stats .panel + .panel { margin-top: 0; }
.stat { display: grid; gap: 4px; padding: 14px 16px; }
.stat .label { font-size: 13px; color: var(--muted-foreground); font-weight: 500; }
.stat b { font-size: 26px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.usage-two { margin-bottom: 12px; }
.usage-two .panel + .panel { margin-top: 0; }
.acct { display: grid; gap: 7px; }
.acct + .acct { margin-top: 18px; }
.acct b { font-variant-numeric: tabular-nums; font-weight: 600; }
.meter { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.meter b { display: block; height: 100%; border-radius: 99px; background: var(--warm); transform-origin: left; animation: grow .9s var(--ease) both; }
.daychart { position: relative; height: 150px; display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; align-items: end; box-shadow: inset 0 -1px 0 var(--border); }
.day { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.day i { display: block; width: min(70%, 26px); border-radius: 4px 4px 0 0; background: var(--warm); opacity: .85; transform-origin: bottom; animation: rise-bar .8s var(--ease) both; transition: opacity .15s; }
.daychart:hover .day i { opacity: .45; }
.daychart .day.on i { opacity: 1; }
.dayaxis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }
.tip { position: absolute; top: 0; transform: translateX(-50%); display: grid; gap: 1px; padding: 7px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; pointer-events: none;
  background: var(--popover); box-shadow: inset 0 0 0 1px var(--border-strong), 0 10px 24px -10px rgba(0, 0, 0, .8); }
.tip[hidden] { display: none; }
.tip span:not(.meta) { font-variant-numeric: tabular-nums; }
.kinds { display: grid; gap: 8px; }
.kind { display: grid; grid-template-columns: 150px minmax(80px, 1fr) 72px 150px; gap: 12px; align-items: center; font-size: 13px; }
.kind i { display: block; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.kind i b { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--warm); transform-origin: left; animation: grow .9s var(--ease) both; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.models { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted-foreground); padding: 0 10px 8px; }
table.data td { padding: 9px 10px; box-shadow: inset 0 1px 0 var(--border); }
table.data th.num, table.data td.num { text-align: right; }
table.data tr[data-ep] { cursor: pointer; transition: background .15s; }
table.data tr[data-ep]:hover { background: rgba(255, 255, 255, .035); }
table.data tr.outside td { color: var(--muted-foreground); }
@keyframes rise-bar { from { transform: scaleY(0); } }
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kind { grid-template-columns: 110px 1fr 64px; }
  .kind .meta { display: none; }
  table.data { display: block; overflow-x: auto; }
}

/* --- On air ------------------------------------------------------------------------------------- */
.air { margin-bottom: 14px; }
.air .panel-title { gap: 8px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.lane + .lane { margin-top: 16px; padding-top: 14px; box-shadow: inset 0 1px 0 var(--border); }
.lane-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.lane-head a { color: var(--foreground); text-underline-offset: 2px; }
.lane-head .next { font-size: 12px; color: var(--warm); }
.lane-head .next b, .st b { font-variant-numeric: tabular-nums; font-weight: 600; }
.lane-err { margin: -2px 0 8px; }
.due { color: var(--warm); }
.bad { color: var(--bad); }
.air-table td { padding: 7px 8px; vertical-align: top; }
.air-table .who { width: 36px; color: var(--faint); }
.air-table .name { width: 170px; white-space: nowrap; }
.air-table .what { color: var(--muted-foreground); max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.air-table .when { width: 210px; white-space: nowrap; }
.air-table .acts { width: 150px; text-align: right; white-space: nowrap; }
.air-table .acts .btn { height: 26px; }
.air-table tr.sent .what { color: var(--foreground); }
.air-table tr.stopped, .air-table tr.done { opacity: .55; }
.st { font-size: 12.5px; }
.st.ok { color: var(--ok); }
.st.due { color: var(--warm); }
.st.bad { color: var(--bad); display: inline-block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.st.muted { color: var(--faint); }
@media (max-width: 1000px) { .air-table .name { width: auto; } .air-table .what { display: none; } }

/* --- Russian mirror & voice ------------------------------------------------------------------ */
.lang-tabs { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.notice { padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius); background: rgba(224, 145, 95, .08); box-shadow: inset 0 0 0 1px rgba(224, 145, 95, .25); color: var(--foreground); font-size: 13px; }
.linkish { background: none; border: 0; padding: 0; color: var(--warm); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chip.warnchip { color: var(--warn); background: rgba(217, 182, 94, .08); box-shadow: inset 0 0 0 1px rgba(217, 182, 94, .28); }
.ru-lines { display: grid; gap: 8px; margin-top: 12px; }
.ru-line { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border-radius: 12px; background: rgba(6, 7, 12, .4); box-shadow: inset 0 0 0 1px var(--border); }
.ru-line.edited { box-shadow: inset 0 0 0 1px rgba(143, 166, 196, .35); }
.ru-body { display: grid; gap: 4px; min-width: 0; }
.ru-body .from { font-size: 13px; font-weight: 600; color: var(--cyan); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ru-body .from .no { color: var(--faint); font-weight: 400; font-size: 11px; }
.ru-body .en { font-size: 12.5px; color: var(--faint); line-height: 1.45; }
.ru-body .ru { line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.ru-sys { font-size: 12px; color: var(--muted-foreground); padding: 2px 10px; }

/* translation editor: the English source always sits beside what you write */
.tr-panes { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.tr-panes > * { min-width: 0; }
.tr-panes [data-pane][hidden] { display: none; }
.pane-head { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 13px; color: var(--muted-foreground); font-weight: 500; }
.tr-source {
  height: 100%; min-height: 120px; padding: 9px 12px; border-radius: var(--radius); line-height: 1.55; white-space: pre-wrap; word-wrap: break-word;
  background: rgba(255, 255, 255, .025); box-shadow: inset 0 0 0 1px var(--border); color: var(--foreground); user-select: text;
}
.tr-source.raw { font-family: var(--mono); font-size: 13px; color: var(--muted-foreground); }
.tr-pane { display: grid; grid-template-rows: auto 1fr; gap: 6px; }
.tr-pane textarea { min-height: 120px; height: 100%; }
.seg.mini button { height: 22px; padding: 0 8px; font-size: 12px; }

.tr-lines { display: grid; gap: 10px; margin-top: 12px; }
.tr-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 0 10px; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.tr-line { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; align-items: start; padding: 10px; border-radius: 12px; background: rgba(6, 7, 12, .4); box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow .2s; }
.tr-line.edited { box-shadow: inset 0 0 0 1px rgba(143, 166, 196, .35); }
.tr-line.dirty { box-shadow: inset 0 0 0 1px rgba(224, 145, 95, .5); }
.tr-line .from { grid-column: 2 / -1; font-size: 13px; font-weight: 600; color: var(--cyan); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tr-line .from .no { color: var(--faint); font-weight: 400; font-size: 11px; }
.tr-line .avatar { grid-row: span 2; }
.tr-line .src { display: grid; gap: 6px; align-content: start; }
.tr-line .src .quote { font-size: 12px; color: var(--faint); padding-left: 8px; box-shadow: inset 2px 0 0 var(--border-strong); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tr-line .src .tr-source { min-height: 0; height: auto; }
.tr-line .dst { display: grid; gap: 6px; align-content: start; }
.tr-line .dst textarea { min-height: 0; resize: none; overflow: hidden; }
.tr-line .dst .ru { padding: 9px 12px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.tr-line .line-foot { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.tr-line .line-foot .meta { font-size: 11px; }
@media (max-width: 1000px) {
  .tr-panes { grid-template-columns: 1fr; }
  .tr-head { display: none; }
  .tr-line { grid-template-columns: 36px minmax(0, 1fr); }
  .tr-line .dst { grid-column: 2; }
}
.voice-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; }
.voice-layout > div > .panel + .panel { margin-top: 12px; }
.voice-guide { position: sticky; top: calc(var(--top) + 4px); }
.voice-guide textarea { font-size: 13px; }
#try-out { display: grid; gap: 8px; }
#try-out[hidden] { display: none; }
.lessons, .edits { display: grid; gap: 6px; margin-top: 12px; }
.lesson { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; transition: background .15s, opacity .2s; }
.lesson:hover { background: rgba(255, 255, 255, .03); }
.lesson input { margin-top: 2px; }
.lesson.off { opacity: .45; }
.lesson .rule { line-height: 1.45; }
.lesson s { color: var(--faint); }
.edit { display: grid; gap: 5px; padding: 10px; border-radius: 10px; background: rgba(6, 7, 12, .35); box-shadow: inset 0 0 0 1px var(--border); }
.edit .before { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(224, 122, 122, .5); line-height: 1.45; }
.edit .after { line-height: 1.45; }
@media (max-width: 1100px) { .voice-layout { grid-template-columns: 1fr; } .voice-guide { position: static; } }

/* --- dialog (replaces confirm/prompt) ----------------------------------------------------------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(4, 5, 9, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .15s ease both; }
.dialog-wrap.out { opacity: 0; transition: opacity .15s; }
.dialog { width: min(460px, 100%); padding: 20px; display: grid; gap: 8px; background: var(--popover); animation: pop .22s var(--ease) both; }
.dialog h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.dialog p { margin: 0; color: var(--muted-foreground); line-height: 1.5; }
.dialog textarea { margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@keyframes fade { from { opacity: 0; } }

/* --- toasts (sonner-like) --------------------------------------------------------------------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 10; }
.toast { padding: 11px 14px 11px 16px; border-radius: 12px; max-width: 400px; font-size: 13px; background: var(--popover); animation: toast-in .5s var(--spring) both, toast-out .35s var(--ease) forwards 3.15s; overflow: hidden; }
.toast.error { animation: toast-in .5s var(--spring) both, toast-out .35s var(--ease) forwards 6.65s; }
.toast::after { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--primary); }
.toast.error::after { background: var(--bad); }

/* --- motion ------------------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes holo { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.8); } }
@keyframes breathe { 50% { opacity: .4; } }
@keyframes blink { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes sweep { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

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

@media (max-width: 1180px) {
  .ideas-layout { grid-template-columns: 1fr; }
  .console { position: relative; top: 0; height: 560px; }
}
@media (max-width: 1000px) {
  .ep, .two { grid-template-columns: 1fr; }
  .chatbox { position: relative; top: 0; height: 440px; }
  .deckrow { grid-template-columns: 56px 1fr; }
}
.speed { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted-foreground); }

/* --- sign-in gate and the Admins tab --- */
.nav button[hidden], .gate[hidden] { display: none; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate .panel { width: min(100%, 380px); padding: 24px; border-radius: 18px; justify-items: center; text-align: center; }
.gate h2, .gate .sub { margin: 0; }
.admin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-row > .grow { flex: 1; min-width: 180px; }
.admin-row select { width: auto; }

/* touch screens have no hover, so tools that appear on hover stay visible */
@media (hover: none) { .bubble .tools { opacity: 1; transform: none; pointer-events: auto; } }

/* phone: the sidebar becomes a top bar */
@media (max-width: 760px) {
  :root { --side: 0px; }
  .sidebar { position: sticky; top: 8px; bottom: auto; left: auto; width: auto; margin: 8px 12px 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px; }
  .nav { order: 3; width: 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .nav button { width: auto; flex: none; }
  .nav .ind::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .status { flex-wrap: nowrap; }
  .pill { font-size: 11px; padding: 2px 7px; }
  .motion-toggle span { display: none; }
  .topbar { position: static; height: 44px; padding: 0 16px; }
  main { padding: 4px 16px calc(80px + env(safe-area-inset-bottom)); }
  input, select, textarea { font-size: 16px; } /* smaller text makes iOS zoom in on focus */
  .slider { grid-template-columns: 100px 1fr 26px; }
  .deckrow { padding: 10px 3px; }
  .deckrow > select, .deckrow > input[name=effect], .deckrow > .row { grid-column: 1 / -1; }
  .console { height: 70vh; }
}

/* --- News research + poster (episode page) --- */
.chatbox form { flex-wrap: wrap; }
.research-toggle { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-foreground); cursor: pointer; user-select: none; }
.research-toggle input { margin: 0; }
.research-toggle:has(input:checked) { color: var(--warm); }
.poster-row { display: flex; gap: 14px; align-items: flex-start; }
.poster-img { display: block; width: 200px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--border-strong); }
.poster-empty { width: 200px; aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: var(--radius); background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.bubble-img { display: block; width: calc(100% + 22px); margin: -7px -11px 8px; border-radius: 12px 12px 0 0; }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.sources a { font-size: 12px; color: var(--muted-foreground); text-decoration: none; padding: 3px 9px; border-radius: 99px; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a:hover { color: var(--warm); box-shadow: inset 0 0 0 1px var(--border-strong); }
@media (max-width: 700px) {
  .poster-row { flex-direction: column; }
  .poster-img, .poster-empty { width: 100%; }
}

/* --- toasts: a sticky one waits for its result; reduced motion must never hide them --- */
.toast.sticky { animation: toast-in .5s var(--spring) both; }
.toast.sticky::after { animation: toast-pulse 1.2s var(--ease) infinite; }
@keyframes toast-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  /* the global reduce rule zeroes delays, which made toast-out fire instantly and every toast invisible */
  .toast, .toast.error, .toast.sticky, .toast.sticky::after { animation: none !important; opacity: 1; }
}

/* --- On Air tab, scenes, review ------------------------------------------------------------ */
.nav button[data-count]:not([data-count=""])::after {
  content: attr(data-count); margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; color: var(--primary-foreground); background: var(--warm);
}
.nav button[data-tab="onair"][data-count]:not([data-count=""])::after { background: var(--ok); }
.panel.air + .panel.air { margin-top: 14px; }
.air-title { flex-wrap: wrap; }
.air-title .ep-name { font-size: 14px; }
.onair-link { align-items: center; gap: 10px; }
.upcoming { margin-top: 12px; display: grid; gap: 6px; }
.up-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }

.delay { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted-foreground); }
.delay select { height: 26px; padding: 0 24px 0 8px; font-size: 12px; background-position: right 6px center; }
.bubble-foot { margin-top: 6px; display: flex; justify-content: flex-end; }

#scenes { margin-top: 14px; }
#scene-cards:empty { display: none; }
#scene-cards { margin-bottom: 12px; }
.scene { padding: 12px; border-radius: var(--radius); background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); display: grid; gap: 10px; }
.scene-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scene .trigger { align-items: end; }
.scene textarea { width: 100%; }
.scene .tagbar { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.scene-lines { display: grid; gap: 6px; }
.scene-line { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .03); }
.scene-line .avatar { width: 30px; height: 30px; font-size: 15px; }
.scene-line .from { font-size: 12px; color: var(--muted-foreground); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.scene-line .txt { font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.line-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.scene-react { font-size: 12px; color: var(--muted-foreground); display: flex; align-items: center; gap: 8px; padding-left: 38px; }
.reader { padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(157, 180, 212, .07); box-shadow: inset 0 0 0 1px rgba(157, 180, 212, .22); display: grid; gap: 4px; font-size: 14px; }
.readers td { vertical-align: top; }
.readers .what { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .scene-line { grid-template-columns: 30px minmax(0, 1fr); }
  .line-tools { grid-column: 2; justify-content: flex-start; }
}
[data-show][hidden] { display: none; }
.readers tr.gone .said, .reader.gone .said { color: var(--faint); text-decoration: line-through; text-decoration-color: rgba(220, 224, 235, .25); }
