:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1b2640;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --success: #10b981;
  --danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --card-radius: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

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

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

.logo-icon {
  font-size: 1.8rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.1;
}

.site-domain-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-top: 2px;
}

.domain-dot {
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 6px #38bdf8;
}

.domain-text {
  letter-spacing: 0.3px;
  color: #94a3b8;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  -webkit-text-fill-color: #fff;
}

.header-status {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* User Direct Personal Link / Tag */
.user-direct-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
}

.tag-icon {
  font-size: 0.85rem;
}

.tag-prefix {
  color: var(--text-muted);
}

.tag-code {
  font-family: monospace;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.tag-copy-btn:hover {
  background: var(--accent-hover);
}

.tag-copy-btn.copied {
  background: var(--success);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.search-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #f59e0b;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* Studio Grid Layout */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 20px;
  margin-top: 16px;
  flex: 1;
  min-height: 0;
  height: calc(100vh - 100px);
}

/* Video Section */
.video-container {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  height: 100%;
  gap: 12px;
}

.remote-card {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--bg-secondary);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Local Video PiP */
.local-card {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 200px;
  height: 130px;
  background: #000;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 10;
}

#localVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror view for self */
}

.local-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  font-size: 0.7rem;
  border-radius: 4px;
  color: #fff;
}

.local-media-status {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Video Placeholder State */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at center, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.placeholder-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.video-placeholder h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.video-placeholder p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 320px;
}

/* Search Spinner */
.spinner-ring {
  display: none;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Partner Badge */
.partner-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: 30px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10;
  animation: fadeIn 0.3s ease;
}

.partner-flag {
  font-size: 1.6rem;
}

.partner-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.partner-langs {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Real-time Subtitles Overlay */
.subtitles-overlay {
  position: absolute;
  bottom: 24px;
  left: 20px;
  right: 230px;
  display: flex;
  justify-content: center;
  z-index: 12;
  pointer-events: none;
}

.subtitle-box {
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
  pointer-events: auto;
}

.sub-speaker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.sub-text {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 500;
  line-height: 1.3;
}

/* Clickable word tokens in subtitles and chat */
.clickable-word {
  display: inline-block;
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 0 1px;
  transition: all 0.15s ease;
  position: relative;
}

.clickable-word:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
  transform: translateY(-1px);
  text-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.clickable-word.word-added {
  background: rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

/* Quick Word Action Tooltip / Popup */
.word-popup {
  position: fixed;
  z-index: 9999;
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 16px var(--accent-glow);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 190px;
  animation: fadeIn 0.15s ease;
}

.word-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.word-popup-target {
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
}

.word-popup-speak {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px;
  opacity: 0.8;
}
.word-popup-speak:hover { opacity: 1; transform: scale(1.1); }

.word-popup-body {
  font-size: 0.8rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.word-popup-trans {
  color: #38bdf8;
  font-weight: 600;
}

.word-popup-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.word-popup-btn:hover { background: var(--accent-hover); }

.word-popup-btn.added {
  background: var(--success);
  cursor: default;
}

.ctrl-btn.active-sub {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--accent);
  color: #c7d2fe;
}

/* Topic Banner */
.topic-banner {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(99, 102, 241, 0.2);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 450px;
  z-index: 10;
}

.topic-icon {
  font-size: 1.3rem;
}

.topic-text {
  font-size: 0.85rem;
  line-height: 1.3;
}

.topic-label {
  display: block;
  font-size: 0.7rem;
  color: #c7d2fe;
  font-weight: 700;
  text-transform: uppercase;
}

.topic-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
}
.topic-close:hover { opacity: 1; }

/* Control Toolbar */
.media-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
}

.ctrl-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: var(--transition);
}

.ctrl-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.ctrl-btn.off {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #fca5a5;
}

.ctrl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn {
  border: none;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.start-btn {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.start-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.start-btn.searching {
  background: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.next-btn {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.next-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.sidebar-section {
  background: var(--bg-secondary);
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.section-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-helper-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Mic Test Section */
.mic-test-container {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.mic-test-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mic-test-btn {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid var(--accent);
  color: #c7d2fe;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.mic-test-btn:hover {
  background: var(--accent);
  color: #fff;
}

.mic-test-btn.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.mic-level-track {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mic-level-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #f59e0b 70%, #ef4444 100%);
  border-radius: 6px;
  transition: width 0.06s ease;
}

.mic-test-feedback {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mic-test-feedback.good {
  color: #34d399;
}

/* Direct Call Box */
.direct-call-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.direct-call-box label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.direct-input-row {
  display: flex;
  gap: 6px;
}

.direct-input-row input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  outline: none;
}

.direct-input-row input:focus {
  border-color: var(--accent);
}

.direct-input-row button {
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.direct-input-row button:hover {
  background: var(--accent-hover);
}

/* Vocabulary / Dictionary Section */
.vocab-section {
  display: flex;
  flex-direction: column;
  max-height: 190px;
}

.vocab-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vocab-counter {
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
}

.flashcards-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.flashcards-btn:hover {
  background: var(--success);
  color: #fff;
  transform: translateY(-1px);
}

.vocab-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
}
.vocab-clear-btn:hover { color: var(--danger); }

.vocab-add-form {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.vocab-add-form input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  outline: none;
}
.vocab-add-form input:focus { border-color: var(--accent); }

.vocab-add-form button {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  width: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vocab-add-form button:hover { background: var(--accent-hover); }

.vocab-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
  min-height: 60px;
}

.vocab-list::-webkit-scrollbar { width: 4px; }
.vocab-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.vocab-empty {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 6px;
  line-height: 1.4;
}

.vocab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  animation: fadeIn 0.2s ease;
}

.vocab-item-texts {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.vocab-word {
  font-weight: 700;
  color: #fff;
}

.vocab-trans {
  color: #94a3b8;
  font-size: 0.7rem;
}

.vocab-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.vocab-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  opacity: 0.6;
  padding: 2px;
}
.vocab-action-btn:hover { opacity: 1; }

/* Language Selectors */
.lang-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

select:focus {
  border-color: var(--accent);
}

.exchange-swap-icon {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 18px;
}

.algorithm-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 12px;
  background: rgba(99, 102, 241, 0.08);
  padding: 8px 12px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

/* Chat Section */
.chat-section {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px;
  margin-bottom: 10px;
  min-height: 120px;
  max-height: 260px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.chat-system-message {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: 8px;
  line-height: 1.3;
}

.message-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: fadeIn 0.2s ease;
}

.message-row.sent {
  align-self: flex-end;
}

.message-row.received {
  align-self: flex-start;
}

.message-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.35;
  word-break: break-word;
}

.message-row.sent .message-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.message-row.received .message-bubble {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border);
}

.message-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
  align-self: flex-end;
}

/* Quick Phrases */
.quick-phrases {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.quick-phrases::-webkit-scrollbar {
  display: none;
}

.phrase-tag {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.phrase-tag:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
}

/* Chat Input Row */
.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.chat-input-row input:focus {
  border-color: var(--accent);
}

.chat-input-row button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.chat-input-row button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.chat-input-row button:disabled,
.chat-input-row input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Flashcards 3D Modal & Cards */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.flashcards-modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(99, 102, 241, 0.2);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.modal-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.modal-close-btn:hover { color: #fff; }

.flashcards-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.flashcards-progress-bar {
  width: 20%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
  transition: width 0.3s ease;
}

.flashcards-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: -8px;
}

/* 3D Flip Card */
.flip-card-wrapper {
  perspective: 1000px;
  height: 220px;
  width: 100%;
  cursor: pointer;
}

.flip-card {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.flipped {
  transform: rotateY(180deg);
}

.flip-card-side {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.flip-card-front {
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.flip-card-back {
  background: radial-gradient(circle at center, #1e1b4b 0%, #0f172a 100%);
  transform: rotateY(180deg);
  border-color: rgba(99, 102, 241, 0.4);
}

.card-side-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-word {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.card-trans {
  font-size: 1.6rem;
  font-weight: 800;
  color: #38bdf8;
}

.card-audio-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: 12px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-audio-btn:hover { background: var(--accent); transform: scale(1.1); }

.card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 14px;
}

/* Action Buttons */
.flashcards-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card-action-btn {
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.repeat-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.repeat-btn:hover { background: var(--danger); color: #fff; }

.know-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.know-btn:hover { background: var(--success); color: #fff; }

/* Responsive */
@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 340px;
  }

  .app-container {
    height: auto;
    min-height: 100vh;
  }

  .remote-card {
    min-height: 360px;
  }
}
