.llm-post {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px;
  color: #1f2937;
  line-height: 1.7;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.llm-post h1 {
  font-size: 2rem;
  margin: 0 0 16px;
  color: #111827;
}

.llm-post h2 {
  margin-top: 40px;
  margin-bottom: 12px;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
}

.llm-post p {
  margin: 14px 0;
}

.llm-post ul {
  margin: 10px 0;
  padding-left: 22px;
}

.llm-post li {
  margin: 6px 0;
}

.note {
  font-size: 0.92rem;
  color: #475569;
  border-left: 3px solid #cbd5e1;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 5px;
  margin: 14px 0;
}

.summary-line {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e40af;
  border-left: 4px solid #1e40af;
  padding: 10px 14px;
  background: #f0f4ff;
  border-radius: 6px;
}

.demo-box {
  margin: 24px 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.demo-box h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  color: #0f172a;
}

.demo-box p {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #475569;
}

.demo-box textarea,
.demo-box input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}

.demo-box textarea:focus,
.demo-box input[type="text"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.demo-box button {
  margin-top: 8px;
  padding: 8px 16px;
  background: #0f172a;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.demo-box button:hover {
  background: #1e293b;
}

.demo-stats {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #475569;
}

/* Tokenizer */
.token-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
  min-height: 36px;
}

.token-chip {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 4px;
  font-family: "SF Mono", Monaco, "Courier New", monospace;
  font-size: 0.88rem;
  white-space: pre;
  line-height: 1.4;
  cursor: default;
  transition: transform 0.1s, box-shadow 0.1s;
}

.token-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Embeddings */
.embed-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.embed-controls input {
  flex: 1;
}

#embedCanvas {
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  display: block;
  cursor: pointer;
}

/* Attention */
.attn-controls {
  margin-bottom: 10px;
}

.attn-controls select {
  width: 100%;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
}

.attn-visual {
  min-height: 60px;
  margin-top: 10px;
}

.attn-word {
  display: inline-block;
  padding: 6px 8px;
  margin: 3px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.15s;
  background: #e2e8f0;
}

.attn-word:hover {
  background: #cbd5e1;
}

.attn-word.selected {
  background: #1e40af;
  color: #fff;
}

.attn-word.highlighted {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

.attn-lines {
  position: relative;
  margin-top: 8px;
}

.attn-bar {
  display: flex;
  align-items: center;
  margin: 3px 0;
  gap: 8px;
  font-size: 0.9rem;
}

.attn-bar-label {
  min-width: 90px;
  text-align: right;
  color: #475569;
}

.attn-bar-fill {
  height: 14px;
  background: #3b82f6;
  border-radius: 3px;
  transition: width 0.2s;
}

.attn-bar-val {
  font-size: 0.82rem;
  color: #64748b;
  min-width: 40px;
}

/* Prediction */
.pred-display {
  margin-top: 12px;
}

.pred-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 0.95rem;
}

.pred-word {
  min-width: 100px;
  font-weight: 600;
  text-align: right;
}

.pred-bar-bg {
  flex: 1;
  height: 16px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.pred-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 4px;
  transition: width 0.3s;
}

.pred-pct {
  min-width: 45px;
  font-size: 0.85rem;
  color: #64748b;
}

/* Temperature */
.temp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.temp-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.temp-input {
  max-width: 320px;
}

.temp-controls input[type="range"] {
  width: 160px;
}

.temp-display {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 48px;
}

.temp-display .sampled {
  font-weight: 600;
  color: #1e40af;
}

.temp-chart-area {
  margin-top: 12px;
}

#tempCanvas {
  max-width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  display: block;
}

@media (max-width: 640px) {
  .llm-post {
    padding: 14px;
  }

  .llm-post h1 {
    font-size: 1.6rem;
  }

  .embed-controls {
    flex-direction: column;
  }

  .temp-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .temp-controls input[type="range"] {
    width: 100%;
  }

  .temp-input {
    max-width: 100%;
  }
}
