/* =============================================
   SoTo — Search over Tokens
   Color palette sampled from pull_figure:
     Warm amber  #F09050  (1D ordered token boxes)
     Steel blue  #5088C8  (scaling chart line)
   ============================================= */

:root {
  /* Warm amber — the "1D ordered" color */
  --sot-warm-light:  #FDE8CC;
  --sot-warm:        #F09050;
  --sot-warm-dark:   #C05A28;

  /* Cool blue — the "search / chart" color */
  --sot-cool-light:  #C8DEFA;
  --sot-cool:        #5088C8;
  --sot-cool-dark:   #2A5A9E;

  /* Aliases used throughout - using blue as primary theme */
  --sot-accent:   var(--sot-cool);
  --sot-dark:     var(--sot-cool-dark);
  --sot-link:     var(--sot-cool-dark);
  --sot-selected: var(--sot-cool-light);
}

/* ---- Typography ---- */
.publication-title,
.publication-authors {
  font-family: 'Google Sans', sans-serif;
}

.publication-title {
  white-space: nowrap;
  font-size: clamp(1.95rem, 3.0vw, 2.85rem);
}

.dmethod {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  font-size: 1.0em;
  color: var(--sot-cool-dark);
}

/* ---- Navbar ---- */
.glass-overlay {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: transparent !important;
}

.navbar-item:hover,
.navbar-link:hover {
  background-color: transparent !important;
}

/* ---- Dropdown menu ---- */
.navbar-dropdown {
  border-top: 2px solid var(--sot-cool);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border-radius: 0 0 6px 6px;
  background: #fff;
}

.navbar-dropdown .navbar-item {
  padding: 0.5rem 1.5rem;
  color: #333;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.navbar-dropdown .navbar-item:hover {
  background-color: var(--sot-cool-light) !important;
  color: var(--sot-cool-dark) !important;
}

.navbar-link {
  color: #333;
}

.navbar-link:hover {
  color: var(--sot-cool-dark);
}

.navbar-item.dmethod {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--sot-cool) !important; /* Blue by default */
  transition: color 0.2s ease;
}

.navbar-item.dmethod:hover {
  color: var(--sot-cool-dark) !important; /* Darker blue on hover */
}

/* ---- Hero / Headline ---- */
.headline {
  position: relative;
  overflow: hidden;
  background: linear-gradient(to top, #fff1eb 0%, #ace0f9 100%);
}

.headline-container {
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}

.title-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Search tree background decoration ---- */
.search-tree-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.09;
  color: #2A4A80;
}

/* ---- Authors ---- */
.publication-authors a {
  color: var(--sot-link) !important;
}

.publication-authors a:hover {
  text-decoration: underline;
}

.author-block {
  display: inline-block;
}

.publication-footnote {
  color: #666;
}

.publication-venue {
  margin-top: 0.9rem;
  margin-bottom: 0.25rem;
  font-family: 'Google Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--sot-cool-dark);
}

/* ---- Links / Buttons ---- */
.link-block-header a {
  margin-top: 10px;
  margin-bottom: -30px;
  padding: 0.75em 1.35em;
  font-size: 1.1rem;
  border-radius: 9999px;
  height: auto;
}

.link-block-header .icon {
  font-size: 1.15em !important;
}

.link-block-header .icon i {
  font-size: 1.15em !important;
}

@media screen and (max-width: 768px) {
  .publication-links {
    display: flex;
    flex-direction: row;
    justify-content: center;
  }
  .link-block-header {
    margin: 0 5px;
  }
  .external-link.button {
    padding: 10px;
    font-size: 14px;
  }
}

/* ---- Teaser ---- */
.teaser {
  font-family: 'Google Sans', sans-serif;
}

.teaser .hero-body {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* Pull figure: wider than the default desktop container */
.pull-figure-wide {
  margin-left: -8%;
  margin-right: -8%;
}

@media screen and (max-width: 1024px) {
  .pull-figure-wide {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ---- Subtitle ---- */
.subtitle {
  padding-top: 1rem;
  padding-bottom: 0.5rem;
  font-size: 1.1em;
  color: #444;
}

/* ---- Inline highlight ---- */
.sot-highlight {
  background: linear-gradient(120deg, rgba(183, 228, 199, 0.45) 0%, rgba(116, 198, 157, 0.35) 100%);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  color: inherit;
}

/* ---- Background toggle (collapsible) ---- */
.sot-background-toggle {
  margin-bottom: 1.25rem;
  border: 1px solid rgba(80, 136, 200, 0.2);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(240, 247, 255, 0.5) 0%, rgba(255, 255, 255, 0.95) 100%);
  overflow: hidden;
}

.sot-background-toggle summary {
  padding: 0.75rem 1.1rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--sot-cool-dark, #2d6a4f);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sot-background-toggle summary::-webkit-details-marker {
  display: none;
}

.sot-background-toggle summary::before {
  content: '▸';
  font-size: 0.85rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sot-background-toggle[open] summary::before {
  transform: rotate(90deg);
}

.sot-background-toggle summary:hover {
  background: rgba(80, 136, 200, 0.06);
}

.sot-background-body {
  padding: 0 1.1rem 0.75rem;
}

.sot-background-body p:last-child {
  margin-bottom: 0;
}

/* ---- Overview tiles (legacy) ---- */
.sot-tile {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
  border-radius: 10px !important;
}

.sot-tile:hover {
  border-color: var(--sot-cool);
  box-shadow: 0 4px 20px rgba(80, 136, 200, 0.18);
}

.sot-tile .title {
  color: var(--sot-cool-dark);
}

.sot-tile-gray {
  background: #f2f3f5 !important;
}

.sot-tile-gray .title,
.sot-tile-gray .sot-tile-list {
  color: #4b5563;
}

.sot-tile .one-line-title {
  white-space: nowrap;
  font-size: 1.12rem;
}

.sot-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--sot-cool-light);
  color: var(--sot-cool);
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
  transition: background 0.25s ease, color 0.25s ease;
}

.sot-tile:hover .sot-tile-icon {
  background: var(--sot-cool);
  color: #fff;
}

.sot-tile-list {
  text-align: left;
  margin: 0;
  padding-left: 1.1em;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.55;
}

.sot-tile-list li {
  margin-bottom: 0.2em;
}

.sot-tile-list li::marker {
  color: var(--sot-cool);
}

.overview-cards-column {
  max-width: 1180px;
}

@media screen and (min-width: 1024px) {
  .overview-cards-column {
    width: calc(100% + 80px);
    max-width: 1180px;
    margin-left: -40px;
    margin-right: -40px;
  }
}

/* ---- Scroll-spy Tree Sidebar ---- */
.scroll-sidebar {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  padding: 0.75rem 0 0.75rem 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.scroll-sidebar.is-visible {
  opacity: 1;
  pointer-events: none;
}
.scroll-sidebar.is-visible .ss-card,
.scroll-sidebar.is-visible .ss-leaf {
  pointer-events: auto;
}

/* Tree container — vertical trunk */
.ss-tree {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Vertical trunk line */
.ss-tree::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: #d2d9e2;
  transform: translateX(-50%);
}

/* Progress overlay on trunk */
.ss-tree::after {
  content: '';
  position: absolute;
  left: 6px;
  top: var(--ss-start, 12px);
  width: 2px;
  height: var(--ss-progress, 0px);
  background: var(--sot-cool);
  transform: translateX(-50%);
  transition: height 0.35s ease, top 0.35s ease;
}

/* ── Node row ── */
.ss-node {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.9rem 0;
  cursor: default;
}

/* Main dot on the trunk */
.ss-dot {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #c0c8d4;
  background: #fff;
  flex-shrink: 0;
  z-index: 2;
  transition: all 0.3s ease;
}

.ss-node.is-active .ss-dot {
  border-color: var(--sot-cool);
  background: var(--sot-cool);
  box-shadow: 0 0 0 4px rgba(80, 136, 200, 0.18);
  transform: scale(1.3);
}

.ss-node.is-past .ss-dot {
  border-color: var(--sot-cool);
  background: var(--sot-cool);
}

/* Horizontal branch line from dot to card */
.ss-branch {
  width: 18px;
  height: 2px;
  background: #d2d9e2;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.ss-node.is-active .ss-branch,
.ss-node.is-past .ss-branch {
  background: var(--sot-cool);
}

/* Card (always visible) */
.ss-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid #e0e8f0;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  width: 175px;
  text-decoration: none !important;
  color: inherit;
  transition: all 0.3s ease;
  cursor: pointer;
}

.ss-card:hover {
  border-color: var(--sot-cool);
  box-shadow: 0 2px 12px rgba(80, 136, 200, 0.15);
}

.ss-node.is-active .ss-card {
  border-color: var(--sot-cool);
  background: linear-gradient(135deg, #f5f9ff 0%, #edf3fb 100%);
  box-shadow: 0 2px 14px rgba(80, 136, 200, 0.18);
}

.ss-node.is-past .ss-card {
  border-color: rgba(80, 136, 200, 0.3);
}

.ss-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--sot-cool-dark);
  line-height: 1.25;
  text-decoration: none !important;
}

.ss-desc {
  font-size: 0.65rem;
  line-height: 1.3;
  color: #888;
  margin-top: 0.15rem;
}

.ss-node.is-active .ss-desc {
  color: #666;
}

/* ── Sub-tree (branches off a parent node) ── */
.ss-node-parent {
  flex-wrap: wrap;
}

.ss-card-parent {
  width: 175px;
}

.ss-card-parent .ss-title {
  font-size: 0.76rem;
}

.ss-subtree {
  /* Position below the card, indented to align with the branch */
  width: 100%;
  padding-left: 30px; /* align with card start: dot(12) + branch(18) */
  margin-top: 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

/* Vertical connector for subtree */
.ss-subtree::before {
  content: '';
  position: absolute;
  left: 37px; /* middle of subtree area */
  top: 0;
  bottom: 8px;
  width: 1.5px;
  background: #d8dfe8;
}

/* Leaf nodes in the subtree */
.ss-leaf {
  display: flex;
  align-items: center;
  padding: 0.25rem 0;
  text-decoration: none !important;
  color: inherit;
  position: relative;
  cursor: pointer;
}

.ss-leaf:hover .ss-leaf-text {
  color: var(--sot-cool-dark);
}

/* Horizontal branch for leaf */
.ss-leaf-branch {
  width: 12px;
  height: 1.5px;
  background: #d8dfe8;
  flex-shrink: 0;
  margin-left: 7px; /* align with subtree vertical line */
}

/* Tiny dot for leaf */
.ss-leaf-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8d0da;
  flex-shrink: 0;
  margin: 0 6px 0 0;
  transition: background 0.3s ease;
}

.ss-leaf.is-active .ss-leaf-dot {
  background: var(--sot-cool);
}

.ss-leaf.is-past .ss-leaf-dot {
  background: var(--sot-cool);
}

.ss-leaf-text {
  font-family: 'Google Sans', sans-serif;
  font-size: 0.67rem;
  color: #888;
  line-height: 1.25;
  transition: color 0.2s ease;
}

.ss-leaf.is-active .ss-leaf-text {
  color: var(--sot-cool-dark);
  font-weight: 600;
}

.ss-leaf.is-past .ss-leaf-text {
  color: #666;
}

/* ── Responsive ── */
@media screen and (max-width: 1400px) {
  .scroll-sidebar { padding-left: 0.7rem; }
  .ss-card { width: 155px; padding: 0.35rem 0.55rem; }
  .ss-card-parent { width: 155px; }
  .ss-title { font-size: 0.72rem; }
  .ss-desc { font-size: 0.6rem; }
  .ss-leaf-text { font-size: 0.62rem; }
}
@media screen and (max-width: 1100px) {
  .ss-card { width: 140px; }
  .ss-card-parent { width: 140px; }
  .ss-desc { display: none; }
  .scroll-sidebar { padding-left: 0.5rem; }
}
@media screen and (max-width: 1280px) {
  .scroll-sidebar { display: none; }
}
@media screen and (max-width: 900px) {
  .scroll-sidebar { display: none; }
}

/* ---- Three-pillar boxes ---- */
.pillar-box {
  border-top: 4px solid var(--sot-cool);
  border-radius: 10px !important;
  height: 100%;
  transition: box-shadow 0.2s ease;
}

.pillar-box:hover {
  box-shadow: 0 4px 18px rgba(80, 136, 200, 0.2);
}

/* ---- Figures ---- */
.full-width-figure {
  margin-left: 0;
  margin-right: 0;
}

.full-width-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.framework-figure {
  margin-bottom: 0;
  overflow: hidden;
  aspect-ratio: 5 / 1;
}

.framework-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.framework-explorer {
  margin: 1.75rem 0 0.5rem;
}

/* Three images in a seamless row, clickable, equal height */
.framework-img-grid {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
}

.framework-img-btn {
  appearance: none;
  border: 3px solid transparent;
  border-radius: 12px;
  background: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  opacity: 0.7;
  flex: 0 1 auto;
}

.framework-img-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.framework-img-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.framework-img-btn:focus-visible {
  outline: 3px solid rgba(82, 183, 136, 0.4);
  outline-offset: 2px;
}

.framework-img-btn.is-active {
  border-color: var(--sot-cool, #52b788);
  opacity: 1;
}

.framework-detail-card {
  margin-top: 1rem;
  border: 1px solid rgba(80, 136, 200, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(240, 247, 255, 0.7) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow: 0 14px 30px rgba(42, 90, 158, 0.08);
}

.framework-detail {
  display: none;
  padding: 1.25rem 1.35rem 1.1rem;
}

.framework-detail.is-active {
  display: block;
}

.framework-detail .title {
  margin-bottom: 0.65rem;
  color: var(--sot-dark);
}

.framework-detail p:last-child {
  margin-bottom: 0;
}

.limitations-toggle {
  margin-bottom: 0.75rem;
}

.narrow-figure {
  margin-left: 10%;
  margin-right: 10%;
}

@media screen and (max-width: 768px) {
  .framework-img-grid {
    flex-direction: column;
  }

  .narrow-figure {
    margin-left: 0;
    margin-right: 0;
  }
}

/* ---- Comparison cards (interactive section) ---- */
.comparison-card {
  border: 2px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
  transition: border-color 0.2s ease;
}

.comparison-card.sot-card {
  border-color: var(--sot-cool);
  background: #f0f7ff;
}

.comparison-label {
  text-align: center;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.grid-label {
  background: #eee;
  color: #555;
}

.sot-label {
  background: var(--sot-cool);
  color: #fff;
}

/* ---- Prompt buttons ---- */
.prompt-btn {
  border-radius: 20px !important;
  font-size: 0.88rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: normal;
  height: auto;
}

.prompt-btn.is-active,
.prompt-btn:hover {
  background-color: var(--sot-cool) !important;
  color: #fff !important;
  border-color: var(--sot-cool) !important;
}

/* ---- Anchor scroll offset ---- */
.anchor {
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  scroll-margin-top: 70px;
}

@media screen and (max-width: 768px) {
  .anchor {
    scroll-margin-top: 60px;
  }
}

/* ---- Slider labels ---- */
.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
}

@media screen and (max-width: 768px) {
  .slider-labels span {
    font-size: 0.7rem;
  }
}

/* ---- Mobile ---- */
@media screen and (max-width: 768px) {
  .title.is-1 {
    font-size: 1.85rem;
  }
  .publication-title {
    white-space: normal;
    line-height: 1.08;
  }
  .publication-authors {
    font-size: 0.88em !important;
  }
  .publication-venue {
    font-size: 1.05rem;
  }
  .is-size-5.has-text-weight-semibold {
    font-size: 0.9em !important;
  }
  .section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
  }
  .navbar-menu {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 26px rgba(28, 42, 56, 0.12);
    padding-bottom: 0.45rem;
  }
  .navbar-item,
  .navbar-link {
    font-size: 0.94rem;
  }
  .navbar-dropdown {
    border-top-width: 1px;
    box-shadow: none;
    padding: 0.2rem 0;
  }
  .navbar-dropdown .navbar-item {
    padding: 0.45rem 1rem;
    white-space: normal;
    line-height: 1.25;
  }
}

/* ---- BibTeX ---- */
pre code {
  font-size: 0.88rem;
  white-space: pre-wrap;
}

/* ---- Footer ---- */
.footer {
  padding: 2rem;
}

/* ---- Misc ---- */
.has-text-centered {
  padding: 0;
}

hr {
  margin: 0;
}

.dlink {
  color: var(--sot-link);
}

/* ---- Results tables (4M-style) ---- */
.sot-table-wrapper {
  overflow-x: auto;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.sot-table thead tr {
  background-color: #2c3e50;
}

.sot-table thead th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  text-align: center;
  border: none;
  white-space: nowrap;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #fff !important;
}

.sot-table thead th:first-child { text-align: left; }

.sot-table tbody tr { 
  border-bottom: 1px solid #e8e8e8;
  transition: background-color 0.15s ease;
}

.sot-table tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

.sot-table tbody tr:hover {
  background-color: #e8f4f8;
}

.sot-table tbody tr:last-child { 
  border-bottom: none;
}

.sot-table tbody td {
  padding: 0.65rem 1rem;
  text-align: center;
  color: #333;
  vertical-align: middle;
}

.sot-table tbody td:first-child { 
  text-align: left; 
  font-weight: 500;
  color: #2c3e50;
}

.sot-table tbody tr.is-best { 
  background-color: var(--sot-cool-light) !important;
  border-left: 3px solid var(--sot-cool);
}

.sot-table tbody tr.is-best:hover {
  background-color: #d4e8f5 !important;
}

.sot-table td strong { 
  font-weight: 700; 
  color: var(--sot-cool-dark);
}

.sot-table tbody tr.is-oracle {
  background: #e3e3e3 !important;
}

.verifier-tabs {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.verifier-tab-btn {
  border: 1px solid #cfcfcf;
  background: #f8f8f8;
  color: #444;
  font-size: 0.88rem;
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.verifier-tab-btn:hover {
  border-color: #9cb9d8;
}

.verifier-tab-btn.is-active {
  background: #dfefff;
  border-color: #5ea8e0;
  color: #2b4f79;
  font-weight: 700;
  box-shadow: inset 0 -2px 0 #2b74b5;
}

.verifier-tab-btn.is-active::after {
  content: " (current)";
  font-weight: 600;
  color: #4e6480;
}

.verifier-tab-panel {
  width: 100%;
}

.delta-positive { 
  color: #2d8a5e; 
  font-weight: 600; 
  font-size: 0.88em;
  margin-left: 0.25rem;
}

@media screen and (max-width: 768px) {
  .sot-table { font-size: 0.82rem; }
  .sot-table thead th,
  .sot-table tbody td { padding: 0.5rem 0.75rem; }
  .verifier-tabs {
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .verifier-tab-btn {
    width: 100%;
    text-align: center;
    font-size: 0.82rem;
    padding: 0.5rem 0.65rem;
  }
}

/* ---- Fig-2 Interactive Widget ---- */
.fig2-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.fig2-panel {
  background: #eef5fc;
  border: 1px solid var(--sot-cool-light);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.fig2-panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--sot-cool-dark);
  letter-spacing: 0.01em;
}

.fig2-prompt-label {
  font-size: 0.78rem;
  color: #555;
  font-style: italic;
  text-align: center;
  line-height: 1.3;
}

/* Token step selector */
.fig2-token-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: center;
}

.fig2-tok-btn {
  background: white;
  border: 2px solid var(--sot-cool);
  border-radius: 8px;
  padding: 4px 13px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--sot-cool-dark);
  transition: background 0.12s, color 0.12s;
}
.fig2-tok-btn:hover  { background: var(--sot-cool-light); }
.fig2-tok-btn.active { background: var(--sot-cool); color: white; border-color: var(--sot-cool); }

.fig2-tok-sep {
  width: 18px;
  border-top: 2px dashed #a8c8f0;
}

/* Decoded image */
.fig2-img-wrap {
  width: 200px;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--sot-cool-light);
  background: #ddedf8;
}
.fig2-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.18s ease;
}

/* Seed buttons */
.fig2-seed-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: center;
}

.fig2-seed-btn {
  background: white;
  border: 2px solid var(--sot-cool);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--sot-cool-dark);
  transition: background 0.12s, color 0.12s;
}
.fig2-seed-btn:hover  { background: var(--sot-cool-light); }
.fig2-seed-btn.active { background: var(--sot-cool); color: white; border-color: var(--sot-cool); }

.fig2-auto-btn {
  background: white;
  border: 2px solid var(--sot-cool);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--sot-cool-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.fig2-auto-btn:hover   { background: var(--sot-cool-light); }
.fig2-auto-btn.running { background: var(--sot-cool); color: white; }

/* Format toggle (MP4 / GIF) */
.fig2b-fmt.active {
  background: var(--sot-cool) !important;
  color: white !important;
  border-color: var(--sot-cool) !important;
}

/* Beam search image */
.fig2-beam-wrap {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--sot-cool-light);
  background: #ddedf8;
}
.fig2-beam-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.12s ease;
}

/* Progress */
.fig2-progress-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}
.fig2-step-label {
  font-size: 0.75rem;
  color: #555;
  white-space: nowrap;
  min-width: 68px;
}
.fig2-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--sot-cool-light);
  border-radius: 3px;
  overflow: hidden;
}
.fig2-progress-fill {
  height: 100%;
  background: var(--sot-cool);
  border-radius: 3px;
  transition: width 0.12s ease;
}

/* Controls */
.fig2-beam-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.fig2-ctrl-btn {
  background: white;
  border: 2px solid var(--sot-cool);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--sot-cool-dark);
  transition: background 0.12s, color 0.12s;
}
.fig2-ctrl-btn:hover  { background: var(--sot-cool-light); }
.fig2-play-btn { min-width: 88px; }
.fig2-play-btn.playing { background: var(--sot-cool); color: white; }

.fig2-speed-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #777;
}

/* ── Fig-2 interactive side-by-side ───────────────────────── */
/* (a) is 3600×2400 = 3:2, (b) is 3600×1920 = 15:8.
   For equal height: w_a/w_b = (3/2)/(15/8) = 4/5 → 4fr 5fr */
.fig2-figure {
  display: grid;
  grid-template-columns: 4fr 5fr;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1rem;
}

.fig2-figure.fig2-figure-single {
  grid-template-columns: 1fr;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.fig2-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Crossfade frame: two imgs stacked via CSS grid */
.fig2-frame {
  display: grid;
  width: 100%;
  position: relative;
}

.fig2-frame img {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  display: block;
}

.fig2-frame .fig2-fg {
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* "Hover to animate" hint overlay */
.fig2-hover-hint {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: center;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 12px;
  margin-bottom: 8px;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 2;
}

/* Dot indicators (shared by fig2 and fig4) */
.fig2-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.fig2-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c8dff0;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.fig2-dot:hover   { background: var(--sot-cool); transform: scale(1.25); }
.fig2-dot.active  { background: var(--sot-cool); }

.fig-anim-btn {
  border-radius: 999px;
  border: 1px solid rgba(80, 136, 200, 0.55);
  background: #fff;
  color: var(--sot-cool-dark);
  padding: 0.28rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.fig-anim-btn:hover {
  background: var(--sot-cool-light);
  border-color: var(--sot-cool);
}

.fig-anim-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Slider row */
.fig2-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
  width: 100%;
  max-width: 220px;
}

.fig2-slider-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
}

.fig2-slider-val {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sot-cool-dark);
  min-width: 12px;
  text-align: center;
}

.fig2-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #d4e8f7;
  outline: none;
}

.fig2-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sot-cool);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.fig2-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sot-cool);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ── Fig-4 training-free widget ───────────────────────────── */
.fig4-widget {
  margin-top: 1rem;
}

/* Prompt selection above the figure */
.fig4-controls-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.fig4-prompt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.fig4-controls-top .fig2-dots {
  flex-shrink: 0;
  gap: 10px;
}

.fig4-controls-top .fig2-dot {
  width: 14px;
  height: 14px;
}

.fig4-controls-top .fig2-dot:hover {
  transform: scale(1.3);
}

.fig4-example-label {
  font-size: 1rem;
  font-style: italic;
  color: #333;
  font-weight: 500;
  text-align: center;
  max-width: 100%;
  line-height: 1.4;
}

.fig4-btn {
  border-radius: 999px;
  border: 1px solid rgba(80, 136, 200, 0.6);
  background: #fff;
  color: var(--sot-cool-dark);
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.fig4-btn:hover {
  background: var(--sot-cool-light);
  border-color: var(--sot-cool);
}

/* ---- Fig-9 interactive gallery (Key Finding 3) ---- */
.fig9-widget {
  margin-top: 1.5rem;
}

.fig9-frame {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(80, 136, 200, 0.3);
  background: #f8fbfe;
}

.fig9-frame img {
  width: 100%;
  height: auto;
  display: block;
}

.fig9-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.fig9-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fig9-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c8dff0;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fig9-dot:hover {
  background: var(--sot-cool);
  transform: scale(1.2);
}

.fig9-dot.active {
  background: var(--sot-cool);
}

.fig9-btn {
  border-radius: 999px;
  border: 1px solid rgba(80, 136, 200, 0.6);
  background: #fff;
  color: var(--sot-cool-dark);
  padding: 0.2rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.fig9-btn:hover {
  background: var(--sot-cool-light);
  border-color: var(--sot-cool);
}

/* ---- Model-size image strip (fig8) ---- */
.fig8-strip-widget {
  margin-top: 1.2rem;
  border: 1px solid rgba(80, 136, 200, 0.25);
  border-radius: 10px;
  background: #f8fbfe;
  padding: 1rem 1rem 0.75rem;
}

.fig8-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.fig8-model-btns {
  display: flex;
  gap: 5px;
}

.fig8-model-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  border: 2px solid var(--btn-color, #aaa);
  background: #fff;
  color: #444;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.fig8-model-btn:hover {
  background: var(--btn-color, #aaa);
  color: #fff;
}

.fig8-model-btn.active {
  background: var(--btn-color, #aaa);
  color: #fff;
}

.fig8-strip-header .fig8-prompt-label {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

.fig8-caption-select {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(80, 136, 200, 0.4);
  background: #fff;
  color: #333;
  cursor: pointer;
}

.fig8-images-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.fig8-img-cell {
  flex: 1 1 0;
  max-width: 16.6%;
  text-align: center;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* image styling is on .fig8-img-wrap img */

.fig8-img-cell .fig8-img-label {
  font-size: 0.7rem;
  color: #888;
  margin-top: 2px;
  white-space: nowrap;
}

.fig8-img-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.fig8-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 2px solid transparent;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.fig8-score-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.4;
  pointer-events: none;
}

.fig8-images-row.has-highlight .fig8-img-cell {
  opacity: 0.45;
  transform: scale(0.95);
}

.fig8-images-row.has-highlight .fig8-img-cell.active {
  opacity: 1;
  transform: scale(1.02);
}

.fig8-img-cell.active .fig8-img-wrap img {
  border-color: var(--sot-cool);
  box-shadow: 0 0 8px rgba(80, 136, 200, 0.45);
}

.fig8-hint {
  font-size: 0.78rem;
  color: #999;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ---- Fig10 prior comparison widget ---- */
.fig10-widget {
  margin-top: 1.5rem;
  border: 1px solid rgba(80, 136, 200, 0.25);
  border-radius: 10px;
  background: #f8fbfe;
  padding: 1rem 1rem 0.75rem;
}

.fig10-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.fig10-header .fig10-prompt-label {
  font-size: 0.88rem;
  color: #555;
  font-style: italic;
}

.fig10-columns {
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 660px;
  margin: 0 auto;
}

.fig10-col {
  flex: 1 1 0;
  max-width: 210px;
  min-width: 0;
  text-align: center;
}

.fig10-col-title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 4px;
  padding: 3px 0;
  border-radius: 4px;
}

.fig10-col-title.prior-conditional { color: #2a7f2a; background: rgba(42, 127, 42, 0.08); }
.fig10-col-title.prior-unconditional { color: #b8860b; background: rgba(184, 134, 11, 0.08); }
.fig10-col-title.prior-uniform { color: #8b3a8b; background: rgba(139, 58, 139, 0.08); }

.fig10-img-wrap {
  position: relative;
  overflow: hidden;
}

.fig10-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.fig10-step-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.fig10-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.fig10-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(80, 136, 200, 0.6);
  background: #fff;
  color: var(--sot-cool-dark);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.fig10-play-btn:hover {
  background: var(--sot-cool-light);
}

.fig10-play-btn.is-active {
  background: var(--sot-cool);
  border-color: var(--sot-cool);
  color: #fff;
}

.fig10-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
  max-width: 500px;
}

.fig10-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--sot-cool);
}

.fig10-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  min-width: 70px;
  text-align: center;
}

.fig10-hint {
  font-size: 0.78rem;
  color: #999;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ---- Fig11 verifier comparison widget ---- */
.fig11-widget {
  margin-top: 1.2rem;
  border: 1px solid rgba(80, 136, 200, 0.25);
  border-radius: 10px;
  background: #f8fbfe;
  padding: 1rem 1rem 0.75rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.fig11-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.fig11-header .fig11-prompt-label {
  font-size: 0.88rem;
  color: #555;
  font-style: italic;
}

.fig11-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.95rem;
  justify-content: center;
}

.fig11-cell {
  min-width: 0;
  text-align: center;
}

.fig11-cell-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
  display: block;
  text-decoration: none;
}

a.fig11-cell-link {
  color: var(--sot-cool-dark);
  text-decoration: none;
}

a.fig11-cell-link:hover {
  text-decoration: underline;
}

.fig11-cell.solo-active .fig11-img-wrap {
  border-color: var(--sot-cool);
  box-shadow: 0 0 8px rgba(80, 136, 200, 0.5);
}

.fig11-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fig11-img-wrap:hover,
.fig11-cell.active .fig11-img-wrap {
  border-color: var(--sot-cool);
  box-shadow: 0 0 6px rgba(80, 136, 200, 0.35);
}

.fig11-grid.has-highlight .fig11-cell {
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

.fig11-grid.has-highlight .fig11-cell.active {
  opacity: 1;
}

.fig11-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.fig11-img-wrap .fig11-step-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

.fig11-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.fig11-slider-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 180px;
  max-width: 400px;
}

.fig11-slider-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--sot-cool);
}

@media screen and (max-width: 1200px) {
  .fig11-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
  }
}

@media screen and (max-width: 1024px) {
  .fig8-images-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }
  .fig8-img-cell {
    max-width: none;
  }
  .fig8-img-cell .fig8-img-label {
    white-space: normal;
    line-height: 1.2;
  }
  .fig11-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
  }
}

.fig11-step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  min-width: 70px;
  text-align: center;
}

.fig11-hint {
  font-size: 0.78rem;
  color: #999;
  text-align: center;
  margin-top: 0.4rem;
  margin-bottom: 0;
}

/* Fig-4 widget: static + animation + slider */
.fig4-static-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(80, 136, 200, 0.2);
}

.fig4-static-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.fig4-anim-section {
  margin-top: 0.75rem;
}

.fig4-anim-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--sot-cool-dark);
  margin-bottom: 0.5rem;
  text-align: center;
}

.fig4-anim-area {
  position: relative;
  width: 100%;
  cursor: pointer;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(80, 136, 200, 0.2);
  background: #f8fbfe;
}

.fig4-anim-area {
  /* Crop a bit of the top band if needed */
  aspect-ratio: 1500 / 245;
}

.fig4-anim-area .fig4-anim-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  display: block;
}

.fig4-hover-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 1rem;
  background: rgba(80, 136, 200, 0.9);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  transition: opacity 0.3s ease;
}

.fig4-anim-area:hover .fig4-hover-hint {
  opacity: 0.7;
}

.fig4-step-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  min-height: 36px;
}

.fig4-step-label {
  font-size: 0.95rem;
  color: #444;
  font-weight: 500;
}

.fig4-step-of {
  font-size: 0.95rem;
  color: #444;
}

.fig4-step-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--sot-cool-dark);
  min-width: 1.5em;
  text-align: center;
}

.fig4-step-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  max-width: 400px;
  height: 5px;
  border-radius: 3px;
  background: #d4e8f7;
  outline: none;
}

.fig4-step-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sot-cool);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.fig4-step-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--sot-cool);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

@media screen and (max-width: 768px) {
  .fig2-panels { grid-template-columns: 1fr; }
  .fig2-figure { grid-template-columns: 1fr; }
  .fig2-img-wrap { width: 160px; height: 160px; }
}

/* ---- Key Finding 1: Interactive token chart (Plotly) ---- */
.token-summary-wrap {
  width: 100%;
  background: #fcfcfc;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 0.6rem;
  overflow-x: auto;
  overflow-y: hidden;
}
.token-summary-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.token-summary-controls-main,
.token-summary-controls-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.token-summary-controls-main {
  justify-content: flex-start;
}
.token-summary-controls-actions {
  justify-content: flex-end;
}
.token-summary-controls-label {
  font-size: 0.96rem;
  color: #5d6873;
  text-align: right;
  flex: 1 1 240px;
}
.token-summary-restart-btn {
  border: 1px solid rgba(80, 136, 200, 0.45);
  background: #fff;
  color: var(--sot-cool-dark);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.token-summary-restart-btn:hover {
  background: var(--sot-cool-light);
  border-color: var(--sot-cool);
}

.token-summary-restart-btn.is-active,
.token-summary-controls .fig10-play-btn.is-active {
  background: var(--sot-cool);
  border-color: var(--sot-cool);
  color: #fff;
  box-shadow: 0 2px 10px rgba(80, 136, 200, 0.22);
}
.token-summary-action-btn {
  background: #f6f9fc;
  border-color: rgba(80, 136, 200, 0.28);
}
.token-summary-action-btn:hover {
  background: #edf4fb;
}
.token-preview-prompt {
  font-size: 0.96rem;
  line-height: 1.45;
}
.token-summary-grid {
  display: grid;
  grid-template-columns: 96px repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
}
.token-summary-head {
  font-size: 0.72rem;
  font-weight: 700;
  color: #333;
  text-align: center;
  padding: 0.2rem 0.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.token-summary-head-empty { visibility: hidden; }
.token-summary-row-label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 0.3rem;
}
.token-summary-row-flex {
  background: rgba(80, 136, 200, 0.08);
  color: #2f5a90;
}
.token-summary-row-grid {
  background: rgba(213, 154, 122, 0.12);
  color: #8b5a3c;
}
.token-summary-cell {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 6px;
  padding: 0.35rem;
}
.token-summary-cell-anim {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.token-summary-cell-anim.is-playing {
  border-color: rgba(80, 136, 200, 0.55);
  box-shadow: 0 2px 10px rgba(80, 136, 200, 0.12);
}
.token-summary-head-anim {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
.token-summary-head-anim .token-summary-head-text {
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
}
.token-summary-col-play {
  width: 20px !important;
  height: 20px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  font-size: 10px !important;
  padding: 0 !important;
  line-height: 1 !important;
  flex-shrink: 0;
  border-width: 1px !important;
  border-radius: 50% !important;
}
.token-summary-controls-hint {
  justify-content: flex-start;
  margin-top: 0.2rem;
}
.token-summary-controls-hint .token-summary-controls-label {
  flex: 1 1 auto;
  text-align: left;
  color: #6a7580;
  font-size: 0.88rem;
}
.token-summary-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}
.token-summary-topbar-prompt {
  flex: 1 1 320px;
  min-width: 220px;
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0;
}
.token-summary-topbar-hint {
  flex: 0 1 340px;
  max-width: 400px;
  text-align: right;
  color: #6a7580;
  font-size: 0.82rem;
  line-height: 1.4;
}
@media (max-width: 768px) {
  .token-summary-topbar {
    gap: 0.5rem;
  }
  .token-summary-topbar-hint {
    text-align: left;
    flex: 1 1 100%;
  }
}
.token-summary-cell-baseline {
  display: flex;
  align-items: center;
  justify-content: center;
}
.token-summary-cell-baseline .token-summary-media {
  width: min(78%, 180px);
  min-width: 92px;
  margin: 0 auto;
}
.token-summary-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 0.3rem;
}
.token-summary-mini-grid-anim {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}
.token-summary-mini-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.token-summary-mini-label {
  font-size: 0.58rem;
  color: #666;
  text-align: center;
  margin-bottom: 0.16rem;
  line-height: 1.1;
}
.token-summary-media {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: #f4f4f4;
  aspect-ratio: 1 / 1;
}
@keyframes tokenSummarySpin {
  to { transform: rotate(360deg); }
}
.token-summary-col-play.is-loading {
  background: #fff !important;
  border-color: rgba(80, 136, 200, 0.25) !important;
  border-top-color: var(--sot-cool) !important;
  color: transparent !important;
  animation: tokenSummarySpin 0.8s linear infinite;
  cursor: progress !important;
}
.token-summary-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}
.token-summary-score {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(17, 24, 39, 0.18);
  color: #1f2937;
  font-size: 0.44rem;
  line-height: 1;
  font-weight: 600;
  padding: 0.14rem 0.22rem;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}
.token-summary-step-overlay {
  display: none !important;
}

.token-chart-wrap {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  transform: none;
  overflow: visible;
}
.token-view-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.token-view-label { font-weight: 600; font-size: 0.95rem; }
.token-view-select {
  padding: 0.35rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  background: #fff;
  cursor: pointer;
}
.token-view-select:hover { border-color: var(--sot-cool); }
.token-chart-and-preview {
  position: relative;
  display: block;
}
.token-chart-area { width: 100%; min-width: 0; }
.token-chart-and-preview.best-per-view .token-chart-area { width: 100%; }
.token-chart-container { width: 100%; }
/* ---- Loading spinner ---- */

.token-plotly { width: 100%; min-height: 360px; }
.token-plotly-single { min-height: 320px; }

/* Keep the t-SNE reset/home control on a white background. */
#tsne-plot .modebar {
  background: #fff !important;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  padding: 2px;
}

#tsne-plot .modebar-btn {
  background: #fff !important;
}

.token-preview-overlay {
  margin-top: 0.35rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #5e6770;
}

.token-preview-overlay-btn {
  border: 1px solid #cfd6dd;
  background: #f6f8fa;
  color: #4a5560;
  border-radius: 5px;
  padding: 0.18rem 0.45rem;
  font-size: 0.74rem;
  line-height: 1.2;
  cursor: pointer;
}

.token-preview-overlay-btn:hover {
  border-color: #a8b8c9;
}

.token-preview-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 16px);
  width: 300px;
  min-width: 300px;
  flex-shrink: 0;
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 0.75rem;
  min-height: 120px;
  z-index: 6;
}
.token-preview-placeholder {
  font-size: 0.9rem;
  color: #888;
  text-align: center;
  padding: 1.5rem 0.5rem;
}
.token-preview-panel:not(.has-preview) .token-point-preview { display: none; }
.token-preview-panel.has-preview .token-preview-placeholder { display: none; }
.token-preview-panel.has-preview .token-point-preview { display: block; }

.token-point-preview {
  max-width: 100%;
}
.token-preview-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.2rem;
}
.token-preview-settings {
  font-size: 0.68rem;
  color: #6e6e6e;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}
.token-preview-setting {
  margin: 0;
}
.token-preview-prompt {
  font-size: 0.68rem;
  color: #6f6f6f;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}
.token-preview-compare {
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.token-preview-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.token-preview-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  display: block;
}
.token-preview-flex .token-preview-col-title { color: #5088C8; }
.token-preview-grid .token-preview-col-title { color: #b87333; }
.token-preview-main {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}
.token-preview-main-wrap {
  position: relative;
  width: 100%;
  display: inline-block;
  overflow: hidden;
}
.token-preview-score {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(17, 24, 39, 0.22);
  color: #1f2937;
  font-size: 0.48rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.16rem 0.28rem;
  border-radius: 5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(1px);
  z-index: 3;
  display: none;
}
.token-preview-steps-wrap {
  border-top: 1px solid #eee;
  padding-top: 0.35rem;
  overflow: hidden;
}
.token-preview-steps-label { font-size: 0.75rem; color: #666; margin-bottom: 0.25rem; }
.token-preview-steps {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 118px;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 4px;
  margin-top: 0;
}
.token-chart-hint {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.5rem;
}

@media screen and (max-width: 1100px) {
  .token-summary-grid {
    grid-template-columns: 86px repeat(4, minmax(0, 1fr));
  }
  .token-chart-and-preview {
    display: block;
  }
  .token-preview-panel {
    position: static;
    left: auto;
    top: auto;
    width: 100%;
    min-width: 0;
    margin-top: 0.85rem;
  }
}
@media screen and (max-width: 900px) {
  .token-summary-grid {
    min-width: 760px;
    grid-template-columns: 72px repeat(4, minmax(132px, 1fr));
    gap: 0.35rem;
  }
  .token-summary-head {
    font-size: 0.62rem;
    padding: 0.15rem 0.1rem;
  }
  .token-summary-row-label {
    font-size: 0.62rem;
    padding: 0.2rem;
  }
  .token-summary-cell {
    padding: 0.25rem;
  }
  .token-summary-mini-label {
    font-size: 0.5rem;
    margin-bottom: 0.12rem;
  }
  .token-summary-media {
    aspect-ratio: auto;
    min-height: 92px;
    background: #fff;
  }
  .token-summary-media img {
    height: auto;
    object-fit: contain;
  }
  .token-summary-cell-baseline .token-summary-media {
    width: 100%;
    min-width: 0;
  }
  .token-summary-score,
  .token-summary-step-overlay {
    transform: scale(0.9);
    transform-origin: bottom right;
  }
  .token-view-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .token-view-select {
    width: 100%;
  }
  .token-preview-compare {
    flex-direction: column;
  }
  .token-preview-steps {
    max-height: none;
  }
}

@media screen and (max-width: 768px) {
  .fig10-widget,
  .fig11-widget {
    padding: 0.8rem 0.75rem 0.65rem;
    width: 100%;
  }
  .token-summary-controls {
    align-items: stretch;
  }
  .token-summary-controls-main,
  .token-summary-controls-actions {
    width: 100%;
    justify-content: center;
  }
  .token-summary-controls-label {
    width: 100%;
    flex: 0 0 100%;
    text-align: center;
  }
  .token-summary-controls .fig10-play-btn {
    margin: 0 auto;
  }
  .token-summary-controls-label {
    font-size: 0.82rem;
    line-height: 1.35;
  }
  .fig10-header,
  .fig11-header {
    align-items: flex-start;
  }
  .fig10-header .fig10-prompt-label,
  .fig11-header .fig11-prompt-label {
    width: 100%;
    font-size: 0.8rem;
    line-height: 1.3;
  }
  .fig10-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.7rem;
    max-width: none;
  }
  .fig10-col {
    max-width: none;
  }
  .fig10-col-title {
    font-size: 0.76rem;
    padding: 0.35rem 0.5rem;
  }
  .fig10-slider-wrap,
  .fig11-slider-wrap {
    width: 100%;
    min-width: 0;
  }
  .fig10-step-label,
  .fig11-step-label {
    min-width: 60px;
    font-size: 0.74rem;
  }
  .fig10-hint,
  .fig11-hint {
    font-size: 0.72rem;
    line-height: 1.35;
  }
  .fig11-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }
  .fig11-cell-title {
    font-size: 0.74rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    min-height: 2.2em;
    line-height: 1.15;
  }
  .fig11-img-wrap {
    min-height: 108px;
  }
  .fig8-strip-header,
  .fig10-header,
  .fig11-header {
    flex-direction: column;
    align-items: stretch;
  }
  .fig8-model-btns {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    gap: 0.35rem;
  }
  .fig8-model-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .fig8-caption-select,
  #fig10-caption-select,
  #fig11-caption-select {
    width: 100%;
    max-width: none;
  }
}
.token-chart-hint em { color: #555; }

.token-nfe-section .token-nfe-controls,
.token-compare-nfe {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.token-nfe-label { font-weight: 600; }
.token-nfe-range {
  flex: 1;
  min-width: 120px;
  max-width: 320px;
  accent-color: var(--sot-cool);
}
.token-nfe-val { font-variant-numeric: tabular-nums; min-width: 5ch; }

.token-compare-cards {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.token-card {
  flex: 1;
  min-width: 140px;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  border: 2px solid;
}
.token-card-grid { border-color: #D59A7A; background: #fff9f5; }
.token-card-flex { border-color: #77BEF0; background: #f0f8ff; }
.token-card-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.token-card-grid .token-card-title { color: #b87333; }
.token-card-flex .token-card-title { color: #5088C8; }
.token-card-score { font-size: 1.25rem; font-weight: 700; }
.token-card-extra { font-size: 0.8rem; color: #666; margin-top: 0.25rem; }

.token-ba-wrap { margin-top: 1.5rem; }
.token-ba-track {
  position: relative;
  height: 48px;
  background: linear-gradient(to right, #fff9f5 0%, #f0f8ff 100%);
  border-radius: 8px;
  overflow: hidden;
}
.token-ba-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50%;
  background: #D59A7A;
  opacity: 0.25;
  pointer-events: none;
}
.token-ba-slider {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  margin: 0;
  opacity: 0.4;
  cursor: ew-resize;
  accent-color: var(--sot-cool);
}
.token-ba-caption {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
  text-align: center;
}
