:root {
  --void: #343132;
  --inkShadow: #413a3b;
  --container: #454041;
  --headerBar: #575354;
  --frameLine: #747071;
  --mutedText: #989392;
  --bodyText: #b8b4b1;
  --boneText: #d5d2c5;
  --phosphor: #e7e6cc;
  --lunarViolet: #9a8498;

  --page: #151315;
  --shell: #1b181a;
  --panel: #211e20;
  --panelDeep: #191719;
  --bar: #2c282a;
  --line: #514c4e;
  --lineBright: var(--frameLine);
  --text: var(--bodyText);
  --title: var(--boneText);
  --muted: var(--mutedText);
  --accent: var(--phosphor);
  --shadow: rgba(0, 0, 0, 0.82);
  --fontBody: "Source Code Pro", "Lucida Console", "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font-family: var(--fontBody);
}

button,
input,
output {
  font: inherit;
}

.demo {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.player {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(10rem, 1.15fr) minmax(12rem, 1.65fr) minmax(7rem, 0.75fr);
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 2.55rem;
  padding: 0.28rem 0.48rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  color: var(--text);
  background:
    radial-gradient(circle at 1px 1px, rgba(231, 230, 204, 0.045) 0 1px, transparent 1.2px) 0 0 / 4px 4px,
    repeating-linear-gradient(135deg, transparent 0 4px, rgba(152, 147, 146, 0.025) 4px 5px, transparent 5px 8px),
    var(--panelDeep);
  box-shadow:
    inset 1px 1px 0 rgba(231, 230, 204, 0.17),
    inset -1px -1px 0 rgba(0, 0, 0, 0.92),
    1px 1px 0 var(--shadow);
  image-rendering: pixelated;
}

.player::before {
  position: absolute;
  inset: 3px;
  border: 1px dotted rgba(116, 112, 113, 0.32);
  border-radius: 0.38rem;
  pointer-events: none;
  content: "";
}

.player > * {
  position: relative;
  z-index: 1;
}

.playerControls {
  display: flex;
  gap: 0.14rem;
  padding-right: 0.5rem;
  border-right: 1px solid var(--line);
}

.playerControls button {
  display: grid;
  place-items: center;
  width: 1.38rem;
  height: 1.45rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.12rem;
  color: var(--title);
  background:
    radial-gradient(circle at 1px 1px, rgba(231, 230, 204, 0.055) 0 1px, transparent 1.2px) 0 0 / 3px 3px,
    var(--bar);
  box-shadow:
    inset 1px 1px 0 rgba(231, 230, 204, 0.2),
    inset -1px -1px 0 #000;
  font-size: 0.52rem;
  line-height: 1;
  cursor: pointer;
}

.playerControls #pause {
  font-size: 0.68rem;
}

.playerControls button:hover {
  color: var(--accent);
  border-color: var(--lineBright);
}

.playerControls button:active,
.playerControls button.isActive {
  color: var(--lunarViolet);
  background: var(--panelDeep);
  box-shadow:
    inset 1px 1px 0 #000,
    inset -1px -1px 0 rgba(231, 230, 204, 0.12);
  transform: translate(1px, 1px);
}

.playerInfo {
  min-width: 0;
  padding-right: 0.45rem;
  border-right: 1px solid var(--line);
}

.playerTitle,
.playerArtist,
.playerTime,
#status {
  margin: 0;
}

.playerTitle,
.playerArtist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playerTitle {
  color: var(--title);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 1px 1px 0 #000;
}

.player.isPlaying .playerTitle {
  color: var(--lunarViolet);
}

.playerArtist {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.54rem;
}

.playerProgress {
  display: grid;
  grid-template-columns: auto minmax(4rem, 1fr);
  gap: 0.42rem;
  align-items: center;
  min-width: 0;
  padding-right: 0.45rem;
  border-right: 1px solid var(--line);
}

.playerTime {
  display: flex;
  gap: 0.18rem;
  color: var(--muted);
  font-size: 0.54rem;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.playerTime span:nth-child(2) {
  color: var(--lineBright);
}

input[type="range"] {
  --fill: 0%;
  width: 100%;
  height: 0.7rem;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--lunarViolet) 0 var(--fill), var(--shell) var(--fill) 100%);
  box-shadow:
    inset 1px 1px 0 rgba(0, 0, 0, 0.85),
    inset -1px -1px 0 rgba(231, 230, 204, 0.08);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border: 1px solid var(--line);
  background: var(--shell);
  box-shadow: inset 1px 1px 0 rgba(0, 0, 0, 0.85);
}

input[type="range"]::-moz-range-progress {
  height: 4px;
  background: var(--lunarViolet);
}

input[type="range"]::-webkit-slider-thumb {
  width: 7px;
  height: 10px;
  margin-top: -4px;
  appearance: none;
  border: 1px solid var(--lineBright);
  border-radius: 0;
  background:
    linear-gradient(135deg, rgba(231, 230, 204, 0.32), transparent 50%),
    var(--bar);
  box-shadow:
    inset 1px 1px 0 rgba(231, 230, 204, 0.18),
    inset -1px -1px 0 #000;
}

input[type="range"]::-moz-range-thumb {
  width: 6px;
  height: 9px;
  border: 1px solid var(--lineBright);
  border-radius: 0;
  background: var(--bar);
  box-shadow:
    inset 1px 1px 0 rgba(231, 230, 204, 0.18),
    inset -1px -1px 0 #000;
}

.playerVolume {
  display: grid;
  grid-template-columns: auto minmax(3rem, 1fr) 2rem;
  gap: 0.25rem;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.52rem;
}

.playerVolume output {
  color: var(--muted);
  text-align: right;
}

#status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .player {
    grid-template-columns: auto minmax(8rem, 1fr) minmax(8rem, 1fr);
  }

  .playerVolume {
    display: none;
  }

  .playerProgress {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .player {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem;
  }

  .playerControls {
    grid-row: 1 / span 2;
    flex-wrap: wrap;
    width: 3.1rem;
  }

  .playerInfo {
    padding-right: 0;
    border-right: 0;
  }

  .playerProgress {
    grid-template-columns: auto minmax(3rem, 1fr);
  }
}

@media (max-width: 390px) {
  .playerArtist,
  .playerTime span:last-child,
  .playerTime span:nth-child(2) {
    display: none;
  }
}
