.tape-player-launch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  white-space: nowrap;
}

.tape-player-launch:is(:hover, :focus-visible) {
  background: var(--ui-accent);
  color: var(--accent-text);
}

.tape-player-launch__icon {
  width: 17px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background:
    radial-gradient(circle, currentColor 1px, transparent 1.4px) 2px 2px / 4px 4px no-repeat,
    radial-gradient(circle, currentColor 1px, transparent 1.4px) 9px 2px / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) center 7px / 7px 1px no-repeat;
}

.tape-shelf-menu-item {
  width: 100%;
  text-align: left;
}

.entry-window:is(.tape-player-window, .tape-library-window, .tape-shelf-window) {
  --window-min-content-width: 0px;
  --window-min-content-height: 0px;
  width: min(24rem, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
}

.entry-window.tape-shelf-window {
  width: min(26rem, calc(100% - 1.5rem));
}

.entry-window:is(.tape-player-window, .tape-library-window, .tape-shelf-window).entry-window--maximized {
  max-height: 100%;
}

:is(.tape-player-window, .tape-library-window, .tape-shelf-window) > .entry-window__body {
  display: flex;
  background: #20222a;
}

.tape-window-scroll {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.tape-window-scroll[data-scroll-active="true"] {
  grid-template-columns: minmax(0, 1fr) 18px;
}

.tape-window-scroll > .entry-article__scrollbar {
  margin-bottom: 16px;
}

.tape-window-scroll .entry-article__scroll-thumb {
  touch-action: none;
}

.tape-window-scroll__viewport {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

:is(.tape-window-scroll__viewport, .tape-shelf__list) {
  scrollbar-width: none;
}

:is(.tape-window-scroll, .tape-shelf):not([data-scroll-active="true"]) > .entry-article__scrollbar {
  display: none;
}

:is(.tape-player, .tape-library, .tape-shelf) {
  --tape-accent: #d8ebae;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.76rem;
  color: #f6eae2;
}

.tape-player {
  --tape-supply: 1;
  --tape-takeup: 0.6;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.72rem;
  max-width: 33rem;
  margin: 0 auto;
  padding: clamp(0.65rem, 2vw, 1rem);
}

.tape-player__chassis {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  padding: 0.7rem;
  border: 2px solid #14191f;
  border-radius: 12px 12px 9px 9px;
  background: linear-gradient(145deg, #536570, #3d4d5a 55%, #303e49);
  box-shadow: inset 0 0 0 2px #829199, inset 0 -5px #28313a, 0 4px 0 #14171c;
}

.tape-player__faceplate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7.4rem, 0.6fr);
  gap: 0.25rem 0.65rem;
  padding: 0.25rem;
}

.tape-player__speaker {
  grid-row: span 3;
  min-height: 3.35rem;
  border: 2px solid #28323d;
  border-radius: 4px;
  background: repeating-linear-gradient(#273440 0 2px, #71848f 2px 3px, #526571 3px 5px);
  box-shadow: inset 0 0 7px #141b21, 0 1px #8a9ba5;
}

.tape-player__library-key {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 1.85rem;
  padding: 0.16rem 0.22rem;
  border: 1px solid #202732;
  border-radius: 3px;
  background: linear-gradient(#ccd9df, #98adb9);
  box-shadow: inset 0 1px #edf6f5, inset 0 -3px #657b89, 0 1px #202732;
  color: #22303c;
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.tape-player__library-key:hover {
  filter: brightness(1.11);
}

.tape-player__library-key:active {
  background: #95aab6;
  box-shadow: inset 0 2px 3px #516574;
}

.tape-player__status,
.tape-player__readout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.tape-player__readout {
  justify-content: space-between;
}

.tape-player__status {
  padding: 0.15rem 0.28rem;
  line-height: 1.3;
}

.tape-player__model {
  padding: 0.04rem 0.28rem;
  border: 1px solid #8997a0;
  border-radius: 2px;
  background: #303e47;
  color: #f1dfc6;
  font-size: 0.65rem;
  font-weight: bold;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.tape-player__lamp {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #837b80;
  box-shadow: 0 0 0 2px #131216;
}

.tape-player[data-state="playing"] .tape-player__lamp {
  background: var(--tape-accent);
  box-shadow: 0 0 0 2px #131216, 0 0 9px var(--tape-accent);
}

.tape-player:is([data-state="loading"], [data-state="buffering"], [data-state="winding"]) .tape-player__lamp {
  background: #f2c47f;
}

.tape-player:is([data-state="error"], [data-state="blocked"]) .tape-player__lamp {
  background: #ffa59e;
}

.tape-player__key {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  min-height: 3.05rem;
  border: 1px solid #202732;
  border-bottom: 6px solid #5e7381;
  border-radius: 3px 3px 2px 2px;
  background: linear-gradient(#d0dce0, #95aebd);
  box-shadow: inset 0 1px #edf6f5, inset 1px 0 #b9cbd3, 0 2px 0 #0e141a;
  color: #202c38;
  cursor: pointer;
}

.tape-player__key:not(:disabled):hover {
  filter: brightness(1.11);
}

.tape-player__key:not(:disabled):active,
.tape-player__key[data-winding="true"],
.tape-player:is([data-state="playing"], [data-state="buffering"]) .tape-player__key--play {
  translate: 0 3px;
  border-bottom-width: 3px;
  box-shadow: inset 0 1px 3px #516574;
}

.tape-player__key--wind {
  touch-action: none;
  user-select: none;
}

.tape-player__key:disabled {
  filter: saturate(0.65) brightness(0.8);
  cursor: default;
}

.tape-player :is(button, input):focus-visible {
  outline: 2px solid var(--tape-accent);
  outline-offset: 2px;
}

.tape-player__well {
  padding: 0.72rem;
  border: 3px solid #a4b7c0;
  border-radius: 4px;
  background: repeating-linear-gradient(0deg, #151418 0 3px, #1a191c 3px 4px);
  box-shadow: 0 0 0 1px #253039, inset 0 0 0 1px #08090a, inset 0 3px 10px #09080a;
}

.tape-library[data-drop="true"] {
  outline: 2px dashed var(--tape-accent);
  outline-offset: -3px;
}

:is(.tape-cassette, .tape-shelf__tape) {
  --tape-paper: #e6dac1;
  --tape-stripe: #8c7875;
  --tape-stripe-dark: color-mix(in srgb, var(--tape-stripe), #291c26 44%);
}

.tape-cassette:is([data-tape-palette="ochre"], [data-tape-palette="olive"]) {
  --tape-shell: #705043;
}

.tape-cassette:is([data-tape-palette="slate"], [data-tape-palette="oxide"]) {
  --tape-shell: #e7e1d7;
}

[data-tape-palette="oxide"] {
  --tape-paper: #ebc4ba;
  --tape-stripe: #ba6157;
}

[data-tape-palette="olive"] {
  --tape-paper: #dce0bd;
  --tape-stripe: #85955e;
}

[data-tape-palette="slate"] {
  --tape-paper: #cbdde3;
  --tape-stripe: #6691a8;
}

[data-tape-palette="plum"] {
  --tape-paper: #d9cadf;
  --tape-stripe: #966e9c;
}

[data-tape-palette="ochre"] {
  --tape-paper: #f0dcad;
  --tape-stripe: #b88c42;
}

.tape-cassette {
  --tape-shell: #29282b;
  --tape-shell-light: color-mix(in srgb, var(--tape-shell), #fff9ec 28%);
  --tape-shell-shade: color-mix(in srgb, var(--tape-shell), #19161b 20%);
  --tape-shell-dark: color-mix(in srgb, var(--tape-shell), #19161b 48%);
  position: relative;
  container-type: inline-size;
  width: 100%;
  max-width: 24rem;
  aspect-ratio: 1.65;
  margin-inline: auto;
  border: 1px solid #0b0b0f;
  border-radius: 8px 8px 5px 5px;
  background:
    repeating-linear-gradient(115deg, #ffffff0d 0 1px, transparent 1px 5px),
    linear-gradient(150deg, var(--tape-shell-light), var(--tape-shell) 28% 62%, var(--tape-shell-shade));
  box-shadow:
    inset 0 0 0 1px var(--tape-shell-light),
    inset 0 0 0 3px var(--tape-shell-dark),
    inset 0 0 0 4px var(--tape-shell),
    inset 0 -5px var(--tape-shell-dark),
    0 4px 7px #080709;
}

.tape-cassette__screw {
  --screw-inset: max(4px, 3%);
  position: absolute;
  z-index: 1;
  width: clamp(5px, 3.5cqi, 10px);
  aspect-ratio: 1;
  border: 1px solid #252329;
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 41%, #3c393e 42% 54%, #a09592 56%, transparent 61%),
    linear-gradient(135deg, #b2aaa2, #59565d 75%);
  box-shadow: 0 1px #625960;
}

.tape-cassette__screw--top-left {
  top: var(--screw-inset);
  left: var(--screw-inset);
}

.tape-cassette__screw--top-right {
  top: var(--screw-inset);
  right: var(--screw-inset);
  rotate: 65deg;
}

.tape-cassette__screw--bottom-left {
  bottom: var(--screw-inset);
  left: var(--screw-inset);
  rotate: 110deg;
}

.tape-cassette__screw--bottom-right {
  right: var(--screw-inset);
  bottom: var(--screw-inset);
  rotate: 30deg;
}

.tape-cassette__label {
  position: absolute;
  inset: 9% 7% 24%;
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  padding: 0.35rem clamp(0.35rem, 3.2cqi, 0.7rem);
  border: 1px solid #181518;
  border-radius: 5px 5px 3px 3px;
  background:
    repeating-linear-gradient(90deg, #3b242708 0 1px, transparent 1px 4px),
    linear-gradient(var(--tape-paper) 0 42%, var(--tape-stripe) 42% 45%, var(--tape-stripe-dark) 45% 84%, var(--tape-stripe) 84% 88%, var(--tape-paper) 88%);
  color: #332326;
  box-shadow: 0 1px #61585c, inset 0 1px #f7e8ce;
}

.tape-cassette__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.tape-cassette__side {
  flex: 0 0 auto;
  padding: 0.1rem 0.34rem;
  border-radius: 2px;
  background: var(--tape-stripe-dark);
  color: #fff1d9;
  font-size: 0.8rem;
  font-weight: bold;
}

.tape-cassette__name,
.tape-player__track {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tape-cassette__name {
  flex: 1 1 auto;
  padding-bottom: 0.12rem;
  border-bottom: 1px solid var(--tape-stripe);
  font-weight: bold;
}

.tape-cassette__window {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 41% minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  align-self: center;
  justify-self: center;
  width: min(95%, 16rem);
  height: min(100%, 18cqi);
  padding-inline: 0.25rem;
  border: 1px solid #252024;
  border-radius: 5px;
  background: linear-gradient(#3f3b43, #302a30 50%, #27252b);
  box-shadow: 0 1px #e8aea0, inset 0 1px #7c6e70, inset 0 -2px #1d1b22;
  isolation: isolate;
}

.tape-cassette__glass {
  position: relative;
  display: block;
  align-self: center;
  justify-self: stretch;
  height: 57%;
  overflow: hidden;
  border: 1px solid #100f16;
  border-radius: 2px;
  background:
    linear-gradient(118deg, transparent 26%, #e1ebf22b 27% 38%, #e1ebf20e 39% 47%, transparent 48%),
    linear-gradient(#312e37, #4c4851 55%, #25232b);
  box-shadow: 0 1px #797078, inset 0 1px 4px #16141a;
}

.tape-cassette__glass::before {
  position: absolute;
  inset: 52% 0 10%;
  background: linear-gradient(#876557 0 16%, #4d322b 19% 58%, #5c4034 61% 85%, #30201d 86%);
  clip-path: polygon(0 0, 100% 34%, 100% 86%, 0 100%);
  content: "";
}

.tape-cassette__glass::after {
  position: absolute;
  inset: 12% 12% auto;
  height: 22%;
  border-inline: 1px solid #e5ddc674;
  background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), #e5ddc674 calc(20% - 1px) 20%);
  opacity: 0.6;
  content: "";
}

.tape-cassette__spool {
  position: relative;
  display: grid;
  place-items: center;
  width: min(94%, 15cqi);
  aspect-ratio: 1;
  border: 1px solid #17151a;
  border-radius: 50%;
  background: #232127;
  box-shadow: 0 1px #625762, inset 0 1px 3px #100e13;
  isolation: isolate;
}

.tape-cassette__spool::before {
  position: absolute;
  inset: 3%;
  z-index: -1;
  border: 1px solid #9a7358;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, #a47a5a 0 1px, #634433 1px 2.5px);
  content: "";
}

.tape-cassette__spool--supply::before { scale: var(--tape-supply); }
.tape-cassette__spool--takeup::before { scale: var(--tape-takeup); }

.tape-cassette__hub {
  width: 58%;
  aspect-ratio: 1;
  border: 1px solid #a79a86;
  border-radius: 50%;
  background:
    radial-gradient(circle, #211e24 0 22%, transparent 25% 45%, #ddd1ba 47% 59%, #998a79 61% 68%, transparent 70%),
    repeating-conic-gradient(#ded2bd 0deg 16deg, #302c31 17deg 60deg);
  box-shadow: 0 0 0 1px #20191a, inset 0 0 0 1px #d8cbb5;
  animation: tape-reel-turn 2s linear infinite paused;
}

.tape-player[data-state="playing"] .tape-cassette__hub {
  animation-play-state: running;
}

.tape-player[data-wind-direction] .tape-cassette__hub {
  animation-duration: 0.34s;
  animation-play-state: running;
}

.tape-player[data-wind-direction="rewind"] .tape-cassette__hub {
  animation-direction: reverse;
}

.tape-player[data-state="empty"] .tape-cassette__spool::before,
.tape-player[data-state="empty"] .tape-cassette__glass::before {
  visibility: hidden;
}

@keyframes tape-reel-turn {
  to { rotate: 1turn; }
}

.tape-cassette__guide {
  position: absolute;
  inset: auto 16% 1% 16%;
  height: 20%;
  clip-path: polygon(9% 0, 91% 0, 100% 100%, 0 100%);
  border-top: 1px solid var(--tape-shell-light);
  background:
    radial-gradient(circle, #121117 0 25%, #756970 30% 40%, transparent 48%) 27% 61% / 11% 58% no-repeat,
    radial-gradient(circle, #121117 0 25%, #756970 30% 40%, transparent 48%) 73% 61% / 11% 58% no-repeat,
    radial-gradient(ellipse, #16141a 0 39%, #655b62 43% 52%, transparent 58%) 14% 100% / 10% 49% no-repeat,
    radial-gradient(ellipse, #16141a 0 39%, #655b62 43% 52%, transparent 58%) 86% 100% / 10% 49% no-repeat,
    linear-gradient(#111016, #28252b) 50% 100% / 23% 38% no-repeat,
    linear-gradient(var(--tape-shell-light), var(--tape-shell) 42%, var(--tape-shell-dark) 95%);
  box-shadow: inset 0 -2px var(--tape-shell-dark);
}

.tape-player__display {
  padding: 0.4rem 0.55rem 0.15rem;
  border: 1px solid #22201f;
  border-radius: 4px;
  background: linear-gradient(#393630, #2b2927);
  box-shadow: inset 0 1px #6f6559, 0 1px #62747e;
  color: #f0dfc3;
}

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

.tape-player:is([data-state="error"], [data-state="blocked"]) .tape-player__notice {
  position: static;
  width: auto;
  height: auto;
  min-width: 0;
  clip-path: none;
  color: #ffc7ad;
  text-overflow: ellipsis;
}

.tape-player:is([data-state="error"], [data-state="blocked"]) .tape-player__track {
  display: none;
}

.tape-player__times {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.15rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tape-player__counter {
  min-width: 4ch;
  padding: 0.04rem 0.22rem;
  border: 1px solid #100f12;
  border-radius: 2px;
  background: linear-gradient(#1c1918 0 48%, #2d2822 49% 53%, #161415 55%);
  box-shadow: inset 0 1px 2px #09090b, 0 1px #746858;
  color: #fcdeb2;
  font-weight: bold;
  text-align: center;
}

.tape-player__counter--total {
  color: #d9cbb7;
}

.tape-player__time-divider {
  color: #d0bc9e;
}

.tape-player__scale {
  --scale-ticks: 10%;
  --scale-ink: #ae9a7b;
  position: relative;
  display: block;
  min-width: 0;
}

.tape-player__scale::before {
  position: absolute;
  inset: 3px 4px auto;
  height: 5px;
  border-right: 1px solid var(--scale-ink);
  background:
    repeating-linear-gradient(90deg, var(--scale-ink) 0 1px, transparent 1px calc(var(--scale-ticks) * 2)) 0 0 / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--scale-ink) 0 1px, transparent 1px var(--scale-ticks)) 0 0 / 100% 3px no-repeat;
  pointer-events: none;
  content: "";
}

.tape-player__range {
  --range-track-height: 5px;
  --range-cap-width: 9px;
  --range-cap-height: 15px;
  --range-cap-border: #422c20;
  --range-cap-finish: linear-gradient(90deg, #8d6645 0 27%, #f5d49d 29% 65%, #b78956 67%);
  position: relative;
  display: block;
  appearance: none;
  width: 100%;
  height: 1.7rem;
  margin: 0;
  padding-top: 5px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(#161417, #100f11 74%, #6d6152) center calc(50% + 2.5px) / 100% var(--range-track-height) no-repeat;
  cursor: ew-resize;
}

.tape-player__fader {
  --range-cap-width: 17px;
  --range-cap-height: 14px;
  --range-cap-border: #2b2930;
  --range-cap-finish:
    repeating-linear-gradient(90deg, #74685780 0 1px, #f6e3c373 1px 2px, transparent 2px 4px),
    linear-gradient(#d6c9b2, #a89a83);
}

.tape-player__range::-webkit-slider-runnable-track {
  height: var(--range-track-height);
  background: transparent;
}

.tape-player__range::-moz-range-track {
  height: var(--range-track-height);
  background: transparent;
}

.tape-player__range::-webkit-slider-thumb {
  appearance: none;
  width: var(--range-cap-width);
  height: var(--range-cap-height);
  margin-top: calc((var(--range-track-height) - var(--range-cap-height)) / 2);
  border: 1px solid var(--range-cap-border);
  border-radius: 2px;
  background: var(--range-cap-finish);
  box-shadow: inset 0 1px #fff7d885, 0 1px 2px #08080a;
}

.tape-player__range::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--range-cap-width);
  height: var(--range-cap-height);
  border: 1px solid var(--range-cap-border);
  border-radius: 2px;
  background: var(--range-cap-finish);
  box-shadow: inset 0 1px #fff7d885, 0 1px 2px #08080a;
}

.tape-player__range:disabled {
  opacity: 0.5;
  cursor: default;
}

.tape-player__transport {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.28fr) repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 3px 3px 5px;
  border: 1px solid #7f919e;
  border-radius: 4px;
  background: #14202a;
}

.tape-player__key--stop {
  border-bottom-color: #955455;
  background: linear-gradient(#f4b0a3, #d7867e);
  box-shadow: inset 0 1px #ffd5b6, inset 1px 0 #e8a59b, 0 2px 0 #0e141a;
}

.tape-player__symbol {
  display: block;
  width: 0.85rem;
  height: 0.8rem;
  background: currentColor;
}

.tape-player__symbol--play { clip-path: polygon(14% 0, 100% 50%, 14% 100%); }
.tape-player__symbol--stop { width: 0.65rem; height: 0.65rem; }
.tape-player__symbol--forward { clip-path: polygon(0 0, 50% 50%, 50% 0, 100% 50%, 50% 100%, 50% 50%, 0 100%); }
.tape-player__symbol--rewind { clip-path: polygon(100% 0, 50% 50%, 50% 0, 0 50%, 50% 100%, 50% 50%, 100% 100%); }
.tape-player__symbol--eject { clip-path: polygon(50% 0, 100% 67%, 0 67%, 0 82%, 100% 82%, 100% 100%, 0 100%, 0 67%); }

.tape-player__play-markings {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tape-player__symbol--pause {
  width: 0.58rem;
  background: linear-gradient(90deg, currentColor 0 32%, transparent 32% 68%, currentColor 68%);
}

.tape-player__volume {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  padding-inline: 0.28rem;
  color: #f2ede6;
  font-size: 0.63rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tape-player__volume .tape-player__scale {
  --scale-ticks: 12.5%;
  --scale-ink: #bec7c9;
}

.tape-shelf,
.tape-library {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.75rem;
  background: linear-gradient(#38303c, #2c2530);
  box-shadow: inset 0 1px #645568;
}

.tape-library__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tape-library__catalog {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tape-library__row {
  display: flex;
  min-width: 0;
  gap: 0.35rem;
}

.tape-library__shelf {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #19141d;
  border-left: 4px solid #a18470;
  border-radius: 3px;
  background: #47373f;
  box-shadow: inset 0 1px #6d5761;
  color: #f4dfc6;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tape-library__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: bold;
}

.tape-shelf__count {
  color: #dfcfdc;
  white-space: nowrap;
}

.tape-shelf__list {
  --spine-height: 13rem;
  display: flex;
  align-items: flex-end;
  gap: 0.34rem;
  min-height: calc(var(--spine-height) + 1.15rem);
  margin: 0;
  padding: 0.55rem 0.55rem 0.65rem;
  overflow-x: auto;
  overflow-y: hidden;
  list-style: none;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 0.5rem;
  border: 1px solid #151119;
  border-radius: 3px;
  background:
    linear-gradient(90deg, #14101789, transparent 10%, transparent 93%, #141017a8),
    linear-gradient(#1d1820, #30262b 92%, #5a443f 92%, #3c2d31);
  box-shadow: inset 0 3px 8px #100f13, inset 0 -2px #211923;
}

.tape-shelf__list:has(.tape-shelf__empty) {
  min-height: 5.25rem;
}

.tape-shelf__empty {
  align-self: flex-start;
  padding: 0.6rem;
  color: #dfcfdc;
  line-height: 1.55;
}

.tape-shelf__item {
  display: grid;
  flex: 0 0 2.85rem;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem;
  min-width: 0;
}

.tape-shelf__tape {
  --case-rim: #58555e;
  --case-plastic: #25242a;
  --case-shadow: #17161b;
  position: relative;
  display: grid;
  grid-template: 0.52rem minmax(0, 1fr) 0.65rem / minmax(0, 1fr);
  gap: 0.25rem;
  min-width: 0;
  height: var(--spine-height);
  padding: 0.3rem 0.36rem;
  border: 1px solid #111015;
  border-radius: 4px 4px 3px 3px;
  background:
    linear-gradient(90deg, #16151a 0 4%, #d6d3df66 8%, #fff0 16% 84%, #fff4 91%, #16151a 97%),
    linear-gradient(var(--case-rim), var(--case-plastic) 12% 89%, var(--case-shadow));
  box-shadow: inset 0 1px #bbb7c17d, inset 0 -2px var(--case-shadow), 1px 2px 2px #120f14;
  font-weight: bold;
  cursor: pointer;
}

.tape-shelf__tape::before {
  position: absolute;
  inset: 2px;
  z-index: 1;
  border: 1px solid #fff4;
  border-radius: 2px;
  background: linear-gradient(110deg, #fff2, transparent 30% 74%, #fff1);
  pointer-events: none;
  content: "";
}

.tape-shelf__tape::after {
  grid-area: 3 / 1;
  place-self: center;
  width: 62%;
  height: 3px;
  border-top: 1px solid #17131b;
  border-bottom: 1px solid var(--case-rim);
  border-radius: 1px;
  background: #242029;
  content: "";
}

.tape-shelf__tape:is(:hover, [aria-current="true"]) {
  border-color: #e3edb7;
}

.tape-shelf__tape[aria-current="true"] {
  translate: 0 -3px;
  box-shadow: inset 0 0 0 1px #839470, 1px 4px 4px #151018;
}

.tape-shelf__case-hinge {
  align-self: center;
  justify-self: center;
  width: 74%;
  height: 0.33rem;
  border: 1px solid #1d1921;
  border-radius: 1px;
  background: repeating-linear-gradient(90deg, var(--case-shadow) 0 2px, var(--case-plastic) 2px 3px);
  box-shadow: 0 1px var(--case-rim);
}

.tape-shelf__label {
  grid-area: 2 / 1;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  justify-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0.32rem 0.13rem 0.88rem;
  border: 1px solid var(--tape-stripe-dark);
  border-radius: 2px;
  background: linear-gradient(to top, var(--tape-stripe-dark) 0 3px, var(--tape-stripe) 3px 9px, var(--tape-paper) 9px);
  box-shadow: 0 1px #18121c66, inset 1px 0 #ffffff2e;
}

.tape-shelf__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
  writing-mode: vertical-rl;
  color: #2b2327;
  font-size: 0.72rem;
  line-height: 1.06;
  text-align: start;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.tape-shelf__draft {
  z-index: 2;
  grid-area: 3 / 1;
  align-self: center;
  background: #302831;
  color: #f4dfc6;
  font-size: 0.56rem;
  line-height: 1.1;
}

.tape-shelf__tooltip {
  display: none;
  position: fixed;
  inset: auto;
  width: max-content;
  max-width: min(26rem, calc(100% - 1rem));
  margin: 0;
  padding: 0.45rem 0.65rem;
  border: 2px solid var(--border-dark);
  background: var(--surface-panel);
  box-shadow: inset 1px 1px var(--inset-highlight), 3px 3px var(--window-shadow);
  color: var(--ink);
  font: 0.95rem/1.35 ui-monospace, "SF Mono", Consolas, monospace;
  overflow-wrap: anywhere;
}

.tape-shelf__tooltip:popover-open {
  display: block;
}

:is(.tape-shelf, .tape-library) :is(button, input, select, ul):focus-visible {
  outline: 2px solid var(--tape-accent);
  outline-offset: 2px;
}

:is(.tape-shelf, .tape-library) ul:focus-visible {
  outline-offset: -2px;
}

.tape-shelf__edit,
.tape-shelf__add,
.tape-shelf__editor button {
  min-height: 2.2rem;
  padding: 0.25rem 0.45rem;
  border: 1px solid #19141d;
  border-radius: 3px;
  background: #55485a;
  box-shadow: inset 0 1px #7d6980;
  color: #fff0e3;
  font: inherit;
  cursor: pointer;
}

.tape-shelf__edit {
  min-height: 1.75rem;
  padding-inline: 0.1rem;
  font-size: 0.65rem;
}

.tape-library__row .tape-shelf__edit {
  flex: 0 0 auto;
  padding-inline: 0.42rem;
}

:is(.tape-library__shelf, .tape-shelf__edit, .tape-shelf__add, .tape-shelf__editor button):not(:disabled):hover {
  background: #6d5871;
}

.tape-shelf__editor button:disabled {
  opacity: 0.56;
  cursor: default;
}

.tape-shelf__editor {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.6rem;
  border-top: 1px solid #68556a;
}

.tape-shelf__editor[hidden],
.tape-shelf__file[hidden],
.tape-shelf__message:empty {
  display: none;
}

.tape-shelf__editor h3,
.tape-shelf__message {
  margin: 0;
}

.tape-shelf__editor label:not(.tape-shelf__publish),
.tape-shelf__file {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
}

.tape-shelf__editor :is(select, input:not([type="checkbox"])) {
  width: 100%;
  padding: 0.28rem;
  border: 1px solid #746078;
  border-radius: 2px;
  background: #221d25;
  color: #fff0e3;
}

.tape-shelf__editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.tape-shelf__message {
  color: #f4d2bf;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .tape-player-launch {
    margin-left: 0;
  }

  /* The Archive desktop can be wider than the viewport. */
  .entry-window:is(.tape-player-window, .tape-library-window, .tape-shelf-window) {
    max-width: calc(100dvw - 2.5rem);
  }

  .entry-window:is(.tape-player-window, .tape-library-window, .tape-shelf-window).entry-window--maximized {
    max-width: calc(100dvw - 1.25rem);
  }
}

@media (max-width: 400px) {
  .aseprite-menubar:has(> .tape-player-launch) {
    gap: 0.1rem;
    padding-inline: 6px;
  }

  .aseprite-menubar:has(> .tape-player-launch) .menu-item__trigger {
    padding-inline: 0.22rem;
  }

  .tape-player-launch__suffix { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tape-cassette__hub { animation: none; }
}
