* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #FFFFFF;
  --panel: #FAFAFB;
  --text: #111418;
  --muted: rgba(17, 20, 24, .62);
  --muted-soft: rgba(17, 20, 24, .42);
  --line: rgba(17, 20, 24, .14);
  --line-soft: rgba(17, 20, 24, .06);
  --accent: #F0E35B;
  --ink: #111418;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-serif: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Sans', system-ui, sans-serif;
  --sidebar-w: clamp(260px, 18vw, 340px);
  --reader-w: clamp(320px, 26vw, 460px);
}

html,
body {
  height: 100%;
  max-width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--reader-w);
}

#sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  padding: 1.8rem 1.6rem 1.4rem;
  gap: 1.6rem;
}

#header {
  flex-shrink: 0;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--ink);
}

#header h1 {
  font-family: var(--font-sans);
  font-size: clamp(1.8rem, 2.4vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.05;
  margin-bottom: .65rem;
  color: var(--ink);
}

#header .sub {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.2;
  font-family: var(--font-sans);
  font-style: italic;
}

#filters {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.fg {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fl {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 700;
}

.fd {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 14px;
  line-height: 1.2;
  color: var(--muted);
  margin-bottom: 4px;
}

.fp {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  font-size: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, color .15s;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pill:hover {
  background: var(--ink);
  color: var(--bg);
}

.pill:hover .pill-count {
  background: rgba(255, 255, 255, .18);
  color: var(--bg);
}

.pill.active {
  background: var(--ink);
  color: var(--bg);
}

.pill.layer-active {
  background: var(--layer-color, var(--ink));
  border-color: var(--layer-color, var(--ink));
  color: #fff;
}

/* Layer pills carry an extra description that's hidden by default and
   revealed when the journey is active. The description slides open with a
   smooth grid-row height transition + fade — no janky padding/border tweens. */
.pill-layer {
  align-items: center;
  text-align: left;
}

.pill-layer .pill-desc {
  flex-basis: 100%;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  font-family: var(--font-sans);
  font-style: italic;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.45;
  color: inherit;
  transition: grid-template-rows .32s ease, opacity .22s ease, margin-top .32s ease;
  margin-top: 0;
}

.pill-layer .pill-desc>span {
  min-height: 0;
  overflow: hidden;
}

.pill-layer.layer-active {
  flex: 1 0 100%;
  width: 100%;
  white-space: normal;
  border-radius: 14px;
  padding: 8px 14px 10px;
  cursor: pointer;
  flex-wrap: wrap;
}

.pill-layer.layer-active .pill-desc {
  grid-template-rows: 1fr;
  opacity: .92;
  margin-top: 6px;
  transition: grid-template-rows .32s ease, opacity .22s ease .08s, margin-top .32s ease;
}

.pill .pill-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--layer-color, var(--ink));
  flex-shrink: 0;
}

.pill.layer-active .pill-dot {
  background: #fff;
}

.pill .pill-count {
  margin-left: 4px;
  padding: 0 5px;
  font-size: 9px;
  background: rgba(17, 20, 24, .08);
  border-radius: 6px;
  color: var(--muted);
  letter-spacing: .05em;
  font-weight: 500;
}

.pill.active .pill-count {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

/* Visualization fills the remaining viewport — both width (sidebar takes its
   share via the body grid) and full viewport height. */
#viz {
  height: 100vh;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .25rem;
  overflow: hidden;
}

.viz-radial-wrap {
  display: block;
  height: 100%;
  aspect-ratio: 1;
  max-width: 100%;
  max-height: 100%;
  position: relative;
}

#viz-radial {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Analytical-journey overlay — each sector fades in clockwise so the journey
   is read as a sweeping animation rather than a static colour block. */
@keyframes sector-sweep {
  from {
    opacity: 0;
    transform: scale(.985);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.layer-sector {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 500px 500px;
  animation: sector-sweep .42s cubic-bezier(.2, .7, .25, 1) forwards;
}

/* SVG primitives — light contours so dots stay the focus. */
.ring-line {
  fill: none;
  stroke: rgba(17, 20, 24, .14);
  stroke-width: .6;
}

/* Emphasis ring — slightly heavier on every other ring for rhythm. */
.ring-line.is-emph {
  stroke: rgba(17, 20, 24, .22);
  stroke-width: .9;
}

/* Innermost ring rendered as a dashed contour for the rating-axis pivot. */
.ring-line.is-inner {
  stroke: rgba(17, 20, 24, .25);
  stroke-dasharray: 2 4;
  stroke-width: .6;
}

.sector-divider {
  stroke: rgba(17, 20, 24, .05);
  stroke-width: .5;
}

.axis-mark {
  stroke: rgba(17, 20, 24, .35);
  stroke-width: .7;
  stroke-dasharray: 1 3;
}

.ring-label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .12em;
  fill: var(--ink);
}

.cat-name {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .02em;
  fill: var(--ink);
}

.cat-meta {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  fill: var(--muted);
}

.center-num {
  font-family: var(--font-sans);
  font-weight: 900;
  font-size: 48px;
  fill: var(--ink);
  text-anchor: middle;
}

.center-lbl {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  fill: var(--muted);
  text-anchor: middle;
}

.center-bg {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 1;
}

/* Dots — solid colored satellites, no outline (matches the reference). */
.dot {
  cursor: pointer;
  transition: opacity .15s ease, transform .12s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.dot:hover {
  transform: scale(1.7);
}

.dot.is-focused {
  transform: scale(1.8);
  opacity: 1;
}

/* Reviews that received comments are emphasized in three ways:
   (1) a permanent thin border in the category color,
   (2) a soft scale pulse on the dot itself,
   (3) one or more halo "ping" circles (rendered as siblings) that scale
       outward and fade. Per-dot intensity is set via inline CSS variables
       so dots with more comments ping faster and wider. */
.dot.has-comments {
  stroke-width: 1.4px;
  stroke-opacity: .65;
  paint-order: stroke fill;
  animation: dot-pulse var(--pulse-dur, 2s) ease-in-out infinite;
}

@keyframes dot-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(var(--dot-scale, 1.2));
  }
}

.halos-layer {
  pointer-events: none;
}

.dot-halo {
  transform-origin: center;
  transform-box: fill-box;
  pointer-events: none;
  animation: dot-halo-ping var(--pulse-dur, 2s) ease-out infinite;
  /* Stagger a second halo so the ping reads as continuous radar sweep. */
}

.dot-halo.is-second {
  animation-delay: calc(var(--pulse-dur, 2s) / -2);
}

@keyframes dot-halo-ping {
  0% {
    transform: scale(1);
    opacity: .55;
  }

  80% {
    transform: scale(var(--halo-scale, 2.6));
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Suppress halo + pulse whenever something is focused or this dot is
   hovered, so interaction always reads cleanly. */
body.is-focused .dot-halo {
  display: none;
}

body.is-focused .dot.has-comments:not(.is-focused) {
  animation: none;
  stroke-opacity: 0;
}

.dot.has-comments.is-focused {
  animation: none;
}

.dot.has-comments:hover {
  animation: none;
}

/* When any dot is focused/hovered, fade out everything else so the active
   point reads clearly. */
body.is-focused .dot:not(.is-focused) {
  opacity: .12;
}

.focus-ray {
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-opacity: .9;
  pointer-events: none;
}

/* Reading panel — always-visible fixed sidebar on the right. */
.reader {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--reader-w);
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reader-inner {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.8rem 1.6rem 1.4rem;
}

.reader-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 5px;
  font-family: var(--font-sans);
  font-weight: 500;
}

.reader-cat {
  font-weight: 500;
  color: var(--cat-color, var(--muted));
  letter-spacing: .13em;
}

.cat-chip {
  display: inline-block;
  padding: 3px 9px;
  margin: 0 4px 4px 0;
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 500;
  font-family: var(--font-mono);
}

.reader-stars {
  color: var(--text);
  letter-spacing: 1.5px;
  font-size: 16px;
}

.reader-clinic {
  color: var(--muted);
}

.reader-comments-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid currentColor;
  margin-bottom: 20px;
}

.reader-comments-badge::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.reader-comments-badge[data-state="has"] {
  color: #1f8a44;
}

.reader-comments-badge[data-state="empty"] {
  color: var(--muted);
  opacity: .75;
}

.reader-comments-badge[hidden] {
  display: none;
}

.reader-text {
  font-size: 16px;
  line-height: 1.2;
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--text);
}

.reader-text.is-hint {
  color: var(--muted-soft);
  font-style: italic;
}

.kw {
  background: var(--cat-color, #999);
  color: #fff;
  padding: 0 4px;
  margin: 0 1px;
  border-radius: 2px;
  font-weight: 500;
  letter-spacing: .01em;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .08);
}

/* Comments block in the right reader sidebar. Visible only when a dot has
   been clicked (body.comments-active); hover alone keeps it hidden. */
.reader-comments {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  display: none;
  flex-direction: column;
  gap: .8rem;
}

body.comments-active .reader-comments {
  display: flex;
}

.reader-comments-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
}

.reader-comments-count {
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  letter-spacing: .08em;
  font-weight: 500;
}

.reader-comments-close {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: var(--font-sans);
  transition: background .15s, color .15s, border-color .15s;
}

.reader-comments-close:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.reader-comments-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 38vh;
  overflow-y: auto;
  padding-right: 4px;
}

.reader-comments-list:empty::before {
  content: 'No comments yet.';
  color: var(--muted-soft);
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 14px;
}

.reader-comment-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.reader-comment-time {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-soft);
  font-weight: 500;
}

.reader-comment-form {
  flex: 0 0 auto;
  display: none;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  padding: .9rem 1.6rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

body.comments-active .reader-comment-form {
  display: flex;
}

.reader-comment-form textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s;
}

.reader-comment-form textarea:focus {
  border-color: var(--ink);
}

.reader-comment-form textarea:disabled {
  background: var(--panel);
  color: var(--muted-soft);
  cursor: not-allowed;
}

.reader-comment-form button {
  flex: 0 0 auto;
  align-self: stretch;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  transition: opacity .15s;
}

.reader-comment-form button:disabled {
  opacity: .35;
  cursor: not-allowed;
}