/* ==========================================================================
   IIT Voice Studio — Design System: Clean Flat Dark Mode (No Shadows, No 3D)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;

  /* Color Palette - Flat & Deep */
  --bg-dark: #07090e;
  --bg-deep: #0b0f17;
  --surface-panel: rgba(15, 20, 31, 0.75);
  --surface-panel-hover: rgba(20, 27, 42, 0.85);
  --surface-subtle: rgba(255, 255, 255, 0.03);
  --surface-input: #0a0e18;

  /* Hairline Borders - Flat & Crisp */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: #2563eb;

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;

  /* Flat Accents: Deep Blue & Deep Emerald (No Purple) */
  --accent-blue: #1d4ed8;               /* Deep Blue */
  --accent-blue-hover: #1e40af;
  --accent-blue-light: #60a5fa;
  --accent-emerald: #059669;            /* Deep Emerald Green */
  --accent-emerald-hover: #047857;
  --accent-mint: #34d399;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;

  /* Radius */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 9999px;

  /* Apple Flat Blur (No 3D effect) */
  --apple-blur: blur(20px);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

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

button, select, input[type="file"] {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Ambient Background - Phẳng, dịu sâu, không gây chói
   ========================================================================== */

.ambient-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  will-change: transform;
}

/* Xanh dương đậm trầm phẳng */
.blob-1 {
  width: 520px;
  height: 520px;
  top: -120px;
  left: -80px;
  background: #1e3a8a;
  opacity: 0.15;
}

/* Xanh lá đậm ngọc lục bảo phẳng */
.blob-2 {
  width: 560px;
  height: 560px;
  top: 15%;
  right: -100px;
  background: #064e3b;
  opacity: 0.14;
}

/* Xanh biển sâu phẳng */
.blob-3 {
  width: 480px;
  height: 480px;
  bottom: 8%;
  left: 20%;
  background: #0c4a6e;
  opacity: 0.12;
}

/* Xanh rừng sâu phẳng */
.blob-4 {
  width: 440px;
  height: 440px;
  top: 50%;
  right: 15%;
  background: #065f46;
  opacity: 0.11;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.25;
}

/* ==========================================================================
   Header / Topbar (Flat Frosted Bar, Không Shadow, Không Cắt Logo)
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 68px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: none; /* Không shadow */
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.4px;
}

/* Logo Wrap phẳng sạch sẽ, không shadow, không blur 3D */
.brand-logo-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
}

.brand-logo-wrap::after {
  display: none; /* Bỏ lớp glow 3D */
}

/* Giữ nguyên hình gốc phẳng của Logo */
.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  display: block;
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.brand-title strong {
  color: #ffffff;
  font-weight: 800;
}

.brand-light {
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* Nút API Docs phẳng */
.api-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  background: rgba(29, 78, 216, 0.12);
  border: 1px solid rgba(29, 78, 216, 0.35);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  box-shadow: none; /* Không shadow */
  transform: none; /* Không 3D */
}

.api-nav-pill svg {
  width: 14px;
  height: 14px;
}

.api-nav-pill:hover {
  background: rgba(29, 78, 216, 0.22);
  border-color: rgba(29, 78, 216, 0.6);
  color: #ffffff;
  transform: none; /* Không dịch chuyển */
}

.connection-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
  box-shadow: none;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.connection-dot.is-online {
  background: #10b981;
  box-shadow: none; /* Không shadow */
}

.connection-dot.is-online::after {
  display: none; /* Bỏ animation vòng tròn 3D */
}

/* ==========================================================================
   Page Shell & Clean Layout
   ========================================================================== */

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 48px, 1040px);
  margin: 0 auto;
  padding: 24px 0 32px;
}

/* ==========================================================================
   Flat Panels
   ========================================================================== */

.glass-panel {
  position: relative;
  background: var(--surface-panel);
  backdrop-filter: var(--apple-blur);
  -webkit-backdrop-filter: var(--apple-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: none !important;
  transform: none !important;
  transition: border-color 0.15s ease;
}

.glass-panel:hover {
  border-color: var(--border-hover);
}

/* Panel Header phẳng */
.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 10px;
  box-shadow: none !important;
}

.panel-icon svg {
  width: 20px;
  height: 20px;
}

/* TTS Icon: Flat Deep Blue */
.tts-icon {
  background: rgba(29, 78, 216, 0.15);
  border: 1px solid rgba(29, 78, 216, 0.35);
  color: #60a5fa;
}

/* STT Icon: Flat Deep Emerald */
.stt-icon {
  background: rgba(5, 150, 105, 0.15);
  border: 1px solid rgba(5, 150, 105, 0.35);
  color: #34d399;
}

/* Live Icon: Flat Ocean Blue */
.live-icon {
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: #38bdf8;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.text-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

/* ==========================================================================
   Flat Controls & Fields
   ========================================================================== */

.tts-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 120px;
  gap: 14px;
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.field select,
.field input,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  box-shadow: none; /* Không shadow */
  transition: border-color 0.15s ease;
}

.field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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 12px center;
  padding-right: 36px;
}

.field select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  color: var(--text-muted);
}

.field select option {
  background: #0f1522;
  color: #f8fafc;
}

.field select:focus,
.field input:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: none; /* Không shadow ring */
}

/* ==========================================================================
   Custom Flat Select Component (Không còn native Windows popup)
   ========================================================================== */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.custom-select-trigger:hover:not(.is-disabled) {
  border-color: var(--border-hover);
}

.custom-select-trigger.is-open {
  border-color: var(--border-focus);
}

.custom-select-trigger.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.custom-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}

.custom-select-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  display: grid;
  place-items: center;
}

.custom-select-trigger.is-open .custom-select-arrow {
  transform: rotate(180deg);
  color: var(--text-main);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 90;
  background: #0b0f19;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: none;
}

.custom-select-menu.is-open {
  display: block;
}

.custom-select-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.custom-select-item:hover {
  background: rgba(29, 78, 216, 0.15);
  color: #ffffff;
}

.custom-select-item.is-selected {
  background: rgba(29, 78, 216, 0.25);
  color: #93c5fd;
  font-weight: 600;
}

.custom-select-tag {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.speed-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.speed-input-wrap input {
  padding-right: 30px;
  font-family: 'JetBrains Mono', monospace;
}

.speed-unit {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

textarea::placeholder,
input::placeholder {
  color: var(--text-faint);
}

/* Quick prompt chips phẳng */
.quick-prompts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quick-prompts-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.prompt-chip {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.prompt-chip:hover {
  background: rgba(29, 78, 216, 0.15);
  border-color: rgba(29, 78, 216, 0.4);
  color: #ffffff;
}

.text-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.char-counter {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-faint);
}

/* ==========================================================================
   Flat Buttons & Action Rows (Tuyệt đối KHÔNG Shadow, KHÔNG 3D)
   ========================================================================== */

.action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none !important; /* Không shadow */
  transform: none !important;  /* Không dịch chuyển 3D */
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

.button:active:not(:disabled) {
  transform: none !important;
}

.button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Flat Button: Deep Blue */
.button-primary {
  background: var(--accent-blue);
  color: #ffffff;
  border: 1px solid var(--accent-blue);
}

.button-primary:hover:not(:disabled) {
  background: var(--accent-blue-hover);
  border-color: var(--accent-blue-hover);
  box-shadow: none;
  transform: none;
}

/* Secondary Flat Button */
.button-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.button-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-hover);
  color: var(--text-main);
  transform: none;
}

/* Download Flat Button: Deep Emerald */
.button-download {
  margin-left: auto;
  background: var(--accent-emerald);
  color: #ffffff;
  border: 1px solid var(--accent-emerald);
}

.button-download:hover {
  background: var(--accent-emerald-hover);
  border-color: var(--accent-emerald-hover);
  box-shadow: none;
  transform: none;
}

.button-download.hidden {
  display: none !important;
}

.status-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.status-text.error,
.error {
  color: #f87171 !important;
}

/* ==========================================================================
   Flat Audio Chunks Playlist
   ========================================================================== */

.chunk-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.chunk {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
  transition: border-color 0.15s ease;
}

.chunk:hover {
  border-color: rgba(29, 78, 216, 0.4);
}

.chunk > span {
  min-width: 75px;
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px;
  background: rgba(29, 78, 216, 0.12);
  border-radius: 4px;
  border: 1px solid rgba(29, 78, 216, 0.25);
  text-align: center;
  box-shadow: none;
}

.chunk audio {
  flex: 1;
  max-width: 480px;
  height: 34px;
  border-radius: 6px;
  outline: none;
  filter: invert(1) hue-rotate(180deg) brightness(0.9);
}

/* ==========================================================================
   STT Grid: Upload & Live Transcription (Hoàn toàn Phẳng)
   ========================================================================== */

.stt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.compact-heading {
  margin-bottom: 16px;
}

/* Upload Drop Zone phẳng */
.upload-zone {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 18px;
  border: 1px dashed rgba(5, 150, 105, 0.35);
  border-radius: var(--radius-md);
  background: rgba(5, 150, 105, 0.02);
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  text-align: center;
}

.upload-zone:hover {
  border-color: rgba(5, 150, 105, 0.7);
  background: rgba(5, 150, 105, 0.05);
  transform: none;
}

.upload-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.25);
  color: #34d399;
  margin-bottom: 2px;
  box-shadow: none;
}

.upload-symbol svg {
  width: 18px;
  height: 18px;
}

.upload-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.upload-caption {
  color: var(--text-muted);
  font-size: 11px;
}

.upload-zone input {
  max-width: 240px;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 5px;
}

.upload-zone input::file-selector-button {
  margin-right: 8px;
  padding: 4px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

/* Live Stage phẳng gọn gàng */
.live-stage {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

.live-orb-wrapper {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
}

/* Flat Mic Icon - Không hiệu ứng cầu 3D, không shadow */
.live-orb {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.15);
  border: 1px solid rgba(2, 132, 199, 0.35);
  display: grid;
  place-items: center;
  color: #38bdf8;
  box-shadow: none !important;
  transform: none !important;
  transition: all 0.2s ease;
}

.live-orb svg {
  width: 20px;
  height: 20px;
}

.live-orb-aura {
  display: none !important; /* Bỏ aura 3D */
}

/* Khi đang thu âm: Flat Emerald Active State */
.live-stage.is-recording .live-orb {
  background: rgba(5, 150, 105, 0.2);
  border-color: #10b981;
  color: #34d399;
  animation: none;
  box-shadow: none !important;
}

.live-copy {
  display: grid;
  gap: 2px;
}

.live-copy strong {
  font-size: 13px;
  color: #ffffff;
}

.live-copy span {
  color: var(--text-muted);
  font-size: 11px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

.live-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.live-stage.is-recording .live-indicator {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
}

.live-stage.is-recording .live-indicator i {
  background: #10b981;
  box-shadow: none; /* Không shadow */
}

/* Result Box phẳng */
.result-container {
  position: relative;
  margin-top: 14px;
}

.result {
  min-height: 0;
  max-height: 200px;
  overflow: auto;
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: none;
}

.result:empty {
  display: none;
}

.result:not(:empty) + .copy-result-btn {
  display: inline-flex;
}

.copy-result-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  align-items: center;
  gap: 5px;
  box-shadow: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.copy-result-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Skeleton Placeholders phẳng */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  content: "";
  animation: shimmer 1.8s infinite;
  transform: translateX(-100%);
}

.skeleton-stack {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.skeleton-segment {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface-input);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

.skeleton-label {
  width: 45px;
  height: 10px;
}

.skeleton-track {
  width: min(60%, 280px);
  height: 16px;
  border-radius: 4px;
}

.stt-skeleton,
.live-skeleton {
  margin-top: 12px;
}

.skeleton-line {
  height: 10px;
}

.skeleton-line:nth-child(1) { width: 92%; }
.skeleton-line:nth-child(2) { width: 80%; }
.skeleton-line:nth-child(3) { width: 50%; }

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* Footer phẳng */
.page-footer {
  padding: 32px 0 16px;
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
}

.page-footer a {
  color: #60a5fa;
  text-decoration: none;
}

.page-footer a:hover {
  text-decoration: underline;
}

.page-footer span {
  padding: 0 8px;
  color: var(--text-faint);
}

/* ==========================================================================
   DEDICATED API DOCS (Hoàn toàn Phẳng, Không Shadow, Không 3D)
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  padding: 28px 0 50px;
  position: relative;
  z-index: 1;
  width: min(100% - 48px, 1360px);
  margin: 0 auto;
}

.docs-sidebar {
  position: sticky;
  top: 86px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 10px;
}

.docs-nav-group {
  margin-bottom: 22px;
}

.docs-nav-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 10px;
}

.docs-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.docs-nav-item:hover,
.docs-nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.docs-nav-item.active {
  color: #60a5fa;
  font-weight: 600;
}

/* Method Badges */
.badge-method {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  text-align: center;
}

.method-get {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.method-post {
  background: rgba(29, 78, 216, 0.15);
  border: 1px solid rgba(29, 78, 216, 0.35);
  color: #60a5fa;
}

.method-ws {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.docs-content {
  min-width: 0;
}

.docs-section {
  margin-bottom: 40px;
  scroll-margin-top: 86px;
}

.docs-section-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin: 0 0 8px;
}

.docs-section-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 20px;
}

/* Endpoint Card phẳng */
.endpoint-card {
  background: var(--surface-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: none !important;
  margin-bottom: 24px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.endpoint-card:hover {
  border-color: var(--border-hover);
}

.endpoint-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(8, 12, 20, 0.4);
}

.endpoint-path {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
}

.endpoint-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.endpoint-details {
  padding: 20px;
  border-right: 1px solid var(--border-subtle);
}

.endpoint-details h4 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 16px 0 8px;
}

.endpoint-details h4:first-child {
  margin-top: 0;
}

.endpoint-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.6;
}

/* Param Table phẳng */
.param-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}

.param-table th {
  text-align: left;
  color: var(--text-muted);
  padding: 7px 5px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 600;
  font-size: 11px;
}

.param-table td {
  padding: 8px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  vertical-align: top;
}

.param-name {
  font-family: 'JetBrains Mono', monospace;
  color: #60a5fa;
  font-weight: 600;
}

.param-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}

.param-badge {
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.badge-req {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.badge-opt {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

/* Code Panel phẳng */
.code-panel {
  padding: 18px 20px;
  background: #080c14;
  display: flex;
  flex-direction: column;
}

.code-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.code-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.code-tab:hover {
  color: #ffffff;
}

.code-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.code-copy-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: none;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.code-pre {
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: #060910;
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.6;
  overflow-x: auto;
  box-shadow: none;
}

.code-pre code {
  font-family: inherit;
}

.response-preview-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 14px 0 6px;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1024px) {
  .endpoint-body {
    grid-template-columns: 1fr;
  }
  .endpoint-details {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-sidebar {
    position: static;
    height: auto;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .docs-nav-group {
    display: flex;
    gap: 6px;
    margin-bottom: 0;
  }
  .docs-nav-title {
    display: none;
  }
}

@media (max-width: 768px) {
  .stt-grid {
    grid-template-columns: 1fr;
  }
  .tts-controls {
    grid-template-columns: 1fr 1fr;
  }
  .speed-field {
    grid-column: 1 / -1;
  }
  .page-shell {
    padding-top: 28px;
  }
}

@media (max-width: 540px) {
  .topbar {
    padding: 0 16px;
  }
  .api-nav-pill span {
    display: none;
  }
  .tts-controls {
    grid-template-columns: 1fr;
  }
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .button-download {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.job-progress[hidden] { display: none; }
.pronunciation-settings { margin: 12px 0; color: #94a3b8; font-size: 13px; }
.pronunciation-settings summary { cursor: pointer; margin-bottom: 10px; }
.pronunciation-settings textarea { width: 100%; min-height: 70px; }
.job-progress { margin: 0 0 20px; padding: 14px 16px; border: 1px solid rgba(148,163,184,.2); border-radius: 12px; background: rgba(59,130,246,.06); }
.job-progress-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: 13px; color: #cbd5e1; }
.job-progress progress { display: block; width: 100%; height: 10px; border: none; border-radius: 6px; overflow: hidden; accent-color: #3b82f6; }
.job-progress progress::-webkit-progress-bar { background: #1e293b; border-radius: 6px; }
.job-progress progress::-webkit-progress-value { background: #3b82f6; border-radius: 6px; transition: width .2s; }
.job-progress progress::-moz-progress-bar { background: #3b82f6; }
.job-progress progress:indeterminate { background: linear-gradient(90deg, #1e293b, #3b82f6, #1e293b); background-size: 200% 100%; animation: job-wait 1.5s linear infinite; }
.job-progress[data-terminal="true"] progress:indeterminate { animation: none; background: #1e293b; }
.job-progress p { margin: 8px 0 0; font-size: 12px; }
@keyframes job-wait { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .job-progress progress { animation: none; transition: none; } }
