/* Sift cloud: the same black desktop shell as the original web Sift,
   trimmed down for catalog, auth, and mobile playback. */

:root {
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --pixel: "VT323", "IBM Plex Mono", ui-monospace, monospace;
  --bg: #000;
  --fg: #ff8fc7;
  --accent: #ff8fc7;
  --dim: #9b5b7a;
  --line: #ff8fc7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
}

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

button,
input {
  font: inherit;
}

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

.theme-mono {
  --bg: #000;
  --fg: #ff8fc7;
  --accent: #ff8fc7;
  --dim: #9b5b7a;
  --line: #ff8fc7;
}

.menubar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
}

.mb-logo {
  padding: 0 3px;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.mb-item,
.mb-link {
  cursor: default;
  padding: 0 3px;
  margin: 0 -3px;
  color: var(--fg);
  background: transparent;
  border: 0;
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
}

.mb-item:hover,
.mb-link:hover {
  background: var(--fg);
  color: var(--bg);
}

.mb-spacer {
  flex: 1;
}

.mb-title,
.mb-user,
.mb-clock {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.mb-user {
  color: var(--fg);
}

.desktop-surface {
  position: absolute;
  inset: 22px 0 64px 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    #000;
  background-size: 16px 16px;
}

.desktop-note {
  position: absolute;
  left: 18px;
  bottom: 14px;
  max-width: 420px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
}

.dicon {
  position: absolute;
  width: 88px;
  min-height: 82px;
  text-align: center;
  color: var(--fg);
  cursor: default;
  touch-action: none;
}

.dicon-art {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.dicon-label {
  display: inline-block;
  max-width: 86px;
  margin-top: 4px;
  padding: 1px 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.dicon:hover .dicon-label,
.dicon.sel .dicon-label {
  background: var(--fg);
  color: var(--bg);
}

.pixel-grid {
  display: grid;
  grid-template-columns: repeat(24, 2px);
  grid-template-rows: repeat(24, 2px);
  gap: 0;
  image-rendering: pixelated;
}

.pixel-bit {
  width: 2px;
  height: 2px;
  background: transparent;
}

.pixel-bit.on {
  background: var(--fg);
}

.dicon:hover .pixel-bit.on,
.dicon.sel .pixel-bit.on {
  background: var(--accent);
}

.overlay-layer {
  position: absolute;
  inset: 22px 0 64px 0;
  z-index: 30;
  pointer-events: none;
}

.overlay-layer > * {
  pointer-events: auto;
}

.rwindow {
  position: absolute;
  min-width: 280px;
  min-height: 150px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  font-family: var(--mono);
  font-size: 12px;
}

.rwindow-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  padding: 2px 6px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(
    0deg,
    var(--fg) 0 1px,
    transparent 1px 3px
  );
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 16px;
  cursor: move;
}

.rw-close {
  width: 12px;
  height: 12px;
  border: 1px solid var(--fg);
  background: var(--bg);
  display: inline-block;
  cursor: pointer;
  flex: 0 0 auto;
}

.rw-close:hover {
  background: var(--fg);
}

.rw-close.ghost {
  visibility: hidden;
}

.rw-name {
  flex: 1;
  min-width: 0;
  padding: 0 8px;
  background: var(--bg);
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
  text-overflow: ellipsis;
}

.rw-count {
  flex: 0 0 auto;
  padding: 0 4px;
  background: var(--bg);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
}

.rwindow-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 12px;
  overflow: auto;
}

.rw-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  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%);
}

.rw-empty {
  color: var(--dim);
  font-style: italic;
  padding: 8px 2px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.catalog-card {
  min-height: 76px;
  padding: 8px;
  border: 1px dashed var(--fg);
  background: var(--bg);
  color: var(--fg);
  cursor: default;
}

.catalog-card:hover {
  background: var(--fg);
  color: var(--bg);
}

.catalog-name {
  font-family: var(--pixel);
  font-size: 20px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.catalog-meta,
.track-sub,
.track-link,
.player-hint {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.35;
}

.catalog-card:hover .catalog-meta {
  color: var(--bg);
}

.track-list {
  display: grid;
  gap: 6px;
}

.track-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 4px;
  border: 1px dashed transparent;
  cursor: default;
}

.track-row:hover,
.track-row.playing {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}

.track-row:hover .track-sub,
.track-row:hover .track-link,
.track-row.playing .track-sub,
.track-row.playing .track-link {
  color: var(--bg);
}

.track-cover {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  object-fit: cover;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 24px;
}

.track-row:hover .track-cover,
.track-row.playing .track-cover {
  background: var(--bg);
  color: var(--fg);
}

.track-main {
  min-width: 0;
}

.track-title {
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.track-link {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--dim);
  text-decoration: none;
}

.track-link:hover {
  text-decoration: underline;
}

.track-action {
  min-width: 58px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.track-action:hover:not(:disabled) {
  background: currentColor;
  color: var(--bg);
}

.track-action:disabled {
  opacity: 0.45;
  cursor: default;
}

.player-pane {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.player-cover {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--dim);
  font-family: var(--pixel);
  font-size: 42px;
  object-fit: cover;
}

.player-title {
  margin-bottom: 4px;
  font-family: var(--pixel);
  font-size: 24px;
  line-height: 1;
}

.player-progress {
  width: 100%;
  margin: 12px 0 4px 0;
  accent-color: var(--fg);
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.rbtn {
  min-width: 64px;
  height: 26px;
  padding: 2px 12px;
  border: 1px solid var(--fg);
  box-shadow: 2px 2px 0 var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.rbtn:hover:not(:disabled) {
  background: var(--fg);
  color: var(--bg);
}

.rbtn:active:not(:disabled) {
  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;
}

.rw-field {
  display: block;
  margin-bottom: 10px;
  text-align: left;
}

.rw-field span {
  display: block;
  margin-bottom: 4px;
  font-family: var(--pixel);
  font-size: 14px;
  letter-spacing: 0.06em;
}

.rw-field input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
}

.rw-field input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.rw-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
}

.boot-window {
  min-width: 380px;
}

.boot-body {
  padding: 20px 24px;
  text-align: center;
}

.boot-logo {
  margin-bottom: 2px;
  font-family: var(--pixel);
  font-size: 44px;
  letter-spacing: 0.08em;
}

.boot-logo small {
  display: block;
  margin-top: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-form {
  margin-top: 18px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-mode-btn {
  height: 28px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.auth-mode-btn.active,
.auth-mode-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

.boot-status {
  min-height: 1.2em;
  margin: 10px 0 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
}

.boot-status.err {
  color: var(--fg);
}

.statusbar {
  --statusbar-box-height: 40px;
  position: absolute;
  inset: auto 0 0 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.sb-transport {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: var(--statusbar-box-height);
}

.sb-btn {
  min-width: 34px;
  height: var(--statusbar-box-height);
  padding: 2px 8px;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.sb-btn.big {
  min-width: 42px;
}

.sb-btn:hover,
.sb-btn.on {
  background: var(--fg);
  color: var(--bg);
}

.sb-lcd {
  position: relative;
  flex: 1;
  height: var(--statusbar-box-height);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 10px;
  overflow: hidden;
  border: 1px solid var(--fg);
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.02) 0 1px,
    transparent 1px 2px
  );
  color: var(--accent);
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1;
}

.lcd-cover {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--fg);
  background: var(--bg);
}

.lcd-cover.missing {
  width: 0;
  margin: 0;
  border: 0;
  visibility: hidden;
}

.lcd-title,
.lcd-artist {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lcd-title {
  flex: 0 1 auto;
}

.lcd-artist {
  flex: 1 1 auto;
  color: var(--dim);
}

.lcd-artist:empty {
  display: none;
}

.lcd-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.volume-box {
  width: 148px;
  height: var(--statusbar-box-height);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid var(--fg);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.volume-box input {
  min-width: 0;
  width: 100%;
  accent-color: var(--fg);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  html,
  body,
  .desktop {
    height: 100dvh;
  }

  .menubar {
    gap: 10px;
    padding: 0 8px;
    font-size: 16px;
  }

  .mb-title,
  .mb-clock {
    display: none;
  }

  .desktop-surface {
    inset: 22px 0 104px 0;
    padding: 8px 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .overlay-layer {
    inset: 22px 0 104px 0;
  }

  .dicon {
    position: static !important;
    display: inline-block;
    width: calc(25% - 8px);
    margin: 4px;
    vertical-align: top;
  }

  .desktop-note {
    display: none;
  }

  .rwindow:not(.boot-window) {
    position: fixed !important;
    left: 50% !important;
    top: 36px !important;
    transform: translateX(-50%);
    width: calc(100vw - 24px) !important;
    min-width: 0;
    max-width: 430px;
    max-height: calc(100dvh - 160px);
  }

  .rwindow:not(.boot-window) .rwindow-title {
    cursor: default;
  }

  .rwindow-title {
    min-height: 32px;
    padding: 6px 8px;
  }

  .rw-close {
    width: 24px;
    height: 24px;
  }

  .statusbar {
    --statusbar-box-height: 36px;
    height: auto;
    min-height: 104px;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
  }

  .sb-transport {
    flex: 0 0 auto;
  }

  .sb-btn {
    min-width: 44px;
  }

  .sb-btn.big {
    min-width: 54px;
  }

  .sb-lcd {
    order: 2;
    flex: 1 1 100%;
    height: var(--statusbar-box-height);
    font-size: 15px;
    gap: 8px;
  }

  .volume-box {
    flex: 1 1 auto;
    min-width: 150px;
  }

  .boot-window {
    min-width: 0;
    width: calc(100vw - 32px);
    max-width: 440px;
  }

  .boot-logo {
    font-size: 36px;
  }

  .rw-field input {
    padding: 10px 12px;
    font-size: 16px;
  }

  .track-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .track-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .player-pane {
    grid-template-columns: 1fr;
  }
}
