/* Shared styles and reusable controls, tracks, and player components. */
:root {
  color-scheme: dark;
  --ink: #e8edf7;
  --blue: #70a5ff;
  --selection: #28364a;
  --paper: #0d1119;
  --card: rgb(25 32 45 / 88%);
  --surface: #171e2a;
  --line: rgb(232 237 247 / 13%);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 0 clamp(.455rem, 1.4vw, 1.12rem) clamp(1rem, 3vw, 2rem);
  min-height: 100vh;
  font: 14px/1.35 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
.controls {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0 -.25rem .8rem;
  padding: .55rem .25rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand {
  margin: 0;
  padding-left: 5px;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 900;
  letter-spacing: .16em;
  line-height: 1;
}
.control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.15rem;
  margin: 0;
  padding: .25rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 750 .76rem/1 system-ui, sans-serif;
  letter-spacing: .025em;
  cursor: pointer;
  box-shadow: 0 1px 1px rgb(0 0 0 / 20%);
  transition: translate .15s ease, box-shadow .15s ease, background .15s ease;
}
.control:hover {
  translate: 0 -1px;
  background: #222c3b;
  box-shadow: 0 5px 14px rgb(0 0 0 / 28%);
}
.control[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 5px 16px rgb(21 94 239 / 25%);
}
.control:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.control svg { width: 1rem; height: 1rem; }
.control:disabled { cursor: wait; opacity: .6; translate: none; }
.control.is-loading svg { animation: spin .8s linear infinite; }
.top-filter { padding-inline: .55rem; }
.top-filter.favorite[aria-pressed="true"] { --filter-color: #ff6685; }
.top-filter.energy[aria-pressed="true"] { --filter-color: #ffc857; }
.top-filter.latest[aria-pressed="true"] { --filter-color: #66d4ff; }
.top-filter[aria-pressed="true"] {
  border-color: var(--filter-color);
  background: color-mix(in srgb, var(--filter-color) 25%, var(--surface));
  color: var(--filter-color);
  box-shadow: none;
}
.utility { position: relative; margin-right: auto; }
.utility-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + .45rem);
  left: 0;
  display: flex;
  gap: .4rem;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
  box-shadow: 0 12px 32px rgb(0 0 0 / 38%);
}
.utility-menu[hidden] { display: none; }
.status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.youtube-form {
  position: absolute;
  top: calc(100% + .35rem);
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  width: min(25rem, calc(100vw - 1rem));
  padding: .55rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--paper);
  box-shadow: 0 12px 32px rgb(0 0 0 / 38%);
}
.youtube-form[hidden] { display: none; }
.youtube-form input {
  min-width: 0;
  flex: 1;
  height: 2.15rem;
  padding: 0 .65rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.youtube-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.youtube-form .control { flex: 0 0 auto; }
.youtube-progress {
  flex: 1 0 100%;
  min-height: 1.2rem;
  color: #aeb8c9;
  font-size: .76rem;
}
.youtube-progress[data-state="working"]::before {
  content: "";
  display: inline-block;
  width: .7rem;
  height: .7rem;
  margin-right: .45rem;
  border: 2px solid rgb(112 165 255 / 35%);
  border-top-color: var(--blue);
  border-radius: 50%;
  vertical-align: -.08rem;
  animation: spin .8s linear infinite;
}
.youtube-progress[data-state="done"] { color: #77d69b; }
.youtube-filename { display: flex; flex: 1 0 100%; gap: .4rem; }
.youtube-filename[hidden] { display: none; }
.youtube-filename input { flex: 1; }
@keyframes spin { to { rotate: 360deg; } }
.tracks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
  gap: .6rem;
  width: 100%;
}
.track {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 5.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--card);
  color: inherit;
  font-weight: 550;
  text-align: left;
  text-decoration: none;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  transition: translate .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
  cursor: grab;
}
.track.is-dragging {
  position: fixed;
  top: -10000px;
  left: -10000px;
  width: var(--drag-width);
  height: var(--drag-height);
  pointer-events: none;
}
.track-drop-placeholder {
  min-width: 0;
  min-height: 5.25rem;
  border: 2px dashed var(--blue);
  border-radius: .85rem;
  background: rgb(112 165 255 / 12%);
  box-shadow: inset 0 0 0 3px rgb(112 165 255 / 8%);
}
.track-drag-image {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--drag-width);
  opacity: .92;
  pointer-events: none;
  transform: translate(-200vw, -200vh);
}
.tracks.is-reordering .track:hover { translate: 0 0; }
.track[hidden] { display: none; }
.track-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 5.25rem;
  padding: .72rem .85rem;
  color: inherit;
  text-decoration: none;
}
.track-link > span { min-width: 0; }
.film { color: #6684b3; }
.track-filters {
  position: absolute;
  z-index: 2;
  top: .45rem;
  right: .45rem;
  display: flex;
  gap: .22rem;
  opacity: 0;
  translate: 0 -3px;
  transition: opacity .15s ease, translate .15s ease;
}
.track:hover .track-filters, .track:focus-within .track-filters { opacity: 1; translate: 0 0; }
.track-filter {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(13 17 25 / 88%);
  color: #8590a3;
  cursor: pointer;
}
.track-filter svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.track-filter.favorite[aria-pressed="true"] { color: #ff6685; }
.track-filter.energy[aria-pressed="true"] { color: #ffc857; }
.track-filter.latest[aria-pressed="true"] { color: #66d4ff; }
.track-filter[aria-pressed="true"] svg { fill: currentColor; }
.track-filter:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.video-link {
  position: absolute;
  z-index: 2;
  right: .5rem;
  bottom: .5rem;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(13 17 25 / 88%);
  color: var(--blue);
  opacity: 0;
  translate: 0 3px;
  transition: opacity .15s ease, translate .15s ease, background .15s ease;
}
.video-link svg {
  width: .9rem;
  height: .9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.track:hover .video-link,
.track:focus-within .video-link { opacity: 1; translate: 0 0; }
.video-link:hover { background: #28364a; }
.video-link:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.artist {
  color: var(--blue);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.65;
  text-transform: uppercase;
}
.track:hover {
  translate: 0 -2px;
  border-color: rgb(21 94 239 / 24%);
  background: #202938;
  box-shadow: 0 10px 24px rgb(0 0 0 / 32%);
}
.track.is-playing {
  border-color: var(--blue);
  background: #202938;
  box-shadow: 0 0 0 1px rgb(112 165 255 / 22%), 0 10px 24px rgb(0 0 0 / 32%);
}
.track.is-playing .artist { color: #fff; }
.track-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: .85rem; }
.track:active { translate: 0 0; }

.now-playing {
  position: fixed;
  z-index: 30;
  right: clamp(.65rem, 2vw, 1.6rem);
  bottom: .75rem;
  left: clamp(.65rem, 2vw, 1.6rem);
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 3.75rem;
  padding: .55rem .75rem;
  border: 1px solid rgb(112 165 255 / 35%);
  border-radius: .9rem;
  background: rgb(23 30 42 / 96%);
  box-shadow: 0 12px 36px rgb(0 0 0 / 48%);
  backdrop-filter: blur(12px);
}
.now-playing[hidden] { display: none; }
.now-playing-details { min-width: 0; flex: 1; }
.now-playing-label {
  display: block;
  margin-bottom: .08rem;
  color: var(--blue);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.now-playing-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-actions { display: flex; align-items: center; gap: .35rem; }
.player-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: .42rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #202938;
  color: var(--ink);
  cursor: pointer;
}
.player-button:hover { border-color: var(--blue); background: #28364a; }
.player-button[aria-pressed="true"],
.player-button[aria-pressed="mixed"] { border-color: var(--blue); background: var(--blue); color: #101722; }
.player-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.player-button svg { width: 100%; height: 100%; fill: currentColor; }
.player-button .repeat-icon { display: none; }
.player-button[data-mode="repeat"] .next-icon { display: none; }
.player-button[data-mode="repeat"] .repeat-icon { display: block; }
.player-button .pause-icon { display: none; }
.player-button.is-playing .play-icon { display: none; }
.player-button.is-playing .pause-icon { display: block; }
.volume-control { display: flex; align-items: center; gap: .45rem; color: #aeb8c9; }
.volume-control svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.volume-control input { width: clamp(5.5rem, 14vw, 9rem); accent-color: var(--blue); cursor: pointer; }
body.has-now-playing { padding-bottom: 5.25rem; }

@media (max-width: 520px) {
  body { padding-inline: .35rem; }
  .controls { margin-bottom: .5rem; }
  .tracks { grid-template-columns: minmax(0, 1fr); gap: .45rem; }
  .track-link { min-height: 4.25rem; padding: .65rem .75rem; }
  .now-playing { right: .5rem; bottom: .5rem; left: .5rem; gap: .5rem; }
  .volume-control input { width: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .control, .track { transition: none; }
  .control.is-loading svg { animation: none; }
}

/* Tile dashboard layout. */
/* Share My Style's palette, typography, and compact card treatment. */
body {
  --tile-size: min(11.6rem, calc((100vw - 2 * clamp(.455rem, 1.4vw, 1.12rem) - 2rem - 2px - .6rem) / 2));
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: .35rem;
}
header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  min-height: 2.5rem;
  padding: .55rem .25rem;
}
.brand span { color: var(--blue); }
.bar .brand { flex-shrink: 0; }
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .65rem;
  min-width: 0;
  font-size: .76rem;
}
.project-meta[hidden] { display: none; }
.project-picker { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.project-name {
  appearance: none;
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-radius: .25rem;
  padding: .2rem 1.25rem .2rem 0;
  background: var(--paper);
  color: var(--blue);
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
}
.project-picker > svg {
  position: absolute;
  right: .1rem;
  width: .85rem;
  height: .85rem;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  pointer-events: none;
}
.project-location { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.project-path { color: #fff; overflow-wrap: anywhere; min-width: 0; }
.project-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: .3rem;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.project-edit:hover { background: var(--surface); color: var(--blue); }
.project-edit svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 1.6; }
.project-name:focus-visible, .project-edit:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.project-dialog {
  width: min(28rem, calc(100vw - 2rem));
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--paper);
  color: var(--ink);
}
.project-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.project-dialog h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.project-dialog label { display: grid; gap: .35rem; margin-bottom: .8rem; }
.project-dialog input {
  width: 100%;
  padding: .6rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  color: #fff;
  font: inherit;
}
.project-dialog input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.project-dialog p { color: #aeb8c9; font-size: .76rem; }
.project-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.note { color: #aeb8c9; font-size: .76rem; }
main {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-top: .2rem;
}
.search {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 1px rgb(0 0 0 / 20%);
}
.search:focus-within { outline: 2px solid var(--blue); outline-offset: 2px; }
.search svg { width: 1rem; height: 1rem; color: var(--blue); flex-shrink: 0; }
.search input {
  min-width: 0;
  width: 100%;
  height: 2.15rem;
  padding: .25rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.search input::placeholder { color: #aeb8c9; }
.groups {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 1.5rem;
  align-items: flex-start;
  margin: 1.5rem 0;
}
.frame {
  position: relative;
  min-width: 0;
  flex: 0 0 auto;
  padding: 1rem;
  border: 1px solid var(--blue);
  border-radius: .85rem;
  background: var(--paper);
  box-shadow: 0 0 8px rgb(112 165 255 / 45%), 0 0 24px rgb(112 165 255 / 18%), inset 0 0 18px rgb(112 165 255 / 8%);
}
.frame-heading {
  position: absolute;
  top: -.8rem;
  left: .85rem;
  right: .85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
}
.frame-heading h2 { padding: 0 .4rem; background: var(--paper); }
h2 {
  margin: 0;
  color: var(--blue);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.65;
  text-transform: uppercase;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(2, var(--tile-size));
  gap: .6rem;
  align-items: start;
}
.frame[data-count="1"] .tiles { grid-template-columns: var(--tile-size); }
.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: var(--tile-size);
  height: var(--tile-size);
  aspect-ratio: 1;
  padding: .72rem .85rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--card);
  color: inherit;
  font-weight: 550;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  transition: translate .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
  cursor: pointer;
}
.tile:hover {
  translate: 0 -2px;
  border-color: rgb(21 94 239 / 24%);
  background: #202938;
  box-shadow: 0 10px 24px rgb(0 0 0 / 32%);
}
.tile:active { translate: 0 0; }
.label {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  justify-items: center;
  gap: .4rem;
  min-width: 0;
  height: 100%;
  text-align: center;
}
.tile-icon {
  align-self: center;
  width: 45%;
  height: auto;
  max-width: 5rem;
  max-height: 100%;
  fill: none;
  stroke: #fff;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.label strong {
  display: block;
  color: var(--blue);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .055em;
  line-height: 1.65;
  text-transform: uppercase;
}
/* At most three lines, the last one ending in an ellipsis where the sentence
   is cut; the tile's title attribute carries the whole description. */
.label small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--ink);
  font-size: inherit;
  font-weight: 550;
}
.frame footer {
  position: absolute;
  bottom: -.5rem;
  left: 1rem;
  max-width: calc(100% - 2rem);
  padding: 0 .4rem;
  background: var(--paper);
  color: #aeb8c9;
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.empty { padding: 1rem; color: #aeb8c9; text-align: center; }
.bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .15rem .6rem;
  margin-top: auto;
  padding-top: .35rem;
  line-height: 1.2;
  border-top: 1px solid var(--line);
  color: #aeb8c9;
  font-size: .76rem;
}
.sign-out { margin: 0 0 0 auto; }
.sign-out button {
  font: inherit;
  color: #aeb8c9;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.sign-out button:hover, .sign-out button:focus-visible { color: var(--ink); }
[hidden] { display: none !important; }
@media (max-width: 520px) {
  body { --tile-size: min(11.6rem, calc((100vw - .7rem - 1.5rem - 2px - .45rem) / 2)); }
  main { padding-top: .5rem; }
  .note { display: none; }
  .groups { gap: 2rem 1.5rem; }
  .frame { padding: .75rem; }
  .tiles { gap: .45rem; }
  .tile { padding: .5rem; }
  .label { gap: .25rem; }
  .label strong { font-size: .65rem; line-height: 1.35; }
  .label small { font-size: .7rem; }
  .bottom { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}

/* Group navigation opens beside the tile dashboard. */
.workspace {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.group-panel { min-width: 0; flex: 1; container-type: inline-size; }
.group-nav {
  flex: 0 0 var(--tile-size);
  width: var(--tile-size);
  min-width: 0;
  margin: 1.5rem 0;
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
}
body.has-group-nav {
  --tile-size: min(11.6rem, calc((100vw - 2 * clamp(.455rem, 1.4vw, 1.12rem) - 2rem - 2px - .75rem) / 2));
}
.nav-groups, .nav-tiles { list-style: none; padding: 0; margin: 0; }
.nav-tiles { padding-left: .8rem; }
.nav-row {
  display: block;
  width: 100%;
  height: 30px;
  margin: .15rem 0;
  padding: 0 .4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .35rem;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: .72rem;
  line-height: 28px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.nav-group { color: var(--blue); font-weight: 800; }
.nav-group::before { content: "▸"; margin-right: .35rem; }
.nav-group[aria-expanded="true"]::before { content: "▾"; }
.nav-row:hover { background: #28364a; }
.nav-row.is-selected, .tile.is-selected {
  border-color: var(--blue);
  background: var(--selection);
  box-shadow: inset 0 0 0 1px rgb(112 165 255 / 25%);
}
.group-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.group-button:hover { color: #fff; }
button.tile { font-family: inherit; font-size: inherit; text-align: center; }
.group-button:focus-visible, .nav-row:focus-visible, .tile:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
@container (max-width: 26rem) {
  .has-group-nav .tiles { grid-template-columns: var(--tile-size); }
}
@media (max-width: 520px) {
  body.has-group-nav {
    --tile-size: min(11.6rem, calc((100vw - .7rem - 1.5rem - 2px - .75rem) / 2));
  }
}

.frame.is-selected,
.frame.is-selected .frame-heading h2,
.frame.is-selected footer {
  background: var(--selection);
}

.frame:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* List modules occupy the remaining dashboard workspace. */
body.has-list-module { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: .75rem; }
.has-list-module main { min-height: 0; }
.has-list-module .workspace { flex: 1; min-height: 0; padding-top: 1.5rem; align-items: stretch; }
.has-list-module .group-nav { margin: 0; overflow-y: auto; }
.has-list-module .group-panel { display: flex; min-height: 0; }
.list-module { display: flex; flex-direction: column; width: 100%; min-height: 0; padding: 1rem; border: 1px solid var(--blue); border-radius: .85rem; background: var(--paper); }
.list-toolbar { display: flex; align-items: flex-end; gap: .6rem; }
.list-file { flex: 1; min-width: 0; display: grid; gap: .3rem; color: var(--blue); font-size: .75rem; }
.list-file input { width: 100%; min-width: 0; padding: .5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--ink); font: inherit; }
.list-lines { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: .75rem 0; padding: 0; }
.list-line { display: flex; align-items: center; gap: .5rem; min-height: 2.5rem; border-bottom: 1px solid var(--line); }
.list-bullet { color: var(--blue); }
.list-line input { flex: 1; min-width: 0; padding: .5rem 0; border: 0; outline: none; box-shadow: none; background: transparent; color: var(--ink); font: inherit; }
.list-remove { border: 0; background: transparent; color: #24538a; font: inherit; cursor: pointer; }
.list-remove:hover { color: var(--ink); }
.test-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.test-line { flex-wrap: wrap; cursor: pointer; }
.test-toggle { border: 0; background: transparent; color: inherit; font: inherit; padding: .5rem 0; text-align: left; cursor: pointer; }
.test-details { flex-basis: 100%; min-width: 0; padding: 0 0 1rem 1.5rem; cursor: auto; }
.test-description { margin: .25rem 0 .75rem; font-size: .85rem; }
.test-source { max-width: 100%; margin: 0; padding: .75rem; overflow-x: auto; background: var(--surface); color: var(--ink); font-size: .8rem; line-height: 1.5; white-space: pre; }
.test-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.test-run { flex-shrink: 0; width: 2rem; height: 2rem; border: 0; background: transparent; color: var(--blue); font: inherit; cursor: pointer; padding: 0 0 3px 2px; }
.test-run-all { border: 1px solid var(--blue); border-radius: 50%; font-size: .8rem; }
.test-ok { color: #16803c; font-size: .8rem; font-weight: 600; }
.test-run:disabled { opacity: .5; cursor: default; }
.test-bullet[data-result="passed"] { color: #16803c; }
.test-bullet[data-result="failed"], .test-error { color: #b42318; }
.test-error { font-size: .8rem; }
#list-status { margin: .5rem 0 0; font-size: .8rem; }
@media (max-width: 520px) { .list-toolbar { flex-wrap: wrap; } .list-file, #json-search { flex-basis: 100%; } .list-module { padding: .6rem; } }

/* A document: its search box, left of its path, then its view. */
#json-form { align-items: center; }
#json-search { flex: 0 1 18rem; min-width: 8rem; padding: .5rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--ink); font: inherit; }
#json-search:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
#json-status, #json-search-status { margin: .5rem 0 0; font-size: .8rem; overflow-wrap: anywhere; }
#json-text, #json-view { flex: 1; width: 100%; min-height: 0; margin-top: .75rem; padding: .75rem; border: 1px solid var(--line); border-radius: .35rem; background: var(--surface); color: var(--ink); overflow: auto; font: .9rem/1.5 monospace; }
#json-text { resize: none; tab-size: 2; }
#json-path, #json-text { border: 0; outline: none; box-shadow: none; }
.json-tree, .json-children { list-style: none; margin: 0; padding: 0; }
.json-children { margin-left: .6rem; padding-left: 1rem; border-left: 1px solid var(--line); }
.json-node summary, .json-leaf { padding: .35rem .25rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.json-node summary { cursor: pointer; }
.json-leaf { display: block; }
.json-match { background: var(--paper); color: var(--blue); font-weight: bold; }
.json-message { margin: 0; overflow-wrap: anywhere; }

.image-module { min-width: 0; width: 100%; }
.page-module { min-width: 0; width: 100%; padding: 0; overflow: hidden; }
.page-module iframe { display: block; width: 100%; height: min(80vh, 60rem); border: 0; border-radius: .85rem; background: var(--paper); }
#image-path { border: 0; outline: none; box-shadow: none; }
.image-view { flex: 1; min-height: 0; min-width: 0; margin-top: .75rem; overflow: auto; border-radius: .35rem; background: var(--surface); }
.image-module img { display: block; width: 100%; height: auto; }
#image-status { margin: .5rem 0 0; font-size: .8rem; }

#json-view.markdown-view { font: .95rem/1.65 system-ui, sans-serif; white-space: normal; overflow-wrap: anywhere; }
.markdown-view > :first-child { margin-top: 0; }
.markdown-view h1, .markdown-view h2, .markdown-view h3 { line-height: 1.3; margin: 1.5rem 0 .65rem; color: var(--blue); }
.markdown-view h1 { font-size: 1.7rem; }
.markdown-view h2 { font-size: 1.3rem; }
.markdown-view h3 { font-size: 1.1rem; }
.markdown-view p, .markdown-view ul, .markdown-view ol { margin: .65rem 0; }
.markdown-view a { color: var(--blue); text-decoration: underline; }
.markdown-view code { background: var(--paper); padding: .1rem .3rem; border-radius: .25rem; font: .85em/1.5 monospace; }
.markdown-view pre { overflow: auto; padding: .75rem; border-radius: .35rem; background: var(--paper); }
.markdown-view pre code { display: block; padding: 0; white-space: pre; }
.markdown-view blockquote { margin: .75rem 0; padding: .25rem 1rem; border-left: 3px solid var(--blue); }
.markdown-view table { border-collapse: collapse; margin: .75rem 0; }
.markdown-view th, .markdown-view td { padding: .4rem .65rem; border: 1px solid var(--line); text-align: left; }

.nav-home { display: flex; align-items: center; gap: .4rem; color: #fff; }
.nav-home svg { width: 1rem; height: 1rem; flex-shrink: 0; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linejoin: round; }

/* Moving groups: a grip on the right of each frame's top edge (the group's
   label sits on the left), shown on hover or focus. Dragging it moves the
   group (index.html, startGroupDrag). */
.frame-grip {
  position: absolute;
  top: -.23rem;
  right: 1.1rem;
  width: 2.6rem;
  height: .46rem;
  border: 1px solid var(--blue);
  border-radius: .25rem;
  background: var(--paper);
  opacity: 0;
  cursor: grab;
  touch-action: none;
  transition: opacity .16s ease, background .16s ease;
}
/* A larger target than the rectangle itself. */
.frame-grip::before { content: ""; position: absolute; inset: -.45rem -.6rem; }
.frame:hover .frame-grip, .frame:focus-within .frame-grip { opacity: 1; }
.frame-grip:hover { background: var(--blue); }
.frame.is-dragging { z-index: 20; opacity: .92; box-shadow: 0 16px 40px rgb(0 0 0 / 50%), 0 0 12px rgb(112 165 255 / 45%); }
.frame.is-dragging .frame-grip { opacity: 1; background: var(--blue); cursor: grabbing; }

/* Resizing: a handle in each frame's bottom-right corner, shown on hover.
   Dragging it changes how many tiles wide the group is. */
.frame-resize {
  position: absolute;
  right: .3rem;
  bottom: .3rem;
  width: .95rem;
  height: .95rem;
  border-radius: 0 0 .55rem 0;
  background:
    linear-gradient(135deg, transparent 46%, var(--blue) 46%, var(--blue) 54%, transparent 54%) no-repeat,
    linear-gradient(135deg, transparent 70%, var(--blue) 70%, var(--blue) 78%, transparent 78%) no-repeat;
  opacity: 0;
  cursor: nwse-resize;
  touch-action: none;
  transition: opacity .16s ease;
}
.frame-resize::before { content: ""; position: absolute; inset: -.4rem; }
.frame:hover .frame-resize, .frame:focus-within .frame-resize, .frame.is-resizing .frame-resize { opacity: 1; }
.frame.is-resizing { z-index: 20; }

/* Arranged: each group at its own place (index.html, arrangeGroups). The
   others glide out of the way of one being moved or resized. */
.groups.is-arranged { display: block; position: relative; }
.groups.is-arranged > .frame { position: absolute; transition: left .18s ease, top .18s ease; }
.groups.is-arranged.is-settling > .frame,
.groups.is-arranged > .frame.is-dragging,
.groups.is-arranged > .frame.is-resizing { transition: none; }
.group-placeholder {
  position: absolute;
  z-index: 0;
  border: 1px dashed rgb(112 165 255 / 55%);
  border-radius: .85rem;
  background: rgb(112 165 255 / 6%);
  pointer-events: none;
  transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
}
.layout-status { margin: .25rem 0 0; color: var(--bad, #ff8a8a); font-size: .85rem; }
@media (hover: none) { .frame-grip { opacity: .7; } }
.md-unlinked { text-decoration: underline dotted; text-underline-offset: .15em; }
