:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #151310; color: #f3f2f5; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at top right, #312519 0, #191612 22rem, #151310 42rem); }
header, #sections, main, footer {
  --gutter: clamp(1rem, 4vw, 4rem);
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
header { padding-top: max(1rem, env(safe-area-inset-top)); }
main { min-width: 0; padding-block: 1rem 2rem; }
footer { padding-block: 1rem max(1.25rem, env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; min-height: 4.5rem; border-bottom: 1px solid #ffffff1a; }
.brand { display: inline-flex; align-items: center; gap: .3em; min-height: 44px; color: inherit; font-size: 1.5rem; font-weight: 750; text-decoration: none; }
.brand span { color: #efb747; }
h1 { font-size: clamp(1.65rem, 4vw, 2.75rem); margin: .5rem 0 1rem; overflow-wrap: anywhere; }
button, select, .button { font: inherit; min-height: 2.75rem; padding: .55rem .9rem; border: 1px solid #ffffff35; border-radius: .5rem; background: #272320; color: inherit; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
button, .button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid #efb747; outline-offset: 3px; }
#link, .button { background: #efb747; color: #17130c; border-color: transparent; }
#status:empty { display: none; }
footer, #status { color: #c0becb; }
.catalog-header, .controls, nav { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; justify-content: space-between; }
nav { justify-content: start; margin-bottom: 1rem; }
nav:empty { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9rem, 44%), 1fr)); gap: 1rem; }
.tile { padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.tile-art {
  position: relative; width: 100%; flex: none; aspect-ratio: 2 / 3; overflow: hidden;
  background: linear-gradient(135deg, #4b392a, #26201b 60%, #312924);
}
.tile-art img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.tile-title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  line-height: 1.25; max-height: 2.5em; overflow: hidden; overflow-wrap: anywhere;
  margin: .55rem .65rem .65rem;
}
#more { margin-top: 1rem; }
canvas { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #000; }
.controls { margin-top: .75rem; }
.player-heading { min-width: 0; }
.player-heading h1 { margin-bottom: .25rem; }
#media-source { margin: 0 0 .55rem; color: #d7cfc5; font-size: .875rem; overflow-wrap: anywhere; }
#media-source:empty { display: none; }
#player:is(:fullscreen, [data-maximized]) {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .5rem; background: #000; color: #fff; overflow: auto;
  padding: max(.5rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right))
           max(.5rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
}
#player[data-maximized] { position: fixed; inset: 0; z-index: 100; }
body:has(#player[data-maximized]) { overflow: hidden; }
#player:is(:fullscreen, [data-maximized]) canvas { width: 100%; height: 100%; max-height: none; }
#player:is(:fullscreen, [data-maximized]) h1 { margin: 0; font-size: clamp(1rem, 3vw, 1.5rem); }
#player:is(:fullscreen, [data-maximized]) .controls { margin-top: 0; }
.seek { display: flex; align-items: center; flex: 1; gap: .5rem; }
input[type=range] { width: 100%; min-width: 4rem; min-height: 2.75rem; accent-color: #efb747; }
#decoder { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
[hidden] { display: none !important; }


#sections {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 2;
  flex-wrap: nowrap;
  justify-content: start;
  gap: .125rem;
  margin: 0;
  padding-block: .4rem;
  background: #1c1814;
  border-bottom: 1px solid #ffffff1a;
  overflow-x: auto;
}
#sections button {
  flex: none;
  white-space: nowrap;
  padding-inline: clamp(.5rem, 2vw, 1rem);
  font-size: .875rem;
  font-weight: 650;
  background: transparent;
  border-color: transparent;
}
#sections button[aria-current="page"] { color: #ffd079; background: #efb7471e; }
#sections button:focus-visible { outline-offset: -2px; }
#server-picker, #library-picker { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; max-width: 100%; color: #d7cfc5; }
#movie-options { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-block: .75rem 1rem; }
#movie-options label { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; min-height: 2.75rem; max-width: 100%; }
#movie-unwatched { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: #efb747; }
.tile-watch {
  align-self: flex-start; padding: .15rem .4rem; margin: 0 .65rem .65rem;
  border-radius: .25rem; background: #efb74724; color: #ffda91;
  font-size: .78rem; font-weight: 650;
}
.tile-watch.is-watched { background: #ffffff10; color: #d7cfc5; }
.tile-rating { margin: 0 .65rem .65rem; color: #d7cfc5; font-size: .875rem; }
select { min-width: 0; max-width: 100%; }
#home-title { margin-block: 1.1rem; }
.shelf { margin-block: 1.5rem; }
.shelf h2 { margin: 0 0 .5rem; font-size: clamp(1.15rem, 3vw, 1.5rem); }
.shelf-track {
  display: flex;
  gap: .75rem;
  padding: .35rem .25rem .65rem;
  overflow-x: auto;
  align-items: start;
  scroll-snap-type: x proximity;
  scrollbar-color: #785a38 transparent;
}
.shelf-track > p { margin: .25rem 0; color: #d7cfc5; }
.shelf-track .tile { flex: 0 0 clamp(7.5rem, 29vw, 10rem); scroll-snap-align: start; }
#continueWatching .tile { flex-basis: clamp(10rem, 50vw, 15rem); }
#continueWatching .tile-art { aspect-ratio: 16 / 10; }
#continueWatching .tile-art img { object-position: center 35%; }
.tile { min-width: 0; background: #25201c; }
.tile:hover { border-color: #efb747; }
.tile progress { width: calc(100% - 1.6rem); height: .45rem; margin: 0 .8rem .65rem; accent-color: #efb747; }
#breadcrumbs button { max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .seek { flex: 1 0 100%; order: 1; }
}

#link-qr:not([hidden]) { display: block; margin: 1rem 0; max-width: 100%; height: auto; }
