
@font-face {
  font-family: Alegreya;
  src: url("../assets/fonts/Alegreya.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Alegreya;
  src: url("../assets/fonts/Alegreya-Italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --lightest: #E0F8D0;
  --light: #88C070;
  --dark: #386858;
  --darkest: #081820;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--darkest);
  color: var(--lightest);
  font-family: Alegreya, Georgia, serif;
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 8px 12px;
  background: var(--lightest);
  color: var(--darkest);
  font-size: 1.125rem;
  transform: translateY(-200%);
}

.skip:focus { transform: none; }

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
}


#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template: "stage" minmax(0, 1fr) / minmax(0, 1fr);
}

#stage {
  grid-area: stage;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}

#screen {
  display: block;
  image-rendering: pixelated;
}


#pad { display: none; }

@media (pointer: coarse) {
  #app {
    grid-template: "stage" minmax(0, 1fr) "pad" auto / minmax(0, 1fr);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  }

  #stage {
    place-items: start center;
    padding: 16px 16px 0;
  }

  #pad {
    grid-area: pad;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 16px;
    padding: 16px 24px max(24px, env(safe-area-inset-bottom));
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  body.overlay #pad { visibility: hidden; }
}

@media (pointer: coarse) and (orientation: landscape) {
  #app { grid-template: "left stage right" minmax(0, 1fr) / auto minmax(0, 1fr) auto; }
  #stage { place-items: center; padding: 8px 0; }
  #pad { display: contents; }
  #pad .left { grid-area: left; align-self: center; padding-left: 24px; }
  #pad .right { grid-area: right; align-self: center; padding-right: 24px; }
}

.left { justify-self: start; }
.right { justify-self: end; display: grid; justify-items: end; gap: 20px; }

.dpad {
  position: relative;
  width: 144px;
  height: 144px;
}

.dpad::before,
.dpad::after,
.dpad span {
  content: "";
  position: absolute;
  border: 3px solid var(--lightest);
  background: var(--darkest);
}

.dpad::before { left: 48px; top: 0; width: 48px; height: 144px; }
.dpad::after { top: 48px; left: 0; width: 144px; height: 48px; }
.dpad span { left: 51px; top: 51px; width: 42px; height: 42px; border: 0; z-index: 1; }

.face { display: flex; gap: 16px; align-items: flex-end; }
.face button:first-child { margin-top: 32px; }

#pad button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 3px solid var(--lightest);
  background: var(--darkest);
  touch-action: none;
}

#pad button:active { background: var(--dark); }

#pad .start { width: 96px; height: 44px; }

#pad canvas { display: block; image-rendering: pixelated; }


.layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  --paper: var(--lightest);
  --ink: var(--darkest);
}

.layer[hidden] { display: none; }

.page {
  max-width: 42rem;
  min-height: 100%;
  margin: 0 auto;
  padding: 16px 16px 96px;
  --fg: var(--ink);
  --bg: var(--paper);
  background: var(--bg);
  color: var(--fg);
  font-size: 1.125rem;
  line-height: 1.55;
  font-variant-numeric: oldstyle-nums proportional-nums;
}

@media (min-width: 40rem) {
  .page { padding: 24px 48px 128px; }
}

@media (prefers-color-scheme: dark) {
  .page { --fg: var(--paper); --bg: var(--ink); }
}

.chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.chrome .back {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  cursor: pointer;
}

.chrome .plate {
  display: grid;
  place-items: center;
  padding: 8px 12px;
}

.chrome canvas { display: block; image-rendering: pixelated; }

article header { padding-top: 14vh; }

h1 {
  margin: 0 0 12px;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.15;
  font-variant-caps: small-caps;
}

h1:focus { outline: none; }

.meta, .credit { margin: 0; }

.cover { margin: 2.5rem 0 0; }
.cover img { display: block; width: 100%; height: auto; }

.player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin: 2.5rem 0 0;
  padding: 16px;
  border: 2px solid currentColor;
  background: var(--bg);
}

.player[hidden] { display: none; }
.player audio { display: none; }
.deck canvas { display: block; image-rendering: pixelated; }
.deck-side { flex: 1 1 14rem; min-width: 0; }
.player p { margin: 0; }
.player .now { font-size: 1.375rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.player .now-from { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 1rem; }
.player .now-count { font-style: italic; }

.player .seek { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.player .time { flex: none; font-size: 1rem; font-variant-numeric: lining-nums tabular-nums; }

.player .transport { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.player button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  cursor: pointer;
}

.player button canvas { display: block; image-rendering: pixelated; }
.player button:hover, .player button:focus-visible { background: var(--fg); color: var(--bg); }

.player .volume { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: 1rem; }
.player .volume input { max-width: 10rem; }

.player input[type=range] {
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

.player input[type=range]::-webkit-slider-runnable-track { height: 8px; border: 2px solid currentColor; background: none; }
.player input[type=range]::-moz-range-track { height: 4px; border: 2px solid currentColor; background: none; }
.player input[type=range]::-moz-range-progress { height: 4px; background: currentColor; }
.player input[type=range]::-webkit-slider-thumb { width: 12px; height: 18px; margin-top: -7px; border: 0; border-radius: 0; background: currentColor; -webkit-appearance: none; }
.player input[type=range]::-moz-range-thumb { width: 12px; height: 18px; border: 0; border-radius: 0; background: currentColor; }

.prose .tracklist { margin: 2em 0; padding: 0; list-style: none; }

.tracklist li {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 -12px;
  padding: 8px 12px 8px calc(12px + 2.25em);
}

.tracklist li::before { content: attr(data-n); position: absolute; left: 12px; font-variant-numeric: lining-nums tabular-nums; }
.tracklist li:focus { outline: none; }
.tracklist .title { flex: 1; margin: 0; }
.tracklist .name { font-weight: 600; text-decoration: none; }
.tracklist .name::after { content: ""; position: absolute; inset: 0; }
.tracklist .name:focus-visible { outline: none; }
.tracklist .len { flex: none; font-size: 1rem; font-variant-numeric: lining-nums tabular-nums; }
.tracklist li:hover, .tracklist li:has(.name:focus-visible), .tracklist li.playing { background: var(--fg); color: var(--bg); }

.prose {
  margin-top: 3rem;
  font-size: 1.25rem;
}

.prose p { margin: 0; }
.prose p + p { margin-top: 1em; }

.prose > p:first-child::first-line,
.prose > hr + p::first-line { font-variant-caps: small-caps; }

.prose hr {
  height: 3em;
  margin: 0;
  border: 0;
}

.prose h2, .prose h3 {
  margin: 2em 0 0.5em;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-caps: small-caps;
}

.prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure { margin: 1em 0; }
.prose blockquote { padding-left: 1.5em; }
.prose img { max-width: 100%; height: auto; }
.prose pre { overflow-x: auto; font-size: 0.9rem; }
.prose code { font-family: ui-monospace, monospace; font-size: 0.9em; }
.prose pre code { font-size: inherit; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

sup.ref { line-height: 0; }
sup.ref a { padding: 0 2px; text-decoration: none; }

.endnotes {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid currentColor;
  font-size: 1rem;
}

.endnotes li:focus { outline: none; }
.backref { text-decoration: none; padding: 0 4px; }


.page h2 {
  margin: 3rem 0 1rem;
  font-size: 1.375rem;
  font-weight: 600;
  font-variant-caps: small-caps;
}

.rooms { margin-top: 2.5rem; }

#menu .page { max-width: 48rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid currentColor;
}

.tab {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tab canvas { display: block; image-rendering: pixelated; }
.tab .swatch { flex: none; width: 16px; height: 16px; border: 2px solid currentColor; }
.tab .fresh { font-size: 1rem; font-style: italic; }
.tab:hover { box-shadow: inset 0 0 0 2px currentColor; }
.tab[aria-selected=true] { background: var(--fg); color: var(--bg); box-shadow: none; }

.tally {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin: 12px 0 0;
  font-size: 1rem;
  font-style: italic;
}

.pieces { margin: 0; padding: 0; list-style: none; }
.panel .pieces { margin-top: 8px; }

.pieces li {
  position: relative;
  display: grid;
  grid-template: "title" "when" "credit" "summary" / minmax(0, 1fr);
  margin: 0 -16px;
  padding: 12px 16px 14px;
}

.pieces li > a {
  grid-area: title;
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}

.pieces li > a::after { content: ""; position: absolute; inset: 0; }
.pieces li > a:focus-visible { outline: none; }
.pieces li:hover, .pieces li:has(> a:focus-visible) { background: var(--fg); color: var(--bg); }

.pieces .when {
  grid-area: when;
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-top: 2px;
  font-size: 1rem;
}

.pieces .state { font-style: italic; }

.pieces .play {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  min-height: 36px;
  margin-top: 6px;
  padding: 4px 14px;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.pieces .play:hover, .pieces .play:focus-visible { background: var(--bg); color: var(--fg); }
.pieces li:not(:hover):not(:has(> a:focus-visible)) .play:hover,
.pieces li:not(:hover):not(:has(> a:focus-visible)) .play:focus-visible { background: var(--fg); color: var(--bg); }

.playing-what { margin: 0 0 12px; max-width: 34em; }
.buttons button:disabled { opacity: 0.5; cursor: default; }
.pieces .count:empty { display: none; }
.pieces .credit { grid-area: credit; margin: 2px 0 0; font-size: 1rem; }
.pieces .summary { grid-area: summary; margin: 8px 0 0; max-width: 34em; }
.pieces .summary:empty { display: none; }

@media (min-width: 40rem) {
  .pieces li {
    grid-template: "title when" "credit when" "summary when" / minmax(0, 1fr) auto;
    column-gap: 32px;
    margin: 0 -24px;
    padding: 16px 24px 18px;
  }

  .pieces .when {
    flex-direction: column;
    align-items: flex-end;
    margin-top: 0.3rem;
  }

  .pieces .play { align-self: flex-end; }
}

.settings {
  display: grid;
  column-gap: 48px;
  margin-top: 3rem;
  border-top: 2px solid currentColor;
}

.settings.intro { margin-top: 0; border-top: 0; }

.settings h2 { margin: 2rem 0 0.75rem; }

@media (min-width: 40rem) {
  .settings.intro { grid-template-columns: 1fr 1fr; }
  .settings .about { grid-column: 1 / -1; }
}

.notice {
  margin: 2rem 0 0;
  padding: 12px 16px;
  border: 2px solid currentColor;
}

.buttons { display: flex; flex-wrap: wrap; gap: 12px; }

.buttons button {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

#menu .chrome .back:hover, #menu .chrome .back:focus-visible,
.buttons button:hover, .buttons button:focus-visible { background: var(--fg); color: var(--bg); }

.status:empty { display: none; }

.about p { margin: 0; max-width: 34em; }

.dev label { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.dev input { accent-color: currentColor; }
.dev input[type=range] { flex: 1; min-width: 0; max-width: 20em; }
.dev output { font-variant-numeric: tabular-nums; }
