@font-face {
  font-family: "Pixel";
  src: url("fonts/PixelifySans.ttf") format("truetype");
  font-weight: 400 700;
  font-display: block;
}

:root {
  --body: #e6e6e3;
  --wheel: #fbfbf9;
  --label: #7d7d7d;
  --centre: #e6e6e3;
  --lcd: #b9c59f;
  --ink: #1d2618;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --body: #1f1f21; --wheel: #3a3a3d; --label: #b4b4b4; --centre: #1f1f21; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* The wheel owns every touch: no scroll, zoom, pull-to-refresh, selection, long-press menu. */
html, body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { background: var(--body); font-family: "Pixel", monospace; }

.pod {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4vh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

/* LCD */
.lcd {
  width: 100%;
  max-width: 400px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--lcd);
  color: var(--ink);
  border: 3px solid rgba(0, 0, 0, .35);
  border-radius: 8px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .25);
}
.bar { padding: 4px 8px; border-bottom: 2px solid var(--ink); text-align: center; }
.bar h1 { font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list { position: relative; list-style: none; flex: 1; overflow: hidden; }
.list button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 3px 8px;
  font-size: 20px;
  line-height: 1.3;
}
.list .label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.list .label span { display: inline-block; }
.list .arrow::after { content: ">"; margin-left: 8px; }
.list [aria-current="true"] { background: var(--ink); color: var(--lcd); }
.list .marquee .label { text-overflow: clip; }
.list .marquee .label span { animation: marquee 8s linear infinite alternate; }
@keyframes marquee {
  0%, 15% { transform: none; }
  85%, 100% { transform: translateX(var(--shift)); }
}
.list .empty { padding: 24px 8px; text-align: center; font-size: 18px; }
.list button:focus-visible { outline: 2px dashed var(--ink); outline-offset: -3px; }

/* Play state in the title bar, drawn with borders (no icon font). */
.bar { position: relative; }
.bar[data-state]:not([data-state=""])::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.bar[data-state="playing"]::before { border: 6px solid transparent; border-left: 9px solid var(--ink); border-right: 0; }
.bar[data-state="paused"]::before { width: 9px; height: 11px; border: solid var(--ink); border-width: 0 3px; }

/* Now Playing */
.view { flex: 1; min-height: 0; overflow: hidden; padding: 8px; font-size: 16px; line-height: 1.25; }
.view[hidden], .list[hidden] { display: none; }
.np { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-content: start; height: 100%; }
.art { grid-row: span 1; width: 72px; aspect-ratio: 1; border: 2px solid var(--ink); background: var(--lcd); overflow: hidden; }
.art img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); mix-blend-mode: multiply; }
.art.blank img { display: none; }
.art.blank { display: grid; place-items: center; }
.art.blank::after { content: "\266A"; font: 36px monospace; }
.meta { min-width: 0; }
.meta p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .t { font-weight: 700; font-size: 18px; }
.meta .n { margin-top: 2px; font-size: 14px; }
.prog, .vol, .msg { grid-column: 1 / -1; }
.np progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  border: 2px solid var(--ink);
  background: var(--lcd);
  color: var(--ink);
}
.np progress::-webkit-progress-bar { background: var(--lcd); }
.np progress::-webkit-progress-value { background: var(--ink); }
.np progress::-moz-progress-bar { background: var(--ink); }
.np.scrub .prog progress { height: 16px; }
.np.scrub .times::after { content: "scrub"; order: 1; }
.times { display: flex; justify-content: space-between; font-size: 14px; margin-top: 2px; }
.times span:last-child { order: 2; }
.vol { display: none; align-items: center; gap: 8px; font-size: 14px; }
.vol.show { display: flex; }
.msg { text-align: center; }
.np.none { display: block; }
.np.none > :not(.msg) { display: none; }
.np.none .msg { padding: 16px 0; font-size: 18px; }

/* Wheel */
.wheel {
  position: relative;
  flex: none;
  width: min(100%, 46vh, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--wheel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18), inset 0 -2px 4px rgba(0, 0, 0, .08);
}
.wb {
  all: unset;
  position: absolute;
  width: 34%;
  height: 34%;
  display: grid;
  place-items: center;
  color: var(--label);
  font: 700 16px "Pixel", monospace;
  border-radius: 50%;
}
.wb svg { width: 22px; height: 22px; fill: currentColor; }
.menu { top: 0; left: 33%; }
.play { bottom: 0; left: 33%; }
.next { right: 0; top: 33%; }
.prev { left: 0; top: 33%; }
.wb:active { color: var(--ink); }
.centre {
  all: unset;
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  background: var(--centre);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
}
.centre:active { filter: brightness(.9); }
.wb:focus-visible, .centre:focus-visible { outline: 2px solid var(--label); }

/* Landscape: a note instead of a squashed layout. */
.turn { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .pod { display: none; }
  .turn { display: grid; place-items: center; height: 100%; font-size: 22px; color: var(--label); }
}

/* Text screens: About, Add to Home Screen */
.text { display: grid; gap: 10px; padding: 4px; font-size: 18px; }
