/* Engineering dashboard on Glance: api-core theme tokens, layout, components and motion. */

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dash-radius: 10px;
  --gold: #f5c542;
  --silver: #c3cad5;
  --bronze: #d6935a;
}

/* api-core shell tokens: :root and :root[data-theme='dark'] in resources/assets/scss/_app-shell-theme.scss */
:root[data-app-theme='dark'] {
  color-scheme: dark;
  --border-radius: var(--dash-radius);
  --color-background: #15161b;
  --color-widget-background: #1d1e24;
  --color-widget-background-highlight: #26272e;
  --color-widget-content-border: rgba(244, 245, 247, 0.1);
  --color-separator: rgba(244, 245, 247, 0.1);
  --color-popover-background: #1d1e24;
  --color-popover-border: rgba(244, 245, 247, 0.16);
  --color-progress-border: rgba(244, 245, 247, 0.16);
  --color-progress-value: rgba(244, 245, 247, 0.3);
  --color-vertical-progress-value: rgba(244, 245, 247, 0.3);
  --color-graph-gridlines: rgba(244, 245, 247, 0.08);
  --color-text-highlight: #f4f5f7;
  --color-text-paragraph: rgba(244, 245, 247, 0.74);
  --color-text-base: rgba(244, 245, 247, 0.74);
  --color-text-base-muted: rgba(244, 245, 247, 0.6);
  --color-text-subdue: rgba(244, 245, 247, 0.6);
  --color-primary: #3ddc84;
  --color-positive: #3ddc84;
  --color-negative: #f4687e;
  --dash-warning: #ffb057;
  --dash-track: rgba(244, 245, 247, 0.16);
  --dash-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --dash-shimmer: rgba(255, 255, 255, 0.05);
  --dash-accent-fill: #3ddc84;
  --dash-accent-ink: #090a0d;
}

:root[data-app-theme='light'] {
  color-scheme: light;
  --border-radius: var(--dash-radius);
  --color-background: #f4f4f5;
  --color-widget-background: #ffffff;
  --color-widget-background-highlight: rgba(9, 10, 13, 0.05);
  --color-widget-content-border: rgba(9, 10, 13, 0.08);
  --color-separator: rgba(9, 10, 13, 0.08);
  --color-popover-background: #ffffff;
  --color-popover-border: rgba(9, 10, 13, 0.12);
  --color-progress-border: rgba(9, 10, 13, 0.12);
  --color-progress-value: rgba(9, 10, 13, 0.3);
  --color-vertical-progress-value: rgba(9, 10, 13, 0.3);
  --color-graph-gridlines: rgba(9, 10, 13, 0.06);
  --color-text-highlight: #090a0d;
  --color-text-paragraph: rgba(9, 10, 13, 0.72);
  --color-text-base: rgba(9, 10, 13, 0.72);
  --color-text-base-muted: rgba(9, 10, 13, 0.62);
  --color-text-subdue: rgba(9, 10, 13, 0.62);
  --color-primary: #00792f;
  --color-positive: #00792f;
  --color-negative: #c4183c;
  --dash-warning: #9a4a00;
  --dash-track: rgba(9, 10, 13, 0.12);
  --dash-card-shadow: 0 1px 2px rgba(9, 10, 13, 0.04), 0 1px 3px rgba(9, 10, 13, 0.06);
  --dash-shimmer: rgba(255, 255, 255, 0.7);
  --dash-accent-fill: #00792f;
  --dash-accent-ink: #ffffff;
  /* Medal colors deep enough for 4.5:1 text on white. */
  --gold: #9a6b00;
  --silver: #5f6b7a;
  --bronze: #9c5a1f;
}

/* Light theme: the header takes the Talk sidebar (_shell-theme.scss in aloware-talk2). */
:root[data-app-theme='light'] .header {
  background: #15163f;
  border-color: rgba(255, 255, 255, 0.12);
  color: #9797ae;
  --color-text-highlight: #ffffff;
  --color-text-base: #9797ae;
  --color-text-subdue: #9797ae;
  --color-text-paragraph: #9797ae;
  --color-primary: #ffffff;
  --color-widget-background-highlight: rgba(255, 255, 255, 0.08);
  --dash-switch-pill: rgba(255, 255, 255, 0.16);
}

body {
  font-family: "Nunito", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Component display rules (display: flex) would otherwise override the hidden attribute. */
[hidden] {
  display: none !important;
}

/* Glance tightens word spacing for its monospace font; Nunito's spaces disappear with it. */
.text-compact {
  word-spacing: normal;
}

/* Glance's frame draws a 3px solid bottom edge from its own palette math, which turns black in light mode. */
.widget-content:not(.widget-content-frameless),
.widget-content-frame {
  box-shadow: var(--dash-card-shadow);
}

.dash-frameless > .widget-content {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

/* Titles sit inside the cards: the widget is the card, and Glance's content frame inside it goes flat. */
.widget:not(.dash-tiles-widget) {
  overflow: hidden;
  border: 1px solid var(--color-widget-content-border);
  border-radius: var(--dash-radius);
  background: var(--color-widget-background);
  box-shadow: var(--dash-card-shadow);
}

.widget:not(.dash-tiles-widget) > .widget-content {
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.widget > .widget-header {
  margin: 0;
  padding: 14px calc(var(--widget-content-horizontal-padding) + 1px) 0;
}

.widget > .widget-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.widget > .widget-header h2 {
  color: var(--color-text-highlight);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.widget > .widget-header + .widget-content {
  padding-top: 12px;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
  animation-timing-function: ease;
}

/* Desktop (Glance stacks columns at 1190px and below): the page never scrolls, each column does.
   A scrolling page rubber-bands on macOS and drags a sticky header along; a column keeps its bounce to itself. */
@media (min-width: 1191px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  .body-content {
    height: 100%;
  }

  .header-container {
    flex-shrink: 0;
  }

  /* The header container is also .content-bounds, so it is excluded. */
  .body-content > .content-bounds:not(.header-container),
  .page,
  .page-content,
  .page-columns {
    height: 100%;
    min-height: 0;
  }

  /* Cards keep their full height and the column scrolls. A card with overflow hidden would otherwise shrink to fit. */
  .page-column > * {
    flex-shrink: 0;
  }

  /* A page toolbar sits above the columns, and the columns take the height left. */
  .page-content {
    display: flex;
    flex-direction: column;
  }

  .page-columns {
    flex: 1;
  }

  /* The chat card fills the Spotify side column, so the list shows as many messages as fit. */
  .page[data-page='spotify'] .page-column-small > .widget:last-child {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 320px;
  }

  .page[data-page='spotify'] .page-column-small > .widget:last-child > .widget-content,
  [data-mount='room-chat'] {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  /* My Spotify fills the column with one centered player, so its card ends where the chat ends. */
  :root[data-spotify-mode='me'] .page[data-page='spotify'] .widget.mode-me {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
  }

  :root[data-spotify-mode='me'] .page[data-page='spotify'] .widget.mode-me > .widget-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
  }

  :root[data-spotify-mode='me'] .page[data-page='spotify'] .sp-player--hero {
    grid-template-columns: minmax(240px, min(440px, 45%)) minmax(0, 560px);
    justify-content: center;
  }

  .page[data-page='spotify'] .chat-list {
    flex: 1;
    max-height: none;
  }

  .page-column {
    height: 100%;
    /* Room for focus rings and shadows at the column edge. */
    margin-inline: -4px;
    padding: 0 4px var(--widget-gap);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .page-column::-webkit-scrollbar {
    display: none;
  }

  :root[data-scrolled] .page-column-full {
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 20px);
    mask-image: linear-gradient(to bottom, transparent, #000 20px);
  }
}

/* Theme switch */

.app-theme-switch {
  position: relative;
  display: flex;
  gap: 2px;
  align-self: center;
  padding: 3px;
  border-radius: 9px;
  background: var(--color-widget-background-highlight);
}

.app-theme-switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 2.8rem;
  height: 2.4rem;
  border-radius: 6px;
  background: var(--dash-switch-pill, var(--color-widget-background));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transform: translateX(calc(var(--switch-index, 2) * (2.8rem + 2px)));
}

.app-theme-switch.is-ready::before {
  transition: transform 220ms var(--ease-in-out);
}

.app-theme-switch button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.4rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-subdue);
  cursor: pointer;
  transition: color 150ms ease, transform 160ms var(--ease-out);
}

.app-theme-switch button[aria-pressed='true'] {
  color: var(--color-text-highlight);
}

.app-theme-switch button:active {
  transform: scale(0.94);
}

.app-theme-switch svg {
  width: 1.6rem;
  height: 1.6rem;
}

/* Shared pieces */

.dash-icon {
  flex-shrink: 0;
}

.dash-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 3.4rem;
  padding: 0 12px;
  border: 1px solid var(--color-widget-content-border);
  border-radius: 8px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.dash-button svg {
  width: 1.6rem;
  height: 1.6rem;
}

.dash-button:active:not(:disabled) {
  transform: scale(0.97);
}

.dash-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.dash-button.is-on {
  color: var(--color-positive);
  border-color: color-mix(in srgb, var(--color-positive) 45%, transparent);
}

.dash-button--primary {
  border-color: transparent;
  background: var(--dash-accent-fill);
  color: var(--dash-accent-ink);
}

.dash-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-positive);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.dash-more {
  margin-top: 8px;
}

.dash-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-subdue);
  font-size: 1.05rem;
  font-weight: normal;
  vertical-align: 1px;
}

.dash-count {
  color: var(--color-text-subdue);
  font-variant-numeric: tabular-nums;
}

.dash-footnote {
  margin: 10px 0 0;
  color: var(--color-text-subdue);
  font-size: 1.15rem;
}

.dash-empty {
  margin: 0;
  padding: 8px 0;
  color: var(--color-text-subdue);
  list-style: none;
}

.dash-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.dash-tabs button {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-subdue);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.dash-tabs button[aria-selected='true'] {
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
}

.dash-tabs button:active {
  transform: scale(0.97);
}

.dash-search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  height: 3.6rem;
  padding: 0 12px;
  border: 1px solid var(--color-widget-content-border);
  border-radius: 10px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-subdue);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.dash-search:focus-within {
  border-color: var(--color-positive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-positive) 25%, transparent);
}

.dash-search svg {
  width: 1.6rem;
  height: 1.6rem;
}

.dash-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--color-text-highlight);
  font: inherit;
}

.dash-skeleton,
.dash-skeleton-row {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-widget-background-highlight);
  list-style: none;
}

.dash-skeleton-row {
  height: 44px;
  margin-bottom: 6px;
}

.dash-skeleton::after,
.dash-skeleton-row::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--dash-shimmer), transparent);
  transform: translateX(-100%);
  animation: dash-shimmer 1.4s ease-in-out infinite;
}

/* Metric tiles */

/* Three per row in the middle column, six once the column is wide enough to keep labels on one line. */
.dash-tiles-widget {
  container-type: inline-size;
}

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@container (min-width: 1100px) {
  .dash-tiles {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@container (max-width: 520px) {
  .dash-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dash-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 128px;
  padding: 14px 16px;
  border: 1px solid var(--color-widget-content-border);
  border-radius: var(--dash-radius);
  background: var(--color-widget-background);
  box-shadow: var(--dash-card-shadow);
}

.dash-tile-label {
  color: var(--color-text-subdue);
  font-size: 1.25rem;
  font-weight: 700;
}

.dash-tile-value {
  color: var(--color-text-highlight);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.dash-tile-sub,
.dash-delta {
  color: var(--color-text-subdue);
  font-size: 1.2rem;
}

.dash-delta {
  font-weight: 700;
}

.is-good {
  color: var(--color-positive);
}

.is-warn {
  color: var(--dash-warning);
}

.is-bad {
  color: var(--color-negative);
}

.dash-tile--rank.is-medal-1 { --medal: var(--gold); }
.dash-tile--rank.is-medal-2 { --medal: var(--silver); }
.dash-tile--rank.is-medal-3 { --medal: var(--bronze); }

.dash-tile--rank[class*='is-medal'] {
  background: linear-gradient(160deg, color-mix(in srgb, var(--medal) 16%, var(--color-widget-background)), var(--color-widget-background) 60%);
}

.dash-tile--rank[class*='is-medal'] .dash-tile-value {
  color: var(--medal);
}

.dash-tile-crown {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 2.2rem;
  height: 2.2rem;
  color: var(--gold);
  transform: rotate(12deg);
}

.dash-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 32px;
  margin-top: auto;
  padding-top: 8px;
}

.dash-bar {
  position: relative;
  display: flex;
  flex: 1;
  height: 100%;
}

.dash-bars i {
  width: 100%;
  height: 100%;
  border-radius: 3px 3px 1px 1px;
  background: var(--color-text-subdue);
  opacity: 0.35;
  transform: scaleY(max(var(--h), 0.04));
  transform-origin: bottom;
  transition: opacity 150ms ease;
}

.dash-bar.is-current i {
  background: var(--color-positive);
  opacity: 1;
}

/* Bar tooltip: the week and its count. Fast and without delay, since the bars sit side by side. */
.dash-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--dash-tooltip, #34363e);
  color: #f4f5f7;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: pre;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px) scale(0.97);
  transform-origin: bottom center;
  transition: opacity 125ms ease-out, transform 125ms var(--ease-out);
}

.dash-bar.is-start::after {
  left: 0;
  transform: translate(0, 3px) scale(0.97);
  transform-origin: bottom left;
}

.dash-bar.is-end::after {
  right: 0;
  left: auto;
  transform: translate(0, 3px) scale(0.97);
  transform-origin: bottom right;
}

:root[data-app-theme='light'] {
  --dash-tooltip: #090a0d;
}

/* Card info: what the card shows, under the icon on hover or focus. It opens downward, inside the card. */
.widget-info {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--color-text-subdue);
  cursor: help;
  transition: color 150ms ease;
}

.widget-info svg {
  width: 1.4rem;
  height: 1.4rem;
}

.widget-info:hover,
.widget-info:focus-visible {
  color: var(--color-text-highlight);
}

.widget-info:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

.widget-info::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 5;
  width: max-content;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--dash-tooltip, #34363e);
  color: #f4f5f7;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px) scale(0.97);
  transform-origin: top left;
  transition: opacity 125ms ease-out, transform 125ms var(--ease-out);
}

.widget-info:hover::after,
.widget-info:focus::after {
  opacity: 1;
  transform: none;
}

/* Scoreboard */

.dash-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Wider than a phone, it scrolls sideways inside itself instead of widening the page. */
.dash-segmented {
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border-radius: 9px;
  background: var(--color-widget-background-highlight);
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-segmented::-webkit-scrollbar {
  display: none;
}

.dash-segmented button {
  height: 2.8rem;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-subdue);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.dash-segmented button[aria-pressed='true'] {
  background: var(--color-widget-background);
  color: var(--color-text-highlight);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.dash-segmented button:active {
  transform: scale(0.97);
}

.dash-loading-note {
  margin: 18px 0 10px;
}

.dash-podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 12px;
  max-width: 460px;
  margin: 22px auto 18px;
}

.dash-podium-place {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  text-align: center;
}

.dash-podium-place.is-rank-1 { --medal: var(--gold); }
.dash-podium-place.is-rank-2 { --medal: var(--silver); }
.dash-podium-place.is-rank-3 { --medal: var(--bronze); }

.dash-podium-avatar {
  width: 52px;
  height: 52px;
  border: 3px solid var(--medal);
  border-radius: 50%;
  object-fit: cover;
}

.is-rank-1 .dash-podium-avatar {
  width: 68px;
  height: 68px;
}

.dash-podium-crown {
  position: absolute;
  top: -20px;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--gold);
}

.dash-podium-name {
  max-width: 100%;
  overflow: hidden;
  color: var(--color-text-highlight);
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.is-me .dash-podium-name {
  color: var(--color-positive);
}

.dash-podium-score {
  color: var(--color-text-subdue);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}

.dash-podium-step {
  display: grid;
  place-items: center;
  width: 100%;
  margin-top: 6px;
  border-radius: 8px 8px 2px 2px;
  background: color-mix(in srgb, var(--medal) 20%, transparent);
  color: var(--medal);
  font-size: 2rem;
  font-weight: 800;
  transform-origin: bottom;
}

.is-rank-1 .dash-podium-step { height: 64px; }
.is-rank-2 .dash-podium-step { height: 46px; }
.is-rank-3 .dash-podium-step { height: 32px; }

.dash-board {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.dash-board ~ .dash-more,
.dash-board ~ .dash-footnote {
  display: block;
  max-width: 640px;
  margin-inline: auto;
  padding-inline: 8px;
}

.dash-board li {
  display: grid;
  grid-template-columns: 2.4rem 3.2rem minmax(0, 1fr) 4.6rem 4.6rem minmax(40px, 120px) 3.2rem;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
}

.dash-board li.is-me {
  background: color-mix(in srgb, var(--color-positive) 12%, transparent);
}

.dash-board-rank,
.dash-board-score {
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dash-board-rank {
  color: var(--color-text-subdue);
}

.dash-board-score {
  color: var(--color-text-highlight);
}

.dash-board-name {
  overflow: hidden;
  color: var(--color-text-highlight);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dash-board-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-subdue);
  font-variant-numeric: tabular-nums;
}

.dash-board-stat svg {
  width: 1.4rem;
  height: 1.4rem;
}

.dash-board-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--color-widget-background-highlight);
}

.dash-board-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--color-positive);
  transform: scaleX(var(--w));
  transform-origin: left;
}

/* Pull requests under the 2-approval rule */

.dash-pill {
  display: inline-block;
  min-width: 2rem;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
  font-size: 1.15rem;
  font-weight: normal;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dash-pill.is-good {
  background: color-mix(in srgb, var(--color-positive) 18%, transparent);
  color: var(--color-positive);
}

.dash-tag.is-accent {
  background: color-mix(in srgb, var(--color-positive) 16%, transparent);
  color: var(--color-positive);
}

.dash-tag.is-warn {
  background: color-mix(in srgb, var(--dash-warning) 16%, transparent);
  color: var(--dash-warning);
}

.dash-tag.is-bad {
  background: color-mix(in srgb, var(--color-negative) 14%, transparent);
  color: var(--color-negative);
}

.pr-age {
  flex-shrink: 0;
  min-width: 5.2rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--dash-warning) 16%, transparent);
  color: var(--dash-warning);
  font-size: 1.15rem;
  font-weight: normal;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.pr-age.is-old {
  background: color-mix(in srgb, var(--color-negative) 14%, transparent);
  color: var(--color-negative);
}

.pr-need.is-need-0 {
  background: color-mix(in srgb, var(--color-positive) 16%, transparent);
  color: var(--color-positive);
}

.pr-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pr-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
}

.pr-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.pr-title,
.pr-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pr-title {
  color: var(--color-text-highlight);
  font-weight: 700;
}

.pr-sub {
  color: var(--color-text-subdue);
  font-size: 1.2rem;
}

.pr-approvals {
  display: flex;
  flex-shrink: 0;
}

.pr-approvals .sp-avatar + .sp-avatar {
  margin-left: -6px;
}

.pr-approvals .sp-avatar {
  box-shadow: 0 0 0 2px var(--color-widget-background);
}

.pr-checks {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-positive) 16%, transparent);
  color: var(--color-positive);
}

.pr-checks.is-none {
  background: var(--color-widget-background-highlight);
  color: var(--color-text-subdue);
}

.pr-checks svg {
  width: 1.3rem;
  height: 1.3rem;
}

.pr-need {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 8.4rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: normal;
}

.pr-need svg {
  width: 1.3rem;
  height: 1.3rem;
}

.pr-need.is-need-2 {
  background: color-mix(in srgb, var(--dash-warning) 18%, transparent);
  color: var(--dash-warning);
}

.pr-need.is-need-1 {
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
}

.pr-need.is-ready {
  background: color-mix(in srgb, var(--color-positive) 16%, transparent);
  color: var(--color-positive);
}

.is-entering.pr-list li {
  animation: dash-rise 340ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}

/* Deploy health */

.dash-deploy + .dash-deploy {
  margin-top: 18px;
}

.dash-deploy-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.dash-deploy-name {
  color: var(--color-text-highlight);
  font-weight: 800;
}

.dash-deploy-rate {
  font-size: 2.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-deploy-runs {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin: 8px 0 4px;
}

.dash-run {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--color-widget-background-highlight);
  transition: transform 160ms var(--ease-out);
}

.dash-run.is-success { background: var(--color-positive); }
.dash-run.is-failure,
.dash-run.is-timed_out,
.dash-run.is-startup_failure { background: var(--color-negative); }
.dash-run.is-cancelled,
.dash-run.is-skipped { background: var(--dash-track); }

.dash-run.is-running {
  background: var(--dash-warning);
  animation: dash-pulse 1.4s ease-in-out infinite;
}

/* Spotify player */

.sp-player {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sp-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sp-art {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-widget-background-highlight);
}

.sp-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A solid color faded as one layer: a see-through stroke color shows where the stems cross the circles. */
.sp-art-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--color-text-highlight);
}

.sp-art-empty svg {
  width: 38%;
  height: 38%;
  opacity: 0.27;
}

.sp-player.has-track .sp-art-empty {
  display: none;
}

.sp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sp-titles {
  flex: 1;
  min-width: 0;
}

.sp-title,
.sp-artist {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sp-title {
  color: var(--color-text-highlight);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}

.sp-artist {
  color: var(--color-text-subdue);
  font-size: 1.4rem;
}

.sp-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.sp-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.6rem;
  height: 3.6rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-subdue);
  cursor: pointer;
  transition: color 150ms ease, transform 160ms var(--ease-out);
}

.sp-button svg {
  width: 2rem;
  height: 2rem;
}

.sp-button:active {
  transform: scale(0.9);
}

.sp-play {
  width: 4.4rem;
  height: 4.4rem;
  background: var(--color-text-highlight);
  color: var(--color-background);
}

.sp-play:active {
  transform: scale(0.94);
}

.sp-play svg {
  position: absolute;
  transition: opacity 160ms ease, transform 200ms var(--ease-out), filter 160ms ease;
}

/* Play and pause swap with a short blur so the two icons read as one morph. */
.sp-icon-pause,
.is-playing .sp-icon-play {
  opacity: 0;
  filter: blur(2px);
  transform: scale(0.6);
}

.is-playing .sp-icon-pause {
  opacity: 1;
  filter: none;
  transform: none;
}

.sp-toggleable.is-on {
  color: var(--color-positive);
}

.sp-toggleable.is-on::after {
  content: '';
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.sp-icon-repeat-one,
.is-one .sp-icon-repeat {
  display: none;
}

.is-one .sp-icon-repeat-one {
  display: block;
}

.sp-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-subdue);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.sp-progress {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--dash-track);
  cursor: pointer;
}

/* A taller hit area than the 4px track. */
.sp-progress::after {
  content: '';
  position: absolute;
  inset: -8px 0;
}

.sp-progress:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 6px;
}

.sp-progress-fill {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: var(--color-text-highlight);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms linear, background-color 150ms ease;
}

.sp-player:not(.has-track) .sp-controls,
.sp-player:not(.has-track) .sp-timeline,
.sp-player.no-controls .sp-controls {
  opacity: 0.4;
  pointer-events: none;
}

.sp-note {
  margin: 0;
  color: var(--color-text-subdue);
  font-size: 1.2rem;
}

.sp-eq {
  display: inline-flex;
  flex-shrink: 0;
  align-items: flex-end;
  gap: 2px;
  width: 14px;
  height: 14px;
  transition: opacity 200ms ease;
}

/* Paused, the three short bars read as a "more" menu, so they show only while music plays. */
.sp-player:not(.is-playing) .sp-eq {
  opacity: 0;
}

.sp-eq i {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background: var(--color-text-subdue);
  transform: scaleY(0.3);
  transform-origin: bottom;
  transition: background-color 200ms ease;
}

.is-playing .sp-eq i,
.sp-eq.is-on i {
  background: var(--color-positive);
  animation: sp-eq 0.9s ease-in-out infinite alternate;
}

.is-playing .sp-eq i:nth-child(2),
.sp-eq.is-on i:nth-child(2) {
  animation-duration: 0.7s;
  animation-delay: -0.3s;
}

.is-playing .sp-eq i:nth-child(3),
.sp-eq.is-on i:nth-child(3) {
  animation-duration: 1.1s;
  animation-delay: -0.5s;
}

.sp-player--hero {
  display: grid;
  grid-template-columns: minmax(200px, 340px) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
}

/* The controls center over the progress bar, so the bar is capped to keep them near the title. */
.sp-player--hero .sp-body {
  gap: 20px;
  max-width: 560px;
}

.sp-player--hero .sp-title {
  font-size: 3.4rem;
  white-space: normal;
}

.sp-player--hero .sp-artist {
  font-size: 1.8rem;
}

.sp-player--hero .sp-controls {
  justify-content: center;
  gap: 20px;
}

@media (max-width: 800px) {
  .sp-player--hero {
    grid-template-columns: minmax(112px, 200px) minmax(0, 1fr);
    gap: 20px;
  }

  .sp-player--hero .sp-title {
    font-size: 2.4rem;
  }

  .sp-player--hero .sp-artist {
    font-size: 1.5rem;
  }
}

/* A phone stacks the cover over the title, the way Spotify's own app does. */
@media (max-width: 520px) {
  .sp-player--hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Spotify lists: up next, recently played, room, search results, team */

.sp-list,
.sp-room,
.sp-results,
.sp-team {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-list li,
.sp-room li,
.sp-results li,
.sp-team li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
}

.sp-list img,
.sp-room li > img,
.sp-results img {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.sp-list-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sp-list-title,
.sp-list-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sp-list-title {
  color: var(--color-text-highlight);
  font-weight: 700;
}

.sp-list-sub,
.sp-list-meta {
  color: var(--color-text-subdue);
  font-size: 1.2rem;
}

.sp-list-meta {
  font-variant-numeric: tabular-nums;
}

.sp-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.sp-avatar--small {
  width: 22px;
  height: 22px;
  font-size: 1rem;
}

.sp-avatar--initial {
  display: inline-grid;
  place-items: center;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
  font-weight: 800;
}

.sp-team-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sp-team-name {
  color: var(--color-text-base);
  font-weight: 700;
}

.sp-team li.is-playing .sp-team-name {
  color: var(--color-text-highlight);
}

.sp-team-cover {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.sp-room-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sp-results {
  margin-bottom: 12px;
  padding: 6px;
  border-radius: 10px;
  background: var(--color-widget-background-highlight);
}

.sp-room li.is-next {
  background: color-mix(in srgb, var(--color-positive) 8%, transparent);
}

.sp-vote {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 4.2rem;
  border: 1px solid var(--color-widget-content-border);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-subdue);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.sp-vote svg {
  width: 1.6rem;
  height: 1.6rem;
  transition: transform 200ms var(--ease-out);
}

.sp-vote.is-on {
  border-color: color-mix(in srgb, var(--color-positive) 45%, transparent);
  background: color-mix(in srgb, var(--color-positive) 10%, transparent);
  color: var(--color-positive);
}

.sp-vote.is-on svg {
  transform: translateY(-2px);
}

.sp-vote:active:not(:disabled) {
  transform: scale(0.94);
}

.sp-vote:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Hover only where a pointer can hover, so taps on touch screens leave no stuck state. */
@media (hover: hover) and (pointer: fine) {
  /* The play button keeps its own colors: its icon is the background color on a light disc. */
  .app-theme-switch button:hover,
  .sp-button:not(.sp-play):hover,
  .dash-tabs button:hover {
    color: var(--color-text-highlight);
  }

  .sp-play:hover {
    transform: scale(1.04);
  }

  .sp-progress:hover .sp-progress-fill {
    background: var(--color-positive);
  }

  .sp-list li:hover,
  .sp-results li:hover,
  .dash-board li:not(.is-me):hover {
    background: var(--color-widget-background-highlight);
  }

  .dash-run:hover {
    transform: scale(1.18);
  }

  .dash-bars:hover i {
    opacity: 0.25;
  }

  .dash-bars:hover .dash-bar:hover i {
    opacity: 1;
  }

  .dash-bar:hover::after {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }

  .dash-bar.is-start:hover::after,
  .dash-bar.is-end:hover::after {
    transform: translate(0, 0) scale(1);
  }

  .dash-segmented button:not([aria-pressed='true']):hover {
    color: var(--color-text-highlight);
  }
}

/* Entrance motion: first render and tab switches only (the .is-entering class), never a poll's redraw. */

.widget {
  animation: dash-rise 420ms var(--ease-out) backwards;
  animation-delay: calc((var(--widget-index, 0) + var(--column-index, 0)) * 45ms);
}

.page.content-ready > .page-content {
  animation: none;
}

.page-column:nth-child(2) { --column-index: 1; }
.page-column:nth-child(3) { --column-index: 2; }
.page-column > .widget:nth-child(2) { --widget-index: 1; }
.page-column > .widget:nth-child(3) { --widget-index: 2; }
.page-column > .widget:nth-child(4) { --widget-index: 3; }

.is-entering .dash-tile {
  animation: dash-rise 420ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.is-entering .dash-bars i {
  animation: dash-grow 520ms var(--ease-out) backwards;
  animation-delay: calc(220ms + var(--i, 0) * 30ms);
}

.is-entering .dash-podium-place {
  animation: dash-rise 480ms var(--ease-out) backwards;
}

.is-entering .dash-podium-place.is-rank-2 { animation-delay: 90ms; }
.is-entering .dash-podium-place.is-rank-3 { animation-delay: 180ms; }

.is-entering .dash-podium-step {
  animation: dash-grow 520ms var(--ease-out) backwards;
  animation-delay: 120ms;
}

.is-entering .dash-board li,
.is-entering.sp-list li,
.is-entering.sp-room li,
.is-entering.sp-results li,
.is-entering .sp-team li,
.sp-room li.is-new {
  animation: dash-rise 340ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.is-entering .dash-board li {
  animation-delay: calc(240ms + var(--i, 0) * 30ms);
}

.is-entering .dash-board-bar i {
  animation: dash-grow-x 600ms var(--ease-out) backwards;
  animation-delay: calc(320ms + var(--i, 0) * 30ms);
}

.is-entering .dash-run:not(.is-running) {
  animation: dash-pop 300ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 15ms);
}

/* An automatic reload keeps the screen still. */
:root[data-quiet-load] .widget {
  animation: none;
}

@keyframes dash-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes dash-grow {
  from {
    transform: scaleY(0.04);
  }
}

@keyframes dash-grow-x {
  from {
    transform: scaleX(0.02);
  }
}

@keyframes dash-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes dash-pulse {
  50% {
    opacity: 0.45;
  }
}

@keyframes dash-shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes sp-eq {
  from {
    transform: scaleY(0.25);
  }

  to {
    transform: scaleY(1);
  }
}

@keyframes dash-fade {
  from {
    opacity: 0;
  }
}

/* Reduced motion keeps fades that help reading and drops movement. */
@media (prefers-reduced-motion: reduce) {
  .widget,
  .is-entering .dash-tile,
  .is-entering .dash-board li,
  .is-entering .sp-team li,
  .sp-room li.is-new {
    animation: dash-fade 200ms ease backwards;
  }

  .is-entering .dash-bars i,
  .is-entering .dash-podium-place,
  .is-entering .dash-podium-step,
  .is-entering .dash-board-bar i,
  .is-entering .dash-run,
  .is-playing .sp-eq i,
  .sp-eq.is-on i,
  .dash-run.is-running,
  .dash-skeleton::after,
  .dash-skeleton-row::after {
    animation: none;
  }

  .app-theme-switch.is-ready::before,
  .sp-progress-fill {
    transition: none;
  }
}

/* Header: settings and account */

.header-icon {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 8px;
  color: var(--color-text-subdue);
  transition: color 150ms ease, background-color 150ms ease, transform 160ms var(--ease-out);
}

.header-icon svg {
  width: 1.8rem;
  height: 1.8rem;
}

.header-icon[aria-current='page'] {
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
}

.header-icon:active {
  transform: scale(0.94);
}

[data-mount='user-menu'] {
  position: relative;
}

.user-button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), box-shadow 150ms ease;
}

.user-button .sp-avatar {
  width: 3.2rem;
  height: 3.2rem;
}

.user-button:active {
  transform: scale(0.95);
}

.user-button:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

/* The menu grows from the avatar it belongs to. */
.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--color-popover-border);
  border-radius: 12px;
  background: var(--color-popover-background);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  transform-origin: top right;
  animation: dash-menu-in 150ms var(--ease-out);
}

/* The light theme's header is navy, but its menu opens on the page, so it takes the page's ink. */
:root[data-app-theme='light'] .header .user-menu {
  --color-text-highlight: #090a0d;
  --color-text-subdue: rgba(9, 10, 13, 0.62);
  --color-widget-background-highlight: rgba(9, 10, 13, 0.05);
}

.user-menu-head {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--color-separator);
}

.user-menu-name {
  color: var(--color-text-highlight);
  font-weight: 800;
}

.user-menu-email,
.user-menu-row {
  color: var(--color-text-subdue);
  font-size: 1.2rem;
}

.user-menu-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
}

.user-menu-row svg {
  width: 1.4rem;
  height: 1.4rem;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--color-text-highlight);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .header-icon:hover {
    color: var(--color-text-highlight);
  }

  .user-menu-item:hover {
    background: var(--color-widget-background-highlight);
  }
}

@keyframes dash-menu-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
}

/* Callout: link GitHub */

.dash-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--color-positive) 35%, transparent);
  border-radius: var(--dash-radius);
  background: color-mix(in srgb, var(--color-positive) 8%, var(--color-widget-background));
  animation: dash-rise 420ms var(--ease-out) backwards;
}

.dash-callout-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-callout-title {
  color: var(--color-text-highlight);
  font-size: 1.5rem;
  font-weight: 800;
}

.github-form {
  display: flex;
  gap: 8px;
}

.dash-slot:has(> :empty) {
  display: none;
}

/* Settings */

.page-column.settings-column {
  max-width: 760px;
  margin: 0 auto;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.settings-title {
  color: var(--color-text-highlight);
  font-size: 1.5rem;
  font-weight: 800;
}

.settings-sub {
  color: var(--color-text-subdue);
  font-size: 1.25rem;
}

.settings-row + .settings-sub,
.settings-themes + .settings-sub {
  margin-top: 12px;
}

.settings-avatar {
  width: 4.4rem;
  height: 4.4rem;
}

.settings-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 4.4rem;
  height: 4.4rem;
  border-radius: 50%;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
}

.settings-icon svg {
  width: 2rem;
  height: 2rem;
}

.settings-themes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.settings-theme {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 2px solid var(--color-widget-content-border);
  border-radius: 12px;
  background: none;
  color: var(--color-text-subdue);
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}

.settings-theme[aria-checked='true'] {
  border-color: var(--color-positive);
  color: var(--color-text-highlight);
}

.settings-theme:active {
  transform: scale(0.98);
}

.settings-theme-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.settings-theme-label svg {
  width: 1.5rem;
  height: 1.5rem;
}

.settings-theme-preview {
  display: flex;
  gap: 6px;
  height: 64px;
  padding: 8px;
  border-radius: 8px;
}

.settings-theme-preview i {
  flex: 1;
  border-radius: 5px;
}

.settings-theme-preview.is-dark { background: #15161b; }
.settings-theme-preview.is-dark i { background: #1d1e24; }
.settings-theme-preview.is-light { background: #f4f4f5; }
.settings-theme-preview.is-light i { background: #ffffff; box-shadow: 0 1px 2px rgba(9, 10, 13, 0.08); }
/* System stacks the dark preview on the light one and cuts it on the diagonal. */
.settings-theme-split {
  position: relative;
  display: block;
  height: 64px;
}

.settings-theme-split .settings-theme-preview {
  position: absolute;
  inset: 0;
}

.settings-theme-split .is-dark {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* Room people and chat */

.room-people {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.room-people li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-person-name {
  color: var(--color-text-highlight);
  font-weight: 700;
}

.is-entering .room-people li {
  animation: dash-rise 340ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
  max-height: max(240px, calc(100vh - 470px));
  margin: 0 -4px;
  padding: 0 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.chat-list li {
  position: relative;
  display: flex;
  gap: 8px;
}

.chat-body {
  min-width: 0;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.chat-name {
  color: var(--color-text-highlight);
  font-size: 1.25rem;
  font-weight: 800;
}

.chat-time {
  color: var(--color-text-subdue);
  font-size: 1.1rem;
}

.chat-text {
  color: var(--color-text-paragraph);
  overflow-wrap: anywhere;
}

.chat-delete {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-subdue);
  opacity: 0;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.chat-delete svg {
  width: 1.3rem;
  height: 1.3rem;
}

.chat-list li:focus-within .chat-delete {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .chat-list li:hover .chat-delete {
    opacity: 1;
  }
}

@media (hover: none) {
  .chat-delete {
    opacity: 1;
  }
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 3.4rem;
  padding: 0 12px;
  border: 1px solid var(--color-widget-content-border);
  border-radius: 8px;
  outline: none;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.chat-form input:focus {
  border-color: var(--color-positive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-positive) 25%, transparent);
}

/* Clock */

.clock-main {
  display: flex;
  flex-direction: column;
}

.clock-time {
  color: var(--color-text-highlight);
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.clock-date {
  color: var(--color-text-subdue);
}

.clock-zone {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-separator);
  color: var(--color-text-subdue);
  font-variant-numeric: tabular-nums;
}

/* Listeners see the song and its progress; only admins get the controls. */
.sp-player.is-listener .sp-controls {
  display: none;
}

/* Spotify tab modes: My Spotify or the company room */

:root[data-spotify-mode='me'] .mode-room,
:root[data-spotify-mode='room'] .mode-me {
  display: none;
}

.page-toolbar {
  margin-bottom: var(--widget-gap);
}

.spotify-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spotify-join {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.dash-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
  font-size: 1.25rem;
}

.dash-status.is-good {
  background: color-mix(in srgb, var(--color-positive) 14%, transparent);
  color: var(--color-positive);
}

.dash-status.is-warn {
  background: color-mix(in srgb, var(--dash-warning) 14%, transparent);
  color: var(--dash-warning);
}

.dash-status.is-bad {
  background: color-mix(in srgb, var(--color-negative) 12%, transparent);
  color: var(--color-negative);
}

.settings-notice {
  margin-bottom: 12px;
  text-align: left;
}

/* Tour: ported from api-core's app-tour.vue. Sizes converted from its 16px rem to this page's 10px rem. */

:root[data-app-theme='dark'] {
  --dash-shadow-menu: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
}

:root[data-app-theme='light'] {
  --dash-shadow-menu: 0 8px 24px rgba(9, 10, 13, 0.08), 0 2px 6px rgba(9, 10, 13, 0.06);
}

.app-tour {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.app-tour__ring {
  position: fixed;
  top: var(--ring-top);
  left: var(--ring-left);
  width: var(--ring-width);
  height: var(--ring-height);
  border-radius: var(--ring-radius);
  box-shadow:
    0 0 0 2px var(--color-positive),
    0 0 0 6px color-mix(in srgb, var(--color-positive) 16%, transparent);
  pointer-events: none;
}

.app-tour__card {
  position: fixed;
  top: var(--tour-top);
  left: var(--tour-left);
  width: 32rem;
  max-width: calc(100vw - 32px);
  border: 1px solid var(--color-popover-border);
  border-radius: 12px;
  background: var(--color-popover-background);
  box-shadow: var(--dash-shadow-menu);
  color: var(--color-text-paragraph);
  font-size: 1.3rem;
  font-weight: 500;
}

.app-tour__card.has-arrow-top { transform-origin: var(--tour-arrow) top; }
.app-tour__card.has-arrow-bottom { transform-origin: var(--tour-arrow) bottom; }
.app-tour__card.has-arrow-left { transform-origin: left var(--tour-arrow); }
.app-tour__card.has-arrow-right { transform-origin: right var(--tour-arrow); }

/* A square turned on its corner, half outside the card, with the card's surface and hairline on its outer sides */
.app-tour__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--color-popover-border);
  background: var(--color-popover-background);
  transform: rotate(45deg);
}

.has-arrow-top .app-tour__arrow {
  top: -7px;
  left: calc(var(--tour-arrow) - 6px);
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 2px;
}

.has-arrow-bottom .app-tour__arrow {
  bottom: -7px;
  left: calc(var(--tour-arrow) - 6px);
  border-top: 0;
  border-left: 0;
  border-bottom-right-radius: 2px;
}

.has-arrow-left .app-tour__arrow {
  top: calc(var(--tour-arrow) - 6px);
  left: -7px;
  border-top: 0;
  border-right: 0;
  border-bottom-left-radius: 2px;
}

.has-arrow-right .app-tour__arrow {
  top: calc(var(--tour-arrow) - 6px);
  right: -7px;
  border-bottom: 0;
  border-left: 0;
  border-top-right-radius: 2px;
}

.app-tour__body,
.app-tour__footer {
  line-height: 1.45;
}

.app-tour__body {
  padding: 16px 16px 14px;
}

.app-tour__title {
  margin: 0;
  color: var(--color-text-highlight);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.25;
}

.app-tour__text {
  margin: 6px 0 0;
}

.app-tour__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-popover-border);
}

.app-tour__count {
  margin-right: auto;
  color: var(--color-text-subdue);
  font-variant-numeric: tabular-nums;
}

.app-tour__button {
  height: 3.2rem;
  padding: 0 12px;
  border: 1px solid var(--color-widget-content-border);
  border-radius: 8px;
  background: var(--color-widget-background);
  color: var(--color-text-highlight);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

.app-tour__button.is-primary {
  border-color: transparent;
  background: var(--dash-accent-fill);
  color: var(--dash-accent-ink);
}

.app-tour__button:active {
  transform: scale(0.97);
}

.app-tour__button:focus-visible {
  outline: 2px solid var(--color-positive);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .app-tour__button:not(.is-primary):hover {
    background: var(--color-widget-background-highlight);
  }
}

/* First sign-in setup: the tour card's surface, footer and buttons, centered over a dimmed page */

.wizard-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 10, 13, 0.55);
}

.wizard {
  width: min(100%, 44rem);
  overflow: hidden;
  border: 1px solid var(--color-popover-border);
  border-radius: 12px;
  background: var(--color-popover-background);
  box-shadow: var(--dash-shadow-menu);
  color: var(--color-text-paragraph);
  font-size: 1.3rem;
  font-weight: 500;
}

.wizard-progress {
  display: flex;
  gap: 6px;
  padding: 16px 20px 0;
}

.wizard-progress i {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--color-widget-background-highlight);
  transition: background-color 220ms ease;
}

.wizard-progress i.is-done,
.wizard-progress i.is-current {
  background: var(--color-positive);
}

.wizard-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 22px 20px 20px;
  line-height: 1.5;
}

.wizard-icon {
  display: grid;
  place-items: center;
  width: 4.4rem;
  height: 4.4rem;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--color-widget-background-highlight);
  color: var(--color-text-highlight);
}

.wizard-icon svg {
  width: 2.2rem;
  height: 2.2rem;
}

.wizard-icon.is-logo {
  overflow: hidden;
  border-radius: 50%;
  background: none;
}

.wizard-icon.is-logo img {
  width: 100%;
  height: 100%;
  transform: scale(1.16);
}

.wizard-icon.is-done {
  background: color-mix(in srgb, var(--color-positive) 16%, transparent);
  color: var(--color-positive);
}

.wizard-title {
  margin: 0;
  color: var(--color-text-highlight);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
}

.wizard-text {
  margin: 0;
}

.wizard-action {
  margin-top: 8px;
}

.wizard-action .dash-status svg {
  width: 1.4rem;
  height: 1.4rem;
}

.wizard .app-tour__footer {
  padding: 14px 20px;
}

@media (prefers-reduced-motion: reduce) {
  .app-tour__ring {
    transition: none;
  }
}

/* Narrow screens stack the columns (base.css): the main column leads, and side cards share rows. */
@media (max-width: 1190px) {
  .page-column-full {
    order: -1;
  }

  .page-column-small {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    align-items: start;
  }

  /* The side player turns sideways, so its cover stays small. */
  .sp-player--mini {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
  }
}

@media (max-width: 600px) {
  /* Settings has the same theme choice, and a phone header has no room for it. */
  .header .app-theme-switch {
    display: none;
  }

  .header {
    gap: 1.2rem;
    padding: 0 12px;
  }

  .desktop-navigation {
    gap: 1.6rem;
  }

  /* The room search takes a row of its own, with the skip button under it. */
  .sp-room-head {
    flex-wrap: wrap;
  }

  .sp-room-head .dash-search {
    flex-basis: 100%;
  }

  /* The Listen along note wraps beside its button instead of on a line of its own. */
  .spotify-join {
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
  }

  .spotify-join .settings-sub {
    flex: 1;
    min-width: 0;
  }
}
