/* ============================================================
   llm.css — Styles page LLM
   Les classes préfixées llm- sont spécifiques à cette page.
   Les classes sans préfixe sont à déplacer dans scroll-sections.css
   ============================================================ */

/* ── Tokenizer ── */
.llm-tokenizer-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.llm-tokenizer-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.llm-tokenizer-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ss-border);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-family: var(--ss-font-mono);
  font-size: 0.85rem;
  color: var(--ss-text);
  outline: none;
  transition: border-color 0.2s ease;
}
.llm-tokenizer-input:focus {
  border-color: var(--ss-accent);
}

.llm-tokenizer-count {
  font-family: var(--ss-font-mono);
  font-size: 0.72rem;
  color: var(--ss-accent);
  flex-shrink: 0;
  white-space: nowrap;
}

.llm-tokenizer-output {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 48px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--ss-border);
}

.llm-token {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: var(--ss-font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: default;
  transition: transform 0.15s ease;
  animation: tokenPop 0.2s ease;
}
.llm-token:hover {
  transform: translateY(-2px);
}

@keyframes tokenPop {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Palette de couleurs pour les tokens */
.llm-token-0 {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.llm-token-1 {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.llm-token-2 {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.llm-token-3 {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.llm-token-4 {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.llm-token-5 {
  background: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.llm-token-6 {
  background: rgba(244, 114, 182, 0.2);
  color: #f9a8d4;
  border: 1px solid rgba(244, 114, 182, 0.3);
}
.llm-token-7 {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.llm-tokenizer-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.35rem 0;
}
.llm-token-id {
  font-family: var(--ss-font-mono);
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.25);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
}

/* ── SVG générique ── */
.llm-svg {
  width: 100%;
  height: 360px;
  overflow: visible;
}
.llm-svg--attention {
  height: 300px;
}

/* ── Predictor viz ── */
.llm-predictor-viz {
  width: 100%;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
}

.llm-phrase {
  font-family: var(--ss-font-mono);
  font-size: 1.1rem;
  color: var(--ss-text);
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.llm-phrase-known {
  color: var(--ss-muted);
}
.llm-phrase-target {
  color: var(--ss-accent);
  border-bottom: 2px solid var(--ss-accent);
  padding-bottom: 1px;
}
.llm-phrase-blank {
  display: inline-block;
  width: 80px;
  height: 1.4em;
  background: rgba(59, 130, 246, 0.15);
  border-radius: 4px;
  border: 1px dashed rgba(59, 130, 246, 0.4);
  vertical-align: middle;
  animation: blankPulse 1.5s ease-in-out infinite;
}
@keyframes blankPulse {
  0%,
  100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.llm-candidates {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.llm-candidate {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.llm-candidate-word {
  font-family: var(--ss-font-mono);
  font-size: 0.8rem;
  color: var(--ss-text);
  flex: 0 0 80px;
}
.llm-candidate-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.llm-candidate-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--ss-accent);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.llm-candidate-bar--top {
  background: var(--ss-accent);
}
.llm-candidate-bar--2 {
  background: #8b5cf6;
}
.llm-candidate-bar--3 {
  background: #10b981;
}
.llm-candidate-prob {
  font-family: var(--ss-font-mono);
  font-size: 0.72rem;
  color: var(--ss-muted);
  flex: 0 0 40px;
  text-align: right;
}

/* ── Attention viz ── */
.llm-attention-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

/* ── Training animation ── */
.llm-training-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.llm-training-text {
  font-family: var(--ss-font-mono);
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--ss-muted);
  min-height: 80px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--ss-border);
}

.llm-training-current {
  color: var(--ss-text);
  font-weight: 600;
}
.llm-training-predicted {
  color: var(--ss-accent);
  background: rgba(59, 130, 246, 0.15);
  border-radius: 3px;
  padding: 0 3px;
}
.llm-training-wrong {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border-radius: 3px;
  padding: 0 3px;
  text-decoration: line-through;
}

.llm-training-candidates {
  min-height: 36px;
}
.llm-training-candidate-chip {
  font-family: var(--ss-font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--ss-border);
  color: var(--ss-muted);
  transition: all 0.3s ease;
}
.llm-training-candidate-chip.is-winner {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--ss-accent);
  color: var(--ss-accent);
}
.llm-training-candidate-chip.is-loser {
  opacity: 0.3;
}

.llm-training-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  gap: 1.5rem;
}

.llm-training-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Autocomplétion ── */
.llm-autocomplete-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.llm-autocomplete-text {
  font-family: var(--ss-font-mono);
  font-size: 0.95rem;
  line-height: 2;
  color: var(--ss-text);
  min-height: 100px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--ss-border);
}

.llm-token-generated {
  display: inline;
  animation: tokenAppear 0.2s ease;
}
@keyframes tokenAppear {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.llm-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--ss-accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.7s step-end infinite;
}

@keyframes cursorBlink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.llm-token-generated {
  color: #6ee7b7;
  font-weight: 500;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.llm-autocomplete-candidates {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 32px;
}
.llm-auto-chip {
  font-family: var(--ss-font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--ss-border);
  color: var(--ss-muted);
  transition: all 0.25s ease;
}
.llm-auto-chip.is-chosen {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--ss-accent);
  color: var(--ss-text);
}

/* ── Température ── */
.llm-temp-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.llm-temp-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.llm-temp-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--ss-font-mono);
  font-size: 0.75rem;
  color: var(--ss-muted);
  flex: 0 0 120px;
}
.llm-temp-label .material-icons-round {
  font-size: 16px;
  color: var(--ss-accent);
}
#tempSlider {
  flex: 1;
  accent-color: var(--ss-accent);
  height: 4px;
  cursor: pointer;
}
#tempValue {
  font-family: var(--ss-font-mono);
  font-size: 0.9rem;
  color: var(--ss-accent);
  flex: 0 0 35px;
  text-align: right;
  font-weight: 600;
}

.llm-temp-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.llm-temp-bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.llm-temp-bar-label {
  font-family: var(--ss-font-mono);
  font-size: 0.75rem;
  color: var(--ss-muted);
  flex: 0 0 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.llm-temp-bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  overflow: hidden;
}
.llm-temp-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition:
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.4s ease;
}
.llm-temp-bar-pct {
  font-family: var(--ss-font-mono);
  font-size: 0.68rem;
  color: var(--ss-muted);
  flex: 0 0 38px;
  text-align: right;
}
.llm-temp-hint {
  font-family: var(--ss-font-mono);
  font-size: 0.72rem;
  color: var(--ss-muted);
  font-style: italic;
  min-height: 1.2em;
}

/* ── Hallucinations ── */
.llm-hallucination-wrap {
  width: 100%;
}
.llm-hallucination-examples {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.llm-hallucination-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ss-border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  animation: fadeIn 0.4s ease;
}
.llm-hallucination-card-label {
  font-family: var(--ss-font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}
.llm-hallucination-card--question .llm-hallucination-card-label {
  color: var(--ss-muted);
}
.llm-hallucination-card--answer .llm-hallucination-card-label {
  color: #f43f5e;
}
.llm-hallucination-card-text {
  font-family: var(--ss-font-mono);
  font-size: 0.82rem;
  color: var(--ss-text);
  line-height: 1.6;
}
.llm-hallucination-card--answer .llm-hallucination-card-text {
  color: #fca5a5;
}
.llm-hallucinated-word {
  border-bottom: 2px solid #f43f5e;
  color: #f43f5e;
  cursor: help;
  position: relative;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── RLHF viz ── */
.llm-rlhf-viz {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}
.llm-rlhf-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 420px;
  opacity: 0;
  transform: translateX(20px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.llm-rlhf-step.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.llm-rlhf-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.llm-rlhf-icon .material-icons-round {
  font-size: 20px;
  color: #fff;
}
.llm-rlhf-icon--pretrain {
  background: rgba(59, 130, 246, 0.3);
}
.llm-rlhf-icon--sft {
  background: rgba(139, 92, 246, 0.3);
}
.llm-rlhf-icon--rlhf {
  background: rgba(16, 185, 129, 0.3);
}
.llm-rlhf-info {
  flex: 1;
}
.llm-rlhf-title {
  font-family: var(--ss-font-mono);
  font-size: 0.78rem;
  color: var(--ss-text);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.llm-rlhf-desc {
  font-size: 0.78rem;
  color: var(--ss-muted);
  line-height: 1.5;
}
.llm-rlhf-arrow {
  text-align: center;
  color: rgba(255, 255, 255, 0.15);
  font-size: 1.2rem;
  line-height: 1;
}

/* ── Models viz ── */
.llm-models-viz {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.llm-model-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}
.llm-model-name {
  font-family: var(--ss-font-mono);
  font-size: 0.75rem;
  color: var(--ss-text);
  flex: 0 0 90px;
  white-space: nowrap;
}
.llm-model-bar-track {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
}
.llm-model-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.llm-model-params {
  font-family: var(--ss-font-mono);
  font-size: 0.68rem;
  color: var(--ss-muted);
  flex: 0 0 55px;
  text-align: right;
}
.llm-model-tag {
  font-family: var(--ss-font-mono);
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.llm-model-tag--open {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}
.llm-model-tag--closed {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

/* ── Myth panel (section 0) ── */
.llm-myth-panel {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.llm-myth-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--ss-border);
  opacity: 0;
  transform: translateX(20px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.llm-myth-item.is-visible {
  opacity: 1;
  transform: translateX(0);
}
.llm-myth-icon {
  flex-shrink: 0;
}
.llm-myth-icon .material-icons-round {
  font-size: 18px;
}
.llm-myth-item--wrong .llm-myth-icon .material-icons-round {
  color: #f43f5e;
}
.llm-myth-item--right .llm-myth-icon .material-icons-round {
  color: #10b981;
}
.llm-myth-text {
  font-family: var(--ss-font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}
.llm-myth-item--wrong .llm-myth-text {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: line-through;
}
.llm-myth-item--right .llm-myth-text {
  color: var(--ss-text);
}

.llm-embedding-3d {
  width: 100%;
  height: 550px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--ss-border);
  cursor: grab;
}
.llm-embedding-3d:active {
  cursor: grabbing;
}

.llm-embedding-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}
.ss-btn--sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.72rem;
}
.ss-btn--sm .material-icons-round {
  font-size: 14px;
}

@media (max-width: 900px) {
  .llm-myth-panel {
    display: none;
  }
}
