/* ==========================================================================
   TarjimaAI: English-to-Uzbek Neural Machine Translation
   Design System & Styling
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #07090e;
  --bg-card: rgba(16, 22, 36, 0.75);
  --bg-card-hover: rgba(22, 30, 50, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 242, 254, 0.4);
  --border-glow: rgba(0, 242, 254, 0.25);

  /* Primary Accents */
  --cyan-primary: #00f2fe;
  --cyan-deep: #4facfe;
  --purple-primary: #8b5cf6;
  --purple-deep: #6366f1;
  --amber-primary: #f59e0b;
  --emerald-primary: #10b981;
  --rose-primary: #f43f5e;

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --text-inverse: #07090e;

  /* Typography Fonts */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Shadows & Glows */
  --glow-cyan: 0 0 25px rgba(0, 242, 254, 0.25);
  --glow-purple: 0 0 25px rgba(139, 92, 246, 0.25);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Transitions */
  --trans-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --trans-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base Reset & Smooth Scroll */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Ambient Background Lighting */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  transition: all 1s ease;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  top: -150px;
  left: 10%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.25), transparent 70%);
}

.bg-glow-2 {
  width: 600px;
  height: 600px;
  top: 30%;
  right: -150px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2), transparent 70%);
}

.bg-glow-3 {
  width: 550px;
  height: 550px;
  bottom: -100px;
  left: 20%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15), transparent 70%);
}

/* Header & Navigation Bar */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 14, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 2rem;
}

.header-container {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--cyan-primary), var(--purple-primary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  box-shadow: var(--glow-cyan);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-title span {
  background: linear-gradient(135deg, var(--cyan-primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Telemetry Pills */
.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: var(--trans-smooth);
}

.telemetry-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

.pill-icon {
  width: 14px;
  height: 14px;
  color: var(--cyan-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-primary);
  box-shadow: 0 0 8px var(--emerald-primary);
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--trans-smooth);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  color: var(--cyan-primary);
  background: rgba(0, 242, 254, 0.06);
  border-color: rgba(0, 242, 254, 0.2);
}

.btn-ghost svg {
  width: 16px;
  height: 16px;
}

/* Main Container */
.main-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
  position: relative;
  z-index: 1;
}

/* Hero Section */
.hero-section {
  text-align: center;
  max-width: 880px;
  margin: 0 auto 2.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 9999px;
  color: var(--cyan-primary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.25rem;
  animation: floatBadge 3s ease-in-out infinite;
}

.hero-badge svg {
  width: 15px;
  height: 15px;
}

@keyframes floatBadge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, #ffffff 10%, var(--cyan-primary) 60%, var(--purple-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto 2rem;
}

/* Architecture Mode Selector */
.mode-selector-wrapper {
  display: flex;
  justify-content: center;
}

.mode-selector {
  display: inline-flex;
  background: rgba(13, 17, 28, 0.9);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem;
  border-radius: 14px;
  gap: 0.4rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--trans-smooth);
  text-align: left;
}

.mode-tab svg {
  width: 20px;
  height: 20px;
  color: var(--text-faint);
  transition: var(--trans-smooth);
}

.tab-label-group {
  display: flex;
  flex-direction: column;
}

.tab-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.tab-hint {
  font-size: 0.72rem;
  color: var(--text-faint);
}

.mode-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15), rgba(139, 92, 246, 0.15));
  border-color: var(--border-active);
  box-shadow: var(--glow-cyan);
}

.mode-tab.active svg {
  color: var(--cyan-primary);
}

.mode-tab.active .tab-title {
  color: var(--cyan-primary);
}

/* Notice Banner */
.notice-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 2rem;
  color: #fde68a;
  font-size: 0.88rem;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.notice-icon {
  width: 20px;
  height: 20px;
  color: var(--amber-primary);
  flex-shrink: 0;
}

.notice-content {
  flex-grow: 1;
}

.notice-content code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #fff;
}

.btn-icon-subtle {
  background: transparent;
  border: none;
  color: #fde68a;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-subtle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Translation Studio Layout */
.translation-studio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.translation-studio.comparison-active {
  grid-template-columns: 1fr;
}

/* Studio Card */
.studio-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: var(--trans-smooth);
  position: relative;
}

.studio-card:focus-within, .studio-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

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

.lang-tag {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.flag-icon {
  font-size: 1.25rem;
}

.lang-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

.lang-role {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--cyan-primary);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-tool {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-smooth);
}

.btn-tool:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-subtle);
}

.btn-tool svg {
  width: 16px;
  height: 16px;
}

/* Card Body & Input Area */
.card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

#sourceInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 130px;
}

#sourceInput::placeholder {
  color: var(--text-faint);
}

/* Target Output Box */
.output-display {
  width: 100%;
  min-height: 130px;
  font-size: 1.15rem;
  line-height: 1.6;
  color: #e2e8f0;
  font-family: var(--font-body);
  display: flex;
  align-items: flex-start;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-display.loading {
  opacity: 0.6;
  position: relative;
}

.placeholder-text {
  color: var(--text-faint);
  font-style: italic;
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.divider {
  color: var(--text-faint);
}

.telemetry-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  color: var(--cyan-primary);
}

.telemetry-tag svg {
  width: 14px;
  height: 14px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

.status-dot-active {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-primary);
  box-shadow: 0 0 6px var(--emerald-primary);
}

.action-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.beam-dropdown {
  background: rgba(18, 24, 40, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  transition: var(--trans-smooth);
}

.beam-dropdown:focus, .beam-dropdown:hover {
  border-color: var(--cyan-primary);
  background: rgba(24, 32, 54, 0.95);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

.error-notice-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 10px;
  padding: 1.25rem;
  color: #fca5a5;
  font-size: 0.88rem;
  line-height: 1.5;
}

.error-notice-box strong {
  display: block;
  font-size: 0.95rem;
  color: #f87171;
  margin-bottom: 0.35rem;
}

.error-notice-box p {
  margin: 0.25rem 0 0.75rem 0;
  color: var(--text-muted);
}

.error-notice-box code {
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan-primary);
}

/* Action Translate Button */
.btn-translate {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.4rem;
  background: linear-gradient(135deg, var(--cyan-primary), #3b82f6);
  border: none;
  border-radius: 10px;
  color: #07090e;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--trans-bounce);
  box-shadow: var(--glow-cyan);
}

.btn-translate:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.45);
}

.btn-translate:active {
  transform: translateY(0);
}

.btn-translate svg {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}

.btn-translate:hover svg {
  transform: translateX(3px);
}

.btn-shortcut {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.2rem;
}

/* Preset Chips */
.preset-chips {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-right: 0.25rem;
}

.chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--trans-smooth);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chip:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--border-active);
  color: var(--cyan-primary);
  transform: translateY(-1px);
}

/* Dual Comparison Container */
.dual-comparison-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.dual-card {
  min-height: 220px;
}

.dual-attention {
  border-color: rgba(0, 242, 254, 0.3);
  box-shadow: 0 4px 25px rgba(0, 242, 254, 0.08);
}

.dual-baseline {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 4px 25px rgba(245, 158, 11, 0.08);
}

.model-badge {
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-attention {
  background: rgba(0, 242, 254, 0.12);
  color: var(--cyan-primary);
  border: 1px solid rgba(0, 242, 254, 0.3);
}

.badge-baseline {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber-primary);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-feature {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-faint);
}

.metric-good {
  font-size: 0.78rem;
  color: var(--emerald-primary);
  font-weight: 600;
}

.metric-warning {
  font-size: 0.78rem;
  color: var(--amber-primary);
  font-weight: 600;
}

/* ==========================================================================
   Token Alignment Ribbon (Bipartite Flow)
   ========================================================================== */
.flow-section {
  margin-bottom: 3.5rem;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
}

.section-title svg {
  color: var(--cyan-primary);
  width: 24px;
  height: 24px;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.token-flow-container {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow-x: auto;
}

.flow-track {
  display: flex;
  align-items: center;
  justify-content: space-around;
  min-width: 600px;
  padding: 0.5rem 0;
  gap: 0.75rem;
}

.flow-token {
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans-smooth);
  position: relative;
  user-select: none;
  border: 1px solid var(--border-subtle);
}

.flow-token.source-token {
  background: rgba(0, 242, 254, 0.08);
  color: #38bdf8;
  border-color: rgba(0, 242, 254, 0.25);
}

.flow-token.target-token {
  background: rgba(139, 92, 246, 0.08);
  color: #c084fc;
  border-color: rgba(139, 92, 246, 0.25);
}

.flow-token:hover, .flow-token.active {
  transform: translateY(-2px);
  box-shadow: var(--glow-cyan);
  border-color: var(--cyan-primary);
  color: #fff;
}

.flow-canvas-wrapper {
  height: 120px;
  position: relative;
  width: 100%;
  min-width: 600px;
}

#flowCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   2D Attention Heatmap Matrix
   ========================================================================== */
.matrix-section {
  margin-bottom: 4rem;
}

.matrix-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.custom-select {
  background: rgba(18, 24, 40, 0.9);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.custom-select:focus {
  border-color: var(--cyan-primary);
}

.btn-toggle, .btn-tool-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--trans-smooth);
}

.btn-toggle:hover, .btn-tool-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-toggle.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--border-active);
  color: var(--cyan-primary);
}

.btn-toggle svg, .btn-tool-secondary svg {
  width: 14px;
  height: 14px;
}

/* Matrix Card */
.matrix-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.matrix-scroll-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 550px;
  padding-bottom: 0.5rem;
}

.matrix-content {
  display: inline-block;
  min-width: 100%;
}

/* 2D Grid Table */
.matrix-table {
  border-collapse: separate;
  border-spacing: 4px;
  font-family: var(--font-mono);
}

/* Column Header (English tokens) */
.col-header {
  padding: 0.5rem 0.6rem;
  color: #38bdf8;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  vertical-align: bottom;
  transform-origin: bottom left;
  user-select: none;
}

.col-header.highlighted {
  color: #fff;
  text-shadow: 0 0 10px var(--cyan-primary);
}

/* Row Header (Uzbek tokens) */
.row-header {
  padding: 0.5rem 0.9rem;
  color: #c084fc;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  user-select: none;
}

.row-header.highlighted {
  color: #fff;
  text-shadow: 0 0 10px var(--purple-primary);
}

/* Matrix Cell */
.matrix-cell {
  width: 48px;
  height: 44px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  user-select: none;
}

.matrix-cell:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

.matrix-cell.cell-dimmed {
  opacity: 0.4;
}

.matrix-cell.cell-focused {
  transform: scale(1.18);
  z-index: 12;
  outline: 2px solid #ffffff;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.8);
}

/* Inspector Floating Toolbar */
.matrix-inspector {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  background: rgba(7, 9, 14, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font-size: 0.85rem;
}

.inspector-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inspector-label {
  color: var(--text-faint);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inspector-val {
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.token-uzb {
  color: #c084fc;
  background: rgba(139, 92, 246, 0.12);
}

.token-eng {
  color: #38bdf8;
  background: rgba(0, 242, 254, 0.12);
}

.inspector-connector {
  color: var(--text-faint);
}

.inspector-connector svg {
  width: 16px;
  height: 16px;
}

.inspector-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.score-highlight {
  color: var(--amber-primary);
  font-size: 0.95rem;
  background: rgba(245, 158, 11, 0.15);
}

.inspector-desc {
  margin-left: auto;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
}

/* ==========================================================================
   Architecture & Math Section
   ========================================================================== */
.math-section {
  margin-bottom: 4rem;
}

.math-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

.math-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: var(--trans-smooth);
}

.math-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 242, 254, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.math-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.math-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-primary), var(--purple-primary));
  color: var(--text-inverse);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.math-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.math-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.55;
}

.equation-box {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.equation-box code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--cyan-primary);
  white-space: nowrap;
}

.math-card-note {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: auto;
}

.linguistic-pill-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.ling-pill {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #c084fc;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 0 1rem;
  margin-top: 2rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
}

.footer-brand span {
  color: var(--cyan-primary);
}

.footer-text {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 0.2rem;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Toast Notification System
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: rgba(18, 24, 40, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-active);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  color: var(--text-main);
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s ease 2.7s forwards;
}

.toast svg {
  width: 18px;
  height: 18px;
  color: var(--cyan-primary);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-10px) scale(0.9); }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 980px) {
  .translation-studio {
    grid-template-columns: 1fr;
  }
  .dual-comparison-container {
    grid-template-columns: 1fr;
  }
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .telemetry-bar {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .header-actions {
    display: none;
  }
  .hero-title {
    font-size: 2.1rem;
  }
}
