.app {
  --viewer-gutter: clamp(16px, 4vw, 52px);
  max-width: 1600px;
}

.app [hidden] { display: none !important; }
.topbar, .section, .page-wrap { padding-inline: var(--viewer-gutter); }
.topbar { gap: 12px; }
.topbar .brand { flex-shrink: 0; padding: 0; }
.top-actions { flex-shrink: 0; gap: 4px; }
.icon-btn[data-active="true"] { color: #f6dbc0; background: #2b1d32; }
.desktop-nav { display: none; }
.bottom-nav { width: min(100%, 1600px); }
.bottom-nav button { min-height: 48px; border-radius: 8px; }
.app-nav button:focus-visible, .shelf-link:focus-visible, .movie-card button:focus-visible,
.story-link:focus-visible, .category-item:focus-visible, .discovery-search :is(input, select):focus-visible {
  outline: 2px solid #f6dbc0;
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .app { padding-bottom: 48px; }
  .topbar { height: 72px; justify-content: start; gap: clamp(18px, 3vw, 42px); }
  .top-actions { margin-left: auto; }
  .desktop-nav { display: flex; align-items: center; gap: 6px; }
  .desktop-nav button {
    min-height: 42px; border: 0; border-radius: 8px; padding: 0 12px;
    background: transparent; color: #cdbcd0; cursor: pointer;
  }
  .desktop-nav button:hover, .desktop-nav button.active { background: #281b2f; color: #f8f4e9; }
  .desktop-nav button.active { box-shadow: inset 0 -2px #f6dbc0; }
  .bottom-nav { display: none; }
}

.section { padding-block: 24px 5px; }
.section-head { margin-bottom: 12px; }
.section-head h2 { font-size: clamp(17px, 2.5vw, 25px); letter-spacing: -.02em; }
.shelf-link {
  min-height: 36px; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 4px; border: 0; background: none; color: #f6dbc0;
  font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.shelf-link:hover { color: #f8f4e9; }

.movie-row { gap: clamp(12px, 1.7vw, 20px); padding: 4px 4px 15px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(min(128px, 100%), 1fr)); gap: 20px 13px; }
.movie-card { position: relative; flex: 0 0 clamp(134px, 18vw, 195px); min-width: 0; cursor: default; }
.movie-card .poster {
  display: grid; align-content: end; justify-content: stretch; width: 100%;
  height: auto; aspect-ratio: 2/3; padding: 0; border: 1px solid #ded0dd22;
  background: radial-gradient(ellipse at 95% 4%,#502d55,transparent 58%),linear-gradient(150deg,#34233a,#1c1422 78%);
  isolation: isolate; cursor: pointer;
}
.movie-card .poster:before { z-index: 1; background: linear-gradient(0deg,#19131f75,transparent 48%); }
.movie-card .poster:hover { border-color: #f6dbc0ad; }
.movie-card .poster img { z-index: 0; }
.card-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #f6dbc070; font-size: clamp(23px, 4vw, 48px); font-weight: 950; font-style: italic;
  letter-spacing: -.09em;
}
.card-access {
  position: absolute; top: 10px; left: 8px; z-index: 2; pointer-events: none;
  border: 1px solid #f3d68f66; border-radius: 99px; padding: 4px 7px;
  background: #291c30e8; color: #ffd894; font-size: 10px; font-weight: 800;
}
.movie-card .save-toggle {
  top: 8px; right: 8px; width: 38px; height: 38px; min-height: 38px;
  border: 1px solid #f8f4e93b; background: #1e1524eb; z-index: 3;
}
.movie-card .save-toggle.saved { background: #502d55; color: #f6dbc0; }
.card-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 3px 4px; padding: 9px 2px 0; }
.card-meta h3 { grid-column: 1; margin: 0; white-space: normal; overflow-wrap: anywhere; font-size: 14px; }
.card-meta p, .card-meta .resume-card-position { grid-column: 1; }
.card-meta p { font-size: 12px; }
.card-info {
  grid-column: 2; grid-row: 1 / span 2; justify-self: end; min-width: 32px; min-height: 32px;
  background: #291c30; border: 1px solid #f8f4e922; border-radius: 50%;
  color: #e5dae0; font-size: 15px; cursor: pointer;
}
.card-info:hover { color: #f6dbc0; border-color: #f6dbc0; }
.card-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 5px; z-index: 2; accent-color: #f6dbc0; }
.card-progress::-webkit-progress-bar { background: #3d2a43; }
.card-progress::-webkit-progress-value { background: #f6dbc0; }
.card-progress::-moz-progress-bar { background: #f6dbc0; }

.page-wrap { padding-block: clamp(22px,5vw,44px); }
.page-title { font-size: clamp(25px,4vw,39px); letter-spacing: -.025em; margin-bottom: 18px; }
.viewer-page-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.discovery-search { display: grid; gap: 16px; max-width: 790px; }
.discovery-search input, .discovery-search select {
  width: 100%; min-height: 44px; border: 1px solid #47314d; border-radius: 9px;
  background: #261a2d; color: #f8f4e9; font: inherit; padding: 8px 10px;
}
.discovery-search input { min-height: 52px; padding: 12px 15px; }
.discovery-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.discovery-filters label { display: grid; gap: 5px; color: #d4c4d7; font-size: 12px; font-weight: 700; }
.discovery-summary { margin-block: 21px 10px; min-height: 36px; }
.discovery-summary p { color: #d0bfd2; margin: 0; font-size: 14px; }
.empty, .library-empty { grid-column: 1 / -1; }
.library-empty {
  border: 1px solid #432e49; border-radius: 14px; padding: clamp(20px,5vw,42px);
  background: #24192a; max-width: 600px; color: #e2d6df;
}
.library-empty h2 { margin: 0 0 8px; font-size: 20px; }
.library-empty p { margin: 0 0 17px; color: #cebdd1; }
.library-empty .primary { min-height: 42px; }
.segmented { margin: 0 0 22px; padding: 0; max-width: 380px; }
.segmented button { min-height: 46px; }
.category-list {
  display: grid; grid-template-columns: repeat(auto-fit,minmax(min(175px,100%),1fr));
  gap: 9px;
}
.category-list[hidden] { display: none; }
.category-item {
  border: 1px solid #3e2a44; border-radius: 10px; background: #25192c;
  min-height: 56px; padding-inline: 12px; gap: 9px; font-size: 14px; font-weight: 700;
}
.category-count { margin-left: auto; color: #cfbed2; font-size: 11px; }
.category-results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.menu-list { gap: 8px; max-width: 660px; }
.menu-item { min-height: 53px; border: 1px solid #3e2a44; border-radius: 10px; background: #25192c; padding: 10px 14px; }
.settings-page { max-width: 900px; }
.settings-group { background: #221728; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.detail-artwork { display: none; }
.movie-details:not(.stream-player) .modal-box {
  position: relative; isolation: isolate; background: #1f1625; padding-top: clamp(164px, 29vw, 245px);
}
.movie-details:not(.stream-player) .modal-top { position: absolute; top: 14px; right: 14px; }
.movie-details:not(.stream-player) .detail-artwork {
  display: block; position: absolute; inset: 0 0 auto; height: clamp(230px, 38vw, 345px);
  z-index: -1;
  background: linear-gradient(120deg, #25182d55, #502d558f),
    #271b2e url("/kw-cinema-backdrop.jpg") center 44%/cover no-repeat;
}
.detail-artwork img, .detail-artwork::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.detail-artwork img { object-fit: cover; object-position: center 32%; }
.detail-artwork img[hidden] { display: none; }
.detail-artwork::after { content: ""; background: linear-gradient(0deg,#1f1625 4%,#1f1625ae 39%,#1f162514 83%); }
.movie-details:not(.stream-player) #modalTitle { font-size: clamp(29px,6vw,45px); line-height: 1.05; }
.movie-details:not(.stream-player) .modal-meta { color: #f6dbc0; }
.modal-box .close { min-width: 44px; min-height: 44px; background: #221829e6; }
.stream-player .player-tools button, .stream-player .player-speed { min-height: 40px; border-radius: 8px; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 24px 17px; }
}
@media (max-width: 540px) {
  .movie-details.open:not(.stream-player) { align-items: flex-end; padding: 0; }
  .movie-details:not(.stream-player) .modal-box { max-height: min(88dvh, 700px); border-radius: 18px 18px 0 0; }
  .topbar .brand { font-size: clamp(15px, 5vw, 20px); gap: 6px; }
}
@media (max-width: 360px) {
  .discovery-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .discovery-filters label:last-child { grid-column: 1 / -1; }
  .top-actions .icon-btn { width: 37px; }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}
