/* ============================================================
   sift · retro desktop — shared styles
   ============================================================ */

:root {
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --pixel: "VT323", "IBM Plex Mono", ui-monospace, monospace;
  --bg: #000;
  --fg: #e8e8e8;
  --accent: #e8e8e8;
  --dim: #7a7a7a;
  --wave: #ff8a4c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  font-family: var(--mono);
  color: #e8e8e8;
}

/* Desktop container */
.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  user-select: none;
  -webkit-user-select: none;
  image-rendering: pixelated;
}

/* Themes */
.theme-mono {
  --bg: #000;
  --fg: #e8e8e8;
  --accent: #e8e8e8;
  --dim: #7a7a7a;
  --wave: #ff8a4c;
}

/* Menu bar */
.menubar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 22px;
  padding: 0 12px;
  border-bottom: 1px solid var(--fg);
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
  background: var(--bg);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
}
.mb-logo {
  margin-right: 4px;
}
.mb-item {
  cursor: default;
  padding: 0 3px;
  margin: 0 -3px;
}
.mb-item:hover,
.mb-item.open {
  background: var(--fg);
  color: var(--bg);
}
.mb-spacer {
  flex: 1;
}
.mb-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
  text-transform: uppercase;
}
.mb-clock {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* Dropdown menu */
.mb-dropdown {
  position: absolute;
  top: 22px;
  min-width: 200px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  box-shadow: 2px 2px 0 var(--fg);
  font-family: var(--pixel);
  font-size: 16px;
  z-index: 200;
  padding: 2px 0;
  isolation: isolate;
}
.mb-dropdown-item {
  padding: 2px 14px 2px 18px;
  cursor: default;
  position: relative;
  white-space: nowrap;
}
.mb-dropdown-item:hover {
  background: var(--fg);
  color: var(--bg);
}
.mb-dropdown-item.disabled {
  color: var(--dim);
  pointer-events: none;
}
.mb-dropdown-item .check {
  position: absolute;
  left: 6px;
}
.mb-dropdown-sep {
  border-top: 1px solid var(--fg);
  margin: 2px 0;
}

/* Desktop surface */
.desktop-surface {
  position: absolute;
  inset: 22px 0 64px 0;
  overflow: hidden;
}
.desktop-surface.dropping {
  outline: 2px dashed var(--wave);
  outline-offset: -8px;
  background: rgba(255, 138, 76, 0.04);
}

/* Icons */
.dicon {
  position: absolute;
  width: 80px;
  text-align: center;
  cursor: default;
  color: var(--fg);
  touch-action: none;
}
.dicon-art {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.dicon-label {
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  margin-top: 4px;
  padding: 1px 3px;
  display: inline-block;
  letter-spacing: 0.02em;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dicon.sel .dicon-label,
.dicon.drag .dicon-label {
  background: var(--fg);
  color: var(--bg);
}
.dicon.drag {
  opacity: 0.9;
}

/* Row drag ghost */
.row-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 300;
  width: 40px;
  height: 40px;
  color: var(--fg);
  background: var(--bg);
  border: 1px dashed var(--fg);
  padding: 2px;
  opacity: 0.9;
  display: grid;
  place-items: center;
}

/* Marquee selection rectangle */
.marquee {
  position: absolute;
  border: 1px dashed var(--fg);
  background: rgba(255, 138, 76, 0.08);
  pointer-events: none;
  z-index: 5;
}

/* Folder drop target */
.folder-target {
  position: absolute;
  border: 1px dashed var(--fg);
  pointer-events: none;
  animation: ants 0.6s linear infinite;
}
@keyframes ants {
  0% {
    border-style: dashed;
  }
  50% {
    border-style: dotted;
  }
  100% {
    border-style: dashed;
  }
}

/* Overlay layer (windows, dialogs) */
.overlay-layer {
  position: absolute;
  inset: 22px 0 64px 0;
  pointer-events: none;
  z-index: 30;
}
.overlay-layer > * {
  pointer-events: auto;
}

/* Window */
.rwindow {
  position: absolute;
  min-width: 280px;
  min-height: 140px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  box-shadow: 3px 3px 0 var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  display: flex;
  flex-direction: column;
}
.rw-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 0 50%, var(--fg) 50% 60%, transparent 60% 70%, var(--fg) 70% 80%, transparent 80% 90%, var(--fg) 90% 100%);
  z-index: 2;
}
.rwindow-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px;
  border-bottom: 1px solid var(--fg);
  font-family: var(--pixel);
  font-size: 16px;
  background: repeating-linear-gradient(
    0deg,
    var(--fg) 0 1px,
    transparent 1px 3px
  );
  color: var(--fg);
  cursor: move;
}
.rw-close {
  width: 11px;
  height: 11px;
  border: 1px solid var(--fg);
  background: var(--bg);
  display: inline-block;
  cursor: pointer;
  flex: 0 0 auto;
}
.rw-name {
  background: var(--bg);
  padding: 0 8px;
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rw-count {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  padding: 0 4px;
}
.rw-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 16px;
  padding: 0 4px;
  background: var(--bg);
  border: 1px solid var(--fg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--folder-accent, var(--fg));
  flex: 0 0 auto;
}
.rw-menu:hover {
  background: var(--fg);
  color: var(--bg);
}
.rw-action {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 6px;
  background: var(--bg);
  border: 1px solid var(--fg);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 1;
  color: var(--folder-accent, var(--fg));
  flex: 0 0 auto;
  user-select: none;
}
.rw-action:hover {
  background: var(--fg);
  color: var(--bg);
}
.rw-action.disabled {
  opacity: 0.5;
  cursor: default;
}
.rwindow {
  border-color: var(--folder-accent, var(--fg));
}
.rwindow .rwindow-title {
  border-color: var(--folder-accent, var(--fg));
}
.dicon-cover {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid var(--fg);
}
.mb-sep {
  height: 1px;
  background: var(--fg);
  margin: 4px 0;
  opacity: 0.6;
}
.color-pick-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.color-pick {
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 14px 16px;
  min-width: 280px;
  font-family: var(--pixel);
}
.color-pick-title {
  font-size: 14px;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.color-pick-subtitle {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 10px;
}
.color-pick-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  cursor: pointer;
  padding: 0;
}
.color-swatch:hover {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.color-swatch-wheel {
  background:
    radial-gradient(circle at center, #ffffff 0%, transparent 55%),
    conic-gradient(
      from 0deg,
      #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000
    );
}
.rwindow-body {
  padding: 10px 12px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 60vh;
  overflow: auto;
}
.rwindow[style*="height"] .rwindow-body {
  max-height: none;
}
.rw-empty {
  color: var(--dim);
  font-style: italic;
  padding: 8px 2px;
}
.rwindow-text {
  white-space: pre-wrap;
  line-height: 1.45;
}

/* Window list rows */
.rw-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  cursor: default;
}
.rw-row:hover,
.rw-row.sel {
  background: var(--fg);
  color: var(--bg);
}
.rw-row:hover svg rect,
.rw-row.sel svg rect {
  fill: var(--bg);
}
.rw-row.playing .rw-row-title {
  font-weight: 700;
}
.rw-row.playing .rw-row-title::before {
  content: "► ";
  font-family: var(--pixel);
}
.rw-row .rw-row-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rw-row .rw-row-meta {
  font-size: 11px;
  color: inherit;
  opacity: 0.7;
}
.rw-row-x {
  flex: 0 0 auto;
  margin-left: 4px;
  width: 16px;
  height: 16px;
  padding: 0;
  font-family: var(--pixel);
  font-size: 14px;
  line-height: 1;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.rw-row-x:hover {
  background: currentColor;
  color: var(--bg);
}
.rw-row.sel .rw-row-x:hover,
.rw-row:hover .rw-row-x:hover {
  background: var(--bg);
  color: var(--fg);
}

/* Folder window: column header + row grid */
.rw-header,
.rw-row-cols {
  display: grid;
  grid-template-columns: 1fr 44px 56px 48px 16px 16px;
  gap: 8px;
  align-items: center;
  padding: 2px 4px;
}
.rw-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  margin-bottom: 4px;
  user-select: none;
  cursor: default;
}
.rw-header .rw-col {
  cursor: pointer;
  opacity: 0.65;
}
.rw-header .rw-col:hover,
.rw-header .rw-col.active {
  opacity: 1;
}
.rw-row-cols .rw-col-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rw-row-cols .rw-row-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rw-row-cols .rw-col-bpm,
.rw-row-cols .rw-col-key,
.rw-row-cols .rw-col-time,
.rw-header .rw-col-bpm,
.rw-header .rw-col-key,
.rw-header .rw-col-time {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  opacity: 0.85;
}
.rw-row-cols.sel .rw-col-bpm,
.rw-row-cols.sel .rw-col-key,
.rw-row-cols.sel .rw-col-time,
.rw-row-cols:hover .rw-col-bpm,
.rw-row-cols:hover .rw-col-key,
.rw-row-cols:hover .rw-col-time {
  opacity: 1;
}

/* Dialog form fields */
.rw-field {
  display: block;
  margin: 0 0 10px 0;
}
.rw-field label {
  display: block;
  margin-bottom: 4px;
  font-family: var(--pixel);
  font-size: 14px;
  letter-spacing: 0.06em;
}
.rw-field input {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 13px;
}
.rw-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.rw-help {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 4px;
}
.rw-error {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  background: var(--bg);
  border: 1px dashed var(--fg);
  padding: 4px 6px;
  margin-top: 8px;
}
.rw-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

/* Chunky retro button */
.rbtn {
  font-family: var(--pixel);
  font-size: 16px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 2px 12px;
  min-width: 64px;
  height: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--fg);
}
.rbtn:hover {
  background: var(--fg);
  color: var(--bg);
}
.rbtn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--fg);
}
.rbtn:disabled {
  color: var(--dim);
  border-color: var(--dim);
  box-shadow: 2px 2px 0 var(--dim);
  cursor: default;
}
.rbtn.folder-create-busy {
  color: var(--fg);
  border-color: var(--fg);
  box-shadow: 2px 2px 0 var(--fg);
}
.rbtn.folder-create-busy::after {
  content: "";
  display: inline-block;
  width: 1.5ch;
  text-align: left;
  animation: folder-create-dots 1s steps(4, end) infinite;
}
@keyframes folder-create-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}

/* Boot / login overlay */
.boot-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.boot-window {
  min-width: 380px;
}
.boot-body {
  padding: 20px 24px;
  text-align: center;
}
.boot-logo {
  font-family: var(--pixel);
  font-size: 44px;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}
.boot-logo small {
  display: block;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--dim);
  letter-spacing: 0.18em;
  margin-top: 4px;
}
.boot-prompt {
  margin-top: 18px;
  font-family: var(--pixel);
  font-size: 18px;
  text-align: left;
}
.boot-status {
  min-height: 1.2em;
  font-size: 11px;
  color: var(--dim);
  margin-top: 10px;
  font-family: var(--mono);
  text-align: left;
}
.boot-status.err {
  color: var(--fg);
}

/* Status bar */
.statusbar {
  --statusbar-box-height: 40px;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  border-top: 1px solid var(--fg);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--bg);
  z-index: 20;
}
.sb-transport {
  display: flex;
  gap: 4px;
  height: var(--statusbar-box-height);
  align-items: stretch;
}
.sb-btn {
  font-family: var(--pixel);
  font-size: 18px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 2px 8px;
  min-width: 34px;
  height: var(--statusbar-box-height);
  cursor: pointer;
  line-height: 1;
}
.sb-btn.big {
  min-width: 42px;
}
.sb-btn-text {
  min-width: 52px;
  font-size: 16px;
  letter-spacing: 0.04em;
}
.sb-btn:hover,
.sb-btn:active,
.sb-btn.on {
  background: var(--fg);
  color: var(--bg);
}
.sb-btn:disabled {
  color: var(--dim);
  border-color: var(--dim);
  cursor: default;
  background: var(--bg);
}

.sb-lcd {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--fg);
  padding: 4px 10px;
  height: var(--statusbar-box-height);
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.02) 0 1px,
    transparent 1px 2px
  );
  color: var(--accent);
  overflow: hidden;
}
.lcd-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--dim);
  letter-spacing: 0.12em;
}
.waveform-zone {
  position: absolute;
  left: -1px;
  right: -1px;
  top: -45px;
  height: 44px;
  cursor: pointer;
  z-index: 25;
  pointer-events: auto;
  touch-action: none;
  background: rgba(255, 138, 76, 0.06);
  border-bottom: 1px dashed var(--wave);
}
.waveform-zone canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.lcd-cover {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  object-fit: cover;
  border: 1px solid var(--fg);
  background: var(--bg);
  image-rendering: auto;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}
.lcd-cover:active {
  cursor: grabbing;
}
.lcd-cover.missing {
  visibility: hidden;
  width: 0;
  border: 0;
  margin: 0;
}
.lcd-title {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.lcd-title:active {
  cursor: grabbing;
}
.cd-art {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
}
.cd-disc {
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
}
.dicon.nowplaying .cd-disc {
  animation: cd-spin 2.4s linear infinite;
}
.dicon.nowplaying.paused .cd-disc {
  animation-play-state: paused;
}
.title-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--fg);
  padding: 2px 6px;
  white-space: nowrap;
  opacity: 0.9;
}
@keyframes cd-spin {
  to { transform: rotate(360deg); }
}
.lcd-title {
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.lcd-artist {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--dim);
  margin-left: 8px;
}
.lcd-artist:empty {
  margin-left: 0;
}
.lcd-time {
  font-variant-numeric: tabular-nums;
}

.sb-meter {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--fg);
  height: var(--statusbar-box-height);
  align-items: center;
}
.meter-cell {
  width: 6px;
  height: 24px;
  background: var(--dim);
  opacity: 0.4;
}
.meter-cell.on {
  background: var(--accent);
  opacity: 1;
}

/* CRT scanlines */
.desktop.scanlines::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0 1px,
    transparent 1px 3px
  );
  z-index: 100;
}
.desktop.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 101;
}

/* Noise */
.desktop.noise .desktop-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: screen;
}

/* Blinking cursor */
.cursor-blink {
  position: absolute;
  left: 14px;
  bottom: 72px;
  font-family: var(--pixel);
  font-size: 22px;
  color: var(--fg);
  animation: blink 1.06s steps(2, end) infinite;
  z-index: 10;
  pointer-events: none;
}
.desktop.no-cursor .cursor-blink {
  display: none;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* Hidden native audio */
#audioPlayer {
  display: none;
}

/* Import list + diagnostics inner */
.rw-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 1px 0;
}
.rw-kv span:first-child {
  color: var(--dim);
  letter-spacing: 0.05em;
}
.import-chip {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--fg);
  font-family: var(--pixel);
  font-size: 13px;
  margin-right: 6px;
  vertical-align: middle;
}
.import-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin-right: 6px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  user-select: none;
}
.import-cancel:hover {
  background: var(--fg);
  color: var(--bg);
}
.import-cancel.disabled {
  opacity: 0.5;
  cursor: default;
}
.import-card {
  border: 1px dashed var(--fg);
  padding: 6px 8px;
  margin-bottom: 8px;
}
.import-card .import-url {
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
  margin: 2px 0 4px 0;
}
.import-card .import-items {
  margin: 4px 0 0 0;
  padding-left: 16px;
  color: var(--dim);
  font-size: 11px;
}
.import-bar {
  position: relative;
  height: 6px;
  background: var(--bg);
  border: 1px solid var(--fg);
  margin: 6px 0 4px 0;
  overflow: hidden;
}
.import-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--wave);
  transition: width 120ms linear;
}
.import-bar.indeterminate .import-bar-fill {
  animation: import-indeterminate 1.6s linear infinite;
  width: 30%;
}
@keyframes import-indeterminate {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(360%);
  }
}

/* YouTube search results */
.yt-results {
  margin-top: 10px;
}
.yt-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  padding: 4px 6px;
  border: 1px dashed var(--dim);
}
.yt-card {
  display: flex;
  gap: 8px;
  align-items: stretch;
  border: 1px dashed var(--fg);
  padding: 6px;
  margin-bottom: 6px;
}
.yt-thumb {
  width: 96px;
  height: 54px;
  object-fit: cover;
  flex: 0 0 96px;
  background: var(--bg);
  border: 1px solid var(--dim);
  filter: grayscale(1) contrast(1.1);
}
.yt-thumb--square {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
}
.yt-section-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin: 10px 0 4px 0;
  border-bottom: 1px dashed var(--dim);
  padding-bottom: 2px;
}
.yt-section-title:first-child {
  margin-top: 0;
}
.yt-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.yt-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  text-decoration: none;
  align-self: flex-start;
}
.yt-link:hover {
  color: var(--fg);
  text-decoration: underline;
}
.yt-load {
  align-self: center;
  min-width: 72px;
}
.yt-load-done {
  color: var(--dim);
  border-color: var(--dim);
  box-shadow: 2px 2px 0 var(--dim);
}

/* Play log */
.playlog-text {
  font-family: var(--mono);
  font-size: 12px;
  margin: 0 0 10px 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 40vh;
  overflow: auto;
  border: 1px dashed var(--fg);
  padding: 6px 8px;
  line-height: 1.3;
}

/* Draggable play-log rows — keep the .txt vibe, make each tappable */
.playlog-list {
  font-family: var(--mono);
  font-size: 12px;
  margin: 0 0 10px 0;
  max-height: 40vh;
  overflow: auto;
  border: 1px dashed var(--fg);
  padding: 4px 6px;
  line-height: 1.3;
}
.playlog-row {
  display: flex;
  gap: 10px;
  white-space: nowrap;
  padding: 1px 2px;
  cursor: default;
}
.playlog-row:hover,
.playlog-row.sel {
  background: var(--fg);
  color: var(--bg);
}
.playlog-row.missing {
  opacity: 0.5;
}
.playlog-ts {
  flex: 0 0 auto;
  color: var(--dim);
}
.playlog-row:hover .playlog-ts,
.playlog-row.sel .playlog-ts {
  color: inherit;
}
.playlog-title {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlog-ctx {
  flex: 0 0 auto;
  opacity: 0.7;
}
.history-action {
  flex: 0 0 56px;
  color: var(--dim);
  letter-spacing: 0.05em;
}
.history-row:hover .history-action,
.history-row.sel .history-action {
  color: inherit;
}

/* info.txt readme block — keep the .txt vibe */
.info-readme {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border: 1px dashed var(--fg);
  padding: 8px 10px;
}
.info-readme p {
  margin: 0 0 10px 0;
}
.info-readme p:last-child {
  margin-bottom: 0;
}
.info-readme a {
  color: inherit;
  text-decoration: underline;
}

/* Context menu (right-click) */
.context-menu {
  position: fixed;
}

/* Utility */
.hidden {
  display: none !important;
}

/* ============================================================
   Mobile (≤ 720px) — keep the retro chrome, reflow for touch
   ============================================================ */
@media (max-width: 720px) {
  /* Disable the 300ms double-tap-zoom delay so taps fire immediately */
  * {
    touch-action: manipulation;
  }

  .desktop {
    height: 100dvh;
    font-size: 14px;
  }

  /* Menubar — drop the workspace title (would push the clock off) */
  .menubar {
    gap: 12px;
    padding: 0 8px;
    font-size: 16px;
  }
  .mb-title {
    display: none;
  }

  /* Desktop surface — flow icons, allow scroll, leave room for taller statusbar */
  .desktop-surface {
    inset: 22px 0 96px 0;
    padding: 8px 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .overlay-layer {
    inset: 22px 0 96px 0;
  }

  /* Icons flow as a grid; absolute coords from layoutIcons() are ignored */
  .dicon {
    position: static !important;
    display: inline-block;
    width: calc(25% - 8px);
    margin: 4px;
    vertical-align: top;
  }

  /* Windows are small centered modals that fit inside the desktop viewport */
  .rwindow:not(.boot-window) {
    position: fixed !important;
    left: 50% !important;
    top: 36px !important;
    right: auto;
    bottom: auto;
    transform: translateX(-50%);
    width: calc(100vw - 24px) !important;
    min-width: 0;
    max-width: 420px;
    max-height: calc(100dvh - 160px);
    display: flex;
    flex-direction: column;
  }
  .rwindow:not(.boot-window) .rwindow-title {
    flex: 0 0 auto;
    cursor: default;
  }
  .rwindow:not(.boot-window) .rwindow-body {
    flex: 1 1 auto;
    max-height: none;
    overflow: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
  }

  /* Statusbar — wrap LCD to a second row, drop the meter, taller transport */
  .statusbar {
    --statusbar-box-height: 36px;
    flex-wrap: wrap;
    align-items: center;
    height: auto;
    min-height: 96px;
    gap: 6px;
    padding: 6px 8px;
  }
  .sb-transport {
    flex: 0 0 auto;
    gap: 4px;
  }
  .sb-btn {
    min-width: 44px;
    height: var(--statusbar-box-height);
    padding: 0 6px;
  }
  .sb-btn.big {
    min-width: 54px;
  }
  .sb-btn-text {
    min-width: 60px;
    font-size: 15px;
  }
  .sb-lcd {
    flex: 1 1 100%;
    order: 2;
    height: var(--statusbar-box-height);
    min-height: var(--statusbar-box-height);
    padding: 4px 8px;
    font-size: 15px;
    gap: 8px;
  }
  .lcd-label {
    display: none;
  }
  .sb-meter {
    display: none;
  }

  /* Cursor blink would sit over the wrapped statusbar */
  .cursor-blink {
    display: none;
  }

  /* Boot window fits any phone width */
  .boot-window {
    min-width: 0;
    width: calc(100vw - 32px);
    max-width: 440px;
  }
  .boot-logo {
    font-size: 36px;
  }

  /* Dropdowns — keep within viewport, larger tap targets */
  .mb-dropdown {
    max-width: calc(100vw - 16px);
    font-size: 18px;
  }
  .mb-dropdown-item {
    padding: 8px 14px 8px 22px;
  }

  /* Larger row tap targets */
  .rw-row {
    padding: 6px 6px;
    gap: 10px;
  }
  .rw-row-x {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  /* Window close button — 11×11 is unhittable on a phone */
  .rwindow-title {
    padding: 6px 8px;
    min-height: 32px;
  }
  .rw-close {
    width: 24px;
    height: 24px;
  }

  /* Form fields and chunky buttons grow to thumb size.
     16px is the iOS threshold — anything smaller triggers auto-zoom on focus. */
  .rw-field input {
    padding: 10px 12px;
    font-size: 16px;
  }
  .rbtn {
    height: 38px;
    font-size: 18px;
    min-width: 84px;
    padding: 0 14px;
  }
  .rw-actions {
    gap: 8px;
  }
}
