/* ------------------------------------------------------------------ */
/* Design tokens                                                         */
/* ------------------------------------------------------------------ */
:root {
  color-scheme: dark;
  --bg:           #0d0d0d;
  --bg-card:      #1a1a1a;
  --text:         #efefef;
  --text-muted:   #999999;
  --text-faint:   #555555;
  --accent:       #60a5fa;
  --link:         rgba(255, 255, 255, 0.22);
  --link-spine:   rgba(255, 255, 255, 0.45);
  --card-border:  #2d2d2d;
  --card-shadow:  0 2px 16px rgba(0, 0, 0, 0.50);
  --card-divider: #2a2a2a;
  --chip-bg:      #222222;
  --meta-bg:      #202020;
  --icon-bg:      #2d2d2d;
  --node-border:  rgba(255, 255, 255, 0.12);
  --font:         -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ------------------------------------------------------------------ */
/* Reset + base                                                          */
/* ------------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

body.app-booting {
  cursor: progress;
}

body.cloud-loading {
  cursor: progress;
}

#boot-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 1;
  background: var(--bg);
  transition: opacity 200ms ease;
}

.boot-loading-content {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.boot-loading-title {
  color: var(--text);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: 0;
}

.title-bang {
  margin-left: 0.075em;
}

body.app-booting #boot-loading,
body.cloud-loading #boot-loading {
  pointer-events: auto;
}

.boot-loading-spinner {
  margin-top: 6px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--card-border) 72%, transparent);
  border-top-color: var(--accent);
  animation: boot-spin 0.85s linear infinite;
}

.boot-loading-message {
  min-height: 16px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

@keyframes boot-spin {
  to {
    transform: rotate(360deg);
  }
}

body:not(.app-booting) #boot-loading {
  opacity: 0;
}

body.cloud-loading:not(.app-booting) #boot-loading {
  opacity: 1;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

body.app-booting #canvas,
body.app-booting #cloud-background-canvas,
body.app-booting #cloud-background-boost-canvas,
body.app-booting #cloud-label-canvas,
body.app-booting #timeline-render-canvas {
  opacity: 0;
}

body.cloud-mode.cloud-loading #canvas,
body.cloud-mode.cloud-loading #cloud-background-canvas,
body.cloud-mode.cloud-loading #cloud-background-boost-canvas,
body.cloud-mode.cloud-loading #cloud-label-canvas {
  opacity: 0;
}

body.cloud-loading #canvas,
body.cloud-loading #cloud-background-canvas,
body.cloud-loading #cloud-background-boost-canvas,
body.cloud-loading #cloud-label-canvas {
  pointer-events: none;
}

body.app-booting #map-card,
body.app-booting #youtube-card,
body.app-booting #detail-card-slot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#map-card.map-card-loading {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 899px) {
  body.app-booting #map-card,
  #map-card.map-card-loading {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transition: opacity 200ms ease;
}

#cloud-background-canvas,
#cloud-background-boost-canvas,
#cloud-label-canvas,
#timeline-render-canvas {
  position: absolute;
  z-index: 0;
  display: none;
  pointer-events: none;
  transition: opacity 200ms ease;
}

#cloud-label-canvas,
#timeline-render-canvas {
  inset: 0;
  width: 100%;
  height: 100%;
}

#cloud-background-canvas,
#cloud-background-boost-canvas {
  left: 0;
  top: 0;
  opacity: var(--cloud-background-opacity, 0);
  transform-origin: 0 0;
  transition: none;
  will-change: transform, opacity;
}

body.cloud-mode #cloud-label-canvas {
  display: block;
}

body.cloud-mode #cloud-background-canvas,
body.cloud-mode #cloud-background-boost-canvas {
  display: block;
}

body.timeline-mode #timeline-render-canvas {
  display: block;
}

#canvas {
  z-index: 1;
}

svg text {
  -webkit-user-select: none;
  user-select: none;
}

body.is-panning-canvas,
body.is-panning-canvas * {
  -webkit-user-select: none;
  user-select: none;
}

#nav-controls,
#map-card,
#search-card,
#youtube-card,
#detail-card-slot,
#mobile-panel-tabs,
#timeline-panel {
  transition: opacity 180ms ease;
  will-change: opacity;
}

#canvas.panning {
  cursor: grabbing;
}

body.cloud-mode.cloud-click-enabled #canvas.cloud-node-hit {
  cursor: pointer;
}

body.timeline-mode #canvas.timeline-node-hit {
  cursor: pointer;
}

body.cloud-mode #canvas.panning.cloud-node-hit {
  cursor: grabbing;
}

#pan-target {
  pointer-events: all;
}

#timeline-year-rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 12px;
  z-index: 2;
  width: 72px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

body.timeline-mode #timeline-year-rail {
  opacity: 1;
}

.timeline-year-marker {
  position: absolute;
  left: 0;
  min-width: 52px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  transform: translateY(-50%);
  backdrop-filter: blur(6px);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.timeline-accessibility {
  position: fixed;
  left: 16px;
  bottom: 64px;
  z-index: 20;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.timeline-accessibility:focus-within {
  width: min(380px, calc(100vw - 32px));
  height: auto;
  max-height: min(520px, calc(100vh - 96px));
  padding: 14px;
  overflow: auto;
  clip: auto;
  clip-path: none;
  white-space: normal;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  box-shadow: 0 16px 46px rgb(0 0 0 / 32%);
  backdrop-filter: blur(14px);
}

.timeline-accessibility h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.timeline-accessibility p {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.timeline-accessible-list {
  display: grid;
  gap: 3px;
  min-height: 40px;
  padding: 4px;
  border-radius: 9px;
  outline: none;
}

.timeline-accessible-list:focus-visible {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 75%, transparent);
}

.timeline-accessible-option {
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.timeline-accessible-option[aria-selected="true"],
.timeline-accessible-option.active,
.timeline-accessible-option-active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.timeline-accessibility-status {
  min-height: 1.45em;
  margin-top: 8px !important;
  margin-bottom: 0 !important;
}

/* World group is panned/zoomed via SVG transform attribute. We animate
   the attribute manually in JS — CSS transitions on SVG transform attrs
   interact unreliably with the attribute value. */
#world {
  /* no transition — pan animations are driven from JS via rAF */
}

body.timeline-mode #edges-layer > .edge:not(.timeline-edge),
body.timeline-mode #nodes-layer > .node:not(.timeline-node) {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Edges                                                                 */
/* ------------------------------------------------------------------ */
.edge {
  stroke: var(--link);
  stroke-width: 1;
  fill: none;
  pointer-events: none;
  transition: opacity 350ms;
}

.edge.spine-edge {
  stroke: var(--link-spine);
  stroke-width: 1.5;
}

.edge.faded {
  opacity: 0.35;
}

.edge.pending {
  opacity: 0;
}

.edge.trimming {
  opacity: 0;
}

.edge.unresolved-edge {
  stroke-dasharray: 3 4;
}

.edge.trace-edge {
  stroke: var(--link-spine);
  stroke-width: 1.5;
  stroke-dasharray: none;
  opacity: 1;
}

.edge.trace-link {
  stroke-width: 1.5;
  opacity: 1;
}

.edge.trace-edge.pending,
.edge.trace-edge.trimming {
  opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Nodes                                                                 */
/* ------------------------------------------------------------------ */
.node {
  cursor: pointer;
  transition: opacity 350ms;
}

.node.faded {
  opacity: 0.225;
}

.node.faded:hover {
  opacity: 0.45;
}

.node.pending {
  opacity: 0;
  pointer-events: none;
}

.node.trimming {
  opacity: 0;
  pointer-events: none;
}

.node.node-current,
.node.node-spine,
.node.node-spine.faded,
.node.node-spine.pending,
.node.node-spine.trimming,
.node.node-current.faded,
.node.node-current.pending,
.node.node-current.trimming {
  opacity: 1;
  pointer-events: auto;
}

.node.revealed {
  opacity: 1;
}

.node-pill {
  fill: var(--bg);
  stroke: var(--node-border);
  stroke-width: 1;
  pointer-events: fill;
  transition: stroke 520ms linear, stroke-width 520ms linear;
}

.node-hit-area {
  cursor: pointer;
  fill: transparent;
  pointer-events: all;
  stroke: transparent;
  stroke-width: 0;
}

.node.node-current .node-pill,
.node.direct-parent .node-pill {
  stroke: var(--genre-color);
  stroke-width: 1.4;
}

.node.node-active-leaf .node-pill {
  fill: var(--genre-color, var(--accent));
  stroke: var(--genre-color, var(--accent));
  stroke-width: 1.3;
}

.node-label {
  font-family: var(--font);
  pointer-events: none;
  user-select: none;
  fill: var(--text);
  transition: none;
}

.node .node-label {
  font-size: 15px;
  font-weight: 500;
}

.node.direct-parent .node-label {
  transition: fill 520ms linear;
}

.node-label-preview {
  display: none;
  fill: var(--genre-color, var(--accent));
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  text-anchor: middle;
  transition: opacity 520ms linear;
  user-select: none;
  will-change: opacity;
}

.node-root .node-label-preview {
  font-size: 17px;
  font-weight: 600;
}

.node:not(.direct-parent):hover .node-label {
  fill: var(--accent);
  transition: none;
}

.node.has-color:not(.direct-parent):hover .node-label {
  fill: var(--genre-color);
  transition: none;
}

.node.node-active-leaf .node-label,
.node.node-active-leaf:hover .node-label,
.node.node-active-leaf.has-color:hover .node-label {
  fill: #050505;
}

.node-root .node-label {
  font-size: 17px;
  font-weight: 600;
}

/* Selected node — scale up the inner group smoothly instead of restyling
   the pill or swapping font size. */
.node-inner {
  transition: transform 320ms cubic-bezier(0.34, 1.3, 0.5, 1);
  transform-origin: 0 0;
}
.node-current .node-inner {
  transform: scale(1.5);
}
.node-current .node-label {
  font-weight: 700;
  letter-spacing: 0;
}

.node.unresolved .node-label {
  fill: var(--text-faint);
}

.node:focus-visible .node-pill {
  stroke: var(--accent);
  stroke-width: 2;
}

.node.node-detail-preview:not(.direct-parent) .node-pill {
  stroke: var(--genre-color, var(--accent));
  stroke-width: 1.55;
}

.node.direct-parent.node-detail-preview .node-label,
.node.direct-parent.node-detail-preview:hover .node-label,
.node.direct-parent.node-detail-preview.has-color:hover .node-label {
  fill: var(--genre-color, var(--accent));
}

/* Genre-coloured labels either persist on the active lineage or reveal on hover. */

/* ------------------------------------------------------------------ */
/* Regional map                                                         */
/* ------------------------------------------------------------------ */
#mobile-panel-tabs {
  display: none;
}

#map-card {
  position: absolute;
  bottom: 32px;
  right: 20px;
  z-index: 8;
  width: 200px;
  box-sizing: border-box;
  aspect-ratio: 320 / 174;
  background: var(--bg-card);
  border: 0;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 0;
  max-height: calc(100vh - 80px);
  overflow: hidden;
  transition:
    opacity 180ms ease,
    width 520ms cubic-bezier(0.2, 0.78, 0.18, 1),
    box-shadow 520ms ease;
  user-select: none;
  -webkit-user-select: none;
}

#map-card.map-expanded {
  width: min(600px, calc(100vw - 400px));
}

#map-card.map-list-mode {
  width: min(320px, calc(100vw - 400px));
  aspect-ratio: auto;
  height: min(var(--map-list-card-height, 460px), calc(100vh - 100px));
  border: 1px solid var(--card-border);
  border-radius: 8px;
}

#map-card.map-expanded.map-list-mode {
  width: min(320px, calc(100vw - 400px));
  height: min(var(--map-list-card-height, 460px), calc(100vh - 100px));
}

#map-toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

#map-world-button {
  position: absolute;
  bottom: 34px;
  left: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 2px 7px 3px;
  border: 1px solid color-mix(in srgb, var(--card-border) 50%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 72%, transparent);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.1;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

#map-card.map-list-mode #map-world-button {
  top: 8px;
  bottom: auto;
  max-width: calc(100% - 52px);
}

#map-world-button[hidden] {
  display: none;
}

#map-card:not(.map-expanded) #map-world-button {
  display: none;
}

#map-world-button:hover,
#map-world-button:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--meta-bg) 78%, transparent);
  outline: none;
}

#map-title {
  position: absolute;
  bottom: 8px;
  left: 10px;
  z-index: 1;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 3px 7px 4px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  text-overflow: ellipsis;
  transition: opacity 120ms ease;
  white-space: nowrap;
}

#map-parent-label {
  position: absolute;
  bottom: 32px;
  left: 10px;
  z-index: 1;
  max-width: calc(100% - 20px);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px 4px 4px;
  border: 1px solid color-mix(in srgb, var(--card-border) 55%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 68%, transparent);
  color: var(--text-muted);
  appearance: none;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  overflow: hidden;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

#map-parent-label:hover,
#map-parent-label:focus-visible {
  color: var(--text);
  background: color-mix(in srgb, var(--meta-bg) 78%, transparent);
  outline: none;
}

#map-parent-label[hidden],
#map-title[hidden] {
  display: none;
}

#map-parent-label .mode-symbol {
  width: 12px;
  font-size: 12px;
  font-variation-settings: "FILL" 0, "wght" 700, "GRAD" 0, "opsz" 20;
  line-height: 1;
  opacity: 0.82;
}

.map-title-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-title-meta {
  margin-left: 5px;
  color: var(--text-muted);
  font-weight: 650;
}

.map-title-meta[hidden] {
  display: none;
}

#map-card.map-list-mode #map-title {
  top: 8px;
  bottom: auto;
  max-width: calc(100% - 92px);
}

#map-card.map-list-mode.map-has-parent-label:not(.map-list-search-mode) #map-parent-label {
  top: 8px;
  bottom: auto;
  max-width: calc(100% - 92px);
}

#map-card.map-list-mode.map-has-parent-label:not(.map-list-search-mode) #map-title {
  top: 32px;
}

#map-card.map-has-parent-label:not(.map-list-mode) #map-parent-label {
  bottom: 10px;
}

#map-card.map-has-parent-label:not(.map-list-mode) #map-title {
  display: none;
}

#map-title.has-map-label {
  opacity: 1;
}

#map-list-search-input {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 3;
  width: calc(100% - 92px);
  height: 28px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  outline: none;
  backdrop-filter: blur(6px);
}

#map-list-search-input::placeholder {
  color: var(--text-muted);
}

#map-list-search-input:focus {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--card-border));
  background: color-mix(in srgb, var(--meta-bg) 82%, transparent);
}

#map-list-search-input[hidden] {
  display: none;
}

#map-list-search-button {
  position: absolute;
  top: 8px;
  right: 44px;
  z-index: 3;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

#map-list-search-button[hidden] {
  display: none;
}

#map-list-search-button:hover,
#map-list-search-button:focus-visible,
#map-list-search-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--meta-bg) 82%, transparent);
  outline: none;
}

#map-list-search-button .mode-symbol {
  font-size: 18px;
  line-height: 1;
}

#map-list-button,
#map-expand-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

#map-list-button[hidden],
#map-expand-button[hidden] {
  display: none;
}

#map-list-button:hover,
#map-list-button:focus-visible,
#map-list-button[aria-pressed="true"],
#map-expand-button:hover,
#map-expand-button:focus-visible {
  background: color-mix(in srgb, var(--meta-bg) 82%, transparent);
  outline: none;
}

#map-list-button[aria-pressed="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--card-border));
}

#map-list-button .mode-symbol {
  font-size: 18px;
  line-height: 1;
}

#map-card.map-list-mode #map-expand-button {
  display: none;
}

#map-expand-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#map-expand-button .icon-collapse,
#map-card.map-expanded #map-expand-button .icon-expand {
  display: none;
}

#map-card.map-expanded #map-expand-button .icon-collapse {
  display: block;
}

#map-reset-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
}

#map-reset-button[hidden] {
  display: none;
}

#map-reset-button:hover,
#map-reset-button:focus-visible {
  background: color-mix(in srgb, var(--meta-bg) 82%, transparent);
  outline: none;
}

#map-reset-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#region-map {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 1;
  transition: opacity 140ms ease;
}

#map-card.map-list-mode #region-map {
  display: none;
}

#map-card.map-switching #region-map {
  opacity: 0;
}

#map-card.map-expanded #region-map {
  cursor: grab;
  touch-action: none;
}

#map-card.map-expanded.map-hover-active #region-map {
  cursor: pointer;
}

#map-card.map-expanded #region-map:active {
  cursor: grabbing;
}

#map-card:not(.map-expanded) #region-map {
  cursor: pointer;
}

#map-card:not(.map-expanded) .map-country-hit-active {
  pointer-events: none;
}

#region-map * {
  outline: none;
}

#map-list {
  position: absolute;
  inset: 40px 8px 10px;
  overflow: auto;
}

#map-card.map-list-mode.map-has-parent-label:not(.map-list-search-mode) #map-list {
  inset: 64px 8px 10px;
}

#map-card:not(.map-list-mode) #map-list {
  display: none;
}

.map-list-virtual-space {
  position: relative;
  width: 100%;
}

.map-list-group-header {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
}

.map-list-item {
  position: absolute;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--card-border) 74%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.map-list-item:hover,
.map-list-item:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--meta-bg) 82%, transparent);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--card-border));
}

.map-list-item.is-selected {
  color: var(--accent);
  background: color-mix(in srgb, var(--meta-bg) 78%, transparent);
}

.map-list-item.has-parent {
  left: calc(var(--tree-depth) * 14px);
}

.map-list-item.has-parent::before {
  content: "";
  position: absolute;
  left: -10px;
  top: -5px;
  bottom: 50%;
  width: 1px;
  background: color-mix(in srgb, var(--card-border) 92%, transparent);
}

.map-list-item.has-parent::after {
  content: "";
  position: absolute;
  left: -10px;
  top: calc(50% - 0.5px);
  width: 10px;
  height: 1px;
  background: color-mix(in srgb, var(--card-border) 92%, transparent);
}

.map-list-icon-wrap {
  width: 38px;
  height: 26px;
  display: grid;
  place-items: center;
  line-height: 1;
}

.map-list-icon {
  width: 38px;
  height: 26px;
  display: block;
}

.map-list-flag {
  width: 34px;
  height: 23px;
  display: block;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--card-border) 78%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--chip-bg) 74%, transparent);
}

.map-list-flag-fallback {
  display: grid;
  place-items: center;
  width: 34px;
  height: 23px;
  font-size: 20px;
  line-height: 1;
}

.map-list-icon-path {
  stroke: color-mix(in srgb, var(--card-border) 88%, transparent);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.map-list-title {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-list-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin-top: auto;
  margin-bottom: auto;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.map-water {
  fill: color-mix(in srgb, var(--meta-bg) 88%, var(--accent));
}

.map-country {
  fill: var(--chip-bg);
  stroke: var(--card-border);
  stroke-width: 0.45;
  vector-effect: non-scaling-stroke;
  transition: fill 140ms, opacity 140ms, stroke 140ms;
}

.map-country-active {
  fill: #b8b8b8;
  stroke: #ffffff;
  stroke-width: 0.45;
}

.map-country-context {
  fill: color-mix(in srgb, var(--accent) 62%, var(--chip-bg));
  stroke: color-mix(in srgb, var(--accent) 78%, var(--text-faint));
  stroke-width: 0.85;
}

.map-country-hovered {
  fill: var(--accent);
}

.map-country-selected {
  fill: color-mix(in srgb, var(--accent) 62%, var(--chip-bg));
  stroke: color-mix(in srgb, var(--accent) 78%, var(--text-faint));
  stroke-width: 0.85;
  filter: none;
}

.map-country-highlight-border {
  fill: none;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-country-highlight-border-context {
  stroke: #ffffff;
}

.map-country-highlight-border-selected {
  stroke: #ffffff;
}

.map-superregion-border {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-point {
  display: none;
}

.map-country-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  outline: none;
  pointer-events: none;
}

.map-country-hit-active {
  cursor: pointer;
  outline: none;
  pointer-events: all;
}

.map-country-hit-active:focus,
.map-country-hit-active:focus-visible {
  outline: none;
}

/* ------------------------------------------------------------------ */
/* Detail card                                                           */
/* ------------------------------------------------------------------ */
#right-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 4;
  width: 356px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  pointer-events: none;
}

#search-card {
  position: relative;
  z-index: 4;
  width: 100%;
  pointer-events: auto;
}

#nav-controls {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
}

#nav-back-button,
#nav-forward-button,
.mode-toggle-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}

#nav-back-button:hover,
#nav-back-button:focus-visible,
#nav-forward-button:hover,
#nav-forward-button:focus-visible,
.mode-toggle-button:hover,
.mode-toggle-button:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
  background: var(--meta-bg);
}

#nav-back-button:disabled,
#nav-forward-button:disabled {
  cursor: default;
  opacity: 0.4;
}

#nav-back-button svg,
#nav-forward-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-toggle-button {
  width: auto;
  min-width: 0;
  gap: 6px;
  padding: 0 10px 0 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.mode-toggle-label {
  line-height: 1;
  white-space: nowrap;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

#genre-search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  outline: none;
}

#genre-search-input::placeholder {
  color: var(--text-faint);
}

#genre-search-input:focus {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
}

#random-genre-button,
#graph-toggle-button,
#cloud-toggle-button,
#timeline-toggle-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

#random-genre-button:hover,
#random-genre-button:focus-visible,
#graph-toggle-button:hover,
#graph-toggle-button:focus-visible,
#cloud-toggle-button:hover,
#cloud-toggle-button:focus-visible,
#timeline-toggle-button:hover,
#timeline-toggle-button:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
  background: var(--meta-bg);
}

#random-genre-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

#random-genre-button svg,
#graph-toggle-button svg,
#cloud-toggle-button svg,
#timeline-toggle-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#graph-toggle-button.mode-toggle-active,
#cloud-toggle-button.mode-toggle-active,
#timeline-toggle-button.mode-toggle-active,
#graph-toggle-button[aria-pressed="true"],
#cloud-toggle-button[aria-pressed="true"],
#timeline-toggle-button[aria-pressed="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 62%, var(--card-border));
  background: color-mix(in srgb, var(--meta-bg) 84%, var(--accent));
}

#graph-toggle-button .mode-symbol,
#cloud-toggle-button .mode-symbol,
#timeline-toggle-button .mode-symbol,
#detail-restore-button .mode-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-family: "Material Symbols Rounded";
  font-size: 22px;
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  color: currentColor;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  overflow: visible;
}

#nav-controls #graph-toggle-button,
#nav-controls #cloud-toggle-button,
#nav-controls #timeline-toggle-button {
  width: auto;
  min-width: 0;
}

.ui-tooltip {
  position: fixed;
  z-index: 40;
  max-width: min(240px, calc(100vw - 24px));
  padding: 6px 8px;
  border: 1px solid var(--card-border);
  border-radius: 7px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 90ms ease, transform 90ms ease;
  white-space: nowrap;
}

.ui-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.cloud-mode #edges-layer > .edge,
body.cloud-mode #nodes-layer > .node:not(.cloud-node) {
  display: none;
}

body.cloud-mode #nodes-layer > .cloud-node {
  display: none;
}

.cloud-node {
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, fill 120ms ease;
}

.cloud-node.cloud-node-visible {
  opacity: 1;
}

.cloud-node.cloud-node-exiting {
  pointer-events: none;
}

body.is-panning-canvas .cloud-node {
  pointer-events: none;
}

.cloud-node-label {
  fill: var(--genre-color, var(--text-muted));
  font-family: var(--font);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.cloud-node:focus-visible .cloud-node-label {
  fill: var(--genre-color, var(--text));
}

.cloud-node-selected .cloud-node-label,
.cloud-node-selected:hover .cloud-node-label,
.cloud-node-selected:focus-visible .cloud-node-label {
  fill: var(--genre-color, var(--text));
  font-weight: 800;
}

.cloud-node-underline {
  opacity: 0;
  stroke: var(--genre-color, var(--text));
  stroke-width: 1.15;
  stroke-linecap: round;
  transition: opacity 520ms linear;
  pointer-events: none;
}

.cloud-node-detail-preview .cloud-node-underline {
  opacity: 1;
  transition: opacity 520ms linear;
}

.cloud-node-selected .cloud-node-underline {
  opacity: 0;
}

.cloud-node-selected.cloud-node-detail-preview .cloud-node-underline {
  opacity: 1;
  stroke: #050505;
}

/* ------------------------------------------------------------------ */
/* Timeline map                                                          */
/* ------------------------------------------------------------------ */
#timeline-panel {
  position: absolute;
  top: 20px;
  right: 360px;
  bottom: 20px;
  left: 20px;
  z-index: 3;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
}

#timeline-panel[hidden] {
  display: none;
}

.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.timeline-kicker {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#timeline-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  line-height: 1.2;
}

.timeline-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

#timeline-confidence,
#timeline-close-button {
  height: 32px;
  border: 1px solid var(--card-border);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  outline: none;
}

#timeline-confidence {
  padding: 0 8px;
}

#timeline-close-button {
  padding: 0 10px;
  cursor: pointer;
}

#timeline-canvas {
  width: 100%;
  height: 100%;
  overflow: visible;
  border-radius: 6px;
  background: color-mix(in srgb, var(--meta-bg) 72%, transparent);
}

#timeline-status {
  min-height: 18px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.timeline-tick {
  stroke: color-mix(in srgb, var(--text) 10%, transparent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.timeline-tick-label {
  fill: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  text-anchor: end;
}

.timeline-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--text) 34%, transparent);
  stroke-width: 1.4;
  opacity: var(--timeline-edge-opacity, 1);
  pointer-events: none;
  transition: opacity 140ms ease;
  vector-effect: non-scaling-stroke;
}

.timeline-edge-hidden-detail {
  opacity: 0;
}

.timeline-edge-entering {
  opacity: 0;
}

.timeline-edge-exiting {
  opacity: 0;
  pointer-events: none;
}

.timeline-grid,
.timeline-edge-layer,
.timeline-node-layer {
  transition: opacity 170ms ease;
}

.timeline-layer-exiting {
  opacity: 0;
  pointer-events: none;
}

.timeline-edge-derivative,
.timeline-edge-derived_genres {
  stroke-dasharray: 5 4;
}

.timeline-edge-fusion_genre {
  stroke-dasharray: 2 4;
}

.timeline-node {
  cursor: pointer;
  outline: none;
  transition: opacity 140ms ease;
}

.timeline-node-hidden-detail {
  opacity: 0;
  pointer-events: none;
}

.timeline-node-entering {
  opacity: 0;
}

.timeline-node-exiting {
  opacity: 0;
  pointer-events: none;
}

.timeline-node-unfocused {
  opacity: 0.22;
}

.timeline-node-unfocused .timeline-node-pill {
  stroke: color-mix(in srgb, var(--node-border) 48%, transparent);
}

.timeline-node-focus .timeline-node-pill {
  stroke: color-mix(in srgb, var(--genre-color, var(--accent)) 72%, var(--node-border));
}

.timeline-node-pill {
  fill: var(--bg);
  stroke: var(--node-border);
  stroke-width: 1;
  transition: stroke 520ms linear, stroke-width 520ms linear;
}

.timeline-node-dated .timeline-node-label {
  fill: var(--genre-color, var(--accent));
}

.timeline-node-selected .timeline-node-label,
.timeline-node-selected:hover .timeline-node-label,
.timeline-node-selected.has-color:hover .timeline-node-label {
  fill: #050505;
}

.timeline-node-label {
  transition: opacity 140ms ease;
}

.timeline-no-transition,
.timeline-no-transition * {
  transition: none !important;
}

.timeline-node-label-hidden .timeline-node-label {
  opacity: 0;
}

.timeline-node-inferred {
  opacity: 0.72;
}

.timeline-node-inferred.timeline-node-hidden-detail {
  opacity: 0;
}

.timeline-node:hover .timeline-node-pill,
.timeline-node:focus-visible .timeline-node-pill {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.timeline-node.timeline-node-detail-preview .timeline-node-pill {
  stroke: var(--genre-color, var(--accent));
  stroke-width: 1.55;
}

.timeline-node-year {
  fill: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.timeline-node-selected .timeline-node-year {
  fill: rgba(5, 5, 5, 0.68);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 6;
  margin-top: 0;
  max-height: min(44vh, 360px);
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 4px;
  scrollbar-width: thin;
}

.search-result {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--meta-bg);
  outline: none;
}

.search-result-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.search-result-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 550;
  line-height: 1.25;
}

.search-empty {
  padding: 10px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
}

#youtube-card {
  position: relative;
  z-index: 3;
  width: 100%;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 7px;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 90ms ease;
}

body.detail-card-visible #youtube-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#youtube-card.youtube-card-hidden {
  display: none;
}

#youtube-close-button {
  display: none;
}

.youtube-embed-wrap {
  position: relative;
  min-width: 0;
  width: 156px;
  height: 88px;
  overflow: hidden;
  border-radius: 6px;
  background: #000;
  --youtube-frame-scale: 0.4875;
}

#youtube-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 180px;
  display: block;
  border: 0;
  transform: scale(var(--youtube-frame-scale));
  transform-origin: top left;
}

#youtube-card.youtube-no-playlist-state {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}

#youtube-card.youtube-no-playlist-state .youtube-embed-wrap,
#youtube-card.youtube-no-playlist-state .youtube-controls {
  display: none;
}

#youtube-card.youtube-no-playlist-state .youtube-card-meta {
  height: auto;
}

#youtube-card.youtube-no-playlist-state .youtube-title-block {
  gap: 4px;
}

#youtube-card.youtube-no-playlist-state #youtube-genre-title {
  display: none;
}

.youtube-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  border-radius: inherit;
  background: transparent;
  isolation: isolate;
  contain: paint;
  transform: translateZ(0);
}

.youtube-empty::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  border-radius: inherit;
  background: #252525;
  transform: translateZ(0);
}

#youtube-card.youtube-empty-state #youtube-frame {
  visibility: hidden;
}

#youtube-card.youtube-empty-state .youtube-empty {
  display: flex;
}

#youtube-card.youtube-dev-diagnostics-state.youtube-empty-state .youtube-empty {
  inset: auto 6px 6px auto;
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  pointer-events: none;
}

#youtube-card.youtube-dev-diagnostics-state.youtube-empty-state .youtube-empty::before {
  inset: 0;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

#youtube-card.youtube-dev-diagnostics-state.youtube-empty-state .youtube-spinner {
  width: 16px;
  height: 16px;
}

.youtube-spinner {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  overflow: visible;
}

.youtube-spinner-track,
.youtube-spinner-arc {
  fill: none;
  stroke-width: 2.5;
}

.youtube-spinner-track {
  stroke: rgba(255, 255, 255, 0.12);
}

.youtube-spinner-arc {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-dasharray: 34 72;
  stroke-linecap: round;
}

.youtube-card-meta {
  min-width: 0;
  height: 88px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 4px;
  overflow: hidden;
}

.youtube-title-block {
  min-width: 0;
  min-height: 0;
  align-self: start;
  display: grid;
  gap: 1px;
  overflow: hidden;
}

.youtube-title-block > * {
  min-width: 0;
  max-width: 100%;
}

#youtube-genre-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

#youtube-genre-title:hover,
#youtube-genre-title:focus-visible {
  color: var(--text);
  outline: none;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

#youtube-song-title {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.14;
  letter-spacing: 0;
}

#youtube-song-title.youtube-loading-title {
  max-width: 100%;
  display: block;
  color: transparent;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--text-muted) 52%, transparent) 0%,
      color-mix(in srgb, var(--text-muted) 52%, transparent) 34%,
      rgba(255, 255, 255, 0.72) 50%,
      color-mix(in srgb, var(--text-muted) 52%, transparent) 66%,
      color-mix(in srgb, var(--text-muted) 52%, transparent) 100%
    );
  background-clip: text;
  background-size: 220% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: youtube-text-shimmer 2200ms ease-in-out infinite;
  white-space: nowrap;
}

#youtube-song-title.youtube-dev-loading-title {
  display: block;
  color: var(--text);
  white-space: nowrap;
  text-overflow: ellipsis;
}

#youtube-song-title.youtube-openable-title {
  cursor: pointer;
  text-decoration: none;
  text-underline-offset: 2px;
}

#youtube-song-title.youtube-openable-title:hover,
#youtube-song-title.youtube-openable-title:focus-visible {
  outline: none;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

@keyframes youtube-text-shimmer {
  from {
    background-position: 140% 0;
  }
  to {
    background-position: -140% 0;
  }
}

#youtube-artist-title {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.youtube-empty-message {
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  opacity: 0.82;
}

.youtube-empty-genre-name {
  font-style: italic;
}

.youtube-submit-button {
  width: fit-content;
  max-width: 100%;
  margin: 2px 0 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.youtube-submit-button:hover,
.youtube-submit-button:focus-visible {
  text-decoration: underline;
  outline: none;
}

.youtube-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  min-height: 24px;
}

.youtube-volume-control {
  position: relative;
  width: 27px;
  height: 24px;
}

.youtube-controls button,
#youtube-volume-button {
  width: 27px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease, opacity 120ms ease;
}

.youtube-volume-control:hover #youtube-volume-button,
.youtube-volume-control:focus-within #youtube-volume-button,
.youtube-volume-control.volume-panel-open #youtube-volume-button {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.youtube-controls button:hover,
.youtube-controls button:focus-visible,
.youtube-volume-control:hover #youtube-volume-button,
.youtube-volume-control:focus-within #youtube-volume-button {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
  background: var(--meta-bg);
}

.youtube-controls button:disabled,
#youtube-volume-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.youtube-volume-panel {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: 84px;
  height: 30px;
  display: grid;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.youtube-volume-panel.volume-panel-open {
  opacity: 1;
  pointer-events: auto;
}

.youtube-volume-panel input {
  width: 100%;
  height: 14px;
  display: block;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.youtube-volume-panel input::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 58%, var(--card-border));
}

.youtube-volume-panel input::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, #fff);
  border-radius: 50%;
  background: var(--text);
}

.youtube-volume-panel input::-moz-range-track {
  height: 3px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 58%, var(--card-border));
}

.youtube-volume-panel input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, #fff);
  border-radius: 50%;
  background: var(--text);
}

.youtube-volume-panel input:disabled {
  opacity: 0.42;
}

#youtube-pause-button.is-paused:not(:disabled),
#youtube-pause-button.autoplay-blocked:not(:disabled) {
  color: #050505;
  border-color: var(--accent);
  background: var(--accent);
  opacity: 1;
}

#youtube-pause-button.is-paused:not(:disabled):hover,
#youtube-pause-button.is-paused:not(:disabled):focus-visible,
#youtube-pause-button.autoplay-blocked:not(:disabled):hover,
#youtube-pause-button.autoplay-blocked:not(:disabled):focus-visible {
  color: #050505;
  border-color: color-mix(in srgb, var(--accent) 82%, #050505);
  background: color-mix(in srgb, var(--accent) 90%, #fff);
}

#youtube-pin-indicator {
  margin-left: auto;
  width: 20px;
  color: var(--accent);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#youtube-pin-indicator[hidden] {
  display: none;
}

#youtube-pin-indicator:not([hidden]) + .youtube-menu-control {
  margin-left: 0;
}

.youtube-control-symbol,
.youtube-menu-symbol {
  display: grid;
  place-items: center;
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  color: currentColor;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  overflow: visible;
}

.youtube-control-symbol {
  width: 15px;
  height: 15px;
  font-size: 15px;
}

.youtube-menu-symbol {
  width: 17px;
  height: 17px;
  font-size: 17px;
}

.youtube-menu-control {
  margin-left: auto;
}

#youtube-menu-button.menu-open {
  color: var(--text);
  border-color: transparent;
  background: transparent;
}

#youtube-menu-button circle {
  fill: currentColor;
  stroke: none;
}

#youtube-menu-button,
#youtube-menu-button:hover,
#youtube-menu-button:focus-visible {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.youtube-context-menu {
  position: fixed;
  z-index: 30;
  min-width: 184px;
  display: grid;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.youtube-context-menu[hidden] {
  display: none;
}

.youtube-context-menu button {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
}

.youtube-context-menu button + button {
  border-top: 1px solid var(--card-divider);
}

.youtube-context-menu button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.youtube-context-menu button:hover,
.youtube-context-menu button:focus-visible {
  background: var(--meta-bg);
  outline: none;
}

.youtube-context-menu button:disabled {
  color: var(--text-faint);
  opacity: 0.55;
  cursor: default;
}

.youtube-controls svg,
#youtube-volume-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#youtube-pause-button .icon-pause,
#youtube-pause-button.is-playing .icon-play {
  display: none;
}

#youtube-pause-button.is-playing .icon-pause {
  display: block;
}

#youtube-pause-button .icon-play {
  display: block;
  fill: currentColor;
  stroke: none;
}

#detail-card-slot {
  position: relative;
  z-index: 2;
  width: 100%;
  flex: 0 1 auto;
  min-height: 0;
  display: grid;
  pointer-events: none;
}

/* Docked in the right panel for the selected node (T944); hidden only while there's no card to show. */
body:not(.detail-card-visible) #detail-card-slot:not(.detail-card-floating) {
  display: none !important;
}

#detail-card-slot.detail-card-floating {
  position: fixed !important;
  top: var(--detail-card-floating-y, 50vh) !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--detail-card-floating-x, 50vw) !important;
  z-index: 80 !important;
  width: min(360px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px);
  height: var(--detail-card-floating-height, auto) !important;
  max-height: none !important;
  display: grid !important;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  opacity: var(--detail-card-floating-opacity, 0) !important;
  pointer-events: none;
  --detail-card-floating-solid-opacity: 0;
  --detail-card-floating-offset-y: 0px;
  transform: translate3d(0, var(--detail-card-floating-offset-y, 0px), 0);
  transform-origin: top center;
  transition:
    opacity 200ms linear,
    height 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    transform 600ms cubic-bezier(0.22, 0.68, 0.18, 1);
}

#detail-card-slot.detail-card-floating.detail-card-floating-above {
  top: auto !important;
  bottom: var(--detail-card-floating-bottom, auto) !important;
  transform-origin: bottom center;
}

#detail-card-slot.detail-card-floating.detail-card-floating-no-size-transition {
  transition: opacity 200ms linear !important;
}

#detail-card-slot.detail-card-floating.detail-card-floating-no-size-transition #detail-card,
#detail-card-slot.detail-card-floating.detail-card-floating-no-size-transition #card-summary,
#detail-card-slot.detail-card-floating.detail-card-floating-no-size-transition .card-link-row {
  transition: none !important;
}

#detail-card-slot.detail-card-floating::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border: 1px solid rgba(62, 62, 62, 0.62);
  border-radius: inherit;
  background-color: rgba(52, 52, 52, 0.42);
  opacity: 0.12;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

#detail-card-slot.detail-card-floating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border: 0;
  border-radius: inherit;
  background-color: rgb(26, 26, 26);
  opacity: var(--detail-card-floating-solid-opacity);
  transition: opacity 600ms cubic-bezier(0.22, 0.68, 0.18, 1);
}

.detail-card-backdrop-snapshot {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}

.detail-card-backdrop-scene {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  background: var(--bg);
  filter: blur(10px) saturate(1.2);
  opacity: 1;
  transform-origin: 0 0;
}

.detail-card-backdrop-layer {
  position: absolute;
  pointer-events: none;
}

#detail-card-slot.detail-card-floating.detail-card-floating-visible {
  opacity: var(--detail-card-floating-opacity, 1) !important;
}

#detail-card-slot.detail-card-floating.detail-card-floating-opaque-reveal {
  --detail-card-floating-solid-opacity: 1;
}

#detail-card-slot.detail-card-floating.detail-card-floating-exiting {
  opacity: var(--detail-card-floating-opacity, 0) !important;
}

#detail-card-slot.detail-card-floating #detail-card {
  max-height: none;
  position: relative;
  z-index: 2;
  overflow: visible;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  visibility: visible;
  transition:
    opacity 200ms linear,
    transform 600ms cubic-bezier(0.22, 0.68, 0.18, 1);
  animation: none;
}

#detail-card-slot.detail-card-floating #detail-card::before {
  content: none;
}

#detail-card-slot.detail-card-floating.detail-card-floating-young,
#detail-card-slot.detail-card-floating.detail-card-floating-young #detail-card {
  pointer-events: none !important;
}

#detail-card-slot.detail-card-floating.detail-card-floating-young {
  --detail-card-floating-solid-opacity: 0;
}

#detail-card-slot.detail-card-floating.detail-card-floating-young.detail-card-floating-opaque-reveal {
  --detail-card-floating-solid-opacity: 1;
}

#detail-card-slot.detail-card-floating.detail-card-floating-young #detail-card::before {
  content: none;
}

#detail-card-slot.detail-card-floating #card-summary {
  max-height: calc(13px * 1.62 * 8 + 13px);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    transform 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    max-height 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    padding-top 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    border-color 600ms cubic-bezier(0.22, 0.68, 0.18, 1);
}

#detail-card-slot.detail-card-floating .card-link-row {
  max-height: 36px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  visibility: visible;
  transition:
    opacity 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    transform 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    max-height 600ms cubic-bezier(0.22, 0.68, 0.18, 1),
    margin-top 600ms cubic-bezier(0.22, 0.68, 0.18, 1);
}

#detail-card-slot.detail-card-floating.detail-card-floating-young .card-link-row {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
}

#detail-card-slot.detail-card-floating #detail-card.card-relation-empty .card-title-row {
  margin-top: 0;
  padding-top: 6px;
}

#detail-card-slot.detail-card-floating .card-relation,
#detail-card-slot.detail-card-floating .synonym-list,
#detail-card-slot.detail-card-floating .metadata-row,
#detail-card-slot.detail-card-floating #card-summary {
  flex: 0 0 auto;
}

#detail-card-slot.detail-card-floating #card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

#detail-card-slot.detail-card-floating .metadata-row {
  overflow: hidden;
}

#detail-card-slot.detail-card-floating .metadata-origin span:last-child,
#detail-card-slot.detail-card-floating .metadata-instrument span:last-child {
  -webkit-line-clamp: 1;
}

#detail-card-slot.detail-card-floating #card-summary {
  -webkit-line-clamp: 8;
}

#detail-card-slot.detail-card-floating.detail-card-floating-young #card-summary {
  max-height: calc(13px * 1.62 * 3 + 15px);
  -webkit-line-clamp: 3;
  opacity: 0.84;
}

#detail-card-slot.detail-card-floating #detail-card a,
#detail-card-slot.detail-card-floating #detail-card button,
#detail-card-slot.detail-card-floating #detail-card input,
#detail-card-slot.detail-card-floating #detail-card textarea,
#detail-card-slot.detail-card-floating #detail-card select {
  pointer-events: auto;
}

#detail-card-slot.detail-card-floating #card-target-button,
#detail-card-slot.detail-card-floating #card-close-button,
#detail-card-slot.detail-card-floating #detail-restore-button {
  display: none !important;
}

#detail-card {
  position: relative;
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  --alias-empty-gap-reclaim: 6px;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  scrollbar-width: thin;
  transform: translateY(4px);
  visibility: hidden;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0s linear 140ms;
}

.detail-card-transition-clone {
  position: absolute;
  grid-area: 1 / 1;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  --alias-empty-gap-reclaim: 6px;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
  scrollbar-width: thin;
  transform: translateX(0);
  visibility: visible;
  animation: detail-card-exit-left 145ms cubic-bezier(0.2, 0.72, 0.18, 1) both;
  will-change: opacity, transform;
  contain: paint;
}

body.detail-card-visible #detail-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0s linear 0s;
}

#detail-card.detail-card-entering,
body.detail-card-visible #detail-card.detail-card-entering {
  z-index: 2;
  animation: detail-card-enter-left 160ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
  will-change: opacity, transform;
  contain: paint;
}

body.detail-card-visible.detail-card-moving #detail-card {
  pointer-events: none;
  transform: translateY(0);
  visibility: visible;
}

body:not(.detail-card-visible) #detail-card {
  opacity: 0;
  pointer-events: none;
  transform: translateY(0);
  visibility: hidden;
}

#detail-card > * {
  transition: opacity 72ms ease;
}

@keyframes detail-card-exit-left {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(0);
  }
}

@keyframes detail-card-enter-left {
  from {
    opacity: 0;
    transform: translateX(0);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#detail-restore-button {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: var(--card-shadow);
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  visibility: hidden;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0s linear 140ms,
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

body.detail-restore-available:not(.detail-card-visible):not(.map-list-mode-active) #detail-restore-button,
body.detail-restore-available.map-list-mode-active.map-list-detail-hidden #detail-restore-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  visibility: visible;
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    visibility 0s linear 0s,
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

#detail-restore-button:hover,
#detail-restore-button:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
  background: var(--meta-bg);
}

.card-relation {
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  min-height: calc(12px * 1.35);
  color: var(--text-faint);
  letter-spacing: 0;
  opacity: 0.82;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-top: -5px;
}

#card-title,
.detail-card-snapshot-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: 0;
}

#detail-card.card-aliases-empty .card-title-row {
  margin-bottom: calc(-1 * var(--alias-empty-gap-reclaim));
}

.detail-card-transition-clone.card-aliases-empty .card-title-row {
  margin-bottom: calc(-1 * var(--alias-empty-gap-reclaim));
}

#card-target-button,
#card-close-button,
.detail-card-snapshot-target-button,
.detail-card-snapshot-close-button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

#card-target-button,
.detail-card-snapshot-target-button {
  justify-self: end;
  transform: translateY(1px);
}

#card-close-button,
.detail-card-snapshot-close-button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  display: grid;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text-faint);
}

#card-target-button.card-target-button-inactive,
.detail-card-snapshot-target-button.card-target-button-inactive {
  visibility: hidden;
  pointer-events: none;
}

#card-target-button:hover,
#card-target-button:focus-visible,
#card-close-button:hover,
#card-close-button:focus-visible {
  background: transparent;
  color: var(--accent);
  outline: none;
}

#card-target-button svg,
#card-close-button svg,
.detail-card-snapshot-target-button svg,
.detail-card-snapshot-close-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.synonym-list {
  display: block;
  max-width: 100%;
  margin-top: -3px;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
}

.synonym-list:empty,
.synonym-list[hidden] {
  display: none;
}

.metadata-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.metadata-chip {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  overflow: hidden;
  max-width: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  min-width: 0;
}

.metadata-chip span:last-child {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metadata-origin,
.metadata-instrument {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
}

.metadata-origin span:last-child,
.metadata-instrument span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.metadata-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 15px;
  color: var(--accent);
  font-size: 15px;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 20;
  line-height: 1;
  text-align: center;
  transform: translateY(-1px);
}

#card-summary,
.detail-card-snapshot-summary {
  font-size: 13px;
  color: var(--text);
  line-height: 1.62;
  padding-top: 12px;
  border-top: 1px solid var(--card-divider);
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.feedback-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.feedback-link:hover,
.feedback-link:focus-visible {
  color: var(--accent);
  outline: none;
  text-decoration: underline;
}

.wiki-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
}
.wiki-link:hover { text-decoration: underline; }

.modal-shell[hidden] {
  display: none;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
}

.feedback-modal-card,
.app-error-card {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 40px));
  display: grid;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.36);
}

.feedback-modal-card {
  height: min(760px, calc(100vh - 40px));
  grid-template-rows: auto minmax(0, 1fr);
}

.app-error-card {
  max-height: min(460px, calc(100vh - 40px));
  grid-template-rows: auto minmax(0, 1fr);
}

.feedback-modal-header,
.app-error-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--card-divider);
}

#feedback-modal-title,
#app-error-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#feedback-close-button,
#app-error-close-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}

#feedback-close-button:hover,
#feedback-close-button:focus-visible,
#app-error-close-button:hover,
#app-error-close-button:focus-visible {
  background: var(--meta-bg);
  color: var(--text);
  outline: none;
}

#feedback-close-button svg,
#app-error-close-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.app-error-body {
  min-width: 0;
  overflow: auto;
  padding: 14px;
  color: var(--text-muted);
}

#app-error-message {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

#app-error-detail {
  max-height: 180px;
  margin: 12px 0 0;
  overflow: auto;
  color: var(--text-faint);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

#app-error-detail:empty {
  display: none;
}

.app-error-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

#app-error-retry-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--card-border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-card));
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

#app-error-retry-button:hover,
#app-error-retry-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--card-border));
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-card));
  outline: none;
}

.feedback-form {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
}

.feedback-context {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--card-divider);
  border-radius: 6px;
  background: var(--meta-bg);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.feedback-context strong {
  color: var(--text);
}

.feedback-form label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

#feedback-notes {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 10px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}

#feedback-notes:focus {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--card-border));
}

.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#feedback-status {
  min-width: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

#feedback-submit-button {
  height: 32px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 64%, var(--card-border));
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

#feedback-submit-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

/* ------------------------------------------------------------------ */
/* Footer                                                                */
/* ------------------------------------------------------------------ */
#footer {
  position: absolute;
  bottom: 7px;
  right: 30px;
  left: 24px;
  z-index: 6;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: end;
  gap: 16px;
  font-size: 12px;
  color: var(--text-faint);
  text-shadow:
    0 0 3px var(--bg),
    0 0 7px var(--bg);
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 120ms ease, visibility 0s linear 0s;
}

.footer-controls {
  grid-column: 2;
  justify-self: center;
  align-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.footer-brand,
.footer-attributions {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text-faint);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
  pointer-events: auto;
}

.footer-brand {
  grid-column: 1;
  justify-self: start;
}

.footer-attributions {
  grid-column: 3;
  justify-self: end;
}

.footer-credit-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.footer-credit-link:hover,
.footer-credit-link:focus-visible {
  color: var(--text-muted);
  outline: none;
}

.footer-credit-icon {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  font-size: 13px;
  line-height: 1;
}

.footer-credit-dot {
  color: color-mix(in srgb, var(--text-faint) 70%, transparent);
}

#footer-depth,
#footer-zoom-value,
#footer-zoom,
#footer-reset {
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

#footer-depth,
#footer-hint {
  display: none;
}

#footer-zoom-value,
.footer-reset-label {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

#footer-zoom {
  position: relative;
  display: block;
  flex: 0 0 76px;
  width: 76px;
  min-width: 76px;
  height: 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-border) 84%, transparent);
  border-radius: 5px;
  clip-path: inset(0 round 5px);
  background: color-mix(in srgb, var(--bg-card) 72%, transparent);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.42);
  cursor: ew-resize;
  outline: none;
  pointer-events: auto;
  touch-action: none;
  transition:
    width 150ms cubic-bezier(0.2, 0.78, 0.18, 1),
    min-width 150ms cubic-bezier(0.2, 0.78, 0.18, 1),
    flex-basis 150ms cubic-bezier(0.2, 0.78, 0.18, 1),
    height 150ms cubic-bezier(0.2, 0.78, 0.18, 1),
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease;
}

#footer-zoom:hover,
#footer-zoom:focus-visible,
#footer-zoom.zoom-progress-active {
  flex-basis: 128px;
  width: 128px;
  min-width: 128px;
  height: 20px;
  border-color: color-mix(in srgb, var(--card-border) 84%, transparent);
  background: color-mix(in srgb, var(--bg-card) 86%, transparent);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.46),
    0 2px 12px rgba(0, 0, 0, 0.22);
}

.zoom-progress-fill {
  position: absolute;
  inset: 1px;
  border-radius: 4px;
  background: color-mix(in srgb, #fff 31%, var(--text-muted));
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.10);
  pointer-events: none;
  transform: scaleX(var(--zoom-progress, 0));
  transform-origin: left center;
  transition: none;
}

#footer-zoom.zoom-progress-active .zoom-progress-fill {
  transition: none;
}

#footer-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  color: var(--text-faint);
  line-height: inherit;
  cursor: pointer;
  outline: none;
  pointer-events: auto;
  user-select: none;
  transition: color 120ms ease, opacity 120ms ease, transform 120ms ease;
}

#footer-reset:hover,
#footer-reset:focus-visible {
  color: var(--text);
  transform: scale(1.05);
}

.footer-reset-icon {
  display: block;
  font-size: 15px;
  line-height: 1;
}

body.is-loading #footer,
body.app-booting #footer,
body.cloud-loading #footer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 80ms ease, visibility 0s linear 0s;
}

body.is-loading #footer-zoom,
body.is-loading #footer-reset,
body.app-booting #footer-zoom,
body.app-booting #footer-reset,
body.cloud-loading #footer-zoom,
body.cloud-loading #footer-reset {
  pointer-events: none;
}

.hidden { display: none !important; }

@media (max-width: 899px) {
  :root {
    --mobile-edge: 12px;
    --mobile-map-collapsed-width: min(140px, 36vw);
    --mobile-bottom-row-height: 44px;
    --mobile-bottom-row-bottom: 28px;
    --mobile-bottom-panel-gap: 10px;
    --mobile-selector-width: 136px;
    --mobile-card-gap: 10px;
    --mobile-bottom-panel-bottom: calc(var(--mobile-bottom-row-bottom) + var(--mobile-bottom-row-height) + var(--mobile-bottom-panel-gap));
  }

  #right-panel {
    display: contents;
  }

  #map-card {
    position: absolute;
    top: var(--mobile-edge);
    right: var(--mobile-edge);
    bottom: auto;
    left: auto;
    z-index: 8;
    width: var(--mobile-map-collapsed-width);
    height: auto;
    max-height: none;
    aspect-ratio: 320 / 174;
    padding: 0;
    overflow: hidden;
    transition: none;
  }

  #map-card.map-list-mode {
    top: var(--mobile-edge);
    right: var(--mobile-edge);
    bottom: auto;
    left: auto;
    width: min(320px, calc(100vw - (var(--mobile-edge) * 2)));
    height: min(var(--map-list-card-height, 260px), calc(100vh - (var(--mobile-edge) * 2)));
    max-height: calc(100vh - (var(--mobile-edge) * 2));
    aspect-ratio: auto;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--meta-bg) 88%, var(--accent));
    box-shadow: var(--card-shadow);
  }

  body.map-expanded-active::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 7;
    background: rgba(0, 0, 0, 0.62);
    pointer-events: auto;
  }

  #map-card.map-expanded,
  #map-card.map-expanded.map-list-mode {
    position: fixed;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    z-index: 26;
    width: min(
      calc(100vw - (var(--mobile-edge) * 2)),
      calc((100vh - (var(--mobile-edge) * 2)) * 320 / 174)
    );
    height: auto;
    aspect-ratio: 320 / 174;
    background: color-mix(in srgb, var(--meta-bg) 88%, var(--accent));
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
    transform: translate(-50%, -50%);
    transition:
      opacity 180ms ease,
      box-shadow 180ms ease;
  }

  #map-toolbar {
    top: 8px;
    right: 8px;
  }

  #map-list-button,
  #map-expand-button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  #map-card.map-list-mode #map-title,
  #map-card.map-list-mode.map-has-parent-label:not(.map-list-search-mode) #map-parent-label {
    max-width: calc(100% - 112px);
  }

  #map-list-search-input {
    width: calc(100% - 112px);
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
  }

  #map-list-search-button {
    right: 52px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  #map-list-search-button .mode-symbol {
    width: 22px;
    height: 22px;
    font-size: 22px;
    line-height: 22px;
  }

  #map-card.map-expanded #map-toolbar {
    top: 12px;
    right: 12px;
  }

  #map-card.map-expanded #map-list-search-input {
    top: 12px;
    left: 12px;
    width: calc(100% - 124px);
  }

  #map-card.map-expanded #map-list-search-button {
    top: 12px;
    right: 56px;
  }

  #nav-controls {
    top: var(--mobile-edge);
    left: var(--mobile-edge);
    right: calc(var(--mobile-map-collapsed-width) + var(--mobile-edge) + 8px);
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 7px;
  }

  #nav-back-button,
  #nav-forward-button,
  #nav-controls #graph-toggle-button,
  #nav-controls #cloud-toggle-button,
  #nav-controls #timeline-toggle-button {
    height: 40px;
    border-radius: 9px;
  }

  #nav-back-button,
  #nav-forward-button {
    width: 40px;
  }

  #nav-controls #graph-toggle-button,
  #nav-controls #cloud-toggle-button,
  #nav-controls #timeline-toggle-button {
    padding: 0 11px 0 9px;
    font-size: 12px;
  }

  #detail-card-slot {
    position: absolute;
    top: auto !important;
    bottom: var(--mobile-bottom-panel-bottom) !important;
    z-index: 2;
    width: auto;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #detail-card {
    height: auto !important;
    max-height: none !important;
    --alias-empty-gap-reclaim: 4px;
    justify-content: flex-start;
    overflow: visible !important;
  }

  #youtube-card {
    position: absolute;
    top: auto !important;
    bottom: var(--mobile-bottom-panel-bottom) !important;
    width: auto;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #search-card {
    position: absolute;
    top: auto;
    bottom: var(--mobile-bottom-row-bottom);
    left: var(--mobile-edge);
    width: auto;
    z-index: 5;
  }

  #detail-restore-button {
    position: fixed;
    top: auto;
    right: var(--mobile-edge);
    bottom: var(--mobile-bottom-row-bottom);
    z-index: 6;
    width: var(--mobile-bottom-row-height);
    height: var(--mobile-bottom-row-height);
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    visibility: hidden;
  }

  #detail-restore-button .mode-symbol {
    width: 25px;
    height: 25px;
    font-size: 24px;
  }

  body.detail-restore-available:not(.mobile-cards-hidden) #detail-restore-button {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(10px);
    visibility: hidden !important;
  }

  body:not(.detail-card-visible) #search-card,
  body.mobile-cards-hidden #search-card {
    right: var(--mobile-edge);
  }

  body.mobile-cards-hidden #mobile-panel-tabs {
    display: none;
  }

  body.mobile-cards-hidden #youtube-card,
  body.mobile-cards-hidden #detail-card {
    display: none;
  }

  body.mobile-cards-hidden #detail-card-slot {
    display: grid;
  }

  body.mobile-cards-hidden.detail-restore-available #detail-restore-button {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(10px);
    visibility: hidden !important;
  }

  #card-close-button,
  .detail-card-snapshot-close-button {
    top: 8px;
    right: 8px;
    z-index: 3;
    width: 34px;
    height: 34px;
  }

  #card-target-button,
  .detail-card-snapshot-target-button {
    position: absolute;
    top: 8px;
    right: 46px;
    z-index: 3;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--text-faint);
    transform: none;
  }

  #card-target-button.card-target-button-inactive,
  .detail-card-snapshot-target-button.card-target-button-inactive {
    visibility: hidden;
    pointer-events: none;
  }

  #card-target-button svg,
  #card-close-button svg,
  .detail-card-snapshot-target-button svg,
  .detail-card-snapshot-close-button svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.9;
  }

  #genre-search-input {
    height: var(--mobile-bottom-row-height);
    padding: 0 14px;
    font-size: 13px;
    border-radius: 8px;
  }

  .search-row {
    grid-template-columns: minmax(0, 1fr) var(--mobile-bottom-row-height);
    gap: 8px;
  }

  #random-genre-button {
    width: var(--mobile-bottom-row-height);
    height: var(--mobile-bottom-row-height);
    border-radius: 8px;
  }

  #timeline-panel {
    top: 12px;
    right: 12px;
    bottom: var(--mobile-bottom-panel-bottom);
    left: 12px;
    padding: 12px;
  }

  .timeline-header {
    align-items: flex-start;
  }

  #timeline-title {
    font-size: 15px;
  }

  .search-results {
    top: auto;
    bottom: calc(100% + 6px);
    max-height: min(34vh, 260px);
  }

  #card-title,
  .detail-card-snapshot-title {
    font-size: 17px;
  }

  #youtube-song-title {
    font-size: 13px;
  }

  #card-summary,
  .detail-card-snapshot-summary {
    font-size: 12px;
    line-height: 1.5;
    -webkit-line-clamp: 4;
  }

  #youtube-card.youtube-no-playlist-state {
    height: auto;
    min-height: 0;
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    align-content: start;
    padding: 10px 46px 10px 12px;
  }

  #youtube-card.youtube-no-playlist-state .youtube-card-meta {
    height: auto;
    min-height: 0;
    grid-template-rows: auto;
    gap: 0;
    overflow: visible;
  }

  #youtube-card.youtube-no-playlist-state .youtube-title-block {
    gap: 5px;
    overflow: visible;
  }

  #youtube-card.youtube-no-playlist-state .youtube-empty-message {
    display: block;
    overflow: visible;
    -webkit-line-clamp: initial;
    -webkit-box-orient: initial;
  }

  .synonym-list {
    font-size: 11px;
    line-height: 1.35;
    max-height: 30px;
  }

  .metadata-row {
    width: 100%;
    min-width: 0;
    max-height: 42px;
    overflow: hidden;
  }

  .metadata-chip {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .metadata-origin span:last-child,
  .metadata-instrument span:last-child {
    -webkit-line-clamp: 1;
    white-space: nowrap;
  }

  .card-link-row {
    flex: 0 0 auto;
    margin-top: auto;
  }

  .wiki-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    white-space: nowrap;
  }

  #footer {
    position: absolute;
    right: var(--mobile-edge);
    bottom: 7px;
    left: var(--mobile-edge);
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
  }

  .footer-controls {
    display: none;
  }

  .footer-brand,
  .footer-attributions {
    gap: 6px;
    white-space: nowrap;
  }

  .footer-brand {
    grid-column: 1;
    justify-content: flex-start;
    text-align: left;
  }

  .footer-attributions {
    grid-column: 2;
    justify-content: flex-end;
    text-align: right;
  }

  .footer-credit-icon {
    width: 12px;
    height: 12px;
    font-size: 12px;
  }

  .youtube-context-menu {
    min-width: 220px;
    border-radius: 10px;
  }

  .youtube-context-menu button {
    min-height: 44px;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
    padding: 0 14px;
    font-size: 13px;
  }

  .youtube-context-menu .youtube-menu-symbol {
    width: 22px;
    height: 22px;
    font-size: 22px;
  }
}

@media (max-width: 599px) {
  #mobile-panel-tabs {
    position: absolute;
    right: var(--mobile-edge);
    bottom: var(--mobile-bottom-row-bottom);
    z-index: 7;
    width: var(--mobile-selector-width);
    height: var(--mobile-bottom-row-height);
    box-sizing: border-box;
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 9px;
    box-shadow: var(--card-shadow);
    pointer-events: auto;
    touch-action: manipulation;
  }

  #mobile-panel-tabs button {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 0 8px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    outline: none;
    transition: color 120ms ease, background 120ms ease;
  }

  #mobile-panel-tabs button.active,
  #mobile-panel-tabs button[aria-pressed="true"] {
    background: var(--meta-bg);
    color: var(--text);
  }

  #mobile-panel-tabs button:focus-visible {
    color: var(--text);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 52%, transparent);
  }

  #detail-card-slot {
    right: var(--mobile-edge);
    bottom: var(--mobile-bottom-panel-bottom);
    left: var(--mobile-edge);
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #youtube-card {
    right: var(--mobile-edge);
    bottom: var(--mobile-bottom-panel-bottom);
    left: var(--mobile-edge);
    grid-template-columns: min(160px, 42vw) minmax(0, 1fr);
    padding: 8px;
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #youtube-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: var(--text-faint);
    cursor: pointer;
  }

  #youtube-close-button:hover,
  #youtube-close-button:focus-visible {
    color: var(--accent);
    outline: none;
  }

  #youtube-close-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .youtube-embed-wrap {
    width: min(160px, 42vw);
    height: min(90px, 23.625vw);
    --youtube-frame-scale: 1;
  }

  #youtube-frame {
    width: 100%;
    height: 100%;
    transform: none;
  }

  .youtube-card-meta {
    height: auto;
    min-height: min(90px, 23.625vw);
    overflow: visible;
  }

  .youtube-controls {
    gap: 8px;
    min-height: 44px;
  }

  .youtube-volume-control,
  .youtube-controls button,
  #youtube-volume-button {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  #youtube-pin-indicator {
    width: 34px;
  }

  .youtube-controls svg,
  #youtube-volume-button svg {
    width: 21px;
    height: 21px;
  }

  .youtube-control-symbol {
    width: 22px;
    height: 22px;
    font-size: 22px;
  }

  #search-card {
    right: calc(var(--mobile-edge) + var(--mobile-selector-width) + 8px);
  }

  body.mobile-cards-hidden #mobile-panel-tabs {
    display: inline-flex;
  }

  body.mobile-cards-hidden #search-card {
    right: calc(var(--mobile-edge) + var(--mobile-selector-width) + 8px);
  }

  body.mobile-cards-hidden.detail-restore-available #detail-restore-button {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(10px);
    visibility: hidden !important;
  }

  body:not(.mobile-radio-active) #youtube-card,
  body.mobile-radio-active:not(.mobile-cards-hidden) #detail-card-slot {
    display: none;
  }
}

@media (min-width: 600px) and (max-width: 899px) {
  :root {
    --mobile-edge: 16px;
    --mobile-map-collapsed-width: min(190px, 27vw);
    --mobile-bottom-row-height: 52px;
    --mobile-bottom-row-bottom: 30px;
    --mobile-bottom-panel-gap: 12px;
    --mobile-card-gap: 12px;
    --tablet-card-height: 250px;
    --tablet-playback-width: 226px;
  }

  #map-card,
  #map-card:not(.map-list-mode) {
    width: var(--mobile-map-collapsed-width);
  }

  #map-card.map-list-mode:not(.map-expanded) {
    width: min(320px, calc(100vw - (var(--mobile-edge) * 2)));
  }

  #map-card.map-expanded,
  #map-card.map-expanded.map-list-mode {
    width: min(
      calc(100vw - (var(--mobile-edge) * 2)),
      calc((100vh - (var(--mobile-edge) * 2)) * 320 / 174)
    );
  }

  #nav-controls {
    right: calc(var(--mobile-map-collapsed-width) + var(--mobile-edge) + 10px);
    gap: 8px;
  }

  #nav-back-button,
  #nav-forward-button,
  #nav-controls #graph-toggle-button,
  #nav-controls #cloud-toggle-button,
  #nav-controls #timeline-toggle-button {
    height: 46px;
    border-radius: 10px;
  }

  #nav-back-button,
  #nav-forward-button {
    width: 46px;
  }

  #nav-controls #graph-toggle-button,
  #nav-controls #cloud-toggle-button,
  #nav-controls #timeline-toggle-button {
    padding: 0 13px 0 11px;
    font-size: 13px;
  }

  #mobile-panel-tabs {
    display: none;
  }

  #search-card {
    right: var(--mobile-edge);
  }

  body:not(.detail-card-visible) #search-card,
  body.mobile-cards-hidden #search-card {
    right: var(--mobile-edge);
  }

  body.mobile-cards-hidden #youtube-card {
    display: grid;
  }

  body.mobile-cards-hidden #detail-card-slot {
    display: grid;
  }

  body:not(.detail-card-visible) #detail-card-slot,
  body.mobile-cards-hidden #detail-card-slot {
    z-index: 30;
  }

  body:not(.detail-card-visible) #detail-restore-button,
  body.mobile-cards-hidden #detail-restore-button {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(10px);
    visibility: hidden !important;
  }

  body.is-loading #detail-restore-button,
  body.app-booting #detail-restore-button {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }

  #detail-card-slot {
    right: var(--mobile-edge);
    bottom: var(--mobile-bottom-panel-bottom);
    left: calc(var(--mobile-edge) + var(--tablet-playback-width) + var(--mobile-card-gap));
    top: auto !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  #detail-card {
    height: auto !important;
    max-height: none !important;
    padding: 14px 16px;
    gap: 8px;
    justify-content: flex-start;
    overflow: visible !important;
  }

  #youtube-card {
    right: auto;
    bottom: var(--mobile-bottom-panel-bottom);
    left: var(--mobile-edge);
    width: var(--tablet-playback-width);
    top: auto !important;
    height: auto !important;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 9px;
    align-content: start;
    padding: 12px;
    max-height: none !important;
    overflow: visible !important;
  }

  .youtube-embed-wrap {
    width: 200px;
    height: 112.5px;
    aspect-ratio: auto;
    --youtube-frame-scale: 0.625;
  }

  #youtube-frame {
    width: 320px;
    height: 180px;
    transform: scale(var(--youtube-frame-scale));
  }

  .youtube-card-meta {
    height: auto;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 9px;
  }

  .youtube-title-block {
    gap: 3px;
  }

  #youtube-genre-title {
    font-size: 10px;
  }

  #youtube-song-title {
    font-size: 15px;
    line-height: 1.16;
    -webkit-line-clamp: 1;
  }

  #youtube-artist-title {
    font-size: 12px;
  }

  .youtube-controls {
    gap: 8px;
    min-height: 44px;
  }

  .youtube-volume-control,
  .youtube-controls button,
  #youtube-volume-button {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  #youtube-pin-indicator {
    width: 34px;
  }

  .youtube-controls svg,
  #youtube-volume-button svg {
    width: 21px;
    height: 21px;
  }

  .youtube-control-symbol {
    width: 22px;
    height: 22px;
    font-size: 22px;
  }

  .youtube-menu-control {
    margin-left: auto;
  }

  #youtube-card.youtube-no-playlist-state {
    width: var(--tablet-playback-width);
    height: auto;
    max-height: none;
  }

  .synonym-list {
    margin-top: -2px;
    font-size: 11px;
    line-height: 1.3;
    max-height: 29px;
  }

  .metadata-row {
    gap: 5px 8px;
    width: 100%;
    min-width: 0;
    max-height: 38px;
    overflow: hidden;
  }

  .metadata-chip {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    font-size: 11px;
    line-height: 1.25;
  }

  .metadata-origin span:last-child,
  .metadata-instrument span:last-child {
    -webkit-line-clamp: 1;
    white-space: nowrap;
  }

  #card-summary,
  .detail-card-snapshot-summary {
    padding-top: 9px;
    font-size: 12px;
    line-height: 1.42;
    -webkit-line-clamp: 4;
  }

  .card-link-row {
    margin-top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .node,
  .edge,
  .node-inner,
  .node-label {
    transition-duration: 1ms;
  }
}

/* Map mode is disabled. */
#map-card[hidden] {
  display: none !important;
}
#mobile-panel-tabs button[hidden] {
  display: none !important;
}
