/* Room icons and the Desk / Local / Stream / Away rows (redesign 2026-11).
   The emoji stay in the markup (controlState.js still writes them, and
   they remain the text fallback); on screen they are replaced by drawn
   icons with one colour per mode across the product:
   Desk gold, Local teal, Stream blue, Away orange. */

:root {
  --sw-mode-desk: #f1c979;
  --sw-mode-local: #6fd3c0;
  --sw-mode-stream: #7db8ff;
  --sw-mode-away: #f29b5c;
  /* Desk: three faders on a tilted base. */
  --sw-ico-desk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 20h15l-1.6-4H6.1Z'/%3E%3Cpath d='M8 4v9M12 4v9M16 4v9'/%3E%3Cpath d='M6.6 7h2.8M10.6 10.5h2.8M14.6 6h2.8'/%3E%3C/svg%3E");
  /* Local: headphones (listen on this device only). */
  --sw-ico-local: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 15v-3a8 8 0 0 1 16 0v3'/%3E%3Crect x='3.5' y='14' width='4' height='6' rx='1.5'/%3E%3Crect x='16.5' y='14' width='4' height='6' rx='1.5'/%3E%3C/svg%3E");
  /* Stream: a screen with play and two waves. */
  --sw-ico-stream: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='13' height='11' rx='2'/%3E%3Cpath d='M7.5 8.5v4l3.4-2Z'/%3E%3Cpath d='M18.5 8a4.5 4.5 0 0 1 0 5M21 5.8a8 8 0 0 1 0 9.4'/%3E%3Cpath d='M6 20h7'/%3E%3C/svg%3E");
  /* Away: a cup with steam. */
  --sw-ico-away: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 10h11v4.5a5 5 0 0 1-5 5h-1a5 5 0 0 1-5-5Z'/%3E%3Cpath d='M15.5 11.5h1.6a2.4 2.4 0 0 1 0 4.8h-1.9'/%3E%3Cpath d='M8.5 3.5v3M12 3.5v3'/%3E%3C/svg%3E");
}

/* Shared: an icon box whose emoji is hidden and replaced by a mask. */
html body .room-state-list .room-card-icon,
html body .topbar .top-local-room-state .local-mode-icon {
  position: relative;
  color: transparent !important;
  font-size: 0 !important;
  --sw-mode: var(--sw-mode-desk);
  --sw-ico: var(--sw-ico-desk);
  border: 1px solid color-mix(in srgb, var(--sw-mode) 40%, transparent) !important;
  background: color-mix(in srgb, var(--sw-mode) 12%, #151411) !important;
}

html body .room-state-list .room-card-icon::before,
html body .topbar .top-local-room-state .local-mode-icon::before {
  content: "";
  position: absolute;
  inset: 18%;
  background: var(--sw-mode);
  -webkit-mask: var(--sw-ico) center / contain no-repeat;
  mask: var(--sw-ico) center / contain no-repeat;
}

/* Top chip follows the current mode (classes set by controlState.js). */
html body .topbar .top-local-room-state.mode-room .local-mode-icon {
  --sw-mode: var(--sw-mode-local);
  --sw-ico: var(--sw-ico-local);
}

html body .topbar .top-local-room-state.mode-stream .local-mode-icon {
  --sw-mode: var(--sw-mode-stream);
  --sw-ico: var(--sw-ico-stream);
}

html body .topbar .top-local-room-state.mode-away .local-mode-icon {
  --sw-mode: var(--sw-mode-away);
  --sw-ico: var(--sw-ico-away);
}

/* Room panel rows, in markup order: Desk, Local, Stream, Away. */
html body .room-state-list .room-state-row:nth-child(1) { --sw-mode: var(--sw-mode-desk); --sw-ico: var(--sw-ico-desk); }
html body .room-state-list .room-state-row:nth-child(2) { --sw-mode: var(--sw-mode-local); --sw-ico: var(--sw-ico-local); }
html body .room-state-list .room-state-row:nth-child(3) { --sw-mode: var(--sw-mode-stream); --sw-ico: var(--sw-ico-stream); }
html body .room-state-list .room-state-row:nth-child(4) { --sw-mode: var(--sw-mode-away); --sw-ico: var(--sw-ico-away); }

html body .room-state-list .room-state-row .room-card-icon {
  --sw-mode: inherit;
  --sw-ico: inherit;
}

/* Compact rows: about 52 px each instead of about 70. */
@media (min-width: 761px) {
  html body .room-state-list {
    gap: 0.4rem;
  }

  html body .room-state-list .room-state-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto !important;
    gap: 0.6rem !important;
    margin-bottom: 0 !important;
    padding: 0.45rem 0.55rem 0.45rem 0.6rem !important;
    border: 1px solid rgba(255, 248, 232, 0.08) !important;
    border-left: 3px solid color-mix(in srgb, var(--sw-mode) 70%, transparent) !important;
    border-radius: 0.55rem !important;
    background: rgba(255, 248, 232, 0.025) !important;
  }

  html body .room-state-list .room-state-row .room-card-icon {
    width: 2rem !important;
    height: 2rem !important;
    border-radius: 0.55rem !important;
  }

  html body .room-state-list .room-state-row strong {
    font-size: 0.86rem !important;
    line-height: 1.2 !important;
  }

  html body .room-state-list .room-state-row > div > span {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(255, 248, 232, 0.6) !important;
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  html body .room-state-list .room-state-row .small-button {
    min-width: 5.6rem;
    height: 1.9rem !important;
    padding: 0 0.7rem !important;
    font-size: 0.74rem !important;
  }
}
