/* ===== Global ===== */
html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

body {
  font-family: 'Inter', 'Noto Sans', sans-serif;
  color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.section {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
  scroll-margin-top: 64px;
}

/* ===== Sticky Navbar ===== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(88, 28, 135, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(192, 132, 252, 0.25);
  height: 64px;
}

.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-nav-brand {
  font-family: 'Google Sans', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav-brand:hover {
  color: #c7d2fe;
}

.site-nav-logo {
  height: 52px;
  width: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav-links a {
  color: #e9d5ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.site-nav-links a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

@media (max-width: 700px) {
  .site-nav-links a {
    font-size: 11px;
    padding: 5px 8px;
  }
  .site-nav-brand {
    font-size: 15px;
  }
}

.section:nth-child(even) {
  background: #f8fafc;
}

.section.teaser-section,
.section.teaser-section:nth-child(even) {
  background: #ffffff;
}

/* ===== Hero ===== */
.hero-gradient {
  background: #ffffff;
  padding-top: 64px;
  padding-bottom: 0;
}

.hero-gradient .hero-body {
  padding-bottom: 0.5rem;
}

.hero-gradient .publication-title {
  font-family: 'Google Sans', sans-serif;
  font-weight: 700;
  color: #581c87;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  margin-bottom: 0.3rem;
}

.publication-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: #6b21a8;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.publication-venue {
  color: rgba(17, 24, 39, 0.75);
  margin-top: 0.25rem;
  margin-bottom: 0;
  font-size: 1rem;
}

.hero-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.hero-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.2s, transform 0.15s;
}

.hero-link-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  transform: translateY(-1px);
}

/* ===== Abstract card ===== */
.abstract-card {
  margin: 0.75rem 1.5rem 2rem;
  padding: 1.5rem 2rem;
  border-left: 4px solid transparent;
  border-image: linear-gradient(to bottom, #f59e0b, #a855f7, #3b82f6) 1;
  background: #f9fafb;
  border-radius: 0 8px 8px 0;
}

.abstract-text {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #374151;
  margin: 0;
}

/* ===== Section headings ===== */
.title.is-3 {
  font-family: 'Google Sans', sans-serif;
  position: relative;
  padding-bottom: 0.5rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.title.is-3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #a855f7, #ec4899);
}

.title.is-4 {
  font-family: 'Google Sans', sans-serif;
  color: #374151;
}

/* ===== Caption (now used as description above figures/tables) ===== */
.caption {
  color: #374151;
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.02rem;
  line-height: 1.6;
}

/* Override Bulma's .is-size-7 on captions so descriptions remain readable */
.caption.is-size-7 {
  font-size: 1.02rem !important;
}

/* ===== Algorithm box ===== */
.algorithm-box {
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  margin: 1.5rem 0 2rem;
  background: #fdf4ff;
  overflow: hidden;
}

.algorithm-title {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e9d5ff;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  font-size: 0.95rem;
  color: #7e22ce;
  font-weight: 700;
  text-align: center;
}

.algorithm-content {
  padding: 1rem;
  font-size: 0.92rem;
}

.algorithm-content pre {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
}

.algorithm-content hr {
  margin: 0.5rem 0;
  background-color: #e9d5ff;
  height: 1px;
}

.algorithm-content p {
  margin-bottom: 0.25rem;
}

/* ===== Finding cards (TimeWarp-style dropdowns) ===== */
.finding-card {
  margin-bottom: 1rem;
  border-left: 4px solid transparent;
  border-image: linear-gradient(to bottom, #f59e0b, #a855f7, #3b82f6) 1;
  background: #f9fafb;
  border-radius: 0 8px 8px 0;
  overflow: hidden;
}

.finding-summary {
  padding: 1.2rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a2e;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.finding-summary::-webkit-details-marker {
  display: none;
}

.finding-summary::before {
  content: '\25B6';
  font-size: 0.7rem;
  color: #9ca3af;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details.finding-card[open] > .finding-summary::before {
  transform: rotate(90deg);
}

.finding-summary:hover {
  background: rgba(168, 85, 247, 0.05);
}

.finding-body {
  padding: 0 1.5rem 1.5rem;
}

.finding-body p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: #374151;
}

/* ===== Bar charts (CSS) ===== */
.chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 1.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.legend-swatch.dora-swatch {
  background: linear-gradient(135deg, #e9d5ff, #c084fc);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.12) 3px,
    rgba(0, 0, 0, 0.12) 5px
  ), linear-gradient(135deg, #e9d5ff, #c084fc);
}

.grouped-chart {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.chart-group {
  flex: 1;
}

.chart-group-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #581c87;
  text-align: center;
  margin-bottom: 0.5rem;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 18px;
}

.chart-bar {
  height: 100%;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  min-width: 4px;
  transition: width 0.4s ease;
}

.chart-bar-dora {
  background: linear-gradient(90deg, #e9d5ff, #c084fc);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.1) 3px,
    rgba(0, 0, 0, 0.1) 5px
  ), linear-gradient(90deg, #e9d5ff, #c084fc);
  border-color: #a855f7;
}

.chart-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

/* Horizontal bar chart */
.hbar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0.5rem;
}

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

.hbar-label {
  width: 120px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  text-align: right;
  flex-shrink: 0;
}

.hbar-track {
  flex: 1;
  height: 22px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: width 0.4s ease;
}

.hbar-fill-dora {
  background: linear-gradient(90deg, #e9d5ff, #c084fc) !important;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.1) 3px,
    rgba(0, 0, 0, 0.1) 5px
  ), linear-gradient(90deg, #e9d5ff, #c084fc) !important;
  border-color: #a855f7;
}

.hbar-val {
  width: 50px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

/* Side-by-side charts */
.side-by-side-charts {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.side-chart {
  flex: 1;
  min-width: 0;
}

.line-chart {
  width: 100%;
  height: auto;
}

@media (max-width: 700px) {
  .grouped-chart {
    flex-direction: column;
  }
  .hbar-label {
    width: 90px;
    font-size: 0.78rem;
  }
  .side-by-side-charts {
    flex-direction: column;
  }
}

/* ===== Tables ===== */
.table-container {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.table {
  margin-bottom: 0 !important;
}

.table thead th {
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  color: #581c87;
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 2px solid #d8b4fe;
  letter-spacing: 0.02em;
}

.table tbody tr:hover td {
  background-color: #faf5ff !important;
  transition: background 0.15s;
}

.is-dora {
  background-color: #faf5ff !important;
}

tr.is-dora-row > td {
  background-color: #faf5ff !important;
}

tr.model-divider > td {
  border-top: 2px solid #aaa;
}

.table small {
  color: #9ca3af;
}

/* ===== Overview figure ===== */
.overview-figure {
  margin: 1.5rem 0 0;
  text-align: center;
}

.overview-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.10), 0 2px 6px rgba(17, 17, 17, 0.06);
}

/* ===== Scroll Fade-in Animation (inspired by TimeWarp) ===== */
/* Initial hidden state only activates when JS has successfully set up the
   observer (avoids a blank page if scripts fail or are blocked). */
html.js-fade .fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

html.js-fade .fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

html.js-fade .fade-in-delay-1 { transition-delay: 0.1s; }
html.js-fade .fade-in-delay-2 { transition-delay: 0.2s; }
html.js-fade .fade-in-delay-3 { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
  html.js-fade .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== Footer ===== */
.site-footer {
  background: linear-gradient(135deg, #581c87, #7e22ce) !important;
  color: #e9d5ff;
  padding: 2rem 1.5rem;
}

.site-footer .content p {
  color: #f3e8ff;
}

.site-footer strong {
  color: #fff;
}

.site-footer a {
  color: #d8b4fe;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: #fff;
}

.footer-credit {
  font-size: 0.82rem;
  margin-top: 0.5rem;
  color: #c084fc !important;
}

/* MAB rollout animation */
#dora-ep0-parallel {
  background: #ffffff;
  color: #111111;
  margin: 1.5rem 0 0;
}

#dora-ep0-parallel * {
  box-sizing: border-box;
}

#dora-ep0-parallel .dora-ep0-shell {
  max-width: 1120px;
  margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

#dora-ep0-parallel .dora-ep0-header {
  text-align: center;
  margin-bottom: 20px;
}

#dora-ep0-parallel .dora-ep0-kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 8px;
  font-weight: 700;
}

#dora-ep0-parallel .dora-ep0-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #111111;
}

#dora-ep0-parallel .dora-ep0-subtitle {
  margin: 8px 0 14px;
  color: #4b5563;
  font-size: 15px;
}

#dora-ep0-parallel .dora-ep0-status-row {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 12px;
}

#dora-ep0-parallel .dora-ep0-step-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.05);
  font-size: 14px;
  font-weight: 700;
  color: #111111;
  white-space: nowrap;
  flex-shrink: 0;
}

#dora-ep0-parallel .dora-ep0-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

#dora-ep0-parallel .dora-ep0-speed-side {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
}

#dora-ep0-parallel .dora-ep0-speed-slider {
  width: min(220px, 60vw);
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  outline: none;
}

#dora-ep0-parallel .dora-ep0-speed-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: #111111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.18);
}

#dora-ep0-parallel .dora-ep0-speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: #111111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.18);
}

#dora-ep0-parallel .dora-ep0-speed-chip {
  min-width: 56px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111111;
  font-size: 12px;
  font-weight: 800;
}

#dora-ep0-parallel .dora-ep0-progress {
  flex: 1;
  max-width: 400px;
  height: 5px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

#dora-ep0-parallel .dora-ep0-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7 0%, #ec4899 100%);
  transition: width 0.12s linear;
}

/* Side-by-side panels */
#dora-ep0-parallel .dora-ep0-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}

#dora-ep0-parallel .dora-ep0-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}

#dora-ep0-parallel .dora-ep0-panel-head,
#dora-ep0-parallel .dora-ep0-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#dora-ep0-parallel .dora-ep0-agent {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#dora-ep0-parallel .dora-ep0-total {
  white-space: nowrap;
  font-size: 13px;
  color: #4b5563;
}

#dora-ep0-parallel .dora-ep0-total strong {
  color: #111111;
  font-size: 15px;
}

/* Arm buttons row */
#dora-ep0-parallel .dora-ep0-arms {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 18px auto 16px;
}

/* Circular button for each arm */
#dora-ep0-parallel .dora-ep0-arm {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--arm-color);
  background: var(--arm-color);
  color: var(--arm-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  cursor: default;
  user-select: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Best arm gets a subtle gold ring */
#dora-ep0-parallel .dora-ep0-arm.best {
  outline: 2px dashed #9ca3af;
  outline-offset: 4px;
}

/* Pressed / selected: go dark */
#dora-ep0-parallel .dora-ep0-arm.pressed {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #ffffff;
  box-shadow:
    0 0 0 3px var(--arm-color),
    inset 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: scale(0.93);
}

/* Blink on every selection (even consecutive) */
#dora-ep0-parallel .dora-ep0-arm.blink {
  animation: doraArmBlink 0.25s ease-out;
}

@keyframes doraArmBlink {
  0%   { opacity: 1; transform: scale(0.93); }
  40%  { opacity: 0.4; transform: scale(1.05); }
  100% { opacity: 1; transform: scale(0.93); }
}

/* Footer area */
#dora-ep0-parallel .dora-ep0-choice {
  font-size: 14px;
  color: #4b5563;
}

#dora-ep0-parallel .dora-ep0-choice strong {
  color: #111111;
  text-transform: capitalize;
}

#dora-ep0-parallel .dora-ep0-reward-pill {
  min-width: 100px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #111111;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.15s ease, color 0.15s ease;
}

#dora-ep0-parallel .dora-ep0-reward-pill.win {
  background: #dcfce7;
  color: #166534;
}

#dora-ep0-parallel .dora-ep0-reward-pill.loss {
  background: #f1f5f9;
  color: #64748b;
}

@media (max-width: 700px) {
  #dora-ep0-parallel .dora-ep0-grid {
    grid-template-columns: 1fr;
  }
  #dora-ep0-parallel .dora-ep0-arm {
    width: 48px;
    height: 48px;
    font-size: 10px;
  }
}

/* Shared pause/play button for animations */
.anim-pause-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.anim-pause-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* ===== TALES Chat Animation ===== */
#tales-chat-anim {
  margin: 1.5rem 0 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px 22px 20px;
  box-shadow: 0 10px 30px rgba(17, 17, 17, 0.10), 0 2px 6px rgba(17, 17, 17, 0.06);
}

#tales-chat-anim * {
  box-sizing: border-box;
}

.tales-header {
  text-align: center;
  margin-bottom: 16px;
}

.tales-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.tales-step-chip {
  display: inline-flex;
  align-items: center;
  min-width: 90px;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(17, 17, 17, 0.05);
  font-size: 14px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  flex-shrink: 0;
}

.tales-progress {
  flex: 1;
  max-width: 360px;
  height: 5px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.tales-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7 0%, #ec4899 50%, #f59e0b 100%);
  transition: width 0.12s linear;
}

.tales-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tales-speed-side {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
}

.tales-speed-slider {
  width: min(200px, 50vw);
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: #e5e7eb;
  outline: none;
}

.tales-speed-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: #111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.18);
}

.tales-speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  background: #111;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 17, 17, 0.18);
}

.tales-speed-chip {
  min-width: 52px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 800;
}

/* Side-by-side panels */
.tales-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.tales-panel {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.04);
}

.tales-panel[data-tales-run="dora"] {
  border-color: #a855f7;
  background: linear-gradient(180deg, #faf5ff 0%, #fff 40%);
}

.tales-panel[data-tales-run="zeroshot"] {
  border-color: #f97316;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 40%);
}

.tales-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tales-agent {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tales-panel[data-tales-run="dora"] .tales-agent {
  color: #7e22ce;
}

.tales-panel[data-tales-run="zeroshot"] .tales-agent {
  color: #b45309;
}

.tales-score {
  font-size: 13px;
  color: #4b5563;
  white-space: nowrap;
}

.tales-score strong {
  color: #111;
  font-size: 15px;
}

.tales-score.scored strong {
  color: #059669;
}

/* Location chip */
.tales-location {
  margin-bottom: 8px;
}

.tales-location span {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
  color: #7e22ce;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Scrollable chat area */
.tales-chat-scroll {
  flex: 1;
  max-height: 360px;
  min-height: 260px;
  overflow-y: auto;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
  background: #fafbfc;
  padding: 10px;
}

.tales-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Chat message pair (action + feedback) */
.tales-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: talesFadeIn 0.25s ease-out;
}

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

/* Task description message */
.tales-task-msg {
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  color: #78350f;
  font-size: 13px;
  line-height: 1.45;
  animation: talesFadeIn 0.3s ease-out;
}

.tales-task-icon {
  font-size: 16px;
  vertical-align: middle;
  margin-right: 2px;
}

/* Action bubble (outgoing, right-aligned) */
.tales-action {
  align-self: flex-end;
  max-width: 85%;
  padding: 7px 12px;
  border-radius: 14px 14px 4px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}

.tales-action.explore {
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
  color: #7e22ce;
  border: 1px solid #d8b4fe;
}

.tales-action.greedy {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0c4a6e;
  border: 1px solid #7dd3fc;
}

.tales-action.zeroshot {
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  color: #92400e;
  border: 1px solid #fdba74;
}

/* Pathway badge inside action */
.tales-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 5px;
  vertical-align: middle;
}

.tales-badge.explore {
  background: #a855f7;
  color: #fff;
}

.tales-badge.greedy {
  background: #94a3b8;
  color: #fff;
}

/* Feedback bubble (incoming, left-aligned) */
.tales-feedback {
  align-self: flex-start;
  max-width: 85%;
  padding: 7px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.tales-feedback.score-up {
  border-color: #10b981;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  font-weight: 700;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

/* Loop collapse indicator */
.tales-loop {
  align-self: center;
  padding: 10px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fef2f2, #fecaca);
  border: 2px dashed #f87171;
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
  animation: talesFadeIn 0.3s ease-out;
}

.tales-loop-icon {
  font-size: 18px;
  vertical-align: middle;
}

/* End banners */
.tales-banner {
  display: none;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  margin-top: 10px;
}

.tales-banner.win {
  display: block;
  background: linear-gradient(135deg, #d1fae5, #6ee7b7);
  color: #064e3b;
  border: 2px solid #34d399;
  font-size: 15px;
}

.tales-banner.fail {
  display: block;
  background: linear-gradient(135deg, #fee2e2, #fca5a5);
  color: #7f1d1d;
  border: 2px solid #f87171;
  font-size: 15px;
}

/* Score flash animation */
@keyframes talesScoreFlash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); color: #059669; }
  100% { transform: scale(1); }
}

.tales-score.flash strong {
  animation: talesScoreFlash 0.4s ease;
}

@media (max-width: 700px) {
  .tales-grid {
    grid-template-columns: 1fr;
  }
  .tales-chat-scroll {
    max-height: 280px;
    min-height: 200px;
  }
  #tales-chat-anim {
    padding: 14px 12px;
    border-radius: 12px;
  }
}
