/* Text to Speech studio (14 Oct 2026): the NexusHub studio layout (Image Studio / Audio Converter family).
   Top bar with the allowance and Generate, a slim tool rail on the left, the script and player in the middle,
   voices / effects / clips in a full-height drawer on the right. Phones: one scrolling column. */
html { background: #04040a; color-scheme: dark; }
body.tts-studio-page { margin: 0; min-height: 100%; background: #04040a; color: #e4e4e7; font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
body.tts-studio-page .gx-footer, body.tts-studio-page .site-footer { display: none !important; }
.ts { --line: rgba(255, 255, 255, .07); --soft: rgba(255, 255, 255, .04); --acc: #a78bfa; --acc2: #22d3ee;
  position: fixed; top: var(--ts-top, 65px); left: 0; right: 0; bottom: 0; display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "rail stage side"; background: #04040a; }
.ts *, .ts *::before, .ts *::after { box-sizing: border-box; }
.ts [hidden] { display: none !important; }
.ts svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ts :where(button) { font: inherit; color: inherit; }
.ts-hide { display: none; }

/* top bar */
.ts-top { grid-area: top; display: flex; align-items: center; gap: 18px; min-height: 64px; padding: 10px 16px 10px 20px; border-bottom: 1px solid var(--line); background: #0a0a0f; }
.ts-id { display: flex; align-items: center; gap: 10px; flex: 1 1 0; min-width: 0; }
.ts .ts-logo { width: 24px; height: 24px; color: #c4b5fd; }
.ts-id h1 { margin: 0; color: #fff; font-size: 15px; font-weight: 800; white-space: nowrap; }
.ts-sub { color: #71717a; font-size: 12.5px; white-space: nowrap; }
.ts-quota { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; }
.ts-plan { padding: 3px 10px; border-radius: 999px; background: rgba(167, 139, 250, .14); color: #ddd6fe; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ts-plan.vip { background: linear-gradient(90deg, rgba(251, 191, 36, .2), rgba(244, 114, 182, .2)); color: #fde68a; }
.ts-plan.plus { background: rgba(56, 189, 248, .15); color: #bae6fd; }
.ts-meter { width: 140px; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.ts-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acc2), var(--acc)); transition: width .6s cubic-bezier(.22, 1, .36, 1); }
.ts-quota small { color: #a1a1aa; font-size: 12.5px; white-space: nowrap; }
.ts-acts { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex: 1 1 0; }
.ts-pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: #e4e4e7; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .2s, border-color .2s; }
.ts-pill:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); }
.ts-pill.wide { width: 100%; margin-top: 12px; }
.ts-primary { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; overflow: hidden; border: 0; border-radius: 12px; background: #fff; color: #0b0b10 !important; font-size: 13.5px; font-weight: 800; cursor: pointer; white-space: nowrap; box-shadow: 0 8px 22px -12px rgba(255, 255, 255, .5); transition: transform .2s, background .2s; }
.ts-primary svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.ts-primary:hover { background: #f4f4f5; transform: translateY(-1px); }
.ts-primary:disabled { cursor: wait; transform: none; }
.ts-primary.busy::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(167, 139, 250, .35), transparent 80%); animation: ts-sweep 1.1s linear infinite; }
@keyframes ts-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* rail */
.ts-rail { grid-area: rail; display: flex; flex-direction: column; gap: 6px; padding: 14px 10px; border-right: 1px solid var(--line); background: #030305; }
.ts-tool { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 4px 9px; border: 0; border-radius: 14px; background: none; color: #71717a; font-size: 10.5px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .2s, color .2s; }
.ts-tool svg { width: 20px; height: 20px; }
.ts-tool:hover { background: rgba(255, 255, 255, .05); color: #e4e4e7; }
.ts-tool[aria-pressed="true"] { background: rgba(167, 139, 250, .12); color: #ddd6fe; }
.ts-rail a.ts-tool { margin-top: auto; }

/* stage */
.ts-stage { grid-area: stage; display: flex; flex-direction: column; align-items: center; gap: 16px; min-width: 0; min-height: 0; padding: 28px 24px 24px; overflow: auto;
  background: radial-gradient(70% 60% at 50% 0%, rgba(167, 139, 250, .09), transparent 70%), radial-gradient(60% 50% at 80% 100%, rgba(34, 211, 238, .06), transparent 70%), #06060a; }
.ts-card { width: min(820px, 100%); border: 1px solid var(--line); border-radius: 20px; background: rgba(12, 12, 18, .82); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.ts-script { display: flex; flex-direction: column; }
.ts-script:focus-within { border-color: rgba(167, 139, 250, .35); box-shadow: 0 0 0 4px rgba(167, 139, 250, .07), 0 30px 60px -30px rgba(0, 0, 0, .8); }
.ts-card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.ts-card-h h2 { margin: 0; color: #8a8d9b; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ts-samples { display: flex; flex-wrap: wrap; gap: 6px; }
.ts-samples button { height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: #a1a1aa; font-size: 12px; font-weight: 600; cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.ts-samples button:hover { border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .1); color: #fff; }
.ts-script textarea { width: 100%; min-height: clamp(180px, 34vh, 360px); padding: 10px 20px 16px; border: 0; outline: none; resize: vertical; background: none; color: #fafafa; font: 500 19px/1.6 Inter, system-ui, sans-serif; }
.ts-script textarea::placeholder { color: #52525b; }
.ts-card-f { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.ts-voice-chip, .ts-speed-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: #e4e4e7; font-size: 13px; font-weight: 700; }
.ts-voice-chip { cursor: pointer; }
.ts-voice-chip:hover { border-color: rgba(167, 139, 250, .4); }
.ts-voice-chip svg { width: 14px; height: 14px; color: #71717a; }
.ts-speed-chip svg { width: 15px; height: 15px; color: #71717a; }
.ts-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.ts-clear { height: 34px; margin-left: auto; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: #71717a; font-size: 13px; font-weight: 700; cursor: pointer; }
.ts-clear:hover { background: rgba(255, 255, 255, .05); color: #e4e4e7; }
.ts-count { color: #71717a; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ts-count b { color: #d4d4d8; }
.ts-count.over b { color: #fda4af; }

/* player */
.ts-player { overflow: hidden; }
.ts-wave { display: block; width: 100%; height: 132px; background: radial-gradient(80% 120% at 50% 100%, rgba(167, 139, 250, .1), transparent 70%); }
.ts-player-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.ts-play { display: grid; place-items: center; flex: none; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: #0b0b10; cursor: pointer; box-shadow: 0 10px 28px -12px rgba(255, 255, 255, .6); transition: transform .2s, opacity .2s; }
.ts-play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; margin-left: 2px; }
.ts-play:hover:not(:disabled) { transform: scale(1.05); }
.ts-play:disabled { opacity: .25; cursor: default; box-shadow: none; }
.ts-player.playing .ts-play svg { margin: 0; }
.ts-track { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ts-track b { overflow: hidden; color: #fff; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.ts-track small { overflow: hidden; color: #71717a; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.ts-dl { display: flex; gap: 8px; }
.ts-dl button { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); color: #e4e4e7; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .2s, border-color .2s, opacity .2s; }
.ts-dl button svg { width: 15px; height: 15px; }
.ts-dl button:hover:not(:disabled) { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .16); }
.ts-dl button:disabled { opacity: .3; cursor: default; }
.ts-status { width: min(820px, 100%); min-height: 20px; margin: 0; color: #a1a1aa; font-size: 13.5px; text-align: center; }
.ts-status.good { color: #86efac; }
.ts-status.bad { color: #fda4af; }

/* side drawer */
.ts-side { grid-area: side; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden auto; border-left: 1px solid var(--line); background: #08080c; scrollbar-width: thin; scrollbar-color: #27272a transparent; }
.ts-tabs { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px 10px 9px; border-bottom: 1px solid var(--line); background: #08080c; }
.ts-tabs button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border: 0; border-radius: 12px; background: none; color: #71717a; font-size: 10.5px; font-weight: 700; cursor: pointer; transition: background .2s, color .2s; }
.ts-tabs button svg { width: 19px; height: 19px; }
.ts-tabs button:hover { background: rgba(255, 255, 255, .05); color: #e4e4e7; }
.ts-tabs button[aria-selected="true"] { background: rgba(167, 139, 250, .12); color: #ddd6fe; }
.ts-pane { animation: ts-in .25s ease both; }
@keyframes ts-in { from { opacity: 0; transform: translateY(4px); } }
.ts-sec { padding: 18px 18px 20px; border-bottom: 1px solid var(--line); }
.ts-sec h3 { margin: 0 0 12px; color: #8a8d9b; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ts-note { margin: -4px 0 12px; color: #71717a; font-size: 12.5px; line-height: 1.5; }
.ts-find { display: flex; align-items: center; gap: 8px; margin: 14px 14px 6px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); color: #71717a; }
.ts-find:focus-within { border-color: rgba(167, 139, 250, .45); }
.ts-find input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: #fff; font: 500 14px Inter, system-ui, sans-serif; outline: none; }
.ts-voices { display: grid; gap: 6px; padding: 8px 10px 16px; }
.voice-card { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px; border: 1px solid transparent; border-radius: 14px; cursor: pointer; transition: background .2s, border-color .2s; }
.voice-card:hover { background: rgba(255, 255, 255, .035); }
.voice-card.selected { border-color: rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .09); }
.voice-card.locked { opacity: .55; }
.voice-av { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--a, #6366f1), var(--b, #a855f7)); color: #fff; font-weight: 800; font-size: 15px; }
.voice-txt { min-width: 0; }
.voice-txt b { display: flex; align-items: center; gap: 6px; overflow: hidden; color: #f4f4f5; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.voice-txt small { display: block; overflow: hidden; color: #71717a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.voice-tag { padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: #a1a1aa; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.voice-tag.plus { background: rgba(56, 189, 248, .14); color: #bae6fd; }
.voice-tag.vip { background: rgba(251, 191, 36, .15); color: #fde68a; }
.voice-play { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--soft); color: #e4e4e7; cursor: pointer; transition: background .2s, color .2s; }
.voice-play svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.voice-play:hover { background: #fff; color: #0b0b10; }
.voice-play.on { background: var(--acc); color: #0b0b10; border-color: transparent; }
.voice-card-admin { position: absolute; top: 4px; right: 48px; width: 24px; height: 24px; border: 0; border-radius: 7px; background: rgba(255, 255, 255, .06); color: #a1a1aa; font-size: 12px; cursor: pointer; }
.ts-empty { margin: 18px; color: #71717a; font-size: 13px; text-align: center; }
.ts-range { display: flex; align-items: center; gap: 12px; }
.ts-range input { flex: 1; accent-color: var(--acc); }
.ts-range b { min-width: 40px; color: #fff; font-variant-numeric: tabular-nums; }
.ts-marks { display: flex; justify-content: space-between; margin-top: 6px; color: #52525b; font-size: 11px; font-weight: 700; }
.ts-switch { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.ts-switch > span:nth-child(2) { display: flex; flex: 1; flex-direction: column; }
.ts-switch b { color: #f4f4f5; font-size: 14px; }
.ts-switch small { color: #71717a; font-size: 12px; }
.ts-sw-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: rgba(255, 255, 255, .05); color: #a1a1aa; }
.ts-switch i { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: #27272a; transition: background .2s; }
.ts-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #a1a1aa; transition: transform .25s cubic-bezier(.22, 1, .36, 1), background .2s; }
.ts-switch.active { border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .08); }
.ts-switch.active .ts-sw-ic { color: #ddd6fe; background: rgba(167, 139, 250, .16); }
.ts-switch.active i { background: var(--acc); }
.ts-switch.active i::after { transform: translateX(16px); background: #fff; }
.ts-clips { display: grid; gap: 6px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.ts-clip { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; }
.ts-clip:hover { background: rgba(255, 255, 255, .035); }
.ts-clip .voice-play { width: 34px; height: 34px; }
.ts-clip b { display: block; overflow: hidden; color: #f4f4f5; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.ts-clip small { display: block; overflow: hidden; color: #71717a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ts-clip a { color: #a1a1aa; font-size: 12px; font-weight: 700; text-decoration: none; }
.ts-clip a:hover { color: #fff; }
.ts-plans ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ts-plans li { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.ts-plans li b { color: #f4f4f5; font-size: 13.5px; }
.ts-plans li span { color: #71717a; font-size: 12px; }
.ts-plans li.vip { border-color: rgba(251, 191, 36, .25); }
.ts-plans li.vip b { color: #fde68a; }

/* admin voice editor (built by the script for admins only) */
.modal { position: fixed; inset: 0; z-index: 2000; display: none; place-items: center; padding: 16px; background: rgba(2, 2, 6, .7); backdrop-filter: blur(6px); }
.modal.open { display: grid; }
.modal-card { width: min(560px, 100%); padding: 22px; border: 1px solid var(--line, rgba(255, 255, 255, .08)); border-radius: 20px; background: #0c0c12; color: #e4e4e7; }
.modal-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.icon-btn { width: 34px; height: 34px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; background: rgba(255, 255, 255, .04); color: #fff; cursor: pointer; }
.admin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-form label { display: grid; gap: 6px; color: #a1a1aa; font-size: 12.5px; font-weight: 600; }
.admin-form .wide, .admin-actions { grid-column: 1 / -1; }
.admin-form input, .admin-form select { height: 38px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; background: #111117; color: #fff; font: inherit; }
.admin-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ghost-btn { height: 38px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; background: rgba(255, 255, 255, .05); color: #fff; font-weight: 700; cursor: pointer; }
.ghost-btn.danger { border-color: rgba(248, 113, 113, .35); color: #fecaca; }
.hidden { display: none !important; }
.status.bad { color: #fda4af; }
.manage-btn { height: 34px; padding: 0 12px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; background: rgba(255, 255, 255, .04); color: #e4e4e7; font: 700 12.5px Inter, system-ui, sans-serif; cursor: pointer; }

@media (max-width: 1200px) { .ts { grid-template-columns: 80px minmax(0, 1fr) 300px; } .ts-sub { display: none; } .ts-meter { width: 90px; } }
@media (max-width: 960px) {
  body.tts-studio-page { overflow: auto; }
  .ts { position: static; display: flex; flex-direction: column; min-height: calc(100dvh - var(--ts-top, 60px)); }
  .ts-top { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .ts-id { flex: 1 1 auto; }
  .ts-quota { order: 3; flex: 1 1 100%; }
  .ts-meter { flex: 1; width: auto; }
  .ts-acts { flex: 0 0 auto; }
  .ts-pill#ts-upgrade { display: none; }
  .ts-rail { display: none; }
  .ts-stage { padding: 16px 12px; overflow: visible; }
  .ts-script textarea { font-size: 17px; min-height: 180px; }
  .ts-dl button { padding: 0 11px; }
  .ts-side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .ts-tabs { top: var(--ts-top, 60px); }
}
@media (max-width: 520px) {
  .ts-player-row { flex-wrap: wrap; }
  .ts-dl { width: 100%; }
  .ts-dl button { flex: 1; justify-content: center; }
  .ts-speed-chip { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ts *, .ts *::before, .ts *::after { animation: none !important; transition: none !important; } }
