@charset "UTF-8";

:root {
  color-scheme: light;
  --page: #fff;
  --surface: #f7f8f8;
  --surface-elev: #fff;
  --line: #d9dddf;
  --line-strong: #a9b2b8;
  --text: #25282a;
  --muted: #59636a;
  --accent: #95452f;
  --ice: #31607b;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --serif: "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", "Consolas", monospace;
}

* {
  box-sizing: border-box;
}

/* Scroll-state container query root for auto-hiding sticky top bar */
html {
  container-type: scroll-state;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button,
summary {
  cursor: pointer;
}

button {
  background: none;
  border: 0;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[hidden],
.is-hidden,
.tier-row.is-empty {
  display: none !important;
}

:target,
.tier-row {
  scroll-margin-top: 4.5rem;
}

.frame-wrap {
  width: min(1440px, calc(100% - clamp(20px, 4vw, 64px)));
  margin-inline: auto;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
}

.icon svg {
  width: 100%;
  height: 100%;
}

.skip-link {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 40;
  padding: 8px 14px;
  background: var(--surface-elev);
  border: 1px solid var(--accent);
  border-radius: 5px;
}

.skip-link:focus {
  top: 10px;
}

/* ---------------------------------------------------------------------------
 * Compact Sticky Command Bar (scroll-state auto-hide + JS fallback)
 * --------------------------------------------------------------------------- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--line);
  transition: transform 0.22s ease;
}

@container scroll-state((scrolled: bottom) and (scrollable: top)) {
  .top-bar {
    transform: translateY(-100%);
  }
}

.top-bar.is-hidden-bar:not(:focus-within) {
  transform: translateY(-100%);
}

.top-bar:focus-within {
  transform: none;
}

.bar-inner {
  width: min(1440px, calc(100% - clamp(20px, 4vw, 64px)));
  margin-inline: auto;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  flex: none;
  font: 700 16px/1 var(--serif);
  letter-spacing: 0.08em;
}

.brand-seal {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--accent);
  outline: 1px solid rgba(230, 148, 120, 0.45);
  outline-offset: -4px;
  color: var(--accent);
  transform: rotate(-4deg);
  font: 700 18px/1 var(--serif);
  border-radius: 4px 2px 3px 2px;
}

.search-field {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  transition: border-color 0.16s ease;
}

.search-field:focus-within {
  border-color: var(--accent);
  color: var(--text);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
  color: var(--text);
}

.search-field input:focus-visible {
  outline: 0;
}

.search-field input::-webkit-search-cancel-button {
  display: none;
}

.search-field input::placeholder {
  color: #647079;
}

.clear-inline {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

kbd {
  font: 11px/1 var(--mono);
  border: 1px solid rgba(148, 184, 198, 0.34);
  border-radius: 3px;
  padding: 3px 6px;
  color: var(--muted);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.bar-btn,
.primary-btn,
.foot-btn,
.dialog-close,
.fab-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bar-btn {
  height: 36px;
  padding: 0 11px;
  font-size: 13px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}

.bar-btn:hover,
.foot-btn:hover,
.dialog-close:hover {
  background: #edf0f1;
  border-color: var(--line-strong);
}

.bar-btn.icon-only {
  width: 36px;
  padding: 0;
  color: var(--muted);
}

.bar-btn.icon-only:hover {
  color: var(--text);
}

.bar-btn[aria-pressed="true"],
.bar-btn.has-filters {
  color: var(--accent);
  border-color: rgba(230, 148, 120, 0.65);
  background: rgba(230, 148, 120, 0.12);
}

.bar-btn-accent,
.primary-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.bar-btn-accent:hover,
.primary-btn:hover {
  background: #7b3726;
  border-color: #7b3726;
  color: #fff;
}

.bar-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.bar-btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
}

.filter-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: 700 11px/18px var(--mono);
  text-align: center;
}

/* ---------------------------------------------------------------------------
 * Compact Editorial Iceberg Masthead
 * --------------------------------------------------------------------------- */
.sky {
  background:
    radial-gradient(ellipse at 20% 35%, #ffffff9c 0%, transparent 35%),
    radial-gradient(ellipse at 75% 18%, #ffffff7a 0%, transparent 25%),
    linear-gradient(180deg, #add5ef 0%, #d0e8f7 52%, #e8f5fa 94%, #d4e9f1 100%);
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(185px, 20vw, 280px);
  align-items: center;
  gap: 24px;
  padding-block: 18px;
}

.hero-copy {
  position: relative;
  z-index: 1;
}



h1,
h2,
h3,
p {
  margin: 0;
}

.hero-title-row {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin-top: 8px;
}

.hero h1 {
  font: 700 clamp(26px, 2.8vw, 40px)/1.2 var(--serif);
  letter-spacing: 0.04em;
  color: var(--text);
}

.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.hero-stats b {
  font: 600 15px/1 var(--mono);
  color: var(--text);
}

.hero-stats .sep {
  opacity: 0.45;
}


/* Collapsible Chart Notes with True Blank-Line Paragraph Support */
.hero-notes {
  margin-top: 10px;
  max-width: 78ch;
}

.hero-notes summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--accent);
  list-style: none;
  padding: 2px 0;
}

summary::-webkit-details-marker {
  display: none;
}

.hero-notes[open] summary .icon,
.legend-bar[open] summary .icon {
  transform: rotate(180deg);
}

.hero-notes summary .icon,
.legend-bar summary .icon {
  transition: transform 0.18s ease;
}

.hero-notes-body {
  margin-top: 10px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.85;
  color: var(--text);
}

.hero-plate {
  position: relative;
  pointer-events: none;
}

.hero-plate img {
  display: block;
  width: 100%;
  height: auto;
  
}

.chart-toolbar {
  padding-bottom: 12px;
}

.legend-disclosure {
  margin-bottom: 6px;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(49, 96, 123, 0.25);
  color: #1f4458;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.legend-toggle:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(49, 96, 123, 0.5);
}

.legend-disclosure[open] .legend-toggle .icon {
  transform: rotate(180deg);
}

.legend-toggle .icon {
  transition: transform 0.18s ease;
}

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.wave-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 3px 7px;
  color: #294859;
  font-size: 13px;
}
.wave-switch::before {
  content: "";
  width: 28px;
  height: 16px;
  border-radius: 12px;
  background: radial-gradient(circle at 8px center, white 5px, transparent 6px), #75848c;
}
.wave-switch[aria-checked="true"]::before {
  background: radial-gradient(circle at 20px center, white 5px, transparent 6px), #266887;
}
.result-pill {
  text-align: right;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.result-pill b {
  font: 700 13px/1 var(--mono);
  color: var(--text);
}

.legend-bar {
  padding: 4px clamp(10px, 2.5vw, 36px) 12px;
}
.legend-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 8px;
}
.legend-cloud + .legend-cloud { margin-top: 14px; }
/* 16 Categories: original solid vibrant category pills */
.legend-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 12px;
  color: #fff;
  background: var(--chip-color);
  border: 1px solid var(--chip-color);
  border-radius: 999px;
  font: 600 14px/1.4 var(--sans);
  text-shadow: -1px 0 2px #000, 1px 0 2px #000, 0 2px 3px #000;
  transition: opacity 0.14s ease, filter 0.14s ease;
}
.legend-chip:hover {
  outline: 2px solid #24506b;
  outline-offset: 2px;
}
/* 20 Marker Tags: unified clean frosted-ice pill + emoji (zero random rainbow borders) */
#legend-markers .legend-chip {
  color: #1f3646;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(36, 73, 98, 0.18);
  text-shadow: none;
  font-weight: 500;
  font-size: 12.5px;
  padding: 4px 10px;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(24, 54, 76, 0.06);
}
#legend-markers .legend-chip:hover {
  background: #ffffff;
  border-color: rgba(36, 73, 98, 0.42);
  color: #0f2433;
  outline: none;
}
.legend-emoji {
  font-size: 1em;
  line-height: 1;
}
.legend-eye {
  flex: none;
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 1px 1px #2229);
}
#legend-markers .legend-eye {
  width: 14px;
  height: 14px;
  color: #627b8c;
  filter: none;
}
#legend-markers .legend-chip:hover .legend-eye {
  color: currentColor;
}
.legend-chip[aria-pressed="false"] {
  opacity: 0.48;
  filter: saturate(0.32);
  text-decoration: line-through;
}
.legend-chip[aria-pressed="true"] .eye-strike { display: none; }
.legend-chip:focus-visible { outline: 2px solid #24506b; outline-offset: 2px; }
.mk-emoji {
  font-size: 1em;
  line-height: 1;
  flex: none;
}
@media (max-width: 600px) {
  .legend-bar { padding: 8px 4px 10px; }
  .legend-cloud { gap: 6px 5px; }
  .legend-chip, #legend-markers .legend-chip { font-size: 12px; padding: 4px 8px; gap: 4px; }
  .legend-eye { width: 13px; height: 13px; }
}

.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(132, 168, 186, 0.16);
}

.active-filters-bar > div {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--text);
  font-size: 12px;
}

.active-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
 * CLASSIC FRAMED FLOATING-TEXT ICEBERG CHART
 * Zero boxes, zero cards, zero stretched bitmap background!
 * --------------------------------------------------------------------------- */
.chart-stage { padding-bottom: 32px; }
.chart-stage > .frame-wrap { width: 100%; }
.iceberg-frame {
  border-top: 2px solid rgba(139, 214, 245, 0.72);
  background-color: #091936;
  background-image: url("../assets/water-grain.webp"), linear-gradient(to bottom,
    #1b3c5b 0%, #163350 15%, #122844 31%, #0e1e38 49%,
    #10172f 67%, #26162a 79%, #3d1828 90%, #521c2c 100%);
  background-size: 1280px 768px, 100% 100%;
  background-blend-mode: soft-light, normal;
}

.loading-state {
  padding: 72px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.tier-row {
  position: relative;
  padding: 26px max(5vw, calc((100% - 1300px) / 2)) 44px;
}
/* Keep the long chart background static to avoid repainting it every frame. */
.tier-canvas { padding: 15px 4px; }


/* Classic Centered Floating Word Cloud (Default — faithful to classic Iceberg Charts) */
.entries-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  align-content: flex-start;
  column-gap: clamp(20px, 2.4vw, 38px);
  row-gap: clamp(21px, 2.4vw, 36px);
}

/* Pure Borderless Floating Entry — 100% true category color + crisp dark stroke halo */
.entry-float {
  position: relative;
  display: inline-grid;
  grid-template-columns: minmax(0, auto) auto;
  align-items: start;
  max-width: 100%;
  padding: 4px 3px;
  margin-inline-end: var(--air, 0px);
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--cat-color, #e9eee9);
  font-family: var(--sans);
  font-size: calc(var(--base-fs, 17px) * var(--scale, 1));
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: 0.015em;
  text-align: center;
  overflow-wrap: anywhere;
  -webkit-text-stroke: 2px rgba(5, 12, 22, 0.9);
  paint-order: stroke fill;
  text-shadow:
    0 1px 3px rgba(3, 9, 18, 0.94),
    0 0 8px rgba(3, 9, 18, 0.6);
  transform: translateY(var(--drift-y, 0px));
  transition: color 150ms ease-out, text-shadow 150ms ease-out;
}

.entry-float::before {
  content: "";
  position: absolute;
  inset: -2px -4px;
  z-index: -1;
  pointer-events: none;
  border-radius: 8px;
  background: #142333;
  box-shadow: inset 0 0 0 1px #acbfce, 0 3px 7px #0a132945;
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.entry-float:is(:hover, :focus-visible)::before { opacity: 1; }
.waves-on .entry-float:is(:hover, :focus-visible)::before,
.waves-on .entry-float:is(:hover, :focus-visible) {
  transition-delay: var(--settle-time, 180ms);
}

.word-title {
  min-width: 0;
}
.word-tags {
  margin: -.3em 0 0 .2em;
  font: normal .64em/1.2 "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  white-space: nowrap;
  text-shadow: 0 1px 2px #071126;
}

/* Subtle debunked mark (tiny translucent dot/strike hint on hover or badge only? Keep pure text!) */
.entry-float.is-debunked {
  text-decoration: underline dotted color-mix(in srgb, var(--cat-color, #fff) 45%, transparent);
  text-underline-offset: 5px;
}

/* Tidy Left-Aligned Floating Mode (toggled via #btn-layout — still 100% borderless floating text) */
.layout-aligned .entries-cloud {
  justify-content: flex-start;
  column-gap: clamp(19px, 2.3vw, 31px);
  row-gap: 14px;
}

.layout-aligned .entry-float {
  margin-inline-end: 0;
  --drift-y: 0px !important;
  --scale: 1 !important;
  text-align: left;
}

/* Compact Dense Poster Mode (toggled via #btn-density) */
.density-compact .tier-canvas {
  padding: 16px clamp(14px, 2vw, 26px) 22px;
}

.density-compact .entries-cloud {
  column-gap: clamp(14px, 1.7vw, 23px);
  row-gap: 8px;
}

.density-compact .entry-float {
  --base-fs: 13.5px;
  line-height: 1.32;
}

/* Soft Eye-Care Tinted Palette (uses oklab per modern color guidance; default is 100% original category colors) */
.palette-soft .entry-float {
  color: color-mix(in oklab, var(--cat-color, #e9eee9) 76%, #dce7ef);
}

.entry-float:is(:hover, :focus-visible) {
  z-index: 1;
  color: #fff;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.entry-float:focus-visible {
  outline: 2px solid white;
  outline-offset: 4px;
}

.tier-aside {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 12px;
  color: #d8e8ff;
}
.tier-aside::before, .tier-aside::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #a5d2ff49;
}
.tier-aside { text-shadow: 0 1px 3px #081526, 0 1px 1px #081526; }
.tier-aside h2 {
  margin: 0;
  font: 700 23px/1.3 var(--serif);
  letter-spacing: .08em;
  color: #f0f6ff;
}
.tier-level, .tier-count {
  font: 12px/1.4 var(--mono);
  color: #bccfe5;
  white-space: nowrap;
}
.tier-count b { font-weight: inherit; }
@property --wave-strength {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}
.word-title > span {
  display: inline-block;
  max-width: 100%;
  transition: --wave-strength var(--settle-time, 180ms) ease-out;
}
.waves-on {
  & .entry-float.in-view .word-title > span {
    animation: water-ripple 5.6s ease-in-out infinite;
    animation-delay: calc(var(--phase) - var(--wave-offset, 0s));
  }
  .word-title > span:nth-child(2) { --wave-offset: .52s; }
  .word-title > span:nth-child(3) { --wave-offset: 1.04s; }
  &.is-scrolling .entry-float.in-view .word-title > span { animation-play-state: paused; }
  .entry-float:focus-visible .word-title > span { --wave-strength: 0; animation-play-state: paused; }
  @media (any-hover: hover) {
    .entry-float:hover .word-title > span { --wave-strength: 0; animation-play-state: paused; }
  }
}
@keyframes water-ripple {
  0%, 100% {
    transform: translate(calc(-1px * var(--wave-strength)), calc(-2.5px * var(--wave-strength)))
      skewX(calc(-2.5deg * var(--wave-strength))) rotate(calc(-.7deg * var(--wave-strength)));
  }
  50% {
    transform: translate(calc(1px * var(--wave-strength)), calc(2.5px * var(--wave-strength)))
      skewX(calc(2.5deg * var(--wave-strength))) rotate(calc(.7deg * var(--wave-strength)));
  }
}


/* ---------------------------------------------------------------------------
 * Empty State, Footer & Back-to-Top
 * --------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 64px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state h2 {
  font: 700 22px/1.3 var(--serif);
}

.empty-state p {
  color: var(--muted);
  margin: 8px 0 20px;
  font-size: 14px;
}

.primary-btn {
  padding: 9px 18px;
  font-size: 13.5px;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-block: 18px 26px;
  color: var(--muted);
  font-size: 12.5px;
}

.footer code {
  font: 11px/1 var(--mono);
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.fab-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 40px;
  height: 40px;
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 18px;
  z-index: 15;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ---------------------------------------------------------------------------
 * Native Modal Dialogs (animate-to-from-top-layer + prevent-page-scroll-under-modal-dialog)
 * --------------------------------------------------------------------------- */
dialog.modal-dialog {
  position: fixed;
  width: min(650px, calc(100% - 24px));
  max-height: 86dvh;
  padding: 0;
  background: #fff;
  border: 1px solid rgba(146, 186, 204, 0.34);
  border-radius: 10px;
  color: var(--text);
  box-shadow: 0 16px 48px #1b26362b;
  overflow: auto;
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.22s;
  transition-timing-function: ease-out;
  /* Separate declaration per animate-to-from-top-layer so older browsers keep other transitions */
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  dialog.modal-dialog {
    transform: translateY(10px) scale(0.97);
  }
}

dialog.modal-dialog:modal {
  /* MANDATORY per prevent-page-scroll-under-modal-dialog */
  overscroll-behavior: contain;
}

dialog.modal-dialog::backdrop {
  /* MANDATORY per prevent-page-scroll-under-modal-dialog: make ::backdrop a scroll container */
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(4, 10, 16, 0);
  backdrop-filter: blur(4px);
  transition-property: background-color, display, overlay;
  transition-duration: 0.22s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

/* Open state + :where(:not([data-closing])) fallback for Firefox & Safari exit animations */
:is(dialog.modal-dialog[open]):where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0) scale(1);

    @starting-style {
      transform: translateY(10px) scale(0.97);
    }
  }

  &::backdrop {
    background-color: rgba(12, 20, 28, 0.5);

    @starting-style {
      background-color: rgba(4, 10, 16, 0);
    }
  }
}

.dialog-shell,
.filter-shell {
  display: flex;
  flex-direction: column;
  max-height: 85dvh;
}

.dialog-head,
.filter-head,
.dialog-foot,
.filter-foot,
.filter-group-head,
.filter-head-actions,
.dialog-meta-row,
.dialog-action-group,
.dialog-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dialog-head,
.filter-head,
.dialog-foot,
.filter-foot {
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-foot,
.filter-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-close,
.foot-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 6px 11px;
  font-size: 12.5px;
}

.foot-btn-accent {
  border-color: rgba(230, 148, 120, 0.55);
  color: var(--accent);
}

.dialog-close {
  font: 22px/1 var(--sans);
  height: 32px;
  width: 32px;
  padding: 0;
}

.dialog-body,
.filter-body {
  padding: 20px;
  overflow: auto;
  overscroll-behavior: contain;
}

.dialog-title {
  font: 700 25px/1.35 var(--serif);
  color: var(--text);
  border-left: 4px solid var(--cat-color, var(--accent));
  padding-left: 12px;
}

.dialog-title-sm {
  font: 700 20px/1.3 var(--serif);
}

.about-source-title {
  font: 700 17px/1.4 var(--serif);
  color: var(--accent);
  margin-bottom: 4px;
}

/* True Blank-Line Rendering (solves original IcebergThreads white-space: normal limitation) */
.dialog-desc {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #343b3f;
  line-height: 1.9;
  margin-top: 12px;
  font-size: 14.5px;
}

.dialog-desc.is-empty {
  color: var(--muted);
  font-style: italic;
}

.dialog-layer-badge,
.dialog-pos,
.source-domain-badge {
  font-size: 12px;
  color: var(--muted);
}

.cat-dot,
.mk-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-color, var(--mk-color, #92a7a5));
  display: inline-block;
  flex: none;
}

.dialog-cat-pill,
.marker-pill,
.toggle-pill,
.mode-btn,
.related-link {
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 5px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.dialog-cat-pill:hover,
.marker-pill:hover,
.related-link:hover,
.toggle-pill:hover {
  border-color: var(--line-strong);
  background: #ebeff0;
}

.dialog-markers,
.related-list,
.filter-pill-list,
.tag-mode-switch {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.dialog-markers {
  margin: 16px 0;
}

.source-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.source-link:hover {
  border-color: var(--accent);
}

.source-label {
  font-size: 13px;
  color: var(--accent);
}

.source-domain-badge {
  margin-left: 5px;
}

.source-url-full,
.source-missing {
  display: block;
  font: 11.5px/1.6 var(--mono);
  overflow-wrap: anywhere;
  color: var(--muted);
}

.source-missing {
  font-family: var(--sans);
}

.related-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 9px;
}

.related-heading,
.filter-group-title {
  font-size: 13.5px;
  color: var(--text);
}

.filter-group + .filter-group {
  margin-top: 20px;
}

.filter-group-title,
.filter-group-head {
  margin-bottom: 8px;
}

.filter-group-head {
  justify-content: space-between;
}

.toggle-pill[aria-pressed="true"],
.mode-btn.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(230, 148, 120, 0.14);
}

.pill-count {
  color: var(--muted);
  font: 11px/1 var(--mono);
}

.text-btn,
.mini-link {
  color: var(--accent);
  padding: 3px;
  font-size: 12.5px;
}

.text-btn:hover,
.mini-link:hover {
  text-decoration: underline;
}

.full-width {
  width: 100%;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #ece3d7;
  color: #1d2224;
  border-radius: 6px;
  padding: 8px 16px;
  z-index: 30;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* ---------------------------------------------------------------------------
 * Responsive Breakpoints (Tablet & Mobile)
 * --------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) 220px;
  }



  .brand-text {
    display: none;
  }
}

@media (max-width: 780px) {
  .bar-inner {
    gap: 7px;
  }

  .bar-btn .btn-label,
  .search-field kbd,
  #btn-about {
    display: none;
  }

  .bar-btn {
    padding: 0 9px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-block: 14px;
  }

  .hero-plate {
    display: none;
  }

  .tier-row { padding: 19px 12px 30px; }
  .tier-canvas { padding: 10px 0; }
  .tier-aside { gap: 9px; }
  .tier-aside h2 { font-size: 19px; }
  .tier-level, .tier-count { font-size: 10px; }
  .entries-cloud { gap: 15px 12px; }
  .entry-float {
    --base-fs: 14px;
    min-height: 32px;
    margin-inline-end: min(4px, var(--air));
    transform: translateY(clamp(-3px, var(--drift-y), 3px));
  }


  .dialog-head,
  .filter-head,
  .dialog-foot,
  .filter-foot,
  .dialog-body,
  .filter-body {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry-float { --settle-time: 0ms; }
  dialog.modal-dialog,
  dialog.modal-dialog::backdrop {
    transition-duration: 0.1s;
  }

  .top-bar,
  .entry-float::before,
  .entry-float {
    transition: none;
  }
}

@media (forced-colors: active) {
  .entry-float {
    color: LinkText;
    -webkit-text-stroke: 0;
  }

  .entry-float:is(:hover, :focus-visible) {
    color: HighlightText;
    background: Highlight;
    outline: 2px solid Highlight;
  }

  .legend-toggle,
  .legend-chip,
  .bar-btn,
  .dialog-cat-pill,
  .marker-pill {
    border: 1px solid ButtonBorder;
    color: ButtonText;
    background: ButtonFace;
  }
}
