:root {
  color-scheme: dark;
  --background: #171716;
  --panel: #20201f;
  --panel-raised: #292927;
  --line: #41413e;
  --line-soft: #30302e;
  --text: #f4f3ee;
  --muted: #aaa9a1;
  --accent: #f3961e;
  --accent-soft: rgb(243 150 30 / 14%);
  --danger: #f07067;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 85% 0, rgb(243 150 30 / 7%), transparent 30rem),
    var(--background);
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: var(--text);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .38;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: 100%;
  height: 100vh;
  min-height: 620px;
  padding: 10px;
  gap: 8px;
}

.app-header,
.transport-bar,
.status-bar,
.output-control,
.volume-control,
.tabs-bar,
.playlist-toolbar,
.library-header {
  display: flex;
  align-items: center;
}

.app-header {
  justify-content: space-between;
  min-height: 46px;
  padding: 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #171716;
  font-size: 10px;
  font-weight: 900;
}

.brand-name,
.panel-kicker,
.output-control label,
.playlist-table th {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}

.brand-name {
  letter-spacing: .18em;
}

.output-control {
  gap: 8px;
}

.output-control label,
.panel-kicker,
.playlist-table th {
  color: var(--muted);
}

select,
.square-button,
.text-button {
  border: 1px solid var(--line);
  background: var(--panel-raised);
}

select {
  max-width: 230px;
  min-height: 34px;
  padding: 5px 30px 5px 9px;
  border-radius: 5px;
}

.square-button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border-radius: 5px;
  font-size: 18px;
}

.square-button.busy {
  animation: spin .9s linear infinite;
}

.transport-bar {
  min-height: 54px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.transport-buttons {
  display: flex;
  align-self: stretch;
}

.command-button {
  display: grid;
  width: 52px;
  min-width: 44px;
  height: 100%;
  min-height: 52px;
  padding: 0;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  font-size: 25px;
}

.command-button:hover,
.command-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.play-button {
  color: var(--accent);
}

.seek-control {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto;
  flex: 1;
  gap: 14px;
  align-items: center;
  padding: 0 16px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.login-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(10 10 10 / 82%);
  backdrop-filter: blur(8px);
}

.login-overlay[hidden] {
  display: none;
}

.login-panel {
  display: grid;
  width: min(390px, 100%);
  gap: 9px;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgb(0 0 0 / 55%);
}

.login-panel h1 {
  margin: 8px 0 14px;
}

.login-panel input {
  min-width: 0;
  margin-bottom: 8px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #111;
}

.login-panel .text-button {
  justify-self: start;
  margin-top: 5px;
}

.login-error {
  min-height: 1.3em;
  margin: 0;
  color: #ff796f;
}

.time-display {
  display: flex;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.time-divider {
  color: var(--line);
}

.repeat-button {
  border-right: 0;
  border-left: 1px solid var(--line);
  font-size: 19px;
}

.repeat-button[data-repeat="one"]::after {
  content: "1";
  position: absolute;
  margin: 16px 0 0 18px;
  font-size: 9px;
  font-weight: 900;
}

.volume-control {
  align-self: stretch;
  width: 210px;
  gap: 9px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}

.volume-control span,
.volume-control output {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.volume-control output {
  width: 32px;
  font-variant-numeric: tabular-nums;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 31%) minmax(0, 1fr);
  min-height: 0;
}

.left-pane {
  display: grid;
  grid-template-rows: minmax(230px, 58%) minmax(180px, 42%);
  min-height: 0;
}

.panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.library-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-bottom: 0;
}

.panel-header {
  min-height: 55px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.library-header {
  justify-content: space-between;
  gap: 8px;
}

.library-header > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.library-header select {
  max-width: 100%;
  min-height: 30px;
  padding-top: 2px;
  padding-bottom: 2px;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
}

.breadcrumb {
  min-height: 31px;
  padding: 8px 11px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-list {
  grid-row: 3;
  min-height: 0;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
}

.library-entry {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  min-height: 35px;
  padding: 3px 5px;
  border-radius: 4px;
  cursor: default;
}

.library-entry:hover,
.library-entry:focus-within {
  background: var(--panel-raised);
}

.entry-icon {
  color: var(--accent);
  text-align: center;
}

.entry-name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-actions {
  display: flex;
  gap: 3px;
  opacity: 0;
}

.library-entry:hover .entry-actions,
.library-entry:focus-within .entry-actions {
  opacity: 1;
}

.entry-action,
.row-action {
  display: grid;
  width: 27px;
  height: 27px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #181817;
  color: var(--muted);
}

.entry-action:hover,
.row-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.now-playing-pane {
  position: relative;
  display: grid;
  grid-template-columns: minmax(110px, 42%) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  overflow: hidden;
}

.cover-art {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  max-height: 100%;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(140deg, transparent 49.5%, rgb(243 150 30 / 55%) 50%, transparent 50.5%),
    #2b2b29;
}

.cover-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.cover-placeholder[hidden] {
  display: none;
}

.cover-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--accent) 0 8%, #111 8.5% 13%, transparent 13.5%),
    repeating-radial-gradient(circle, #2f2f2c 0 2px, #141413 3px 6px);
  box-shadow: 0 12px 30px rgb(0 0 0 / 45%);
}

.cover-placeholder > span {
  position: absolute;
  color: #111;
  font-size: 8px;
  font-weight: 900;
}

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

.track-summary h1 {
  margin: 8px 0 5px;
  overflow: hidden;
  font-size: clamp(18px, 2.1vw, 30px);
  line-height: 1.05;
  letter-spacing: -.035em;
  text-overflow: ellipsis;
}

.track-summary p {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
}

.playlist-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border-left: 0;
}

.tabs-bar {
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  background: #1b1b1a;
}

.tabs {
  display: flex;
  flex: 1;
  align-self: stretch;
  min-width: 0;
  overflow-x: auto;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 190px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tab.active {
  background: var(--panel);
  color: var(--accent);
  font-weight: 750;
  box-shadow: inset 0 2px var(--accent);
}

.tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-count {
  color: var(--muted);
  font-size: 10px;
}

.tab-delete {
  display: grid;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.tab-delete:hover {
  background: rgb(240 112 103 / 18%);
  color: var(--danger);
}

.tab-add {
  align-self: stretch;
  width: 40px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  font-size: 19px;
}

.playlist-toolbar {
  justify-content: space-between;
  min-height: 53px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.playlist-toolbar > div {
  display: grid;
  gap: 4px;
}

.playlist-toolbar strong {
  font-size: 14px;
}

.text-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.playlist-scroll {
  grid-row: 3;
  min-height: 0;
  overflow: auto;
}

.playlist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.playlist-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  background: #1b1b1a;
  text-align: left;
}

.playlist-table td {
  padding: 9px 7px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-row {
  cursor: default;
}

.playlist-row:hover {
  background: var(--panel-raised);
}

.playlist-row.current {
  background: var(--accent-soft);
}

.playlist-row.current .track-title,
.playlist-row.current .track-number {
  color: var(--accent);
}

.track-number,
.track-album,
.track-duration,
.track-artist {
  color: var(--muted);
}

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

.track-artist {
  margin-top: 2px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.number-column {
  width: 43px;
  text-align: right !important;
}

.duration-column {
  width: 70px;
  text-align: right !important;
}

.action-column {
  width: 42px;
}

.row-action {
  border: 0;
  background: transparent;
  color: transparent;
}

.playlist-row:hover .row-action,
.row-action:focus-visible {
  color: var(--danger);
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.empty-state p {
  margin: 0 0 8px;
}

.empty-state code {
  color: var(--accent);
}

.playlist-empty {
  grid-row: 3;
  z-index: 2;
  align-self: center;
}

.library-pane > .empty-state {
  grid-row: 3;
  z-index: 2;
}

.playlist-empty[hidden],
.library-pane .empty-state[hidden] {
  display: none;
}

.status-bar {
  justify-content: space-between;
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: #121211;
  color: var(--muted);
  font-size: 10px;
}

.audio-status {
  display: flex;
  min-width: 0;
  gap: 13px;
}

.audio-status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status {
  max-width: 46%;
  margin: 0;
  overflow: hidden;
  color: var(--danger);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

button:focus-visible,
select:focus-visible,
input:focus-visible,
.library-entry:focus-visible,
.playlist-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (hover: none) {
  .entry-actions {
    opacity: 1;
  }

  .row-action {
    color: var(--danger);
  }
}

@media (max-width: 850px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .transport-bar {
    flex-wrap: wrap;
  }

  .seek-control {
    order: 3;
    width: 100%;
    min-height: 42px;
    border-top: 1px solid var(--line-soft);
  }

  .transport-buttons {
    flex: 1;
  }

  .command-button {
    height: 52px;
  }

  .volume-control {
    width: 190px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .left-pane {
    grid-template-rows: minmax(330px, 48vh) 190px;
  }

  .playlist-pane {
    min-height: 520px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 6px;
  }

  .app-header {
    align-items: flex-start;
    gap: 12px;
  }

  .brand-name,
  .output-control label {
    display: none;
  }

  .output-control {
    min-width: 0;
  }

  .output-control select {
    max-width: 180px;
  }

  .transport-buttons .command-button {
    flex: 1;
  }

  .repeat-button {
    width: 48px;
  }

  .volume-control {
    flex: 1;
    width: auto;
  }

  .now-playing-pane {
    grid-template-columns: 110px minmax(0, 1fr);
  }

  .playlist-table th:nth-child(3),
  .playlist-table td:nth-child(3) {
    display: none;
  }

  .status-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
    padding: 7px 9px;
  }

  .audio-status {
    flex-wrap: wrap;
    gap: 5px 11px;
  }

  #status {
    max-width: 100%;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
