/*
 * Game Voice Studio. Dark, game-flavoured, on the Tencent Cloud brand ramp
 * (values from docs/design-system.md). No web fonts: this page is opened on
 * conference-room wifi, so it renders in the system stack and never waits on
 * a font CDN.
 */
:root {
  --brand: #006eff;
  --brand-hover: #0052d9;
  --brand-400: #4096ff;
  --brand-200: #bbdeff;
  --navy: #001a45;
  --cyan: #00c8ff;

  --bg: #050b1f;
  --bg-2: #0a1430;
  --card: #0e1a3a;
  --card-2: #13224a;
  --line: rgba(187, 222, 255, 0.12);
  --line-strong: rgba(187, 222, 255, 0.24);
  --text: #eaf2ff;
  --text-2: #a9bbdc;
  --text-3: #7286ab;

  --mm: #b78cff;
  --el: #e6e9f0;
  --tx: #3d9bff;

  --ok: #00a870;
  --warn: #ed7b2f;
  --err: #e34d59;

  --radius: 14px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Noto Sans SC', 'Noto Sans Thai', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--brand-400);
  text-decoration: none;
}

button,
select,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ── Top bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(5, 11, 31, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: flex;
}

.nav {
  display: flex;
  gap: 4px;
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px;
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.lang-switch button[aria-pressed='true'] {
  background: var(--brand);
  color: #fff;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 10px 18px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--brand-400);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 16px 64px;
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(0, 110, 255, 0.35), transparent 60%),
    radial-gradient(700px 380px at 95% 10%, rgba(0, 200, 255, 0.18), transparent 60%),
    linear-gradient(180deg, var(--navy), var(--bg));
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, var(--brand-200));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--text-2);
  font-size: clamp(15px, 2vw, 18px);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.stat {
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(14, 26, 58, 0.6);
}

.stat b {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.stat span {
  color: var(--text-2);
  font-size: 13px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-wave {
  position: absolute;
  inset: auto -10% -40px -10%;
  height: 180px;
  opacity: 0.35;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(0, 200, 255, 0.5) 10px 12px);
  mask: radial-gradient(60% 100% at 50% 100%, #000, transparent 70%);
  -webkit-mask: radial-gradient(60% 100% at 50% 100%, #000, transparent 70%);
}

/* ── Sections ──────────────────────────────────────────────────────────── */
.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 16px 8px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -0.01em;
}

.section-head p {
  margin: 8px 0 24px;
  color: var(--text-2);
  max-width: 760px;
}

.tabs,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.chip {
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
}

.tab[aria-selected='true'],
.chip[aria-pressed='true'] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.callout {
  margin: 0 0 22px;
  padding: 12px 16px 12px 44px;
  position: relative;
  max-width: 920px;
  border: 1px solid color-mix(in srgb, var(--brand) 55%, transparent);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(0, 110, 255, 0.18), rgba(0, 200, 255, 0.06));
  color: var(--text);
  font-size: 14px;
}

.callout::before {
  content: '★';
  position: absolute;
  left: 16px;
  top: 11px;
  color: var(--cyan);
}

.scene-blurb {
  color: var(--text-2);
  margin: 14px 0 22px;
  max-width: 820px;
}

/* ── Vendor tags & play buttons ────────────────────────────────────────── */
.vendor-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.v-minimax {
  --vc: var(--mm);
}

.v-elevenlabs {
  --vc: var(--el);
}

.v-tencent {
  --vc: var(--tx);
}

.vendor-dot {
  background: var(--vc);
}

.vendor-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--vc);
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--vc) 45%, transparent);
  background: color-mix(in srgb, var(--vc) 10%, transparent);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.play:hover {
  background: color-mix(in srgb, var(--vc) 22%, transparent);
}

.play:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.play .icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--vc);
  color: #050b1f;
  flex: none;
}

.play .icon svg {
  width: 10px;
  height: 10px;
}

.play[data-state='loading'] .icon {
  animation: pulse 0.9s ease-in-out infinite;
}

.play[data-state='playing'] {
  background: color-mix(in srgb, var(--vc) 30%, transparent);
  border-color: var(--vc);
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

/* ── Cast cards ────────────────────────────────────────────────────────── */
.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: 16px;
}

.cast {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.cast-head {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  background: radial-gradient(circle at 30% 25%, rgba(0, 200, 255, 0.35), rgba(0, 110, 255, 0.18) 60%, rgba(0, 26, 69, 0.6));
  border: 1px solid var(--line-strong);
}

.cast-head h3 {
  margin: 0;
  font-size: 18px;
}

.cast-head p {
  margin: 2px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.casting {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  font-size: 13px;
}

.casting-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}

.casting-voice {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.voice-name {
  color: var(--text);
}

.id-copy {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.id-copy:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  white-space: nowrap;
}

.badge-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 50%, transparent);
}

.badge-brand {
  color: var(--brand-200);
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
}

.custom-note {
  color: var(--text-2);
  font-size: 12.5px;
}

.lines {
  display: grid;
  gap: 10px;
}

.line {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
}

.line-text {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.emotion {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 200, 255, 0.12);
  color: var(--cyan);
}

.line-plays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Multilingual ──────────────────────────────────────────────────────── */
.multi-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.multi-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}

.multi-row:first-child {
  border-top: 0;
}

.multi-lang {
  font-weight: 600;
}

.multi-text {
  color: var(--text-2);
  min-width: 0;
}

.multi-plays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.multi-cast {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--card);
}

/* ── Library ───────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filters select {
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 7px 10px;
  max-width: 100%;
}

.library-count {
  color: var(--text-3);
  font-size: 13px;
  margin: 14px 0 12px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: 12px;
}

.voice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  min-width: 0;
}

.voice-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.voice h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.voice-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.voice-sample {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  flex: 1;
}

.voice-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.voice-bottom a {
  font-size: 12px;
  color: var(--text-3);
}

.voice-bottom a:hover {
  color: var(--brand-400);
}

/* ── Live ──────────────────────────────────────────────────────────────── */
.live {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card), var(--bg-2));
}

.live-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child {
  font-size: 13px;
  color: var(--text-2);
}

.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 12px;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.6;
}

.field-text {
  position: relative;
}

.counter {
  justify-self: end;
  font-size: 12px;
  color: var(--text-3);
}

.live-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.live-status {
  font-size: 14px;
  color: var(--text-2);
}

.live-status.is-error {
  color: var(--err);
}

.live-status.is-ok {
  color: var(--ok);
}

.live-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ── Service path ──────────────────────────────────────────────────────── */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 18px 18px 18px 60px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, var(--cyan), var(--brand));
  color: #fff;
}

.steps h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.steps p {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

/* ── Footer & toast ────────────────────────────────────────────────────── */
.footer {
  max-width: 1180px;
  margin: 64px auto 0;
  padding: 24px 16px 48px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: #050b1f;
  font-size: 14px;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Narrow screens ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .nav {
    display: none;
  }

  .topbar {
    justify-content: space-between;
  }

  .live-row {
    grid-template-columns: 1fr 1fr;
  }

  .live-row .field:first-child {
    grid-column: 1 / -1;
  }

  .multi-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .multi-plays {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }

  .casting-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .hero {
    padding-top: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .play[data-state='loading'] .icon {
    animation: none;
  }
}
