:root {
  --bg-main: #0a0e17;
  --bg-card: rgba(17, 24, 39, 0.92);
  --bg-card-hover: rgba(30, 41, 59, 0.95);
  --bg-input: #0b1120;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-active: #6366f1;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(6, 182, 212, 0.12) 0%, transparent 40%);
  background-attachment: fixed;
}

.container {
  max-width: 1480px;
  width: 96%;
  margin: 0 auto;
  padding: 16px 8px 40px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.logo-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-muted);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.api-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.api-status-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Grid Layout with minmax(0, 1fr) to prevent blowout */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 22px;
  align-items: start;
}

.input-section, .output-section {
  min-width: 0;
  width: 100%;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: 16px;
  overflow: hidden;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title span {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Emotion & Tag Toolbar */
.emotion-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  align-items: center;
  scrollbar-width: thin;
}

.emotion-tag-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.emotion-tag-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Input Styles */
.textarea-container {
  position: relative;
  width: 100%;
}

textarea {
  width: 100%;
  height: 160px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

textarea:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.text-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 6px;
}

.file-upload-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.file-upload-box:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

/* Voice Filters & Search */
.voice-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.voice-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.voice-filter-btn.active {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
  color: #fff;
}

.voice-search-input {
  flex: 1;
  min-width: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 4px 10px;
  color: var(--text-main);
  font-size: 11px;
  outline: none;
}

.voice-search-input:focus {
  border-color: var(--border-active);
}

/* Voice Selector Grid */
.voices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 14px;
}

.voice-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.voice-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.voice-card.selected {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

.voice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-name {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}

.voice-icon {
  font-size: 15px;
}

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

.voice-tag {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 1px 4px;
  border-radius: 3px;
}

.voice-card.selected .voice-tag {
  background: rgba(99, 102, 241, 0.4);
  border-color: rgba(99, 102, 241, 0.6);
  color: #e0e7ff;
}

.selected-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  display: none;
}

.voice-card.selected .selected-indicator {
  display: block;
  box-shadow: 0 0 6px var(--accent-cyan);
}

/* Director's Note Section */
.director-section {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 14px;
}

.director-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.persona-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.persona-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.persona-chip:hover, .persona-chip.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* Settings Row */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-active);
}

/* Action Buttons Container (Start + Cancel) */
.action-buttons-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Primary Action Generate Button */
.btn-primary-generate {
  flex: 1;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #ffffff;
  border: none;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s ease;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
  letter-spacing: 0.3px;
}

.btn-primary-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, #6366f1, #0891b2);
}

.btn-primary-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Cancel Buttons */
.btn-cancel {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-cancel:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: var(--accent-red);
  color: #fff;
}

.btn-cancel-main {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 15px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-cancel-main:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #fff;
  border-color: var(--accent-red);
}

/* Progress & Live Output Panel */
.progress-card {
  display: none;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  word-break: break-word;
}

.progress-pct {
  font-size: 14px;
  font-weight: 700;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Chunk list with robust truncation */
.chunks-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-right: 4px;
}

.chunk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  gap: 10px;
}

.chunk-item.done {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}

.chunk-item.processing {
  border-color: rgba(6, 182, 212, 0.5);
  background: rgba(6, 182, 212, 0.1);
  animation: pulseBorder 1.5s infinite;
}

.chunk-item.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

@keyframes pulseBorder {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(6, 182, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.chunk-text-snippet {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.chunk-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.badge-pending { background: rgba(255, 255, 255, 0.1); color: var(--text-dim); }
.badge-processing { background: rgba(6, 182, 212, 0.2); color: var(--accent-cyan); }
.badge-done { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.badge-error { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

/* Master Audio Player */
.player-card {
  display: none;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.player-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
}

.player-meta-tag {
  color: var(--accent-cyan);
  font-weight: 600;
}

audio {
  width: 100%;
  margin-bottom: 14px;
  border-radius: 30px;
  outline: none;
  filter: invert(0.9) hue-rotate(180deg);
}

.download-actions {
  display: flex;
  gap: 10px;
}

.btn-download {
  flex: 1;
  background: linear-gradient(135deg, var(--accent-green), #059669);
  color: #fff;
  text-decoration: none;
  padding: 13px;
  border-radius: var(--radius-md);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  transition: all 0.2s;
  font-size: 14px;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, #34d399, #059669);
}

/* History List */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: background 0.2s;
  gap: 10px;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.history-name {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 2px;
  color: #e2e8f0;
  word-break: break-all;
}

.history-meta {
  font-size: 10px;
  color: var(--text-dim);
}

.history-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: #131b2e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Auth Security Gate Overlay */
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 9, 17, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #111827;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 100%;
  padding: 36px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 50px rgba(99, 102, 241, 0.2);
  text-align: center;
}

.auth-lock-icon {
  font-size: 38px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.18);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.auth-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.auth-input {
  text-align: center;
  font-size: 18px;
  letter-spacing: 4px;
  padding: 12px 16px;
  height: 50px;
  background: #090e17;
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  color: #fff;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.45);
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

/* =========================================================
   Gemini 3.8 Studio Additions: Presets, Dialog & Expressions
   ========================================================= */

/* Quick Presets Chips Bar (Google AI Studio style) */
.preset-chips-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.preset-chip {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.preset-chip:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.preset-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.preset-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.preset-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Expression / Vocal Bursts Bar & Popup */
.expression-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.expression-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--primary);
  color: #fff;
}

.expression-picker-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: #0f172a;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 100;
  width: 290px;
  display: none;
}

.expression-picker-popup.show {
  display: block;
}

.expression-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.expression-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.expression-item:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
  color: #fff;
}

/* Dialog / Screenplay Blocks */
.dialog-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.speech-block {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 12px;
  position: relative;
  transition: border-color 0.2s;
}

.speech-block.speaker-2 {
  border-left-color: var(--accent-cyan);
}

.speech-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.speech-block-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speaker-select {
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.speaker-style-select {
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.btn-remove-block {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-remove-block:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.speech-block-textarea {
  width: 100%;
  height: 60px;
  background: #090e17;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}

.speech-block-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-add-speech-block {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-add-speech-block:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--primary);
  color: #fff;
}

/* Temperature Slider */
.temp-slider-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.temp-slider {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.temp-badge {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

/* Extended 2000+ Voices Explorer Modal */
.modal-voices-large {
  max-width: 860px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.voices-explorer-body {
  overflow-y: auto;
  max-height: calc(85vh - 140px);
  padding-right: 6px;
}

.voice-search-bar-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.voice-search-large {
  flex: 1;
  background: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
}

.voice-search-large:focus {
  outline: none;
  border-color: var(--primary);
}

.voice-category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-cyan);
  margin: 16px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 4px;
}

.voice-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.voice-row-card:hover {
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--primary);
}

.voice-row-card.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
}

.voice-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.voice-row-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.voice-row-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.voice-row-badges {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.badge-new {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-voice {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
}

.voice-new-design-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}




