:root {
  --bg-primary: #0a0d14;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #38bdf8;
  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Header */
.top-nav {
  height: 56px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 10;
}

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

.logo-shield {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #0284c7, #10b981);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.brand-text h1 span {
  color: var(--accent-cyan);
}

.brand-text .subtitle {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.room-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.select-pill {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

/* Conference Main Layout */
.conference-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.video-stage-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-primary);
  overflow: hidden;
}

.video-grid {
  flex: 1;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  align-items: center;
  justify-items: center;
}

.video-grid.single-peer {
  grid-template-columns: 1fr;
}

.video-grid.two-peers {
  grid-template-columns: repeat(2, 1fr);
}

.video-grid.multi-peers {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.video-tile {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 180px);
  background-color: #05070b;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-main);
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror local camera */
}

.video-tile.remote-tile video {
  transform: none; /* normal for peers */
}

.tile-overlay {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.user-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
}

.avatar-letter {
  width: 20px;
  height: 20px;
  background: var(--accent-cyan);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 700;
  font-size: 0.65rem;
}

.lang-tag {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.65rem;
}

.media-indicators {
  display: flex;
  gap: 0.35rem;
}

.media-indicators .icon {
  background: rgba(0, 0, 0, 0.65);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Subtitle Ribbon */
.subtitle-ribbon-container {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  max-width: 900px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7);
  z-index: 5;
  transition: all 0.3s ease;
}

.subtitle-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.live-pill {
  font-size: 0.62rem;
  background: linear-gradient(135deg, #0284c7, #10b981);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.speaker-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.subtitle-body .sub-orig {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.35;
}

.subtitle-body .sub-trans {
  font-size: 1.05rem;
  font-weight: 600;
  color: #6ee7b7;
  line-height: 1.35;
  margin-top: 0.2rem;
}

/* Sidebar Drawer */
.conference-sidebar {
  width: 360px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  z-index: 9;
}

.conference-sidebar.collapsed {
  width: 0;
  overflow: hidden;
  border-left: none;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.04);
}

.tab-content {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 0.85rem;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
}

.transcript-header, .mou-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-small {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small.btn-primary {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
}

.transcript-stream {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.transcript-item {
  background: var(--bg-surface-elevated);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-cyan);
  font-size: 0.78rem;
}

.transcript-item.system-item {
  border-left-color: var(--text-dim);
  opacity: 0.7;
}

.ts-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-right: 0.4rem;
}

.ts-speaker {
  font-weight: 700;
  color: var(--accent-cyan);
  margin-right: 0.4rem;
}

.ts-orig {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.2rem;
}

.ts-trans {
  color: #6ee7b7;
  font-weight: 500;
  margin-top: 0.15rem;
}

.mou-editor {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  color: var(--text-main);
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.chat-input-bar {
  display: flex;
  gap: 0.4rem;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
}

.btn-send {
  padding: 0.5rem 0.85rem;
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
}

/* Controls Dock */
.controls-dock {
  height: 72px;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  z-index: 10;
}

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

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dock-btn .icon {
  font-size: 1.15rem;
  margin-bottom: 2px;
}

.dock-btn .label {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.dock-btn:hover {
  background: #374151;
  transform: translateY(-2px);
}

.dock-btn.active-off {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.dock-btn.ai-active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.dock-btn.btn-danger {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: #fff;
}

.dock-btn.btn-danger:hover {
  background: #e11d48;
}

/* Modal Join Form */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.modal-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.modal-card p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1.1rem;
}

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

.form-group input, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.btn-submit {
  width: 100%;
  padding: 0.8rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #0284c7, #10b981);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-submit:hover {
  opacity: 0.95;
}


/* ==========================================================================
   🇱🇺 LëtzTutor (Lëtzebuergesch Léieren) Styles
   ========================================================================== */

.letztutor-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.25rem 0;
  overflow-y: auto;
}

.letztutor-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-md);
}

.letztutor-banner .flag-icon {
  font-size: 2rem;
  line-height: 1;
}

.letztutor-banner h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.letztutor-banner .lt-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0 0;
}

.lt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.lt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.lt-card-header h5 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.lt-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.n-rule-motto {
  font-size: 0.78rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-sky);
  margin: 0 0 0.75rem 0;
}

.n-rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.rule-col {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.72rem;
}

.rule-col h6 {
  font-size: 0.72rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
}

.rule-col ul {
  margin: 0;
  padding-left: 1rem;
}

.rule-col li {
  margin-bottom: 0.25rem;
  color: var(--text-muted);
}

.rule-keep {
  border-left: 3px solid var(--accent-emerald);
}
.rule-keep h6 {
  color: var(--accent-emerald);
}

.rule-drop {
  border-left: 3px solid var(--accent-rose);
}
.rule-drop h6 {
  color: var(--accent-rose);
}

.n-rule-tester {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.n-rule-tester label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.tester-input-group {
  display: flex;
  gap: 0.5rem;
}

.tester-input-group input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
}

.tester-result {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: none;
}

.tester-result.correct {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-emerald);
}

.tester-result.warning {
  display: block;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.target-sentence-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin: 0.75rem 0;
}

.ts-lux-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.ts-lux-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-sky);
  margin: 0;
}

.ts-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.ts-phonetic {
  font-size: 0.72rem;
  color: var(--accent-emerald);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ts-trans-de {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lt-actions-bar {
  display: flex;
  gap: 0.5rem;
  margin: 0.85rem 0;
}

.btn-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-listen {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-sky);
}
.btn-listen:hover {
  background: rgba(56, 189, 248, 0.22);
}

.btn-record {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-emerald);
}
.btn-record:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-record.recording {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--accent-rose);
  color: #fff;
  animation: pulse-border 1.5s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.lt-evaluation-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-top: 0.75rem;
}

.eval-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.eval-score {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
}

.eval-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.word-match {
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-weight: 600;
}

.word-partial {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
}

.word-miss {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  text-decoration: line-through;
}

.eval-feedback {
  font-size: 0.72rem;
  color: var(--text-main);
  margin: 0.4rem 0 0 0;
}
