:root {
  color: #272622;
  background: #f7f3ec;
  font-family:
    "DM Sans",
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-synthesis: none;
  --ink: #272622;
  --muted: #76736c;
  --faint: #a7a299;
  --paper: #fffdfa;
  --canvas: #f7f3ec;
  --canvas-deep: #eee8de;
  --line: #ded8ce;
  --accent: #d9643a;
  --accent-dark: #a83f21;
  --accent-soft: #f9e4d8;
  --sun: #f2a65a;
  --dark: #242320;
  --success: #3d8b68;
  --danger: #c35339;
  --shadow-sm: 0 6px 20px rgb(59 48 34 / 8%);
  --shadow-lg: 0 22px 70px rgb(38 32 24 / 20%);
  --player-height: 96px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  position: relative;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(
      circle at 85% -10%,
      rgb(242 166 90 / 20%),
      transparent 30rem
    ),
    var(--canvas);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

:focus-visible {
  outline: 3px solid rgb(217 100 58 / 42%);
  outline-offset: 3px;
}

svg {
  display: block;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.brand {
  font-family: "Manrope", "DM Sans", sans-serif;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgb(222 216 206 / 75%);
  background: rgb(247 243 236 / 88%);
  backdrop-filter: blur(18px) saturate(130%);
}

.topbar-inner {
  width: min(100% - 48px, 1380px);
  height: 76px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(240px, 720px) auto;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: var(--sun);
  background: var(--dark);
  box-shadow: 0 8px 22px rgb(36 35 32 / 18%);
}

.brand-mark svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-mark circle {
  fill: currentColor;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 16px;
  letter-spacing: -0.025em;
}

.brand-copy small {
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-nav {
  border-top: 1px solid rgb(222 216 206 / 58%);
}

.primary-nav-inner {
  width: min(100% - 48px, 1380px);
  min-height: 47px;
  display: flex;
  align-items: stretch;
  gap: 28px;
  margin: 0 auto;
}

.primary-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.primary-nav a::after {
  height: 3px;
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  border-radius: 99px 99px 0 0;
  content: "";
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.5);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.primary-nav a:hover,
.primary-nav a.active {
  color: var(--ink);
}

.primary-nav a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.header-search {
  min-width: 0;
}

.header-search .search-field {
  height: 46px;
  border-radius: 15px;
  box-shadow: none;
}

.header-search .search-field input {
  font-size: 14px;
}

/*
  Absolute placement keeps both markers at a fixed document offset. A marker
  inside the normal flow would move up as the header shrinks and could then
  re-trigger the opposite state, which is exactly the oscillation this pair
  is meant to avoid.
*/
#topbar-collapse-marker,
#topbar-expand-marker {
  width: 1px;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

#topbar-collapse-marker {
  height: 64px;
}

#topbar-expand-marker {
  height: 24px;
}

.topbar-inner,
.primary-nav-inner,
.header-search .search-field {
  transition:
    height 160ms ease,
    min-height 160ms ease,
    width 160ms ease;
}

.topbar.is-collapsed .topbar-inner {
  height: 52px;
}

.topbar.is-collapsed .brand-copy {
  display: none;
}

.topbar.is-collapsed .primary-nav-inner {
  min-height: 38px;
}

.device-badge {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgb(255 253 250 / 70%);
  font-size: 12px;
  font-family: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.device-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #b4afa6;
}

.device-badge.online .device-status-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(61 139 104 / 12%);
}

.device-badge.offline .device-status-dot {
  background: var(--danger);
}

.device-badge.sleeping .device-status-dot {
  background: #6689b4;
  box-shadow: 0 0 0 4px rgb(102 137 180 / 12%);
}

.device-badge.unknown .device-status-dot {
  background: #c59345;
}

.device-badge:hover {
  border-color: #c9b8a2;
  background: var(--paper);
}

.device-badge:active {
  transform: translateY(1px);
}

.device-badge:focus-visible {
  outline: 3px solid rgb(209 108 54 / 22%);
  outline-offset: 2px;
}

.device-badge svg {
  width: 24px;
  height: 22px;
  overflow: visible;
}

.battery-shell,
.battery-cap {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.battery-fill {
  fill: var(--success);
}

.battery-bolt {
  display: none;
  fill: var(--paper);
  stroke: var(--success);
  stroke-linejoin: round;
  stroke-width: 1.4;
}

.device-badge.level-empty,
.device-badge.level-low {
  color: var(--danger);
}

.device-badge.level-empty .battery-fill {
  width: 2px;
  fill: var(--danger);
}

.device-badge.level-low .battery-fill {
  width: 4px;
  fill: var(--danger);
}

.device-badge.level-medium .battery-fill {
  width: 8px;
}

.device-badge.level-high .battery-fill {
  width: 11px;
}

.device-badge.external-power {
  color: var(--success);
}

.device-badge.external-power .battery-fill {
  width: 13px;
}

.device-badge.external-power .battery-bolt {
  display: block;
}

.device-badge.is-stale {
  opacity: 0.62;
}

.icon-text-button {
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.icon-text-button:hover {
  color: var(--ink);
}

.app-shell {
  width: min(100% - 48px, 1380px);
  min-height: calc(100vh - 124px);
  margin: 0 auto;
  padding: 42px 0 calc(var(--player-height) + 72px);
}

.content-column {
  min-width: 0;
}

.app-view-panel {
  min-width: 0;
}

.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.view-heading h1 {
  margin: 0;
  font-size: clamp(31px, 4.2vw, 46px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.result-count {
  flex: 0 0 auto;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.view-heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-field {
  min-width: 0;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-field:focus-within {
  border-color: rgb(217 100 58 / 55%);
  box-shadow: 0 0 0 4px rgb(217 100 58 / 9%);
}

.search-field > svg {
  width: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.search-field input::placeholder {
  color: var(--faint);
}

.search-field button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
  font-size: 23px;
}

.filter-button {
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.filter-button[aria-expanded="true"] {
  border-color: var(--dark);
  color: var(--paper);
  background: var(--dark);
}

.filter-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 12px;
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(255 253 250 / 72%);
}

.filters label,
.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select,
.login-card input {
  width: 100%;
  height: 46px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
}

select:focus,
.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(217 100 58 / 10%);
}

.reset-filter-button {
  min-height: 46px;
  align-self: end;
  padding: 0 15px;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.shelves {
  min-width: 0;
  display: grid;
  gap: 42px;
  margin-top: 12px;
}

.shelf-section {
  min-width: 0;
}

.shelf-heading,
.catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.shelf-heading h2,
.catalog-heading h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.shelf-heading button {
  min-height: 40px;
  padding: 0 4px;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.shelf-row {
  min-width: 0;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 20px 2px 10px;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-color: #cfc6ba transparent;
  scrollbar-width: thin;
}

/*
 * Während des Ziehens darf keine Textauswahl entstehen und der Zeiger soll
 * zeigen, dass die Reihe gefasst ist.
 */
.shelf-row.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto;
  user-select: none;
}

.shelf-row img {
  -webkit-user-drag: none;
}

.book-card {
  min-width: 0;
  position: relative;
}

.book-card.compact {
  width: 132px;
  min-width: 132px;
  flex: 0 0 132px;
  scroll-snap-align: start;
}

.cover-wrap {
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  border-radius: 14px;
  transition: transform 180ms ease;
}

.cover-wrap:hover {
  transform: translateY(-3px);
}

.cover-button {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: #dfd8cd;
  box-shadow: 0 10px 28px rgb(50 40 28 / 13%);
  transition: box-shadow 180ms ease;
}

.cover-button::after {
  position: absolute;
  inset: auto 0 0;
  height: 30%;
  content: "";
  background: linear-gradient(transparent, rgb(25 21 17 / 20%));
  opacity: 0;
  transition: opacity 180ms ease;
}

.cover-wrap:hover .cover-button {
  box-shadow: 0 18px 36px rgb(50 40 28 / 18%);
}

.cover-wrap:hover .cover-button::after,
.cover-wrap:focus-within .cover-button::after {
  opacity: 1;
}

.cover-button img,
.cover-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cover-fallback {
  display: grid;
  place-items: center;
  color: var(--paper);
  background: linear-gradient(145deg, var(--accent), #9b3f28);
  font-size: 50px;
  font-weight: 800;
}

.book-copy {
  min-width: 0;
  padding: 13px 3px 0;
}

.book-copy h3 {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-copy p {
  min-height: 18px;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-progress {
  width: 100%;
  height: 3px;
  display: block;
  margin-top: 10px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 99px;
  background: #dbd4c9;
}

.book-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: #dbd4c9;
}

.book-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--accent);
}

.book-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--accent);
}

.cover-progress {
  width: calc(100% - 16px);
  height: 7px;
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  left: 8px;
  overflow: hidden;
  appearance: none;
  border: 2px solid rgb(255 253 250 / 88%);
  border-radius: 99px;
  background: rgb(36 35 32 / 52%);
  box-shadow: 0 2px 8px rgb(18 15 12 / 30%);
}

.cover-progress::-webkit-progress-bar {
  background: rgb(36 35 32 / 52%);
}

.cover-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--sun);
}

.cover-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--sun);
}

.play-card-button {
  width: 52px;
  height: 52px;
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--dark);
  background: rgb(255 253 250 / 94%);
  box-shadow: 0 9px 28px rgb(19 16 13 / 28%);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition:
    opacity 150ms ease,
    background 150ms ease;
}

.play-card-button svg {
  width: 24px;
  fill: currentColor;
}

.cover-wrap:hover .play-card-button,
.play-card-button:focus,
.play-card-button:active {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.play-card-button:hover,
.play-card-button:active {
  background: var(--sun);
}

.catalog-heading {
  margin: 62px 0 22px;
  scroll-margin-top: 150px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 30px 16px;
}

.catalog-grid,
.pagination {
  transition: opacity 150ms ease;
}

.catalog-loading .catalog-grid,
.catalog-loading .pagination {
  opacity: 0.5;
  pointer-events: none;
}

.catalog-loading .catalog-heading::after {
  width: 17px;
  height: 17px;
  margin-left: auto;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  content: "";
  animation: spin 0.75s linear infinite;
}

.status-panel {
  min-height: 180px;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 30px;
  border: 1px dashed #c9c0b4;
  border-radius: 20px;
  color: var(--muted);
  text-align: center;
}

.status-panel strong {
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 17px;
}

.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 22px;
}

.series-card {
  min-width: 0;
}

.series-card > button {
  width: 100%;
  min-width: 0;
  display: block;
  overflow: hidden;
  padding: 17px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.series-card > button:hover {
  border-color: #c9b8a2;
  box-shadow: 0 15px 38px rgb(50 40 28 / 14%);
  transform: translateY(-3px);
}

.series-fan {
  height: 152px;
  position: relative;
  display: block;
}

.series-cover {
  width: 118px;
  height: 118px;
  position: absolute;
  top: 13px;
  left: 50%;
  overflow: hidden;
  border: 3px solid var(--paper);
  border-radius: 13px;
  background: #d9d1c5;
  box-shadow: 0 13px 28px rgb(48 37 25 / 22%);
  transform: translateX(-50%);
  transform-origin: 50% 90%;
  transition: transform 180ms ease;
}

.series-fan.count-3 .series-cover:nth-child(1) {
  z-index: 1;
  transform: translateX(-84%) rotate(-8deg);
}

.series-fan.count-3 .series-cover:nth-child(2) {
  z-index: 3;
}

.series-fan.count-3 .series-cover:nth-child(3) {
  z-index: 2;
  transform: translateX(-16%) rotate(8deg);
}

.series-fan.count-2 .series-cover:nth-child(1) {
  z-index: 1;
  transform: translateX(-70%) rotate(-6deg);
}

.series-fan.count-2 .series-cover:nth-child(2) {
  z-index: 2;
  transform: translateX(-30%) rotate(6deg);
}

.series-card > button:hover .series-fan.count-3 .series-cover:nth-child(1) {
  transform: translateX(-89%) rotate(-10deg);
}

.series-card > button:hover .series-fan.count-3 .series-cover:nth-child(3) {
  transform: translateX(-11%) rotate(10deg);
}

.series-cover img,
.series-cover-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.series-cover-fallback {
  display: grid;
  place-items: center;
  color: var(--paper);
  background: linear-gradient(145deg, var(--accent), #9b3f28);
  font-size: 38px;
  font-weight: 800;
}

.series-cover:nth-child(2) .series-cover-fallback {
  background: linear-gradient(145deg, #497c70, #254b43);
}

.series-cover:nth-child(3) .series-cover-fallback {
  background: linear-gradient(145deg, #c68c3e, #85551f);
}

.series-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.series-copy strong,
.series-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-copy strong {
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  letter-spacing: -0.025em;
}

.series-copy span {
  color: var(--muted);
  font-size: 12px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 44px 0 10px;
}

.pagination button {
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.pagination button.active {
  border-color: var(--dark);
  color: var(--paper);
  background: var(--dark);
}

/* Fixed remote */
.remote-player:empty {
  display: none;
}

.remote-player {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  isolation: isolate;
}

.remote-shell {
  width: 100%;
  position: relative;
  color: #f8f5ef;
}

.remote-bar {
  position: relative;
  min-height: var(--player-height);
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 12px max(24px, calc((100vw - 1380px) / 2))
    max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid rgb(255 255 255 / 9%);
  background: rgb(36 35 32 / 97%);
  box-shadow: 0 -12px 50px rgb(29 25 20 / 18%);
  backdrop-filter: blur(22px);
}

.remote-track {
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.remote-cover,
.remote-cover-empty {
  width: 56px;
  height: 56px;
  border-radius: 9px;
  object-fit: cover;
  background: #44413b;
}

.remote-cover-empty {
  display: grid;
  place-items: center;
  color: var(--sun);
  font-size: 24px;
}

.remote-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.remote-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.remote-copy strong {
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  white-space: nowrap;
}

.remote-copy span {
  overflow: hidden;
  color: #aaa69e;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-status {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}

.remote-status::before {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  content: "";
  background: #858078;
}

.remote-shell.is-playing .remote-status::before {
  background: #67bf92;
}

.remote-shell.is-pending .remote-status::before {
  border: 1px solid var(--sun);
  border-right-color: transparent;
  background: transparent;
  animation: spin 0.8s linear infinite;
}

.quick-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.control-button {
  min-width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #f7f3ec;
  background: transparent;
}

.control-button:hover {
  background: rgb(255 255 255 / 8%);
}

.control-button svg {
  width: 23px;
  fill: currentColor;
}

/*
 * Die Füllung des Hauptknopfes zeigt, dass die Halte-Geste erkannt wurde und
 * wie lange sie noch dauert. Ohne diese Rückmeldung wäre eine verborgene Geste
 * nicht zu erraten und ihr Auslösen eine Überraschung.
 */
.control-button {
  position: relative;
}

.control-button svg {
  position: relative;
  z-index: 1;
}

.main-control::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.25);
}

.main-control.is-holding::before {
  animation: hold-to-stop 650ms linear forwards;
}

.main-control.is-held::before {
  opacity: 0.9;
  transform: scale(1);
}

@keyframes hold-to-stop {
  from {
    opacity: 0.18;
    transform: scale(0.25);
  }

  to {
    opacity: 0.9;
    transform: scale(1);
  }
}

/*
 * Ohne Hörbuch bleibt nur die Lautstärke übrig. Sie schwebt unten rechts über
 * dem Inhalt, statt eine leere Leiste über die volle Breite zu halten.
 */
body.player-idle {
  --player-height: 0px;
}

.remote-shell.is-idle {
  display: flex;
  justify-content: flex-end;
  padding: 0 max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) 0;
  pointer-events: none;
}

.remote-shell.is-idle .volume-control {
  pointer-events: auto;
}

.remote-shell.is-idle .volume-toggle {
  width: 48px;
  height: 48px;
  color: #f8f5ef;
  background: rgb(36 35 32 / 94%);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.remote-shell.is-idle .volume-toggle:hover {
  background: rgb(36 35 32 / 100%);
}

.remote-shell.is-idle .volume-toggle:disabled {
  opacity: 0.45;
}

.control-button .skip-icon {
  width: 34px;
  height: 34px;
  position: relative;
  display: grid;
  place-items: center;
}

.control-button .skip-icon svg {
  width: 34px;
  height: 34px;
  position: absolute;
  inset: 0;
}

.skip-icon span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.control-button.main-control {
  width: 54px;
  height: 54px;
  color: var(--dark);
  background: var(--paper);
  box-shadow: 0 6px 20px rgb(0 0 0 / 20%);
}

.control-button.main-control:hover {
  background: var(--sun);
  transform: scale(1.03);
}

.remote-seek {
  position: absolute;
  z-index: 3;
  top: -10px;
  right: 0;
  left: 0;
  height: 20px;
  touch-action: none;
}

.remote-seek-rail {
  height: 3px;
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  overflow: hidden;
  background: rgb(255 255 255 / 13%);
  transform: translateY(-50%);
  transition:
    height 160ms ease,
    box-shadow 160ms ease;
}

.remote-seek:hover .remote-seek-rail,
.remote-seek:focus-within .remote-seek-rail,
.remote-seek.is-active .remote-seek-rail {
  height: 9px;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 7%);
}

.remote-seek-fill {
  width: 0;
  height: 100%;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  background: var(--sun);
}

.remote-chapter-marker {
  width: 2px;
  height: 100%;
  position: absolute;
  z-index: 2;
  top: 0;
  background: rgb(36 35 32 / 78%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 15%);
  transform: translateX(-1px);
}

.remote-seek-input {
  width: 100%;
  height: 100%;
  position: absolute;
  z-index: 3;
  inset: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.remote-seek-input:disabled {
  cursor: default;
}

.remote-shell.is-offline .remote-seek-rail {
  background: rgb(255 255 255 / 10%);
}

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

.volume-control {
  position: relative;
}

.volume-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #aaa69e;
  background: transparent;
}

.volume-toggle:hover,
.volume-control.is-open .volume-toggle {
  color: var(--paper);
  background: rgb(255 255 255 / 8%);
}

.volume-toggle svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.volume-popover {
  width: 72px;
  min-height: 214px;
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  gap: 8px;
  padding: 13px 10px 15px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 18px;
  background: #34322e;
  box-shadow: 0 16px 42px rgb(0 0 0 / 30%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.volume-control.is-open .volume-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.volume-popover input {
  width: 28px;
  height: 150px;
  direction: rtl;
  writing-mode: vertical-lr;
  accent-color: var(--sun);
  cursor: ns-resize;
}

.volume-popover .volume-label {
  color: #aaa69e;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Login, dialog and notifications */
.login-card {
  width: min(100%, 440px);
  margin: 5vh auto 0;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

.login-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border-radius: 18px;
  color: var(--sun);
  background: var(--dark);
  font-size: 28px;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 32px;
  letter-spacing: -0.045em;
}

.login-intro {
  margin-bottom: 28px;
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 17px;
}

.login-card label {
  text-transform: none;
}

.primary-button {
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  color: var(--paper);
  background: var(--accent);
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.error-text {
  padding: 11px 13px;
  border-radius: 10px;
  color: #923d29;
  background: #fde9e1;
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 60;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(var(--player-height) + max(22px, env(safe-area-inset-bottom)));
  width: min(390px, calc(100vw - 36px));
  padding: 14px 18px;
  border: 1px solid #edb7a6;
  border-radius: 14px;
  color: #873923;
  background: #fff8f4;
  box-shadow: 0 18px 50px rgb(51 31 21 / 22%);
  font-size: 13px;
  font-weight: 700;
}

dialog {
  width: min(720px, calc(100% - 32px));
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 26px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 25px 90px rgb(36 31 25 / 32%);
}

dialog::backdrop {
  background: rgb(31 28 24 / 55%);
  backdrop-filter: blur(5px);
}

.dialog-close {
  width: 42px;
  height: 42px;
  position: absolute;
  top: 13px;
  right: 13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
  font-size: 25px;
}

.detail-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

.detail-layout > img {
  width: 100%;
  border-radius: 17px;
  box-shadow: var(--shadow-sm);
}

.detail-layout h2 {
  margin-bottom: 8px;
  font-size: 29px;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.detail-meta {
  color: var(--muted);
}

.detail-layout dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 15px;
  margin: 25px 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-layout dt {
  font-weight: 800;
}

.detail-layout dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
}

.battery-dialog {
  width: min(980px, calc(100% - 32px));
  max-height: min(88vh, 900px);
  padding: 28px;
  overflow-y: auto;
}

.battery-dialog-heading {
  padding-right: 42px;
}

.battery-dialog-heading h2 {
  margin: 2px 0 6px;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.045em;
}

.battery-dialog-heading > p:last-child {
  margin: 0;
  color: var(--muted);
}

.device-dialog-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.device-dialog-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}

.device-dialog-status.online i {
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(61 139 104 / 12%);
}

.device-dialog-status.sleeping i {
  background: #6689b4;
  box-shadow: 0 0 0 4px rgb(102 137 180 / 12%);
}

/*
  Three numbers, one row, no card frames: battery, remaining runtime and
  firmware are what the dialog is opened for. Everything else moved to the
  diagnostics view.
*/
.device-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 18px 0 16px;
  padding: 14px 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--canvas);
}

.device-metrics > div {
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  text-align: center;
}

.device-metrics > div:first-child {
  border-left: 0;
}

.device-metrics span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.device-metrics strong {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 19px;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-metrics small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.view-back-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 14px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--paper);
  font-size: 13px;
  font-family: inherit;
  font-weight: 700;
}

.view-back-button:hover {
  border-color: #c9b8a2;
  color: var(--ink);
}

.view-back-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/*
 * A value that changes on its own needs a moment of emphasis, otherwise a live
 * dialog is indistinguishable from a frozen one.
 */
.device-metrics [data-field].is-updated,
.device-dialog-status [data-field].is-updated {
  animation: value-updated 1200ms ease-out;
}

@keyframes value-updated {
  0% {
    background: var(--accent-soft);
  }

  100% {
    background: transparent;
  }
}

.device-diagnostics-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.device-admin-navigation {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.device-admin-navigation .device-diagnostics-link {
  margin-top: 0;
}

.device-diagnostics-link span {
  display: grid;
  gap: 2px;
}

.device-diagnostics-link small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.device-diagnostics-link:hover {
  border-color: #c9b8a2;
  background: var(--paper);
}

.device-diagnostics-link svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.device-technical-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  margin: 4px 0 0;
}

.device-technical-list dt,
.device-technical-list dd {
  min-width: 0;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.device-technical-list dt {
  padding-right: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.device-technical-list dd {
  margin: 0;
  font-size: 13px;
  text-align: right;
}

.device-monospace {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 14px !important;
}

.device-update-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--canvas);
}

.device-update-card.has-update {
  border-color: #efc6a9;
  background: #fff6ee;
}

.remote-display-entry.is-active {
  border-color: #b9d9c9;
  background: #f1faf5;
}

.remote-display-start-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: end;
  gap: 10px;
}

.remote-display-start-actions label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.remote-start-rate {
  width: 190px;
}

.remote-start-rate > span,
.remote-frame-rate-control label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.remote-start-rate output,
.remote-frame-rate-control output {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.remote-start-rate input,
.remote-frame-rate-control input {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.remote-display-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: min(94dvh, 820px);
  padding: 30px;
  overflow-y: auto;
}

.remote-display-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-right: 42px;
}

.remote-display-heading h2 {
  margin: 2px 0 0;
  font-size: clamp(25px, 4vw, 34px);
  letter-spacing: -0.045em;
}

.remote-display-badge {
  flex: 0 0 auto;
  margin-top: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #765029;
  background: #fff0d7;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.remote-display-badge.live {
  color: #276247;
  background: #e6f6ed;
}

.remote-display-badge.stalled,
.remote-display-badge.error {
  color: #923d29;
  background: #fde9e1;
}

.remote-display-badge.off,
.remote-display-badge.disabled {
  color: var(--muted);
  background: var(--canvas-deep);
}

.remote-display-message {
  min-height: 20px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.remote-display-surface {
  position: relative;
  width: min(100%, 430px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 7px solid #282622;
  border-radius: 50%;
  background: #111;
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 16%) inset,
    0 18px 45px rgb(36 31 25 / 25%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.remote-display-surface:focus-within,
.remote-display-surface:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.remote-display-surface canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  image-rendering: pixelated;
  transition: opacity 160ms ease;
}

.remote-display-surface.has-frame canvas {
  opacity: 1;
}

.remote-display-surface.stalled canvas {
  opacity: 0.48;
  filter: saturate(0.65);
}

.remote-display-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  color: #c5bfb4;
  text-align: center;
  pointer-events: none;
}

.remote-display-placeholder span {
  font-size: 42px;
}

.remote-display-placeholder small {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.remote-display-surface.has-frame .remote-display-placeholder {
  display: none;
}

.remote-display-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}

.remote-display-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.remote-display-stats > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
}

.remote-display-stats span,
.remote-display-stats strong {
  display: block;
}

.remote-frame-rate-control {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--canvas);
}

.remote-frame-rate-control label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.remote-frame-rate-control > span {
  color: var(--muted);
  font-size: 10px;
}

.heading-with-help,
.stat-label-with-help {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.stat-help {
  position: relative;
  display: inline-flex;
  z-index: 4;
}

.stat-help summary {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--muted) 42%, transparent);
  border-radius: 50%;
  color: var(--muted);
  background: var(--paper);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  list-style: none;
  cursor: help;
}

.stat-help summary::-webkit-details-marker {
  display: none;
}

.stat-help > span {
  width: min(300px, calc(100vw - 48px));
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: -10px;
  display: none !important;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 10px;
  color: #f8f5ef !important;
  background: #34322e;
  box-shadow: 0 12px 32px rgb(36 31 25 / 24%);
  font-size: 11px !important;
  font-weight: 550 !important;
  letter-spacing: 0 !important;
  line-height: 1.45;
  text-align: left;
  text-transform: none !important;
}

.stat-help[open] > span,
.stat-help:focus-within > span {
  display: block !important;
}

@media (hover: hover) and (pointer: fine) {
  .stat-help:hover > span {
    display: block !important;
  }
}

.remote-display-stats span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.remote-display-stats strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-display-footer > div > * {
  display: block;
}

.remote-display-footer strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.remote-display-footer span {
  color: var(--muted);
  font-size: 11px;
}

.remote-display-footer .danger-button {
  min-height: 43px;
  padding: 0 15px;
  border: 1px solid #edb7a6;
  border-radius: 11px;
  color: #923d29;
  background: #fff8f4;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.remote-display-footer .danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (hover: hover) and (pointer: fine) {
  .remote-display-surface.live,
  .remote-display-surface.stalled {
    cursor: crosshair;
  }
}

.device-update-card h3 {
  margin: 0 0 5px;
  font-size: 19px;
}

.device-update-card p:last-child,
.device-section-intro {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.device-update-card .primary-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.device-power-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 24px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--canvas);
}

.device-audio-control {
  width: 190px;
}

.device-audio-control > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.device-audio-control output {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.device-audio-control input {
  width: 100%;
  margin: 6px 0 0;
  accent-color: var(--accent);
}

.device-audio-control input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.device-pin-form {
  display: grid;
  gap: 5px;
}

.device-pin-form > label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.device-pin-form > div {
  display: flex;
  gap: 7px;
}

.device-pin-form input {
  width: 92px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.18em;
  text-align: center;
}

.device-pin-card > .device-action-status {
  grid-column: 1 / -1;
}

.topbar-lock-toggle {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
}

.topbar-lock-toggle:hover:not(:disabled) {
  color: var(--accent);
  border-color: #b9cdec;
  background: var(--accent-soft);
}

.topbar-lock-toggle.is-locked {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.topbar-lock-toggle:disabled {
  cursor: wait;
  opacity: 0.55;
}

.topbar-lock-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.device-fps-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px 22px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--canvas);
}

.device-fps-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.device-fps-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.device-fps-result {
  min-width: 140px;
}

.device-fps-result > * {
  display: block;
}

.device-fps-result strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.device-fps-result span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.device-fps-card > button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.device-fps-card > button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.device-power-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.device-power-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.device-power-actions {
  display: flex;
  gap: 8px;
}

.device-power-actions button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.device-power-actions .danger-button {
  color: #923d29;
  border-color: #edb7a6;
  background: #fff8f4;
}

.device-power-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.device-power-actions button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, var(--panel));
  color: var(--accent);
}

.device-power-hint,
.device-action-status {
  grid-column: 1 / -1;
}

.device-action-status:empty {
  display: none;
}

.device-action-status:not(:empty),
.usage-inline-error {
  padding: 8px 10px;
  border-radius: 9px;
  color: #765029 !important;
  background: #fff4df;
}

.diagnostic-details {
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas);
}

.diagnostic-details summary {
  padding: 12px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.diagnostic-details[open] {
  padding-bottom: 14px;
}

.device-battery-section {
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.device-battery-section > div:first-child {
  margin-top: 28px;
}

.battery-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.battery-stat-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--canvas);
}

.battery-stat-card > * {
  display: block;
}

.battery-stat-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.battery-stat-card strong {
  margin-bottom: 7px;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.battery-stat-card span:not(.battery-stat-label),
.battery-stat-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.battery-stat-card small {
  margin-top: 4px;
}

.battery-stat-primary {
  border-color: #efc6a9;
  background: #fff6ee;
}

/*
  A figure that rests on too little data must not look like a measurement.
  "is-learning" has no figure at all yet, "is-thin" has one that is still
  moving; both stay visually behind a settled value.
*/
.battery-stat-card.is-learning strong,
.battery-stat-card.is-thin strong {
  color: var(--muted);
}

.battery-stat-card.is-thin small {
  color: #a8703c;
}

.usage-stat-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.usage-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.usage-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.usage-range-controls {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.usage-range-controls button,
.usage-range-controls a {
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.usage-range-controls button.is-active {
  background: var(--ink);
  color: white;
}

.usage-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.usage-breakdown {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--canvas);
}

.usage-breakdown h4 {
  margin: 0 0 14px;
  font-size: 14px;
}

.usage-breakdown > .stat-help {
  position: absolute;
  top: 12px;
  right: 12px;
}

.usage-breakdown > .stat-help > span {
  right: -4px;
  left: auto;
}

.usage-breakdown {
  position: relative;
}

.usage-row {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(70px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.usage-row progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 99px;
  background: var(--line);
}

.usage-row progress::-webkit-progress-bar {
  border-radius: 99px;
  background: var(--line);
}

.usage-row progress::-webkit-progress-value {
  border-radius: 99px;
  background: var(--accent);
}

.usage-row progress::-moz-progress-bar {
  border-radius: 99px;
  background: var(--accent);
}

.usage-row strong {
  color: var(--ink);
  font-weight: 700;
}

/* Charts */

.chart-frame {
  position: relative;
  min-width: 0;
  margin-top: 12px;
}

.chart-frame svg {
  display: block;
  max-width: 100%;
}

.chart-spark {
  position: relative;
  height: 28px;
  margin: 2px 0 4px;
}

.chart-tooltip {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 1px;
  padding: 7px 10px;
  border-radius: 11px;
  color: var(--paper);
  background: rgb(36 35 32 / 94%);
  font-size: 11px;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip strong {
  font-size: 13px;
}

.chart-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.share-chart {
  min-width: 0;
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--canvas);
}

.share-chart h4 {
  margin: 0 0 12px;
  font-size: 14px;
}

.share-chart > .stat-help {
  position: absolute;
  top: 12px;
  right: 12px;
}

.share-chart > .stat-help > span {
  right: -4px;
  left: auto;
}

/*
 * One track per chart, so shares are comparable across cards. The gap between
 * segments is a surface-coloured spacer rather than a border, which keeps the
 * widths honest.
 */
.share-bar {
  height: 14px;
  display: flex;
  gap: 2px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--canvas-deep);
}

.share-bar > span {
  min-width: 2px;
  border-radius: 4px;
}

.share-legend {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.share-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 48px 96px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.share-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.share-legend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-legend b {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.share-legend small {
  text-align: right;
}

/*
 * Ein angezeigtes Segment tritt hervor, alle anderen zurück. Ohne das
 * Zurücktreten ist eine schmale Scheibe im Balken nicht auffindbar.
 */
.share-bar > span {
  cursor: default;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.share-chart.is-focused .share-bar > span {
  opacity: 0.4;
}

.share-chart .share-bar > span.is-active {
  opacity: 1;
  transform: scaleY(1.35);
}

.share-bar > span:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.share-legend li {
  padding: 1px 4px;
  border-radius: 6px;
  cursor: default;
  transition: background 120ms ease;
}

.share-chart.is-focused .share-legend li {
  opacity: 0.5;
}

.share-chart .share-legend li.is-active {
  opacity: 1;
  background: var(--canvas-deep);
}

.grid-cell {
  cursor: default;
  transition: opacity 120ms ease;
}

.grid-cell.is-active {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.grid-cell:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.share-total {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.usage-timeline {
  margin-top: 14px;
}

.diagnostic-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.diagnostic-summary-grid h4,
.diagnostic-summary-grid p,
.brightness-summary {
  margin: 0 0 7px;
  font-size: 11px;
  line-height: 1.5;
}

.brightness-summary {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.usage-secondary-breakdowns {
  margin-top: 12px;
}

#device-usage-root[aria-busy="true"] .usage-stat-section {
  opacity: 0.65;
}

.usage-firmware-marker {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff0e5;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
}

.battery-stat-section + .battery-stat-section {
  margin-top: 34px;
}

.battery-stat-section h3 {
  margin: 1px 0 15px;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.battery-table-wrap {
  max-height: 310px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.battery-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.battery-table th,
.battery-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.battery-table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--muted);
  background: var(--canvas);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.battery-table tbody th {
  color: var(--ink);
}

.battery-table tbody td {
  color: var(--muted);
}

.battery-table tbody tr:last-child > * {
  border-bottom: 0;
}

.battery-empty {
  margin: 0;
  padding: 18px;
  border-radius: 14px;
  color: var(--muted);
  background: var(--canvas);
  font-size: 13px;
}

.battery-empty-large {
  margin-top: 28px;
  padding: 30px;
  text-align: center;
}

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

.screen {
  display: none;
}

@media (max-width: 900px) {
  :root {
    --player-height: 82px;
  }

  .app-shell,
  .topbar-inner,
  .primary-nav-inner {
    width: min(100% - 32px, 1380px);
  }

  .topbar-inner {
    grid-template-columns: auto minmax(180px, 1fr) auto;
    gap: 14px;
  }

  .brand-copy {
    display: none;
  }

  .app-shell {
    padding-top: 24px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reset-filter-button {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
  }

  .remote-bar {
    min-height: var(--player-height);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 9px max(16px, env(safe-area-inset-right))
      max(9px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .remote-track {
    min-height: 60px;
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 11px;
  }

  .remote-cover,
  .remote-cover-empty {
    width: 50px;
    height: 50px;
  }

  .quick-controls {
    gap: 4px;
  }

  .quick-controls .skip-button {
    display: none;
  }

  .quick-controls .main-control {
    width: 50px;
    height: 50px;
  }

  .toast {
    bottom: calc(var(--player-height) + 18px);
  }
}

@media (max-width: 620px) {
  /*
    Brand, search and badge share one row instead of stacking. The brand copy
    is already hidden at this width, so a row of its own only reserved space
    for a 38 pixel logo.
  */
  .topbar-inner {
    width: calc(100% - 28px);
    height: 56px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .header-search .search-field {
    height: 40px;
    border-radius: 13px;
  }

  .primary-nav-inner {
    width: calc(100% - 28px);
    min-height: 40px;
    justify-content: space-between;
    gap: 18px;
  }

  /*
    Collapsed, the header keeps what is useful while reading: navigation and
    the box status. The brand disappears and the search shrinks to its icon,
    which expands the header again when tapped.
  */
  .topbar.is-collapsed {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
  }

  .topbar.is-collapsed .primary-nav {
    min-width: 0;
    order: 1;
    flex: 1;
    border-top: 0;
  }

  .topbar.is-collapsed .primary-nav-inner {
    width: 100%;
    min-height: 48px;
    gap: 12px;
  }

  .topbar.is-collapsed .topbar-inner {
    width: auto;
    height: 48px;
    order: 2;
    grid-template-columns: auto auto;
    gap: 8px;
  }

  .topbar.is-collapsed .brand {
    display: none;
  }

  .topbar.is-collapsed .header-search .search-field {
    width: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
  }

  .topbar.is-collapsed .header-search input,
  .topbar.is-collapsed .header-search .search-field button {
    display: none;
  }

  .primary-nav a {
    justify-content: center;
    font-size: 12px;
  }

  .brand-copy small,
  .icon-text-button {
    display: none;
  }

  .device-badge {
    min-height: 32px;
    padding: 0 8px;
  }

  dialog.battery-dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
    padding: 28px 18px;
    border-radius: 20px;
  }

  .battery-stat-grid {
    grid-template-columns: 1fr;
  }

  .usage-breakdown-grid {
    grid-template-columns: 1fr;
  }

  .diagnostic-summary-grid {
    grid-template-columns: 1fr;
  }

  .usage-heading {
    display: block;
  }

  .usage-range-controls {
    width: fit-content;
    margin: 12px 0 18px;
  }

  .battery-stat-card {
    padding: 16px;
  }

  .battery-table th,
  .battery-table td {
    padding: 10px 11px;
  }

  .app-shell {
    width: calc(100% - 28px);
    min-height: calc(100vh - 96px);
    padding-top: 16px;
  }

  .view-heading {
    margin-bottom: 22px;
  }

  .result-count {
    display: none;
  }

  .filter-button {
    height: 40px;
    padding: 0 13px;
    border-radius: 13px;
    font-size: 13px;
  }

  .device-metrics {
    gap: 0;
    padding: 12px 0;
  }

  .device-metrics > div {
    padding: 0 8px;
  }

  .device-metrics strong {
    font-size: 15px;
  }

  .device-metrics small {
    font-size: 10px;
  }

  .device-update-card {
    align-items: stretch;
    flex-direction: column;
  }

  .remote-display-start-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .remote-display-start-actions label,
  .remote-display-start-actions button {
    width: 100%;
  }

  .device-power-card {
    grid-template-columns: 1fr;
  }

  .device-audio-control {
    width: 100%;
  }

  .device-fps-card {
    grid-template-columns: 1fr;
  }

  .device-fps-card > button {
    width: 100%;
  }

  .device-power-actions,
  .device-power-actions button {
    width: 100%;
  }

  .device-power-actions {
    flex-direction: column;
  }

  .device-update-card .primary-button {
    width: 100%;
  }

  .filters {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .shelves {
    gap: 34px;
    margin-top: 8px;
  }

  .shelf-heading h2,
  .catalog-heading h2 {
    font-size: 19px;
  }

  .shelf-row {
    width: calc(100% + 14px);
    gap: 14px;
    margin-right: -14px;
    padding-top: 16px;
    padding-right: 14px;
  }

  .book-card.compact {
    width: 112px;
    min-width: 112px;
    flex-basis: 112px;
  }

  .catalog-heading {
    margin-top: 48px;
  }

  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 10px;
  }

  .series-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 10px;
  }

  .series-card > button {
    padding: 11px 9px 14px;
    border-radius: 17px;
  }

  .series-fan {
    height: 118px;
  }

  .series-cover {
    width: 88px;
    height: 88px;
    top: 10px;
    border-width: 2px;
    border-radius: 10px;
  }

  .series-copy strong {
    font-size: 14px;
  }

  .series-copy span {
    font-size: 11px;
  }

  .cover-button {
    border-radius: 13px;
  }

  .book-copy {
    padding-top: 10px;
  }

  .play-card-button {
    width: 46px;
    height: 46px;
  }

  .remote-bar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .remote-track {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .remote-copy strong {
    font-size: 13px;
  }

  .login-card {
    margin-top: 2vh;
    padding: 27px 22px;
    border-radius: 22px;
  }

  dialog {
    max-height: calc(100dvh - 24px);
    padding: 54px 20px 24px;
    border-radius: 22px;
  }

  .detail-layout {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 17px;
  }

  .detail-layout h2 {
    font-size: 21px;
  }

  .detail-layout dl,
  .detail-layout .primary-button {
    grid-column: 1 / -1;
  }

  .detail-layout .primary-button {
    width: 100%;
  }

  .pagination {
    max-width: 100%;
    overflow-x: auto;
    justify-content: start;
  }
}

@media (max-width: 370px) {
  .brand-copy {
    display: none;
  }

  .device-badge {
    gap: 4px;
    padding: 0 6px;
    font-size: 11px;
  }

  .device-badge svg {
    width: 21px;
  }

  .catalog-grid {
    gap: 28px 10px;
  }

  .remote-bar {
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media (max-width: 620px) {
  .quick-controls {
    gap: 2px;
  }

  dialog.remote-display-dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
    padding: 48px 14px 20px;
  }

  .remote-display-heading,
  .remote-display-footer {
    display: block;
  }

  .remote-display-heading {
    padding-right: 32px;
  }

  .remote-display-badge {
    display: inline-block;
    margin-top: 10px;
  }

  .remote-display-surface {
    width: min(100%, calc(100dvh - 310px));
    min-width: 240px;
    border-width: 5px;
  }

  .remote-display-footer .danger-button {
    width: 100%;
    margin-top: 14px;
  }

  .remote-display-stats {
    grid-template-columns: 1fr;
  }

  .volume-toggle {
    width: 44px;
    height: 44px;
  }

  .volume-popover {
    width: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/*
 * A box waiting to be enrolled. The request expires within minutes, so this
 * sits above everything else in the shell rather than in the device panel.
 */
.enrollment-banner {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1.15rem 1.35rem;
  border: 2px solid #3f72c5;
  border-radius: 18px;
  background: linear-gradient(135deg, #eaf2ff, #dbe9ff);
  color: #12233a;
  box-shadow: 0 10px 30px rgba(63, 114, 197, 0.18);
}
.enrollment-banner h2 {
  margin: 0;
  font-size: 1.15rem;
}
.enrollment-banner .enrollment-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.enrollment-banner .enrollment-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  padding: 0.2rem 0.4rem 0.2rem 0.72rem;
  border-radius: 12px;
  background: #ffffff;
  color: #1c4a91;
}
.enrollment-banner .enrollment-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #40566f;
}
.enrollment-banner .enrollment-actions {
  display: flex;
  gap: 0.6rem;
  margin-left: auto;
}
.enrollment-banner button {
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.enrollment-banner .enrollment-approve {
  background: #2f7d54;
  color: #ffffff;
}
.enrollment-banner .enrollment-deny {
  background: #e4e0d6;
  color: #33414d;
}
.enrollment-banner button:disabled {
  opacity: 0.6;
  cursor: default;
}
@media (prefers-color-scheme: dark) {
  .enrollment-banner {
    background: linear-gradient(135deg, #1b2a41, #16233a);
    color: #e8eef8;
    border-color: #5d8fd8;
  }
  .enrollment-banner .enrollment-code {
    background: #0f1826;
    color: #9dc2ff;
  }
  .enrollment-banner .enrollment-meta {
    color: #a9bad0;
  }
  .enrollment-banner .enrollment-deny {
    background: #2c3a4d;
    color: #dbe4f0;
  }
}

/*
  Segmentumschalter. Er trägt zwei Aufgaben: die geteilte Suche im Kopfbereich
  und die drei Abschnitte der Musikansicht. Beide sehen gleich aus, damit die
  Geste einmal gelernt überall gilt.
*/
.segmented {
  display: inline-flex;
  padding: 3px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--canvas-deep);
}

.segmented button {
  padding: 0 14px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segmented-wide {
  display: flex;
  margin-bottom: 22px;
}

.segmented-wide button {
  flex: 1;
  height: 42px;
}

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

.header-search .search-field {
  flex: 1;
}

/*
   Die kleine Bereichsumschaltung innen rechts im Suchfeld. Bewusst
   unauffällig: zwei Icons, das aktive in der Akzentfarbe, das inaktive
   gedimmt. Ein großer Umschalter neben dem Feld würde den Eindruck erwecken,
   hier etwas grundlegend umzuschalten, statt nur die Suchdomäne.
*/
.search-media {
  display: inline-flex;
  gap: 1px;
  flex: 0 0 auto;
  padding: 2px;
  border-radius: 9px;
  background: var(--canvas-deep);
}

.search-media button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.search-media button:hover {
  color: var(--muted);
}

.search-media button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.search-media-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-media-icon circle {
  fill: currentColor;
  stroke: none;
}

/*
   Unter 900 Pixeln bleibt das Suchfeld vollbreit; die Icons sitzen innen und
   brauchen keinen eigenen Zeilenumbruch mehr.
*/
@media (width <= 900px) {
  .header-search {
    flex-wrap: wrap;
  }

  .header-search .search-field {
    flex-basis: 100%;
  }
}

/* Freigabetafel: nur Anzeige, kein Bearbeiten. */
.music-access {
  margin-top: 46px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}

.music-access h2 {
  margin: 0 0 4px;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.music-access-intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.music-access-summary {
  display: flex;
  gap: 10px 26px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.music-access-summary div {
  display: flex;
  flex-direction: column;
}

.music-access-summary strong {
  font-size: 22px;
  letter-spacing: -0.04em;
}

.music-access-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.music-access table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.music-access th {
  padding: 0 10px 8px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.music-access td {
  padding: 8px 10px 8px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.music-access td:last-child,
.music-access th:last-child {
  padding-right: 0;
  text-align: right;
}

.music-access code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--canvas-deep);
  font-size: 12px;
}

.music-access-error {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
}

.music-access-blocked {
  margin-top: 22px;
}

.music-access-blocked h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.music-access-blocked ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.music-access-footer {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.music-access-footer button {
  padding: 0 16px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.music-access-footer button:disabled {
  color: var(--faint);
  cursor: default;
}

/*
  Titelliste im Sammlungsdialog. Jede Zeile ist ein Ziel, deshalb bekommt sie
  die volle Breite und eine Höhe, die auch mit dem Finger zu treffen ist.
*/
.track-list {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
}

.track-list li {
  border-top: 1px solid var(--line);
}

.track-list button {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 9px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.track-list button:hover {
  background: var(--canvas-deep);
}

.track-list .track-number {
  min-width: 24px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-list .track-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.track-list .track-duration {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.track-list li.current button {
  background: var(--accent-soft);
}

.track-list li.current .track-title {
  font-weight: 800;
}

.detail-truncated {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/*
  Zweitrangige Aktion neben „Auf der Box abspielen“. Sie hat dasselbe Maß,
  damit die beiden Knöpfe eine Zeile bilden, aber nicht dasselbe Gewicht.
*/
.secondary-button {
  min-height: 50px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.secondary-button:hover {
  background: var(--canvas-deep);
}

.offline-download-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
}

.offline-download-button:hover {
  color: var(--ink);
  background: var(--canvas-deep);
}

.offline-download-button.is-on {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.offline-download-button svg {
  width: 20px;
  height: 20px;
}

.track-list-heading {
  padding-right: 42px;
  margin-bottom: 6px;
}

.track-list-heading h2 {
  margin: 2px 0 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

/*
  Zufall und Wiederholung. Beide sind Zustände, keine Aktionen: der
  eingeschaltete Zustand muss auf einen Blick vom ausgeschalteten zu
  unterscheiden sein, nicht nur beim Darüberfahren.
*/
.control-button.mode-toggle svg {
  opacity: 0.55;
}

.control-button.mode-toggle.is-on {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.control-button.mode-toggle.is-on svg {
  opacity: 1;
}

/* --- Karten ---------------------------------------------------------------
   Die Kartenseite beantwortet zwei Fragen: Welche Karte startet was, und wirkt
   das schon ohne Controller. Alles andere ist Beiwerk. */

.card-status-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.card-sync-button {
  min-height: 34px;
  padding: 6px 12px;
}

.card-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.card-sync::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentcolor;
  content: "";
}

.card-sync-ok {
  color: #2c6b51;
  background: #e2f1ea;
}

.card-sync-pending {
  color: #8a6524;
  background: #fbeed3;
}

.card-section {
  margin-bottom: 30px;
}

.card-section h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.card-section-error h2 {
  color: var(--danger);
}

.card-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.card-hint-power {
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--canvas-deep);
}

.card-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 14px;
}

.card-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card-row {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
}

.card-row-error {
  border-color: #e5b6a8;
  background: #fdf1ec;
}

.card-cover {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--canvas-deep);
}

.card-row-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.card-row-main strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-row-error-text {
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

/* Die Kennung ist Verwaltungsinformation und darf entsprechend leise sein. */
.card-row-uid {
  color: var(--faint);
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 11px;
}

.card-row-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.card-row-actions button {
  min-height: 38px;
  padding: 0 13px;
  font-size: 13px;
}

.danger-button {
  min-height: 50px;
  padding: 0 20px;
  border: 1px solid #e0b3a6;
  border-radius: 13px;
  color: var(--danger);
  background: var(--paper);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.danger-button:hover {
  background: #fbeae4;
}

/* --- TF-Speicher -------------------------------------------------------- */

.storage-summary,
.storage-section {
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}

.storage-summary-heading,
.storage-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.storage-summary-heading > span {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
}

.storage-summary-heading i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #8b8278;
}

.storage-status-ready .storage-summary-heading i {
  background: #2c8b65;
}

.storage-status-format_required .storage-summary-heading i,
.storage-status-read_only .storage-summary-heading i {
  background: #c68a28;
}

.storage-status-error .storage-summary-heading i,
.storage-status-missing .storage-summary-heading i {
  background: var(--danger);
}

.storage-summary-heading small,
.storage-summary > p,
.storage-section-heading p,
.storage-action-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.storage-summary-heading small {
  text-align: right;
}

.storage-identifiers,
.storage-categories {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.storage-identifiers > div,
.storage-categories > div {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--canvas);
}

.storage-identifiers dt,
.storage-categories dt {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.storage-identifiers dd,
.storage-categories dd {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-capacity-bar {
  display: block;
  width: 100%;
  height: 18px;
  margin-top: 20px;
  accent-color: #de7d48;
}

.storage-bar-pinned {
  background: #de7d48;
}
.storage-bar-cache {
  background: #e6b766;
}
.storage-bar-partial {
  background: #b99ed3;
}
.storage-bar-foreign {
  background: #8aa0af;
}
.storage-bar-free {
  background: #dfe9e2;
}

.storage-key {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.storage-section h2 {
  margin: 0 0 10px;
  font-size: 19px;
}

.storage-transfer-details {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.storage-section-heading h2,
.storage-section-heading p {
  margin: 0;
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.storage-actions button {
  min-height: 44px;
}

.storage-actions button:disabled,
.storage-pin-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.storage-pin-list,
.storage-operation-list {
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.storage-pin-list li,
.storage-operation-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.storage-pin-list li > span:first-child,
.storage-operation-list li > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.storage-pin-list small,
.storage-operation-list small {
  color: var(--muted);
  font-size: 11px;
}

.storage-pin-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.storage-pin-actions button {
  min-height: 36px;
  padding: 0 11px;
  font-size: 12px;
}

.storage-pin-actions .offline-download-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.storage-operation-list em {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--canvas-deep);
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.storage-operation-ready {
  color: #2c6b51 !important;
  background: #e2f1ea !important;
}
.storage-operation-failed {
  color: var(--danger) !important;
  background: #fbeae4 !important;
}

@media (max-width: 700px) {
  .storage-summary-heading,
  .storage-section-heading,
  .storage-pin-list li,
  .storage-operation-list li {
    align-items: stretch;
    flex-direction: column;
  }

  .storage-summary-heading small {
    text-align: left;
  }

  .storage-identifiers,
  .storage-categories {
    grid-template-columns: 1fr 1fr;
  }

  .storage-pin-actions,
  .storage-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .storage-pin-actions button,
  .storage-actions button {
    width: 100%;
  }
}

.card-dialog {
  width: min(560px, 94vw);
  padding: 26px;
  border: 0;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow-lg);
}

.card-dialog::backdrop {
  background: rgb(31 27 22 / 55%);
}

.card-dialog-heading {
  padding-right: 42px;
  margin-bottom: 16px;
}

.card-dialog-heading h2 {
  margin: 2px 0 0;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 22px;
}

.card-dialog-type {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-dialog-wait {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 13px;
  margin: 0 0 12px;
  font-size: 15px;
  text-align: center;
}

.card-dialog-countdown {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.card-dialog-warning {
  padding: 13px;
  border-radius: 10px;
  margin: 0 0 12px;
  color: #923d29;
  background: #fde9e1;
  font-size: 14px;
}

.card-search-label,
.card-name-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-search-label input,
.card-name-label input {
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--canvas);
  font: inherit;
}

.card-results {
  display: grid;
  gap: 6px;
  max-height: 280px;
  padding: 2px;
  margin-bottom: 14px;
  overflow-y: auto;
}

.card-result {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-result:hover {
  background: var(--canvas);
}

.card-result.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.card-result img {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--canvas-deep);
}

.card-result span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-result small {
  color: var(--muted);
  font-size: 12px;
}

.card-options {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.card-toggle {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
}

.card-dialog-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.card-dialog-actions .card-toggle {
  margin-bottom: 0;
  font-size: 13px;
}

@media (width <= 620px) {
  .card-row {
    flex-wrap: wrap;
  }

  .card-row-actions {
    flex: 1 1 100%;
  }

  .card-row-actions button {
    flex: 1 1 auto;
  }
}
