body {
  margin: 0;
  background: #0f0f0f;
  color: #eee;
  font-family: Arial, sans-serif;
}

header {
  padding: 24px;
  background: #181818;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1400px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-inner h1 {
  margin: 0;
}

nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

nav a {
  padding: 7px 10px;
  border-radius: 7px;
  color: #eee;
  text-decoration: none;
  font-size: 14px;
  transition: background 100ms ease;
}

nav a:hover,
nav a:focus {
  background: #242424;
  text-decoration: none;
  outline: none;
}

nav a.active {
  background: #303030;
  color: #fff;
}

main {
  max-width: 1400px;
  margin: auto;
  padding: 24px;
}

button {
  cursor: pointer;
}

@media (max-width: 750px) {
  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    flex-wrap: wrap;
  }
}

/* Scene cards */

.scene {
  background: #1c1c1c;
  border-radius: 12px;
  overflow: hidden;
}

.scene .cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #222;
}

.scene .content {
  padding: 16px;
}

.scene .title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;

  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scene .filename {
  font-size: 12px;
  opacity: .65;
  margin-bottom: 12px;
  word-break: break-word;
}

.scene .status {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 6px;
  background: #333;
  margin-bottom: 12px;
  font-size: 13px;
}

.scene button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 7px;
  font-size: 15px;
}

.scene button:disabled {
  opacity: .5;
  cursor: default;
}

.scene .play-button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 14px;
  border-radius: 7px;
  text-align: center;
  text-decoration: none;
  background: #eee;
  color: #111;
}

/* Login */

body.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-form {
  width: min(360px, calc(100% - 40px));
  background: #1c1c1c;
  padding: 24px;
  border-radius: 12px;
}

.login-form h1 {
  margin-top: 0;
}

.login-form input,
.login-form button {
  width: 100%;
  box-sizing: border-box;
  padding: 11px;
  margin-top: 10px;
  border-radius: 7px;
}

.login-form input {
  border: 1px solid #444;
  background: #111;
  color: #eee;
}

.login-form button {
  border: 0;
}

.login-form .error {
  margin-top: 12px;
}

/* Entity grids */

.entity-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.entity-toolbar input {
  flex: 1;
  padding: 11px;
  border: 1px solid #444;
  border-radius: 7px;
  background: #181818;
  color: #eee;
}

.entity-toolbar select {
  padding: 11px;
  border: 1px solid #444;
  border-radius: 7px;
  background: #181818;
  color: #eee;
}

.entity-grid {
  display: grid;
  gap: 20px;
}

.entity-card {
  background: #1c1c1c;
  border-radius: 10px;
  overflow: hidden;
}

.entity-card-content {
  padding: 12px;
}

.entity-card-name {
  font-weight: bold;
  margin-bottom: 6px;
}

.scene-count {
  color: #aaa;
  font-size: 14px;
}

.entity-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
}

.entity-pagination button {
  padding: 9px 14px;
}
/* Custom dropdowns - HereSphere compatible */

.custom-dropdown {
  position: relative;
  min-width: 150px;
}

.custom-dropdown-toggle {
  width: 100%;
  padding: 11px;
  border: 1px solid #444;
  border-radius: 7px;
  background: #181818;
  color: #eee;
  text-align: left;
  white-space: nowrap;
}

.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 100%;
  z-index: 1000;
  padding: 5px;
  box-sizing: border-box;
  border: 1px solid #444;
  border-radius: 7px;
  background: #181818;
}

.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}

.custom-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #eee;
  text-align: left;
  white-space: nowrap;
}

.custom-dropdown-menu button:hover {
  background: #292929;
}

@media (max-width: 750px) {
  .entity-toolbar {
    flex-wrap: wrap;
  }

  .custom-dropdown {
    min-width: 140px;
  }
}

/* Loading feedback */

.loading-shell {
  position: relative;
  min-height: 120px;
}

.loading-content {
  transition: opacity 120ms ease;
}

.loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 15, .58);
  border-radius: 10px;
  pointer-events: none;
}

.loading-shell.is-loading .loading-content {
  opacity: .38;
  pointer-events: none;
}

.loading-shell.is-loading .loading-overlay {
  display: flex;
}

.loading-indicator {
  padding: 12px 18px;
  border-radius: 9px;
  background: #181818;
  border: 1px solid #444;
  color: #eee;
  font-size: 15px;
  font-weight: 600;
}

.custom-dropdown-toggle:disabled,
.entity-toolbar input:disabled {
  opacity: .55;
  cursor: default;
}

/* Loading indicator always visible in viewport */

.loading-shell.is-loading .loading-indicator {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
}

/* Empty / error states */

.ui-state {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: #bbb;
}

.ui-state-title {
  margin-bottom: 8px;
  color: #eee;
  font-size: 18px;
  font-weight: 600;
}

.ui-state-message {
  margin-bottom: 16px;
  font-size: 14px;
}

.ui-state button {
  width: auto;
  padding: 10px 16px;
  border: 0;
  border-radius: 7px;
  background: #eee;
  color: #111;
}

/* Scene status badges */

.scene .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.scene .status[data-status="AVAILABLE"] {
  background: rgba(70, 170, 95, .18);
  border: 1px solid rgba(70, 170, 95, .45);
}

.scene .status[data-status="UNAVAILABLE"] {
  background: rgba(150, 150, 150, .13);
  border: 1px solid rgba(150, 150, 150, .30);
}

.scene .status[data-status="REQUESTED"],
.scene .status[data-status="STARTED"],
.scene .status[data-status="SEARCHING"],
.scene .status[data-status="RECHECKING"],
.scene .status[data-status="DOWNLOADING"],
.scene .status[data-status="PROCESSING"] {
  background: rgba(220, 170, 60, .15);
  border: 1px solid rgba(220, 170, 60, .40);
}

#status[data-status] {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

#status[data-status="AVAILABLE"] {
  background: rgba(70, 170, 95, .18);
  border: 1px solid rgba(70, 170, 95, .45);
}

#status[data-status="UNAVAILABLE"] {
  background: rgba(150, 150, 150, .13);
  border: 1px solid rgba(150, 150, 150, .30);
}

#status[data-status="REQUESTED"],
#status[data-status="STARTED"],
#status[data-status="SEARCHING"],
#status[data-status="RECHECKING"],
#status[data-status="DOWNLOADING"],
#status[data-status="PROCESSING"] {
  background: rgba(220, 170, 60, .15);
  border: 1px solid rgba(220, 170, 60, .40);
}

/* Active workflow indicator */

.scene .status[data-status="REQUESTED"]::before,
.scene .status[data-status="STARTED"]::before,
.scene .status[data-status="SEARCHING"]::before,
.scene .status[data-status="RECHECKING"]::before,
.scene .status[data-status="DOWNLOADING"]::before,
.scene .status[data-status="PROCESSING"]::before,
#status[data-status="REQUESTED"]::before,
#status[data-status="STARTED"]::before,
#status[data-status="SEARCHING"]::before,
#status[data-status="RECHECKING"]::before,
#status[data-status="DOWNLOADING"]::before,
#status[data-status="PROCESSING"]::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: currentColor;
  animation: vr-status-pulse 1.4s ease-in-out infinite;
}

@keyframes vr-status-pulse {
  0%,
  100% {
    opacity: .35;
    transform: scale(.8);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene .status::before,
  #status[data-status]::before {
    animation: none;
  }
}

/* Pointer / hover feedback */

/* Cards */
.scene,
.entity-card {
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.scene:hover,
.entity-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  background: #222;
}

/* Main scene actions */
.scene .request-button,
.scene .play-button {
  transition:
    filter 100ms ease,
    transform 100ms ease;
}

.scene .request-button:not(:disabled):hover,
.scene .request-button:not(:disabled):focus,
.scene .play-button:hover,
.scene .play-button:focus {
  filter: brightness(1.08);
  outline: none;
}

.scene .request-button:not(:disabled):active,
.scene .play-button:active {
  transform: scale(.98);
}

/* Dropdowns */
.custom-dropdown-toggle,
.custom-dropdown-menu button {
  transition:
    background 100ms ease,
    filter 100ms ease;
}

.custom-dropdown-toggle:not(:disabled):hover,
.custom-dropdown-menu button:hover {
  filter: brightness(1.10);
}

/* Pagination: deliberately simple */
.pager button,
.entity-pagination button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 7px;
  outline: none;
  box-shadow: none;
  transform: none;
}

.pager button:hover,
.pager button:focus,
.pager button:focus-visible,
.pager button:active,
.entity-pagination button:hover,
.entity-pagination button:focus,
.entity-pagination button:focus-visible,
.entity-pagination button:active {
  outline: none;
  box-shadow: none;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .scene,
  .entity-card,
  .scene .request-button,
  .scene .play-button {
    transition: none;
  }
}

/* Refine main action hover: avoid brightness flicker */

.scene .request-button,
.scene .play-button {
  transition:
    transform 100ms ease,
    opacity 100ms ease;
}

.scene .request-button:not(:disabled):hover,
.scene .request-button:not(:disabled):focus,
.scene .play-button:hover,
.scene .play-button:focus {
  filter: none;
  opacity: .92;
  transform: translateY(-1px);
  outline: none;
}

.scene .request-button:not(:disabled):active,
.scene .play-button:active {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Header / navigation ===== */

header {
  padding: 14px 24px;
  background: rgba(18, 18, 18, .97);
  border-bottom: 1px solid #252525;
}

.header-inner {
  min-height: 44px;
}

.header-inner h1 {
  margin: 0;
  color: #f2f2f2;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.35px;
  white-space: nowrap;
}

nav {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
}

nav a {
  position: relative;
  padding: 9px 12px;
  border-radius: 8px;
  color: #999;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 120ms ease,
    color 120ms ease;
}

nav a:hover,
nav a:focus {
  background: #202020;
  color: #eee;
  text-decoration: none;
  outline: none;
}

nav a.active {
  background: #2a2a2a;
  color: #fff;
}

/* Logout visually separated */
nav a:last-child {
  margin-left: 9px;
  padding-left: 15px;
  color: #777;
}

nav a:last-child::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 9px;
  bottom: 9px;
  width: 1px;
  background: #303030;
}

nav a:last-child:hover {
  background: #202020;
  color: #ddd;
}

@media (max-width: 750px) {
  header {
    padding: 14px 16px;
  }

  .header-inner {
    gap: 12px;
  }

  .header-inner h1 {
    font-size: 20px;
  }

  nav {
    gap: 2px;
  }

  nav a {
    padding: 8px 10px;
  }
}

/* Header readability */

nav a {
  color: #d8d8d8;
}

nav a:hover,
nav a:focus {
  color: #fff;
  background: #242424;
}

nav a.active {
  color: #fff;
  background: #303030;
}

nav a:last-child {
  color: #b0b0b0;
}

nav a:last-child:hover,
nav a:last-child:focus {
  color: #fff;
}

/* Library page transition */

#grid {
  transition: opacity 100ms ease;
}

#grid.page-changing {
  opacity: .38;
  pointer-events: none;
}


/* Progressive image loading */

.scene .cover,
.entity-card img {
  opacity: 0;
  transition: opacity 180ms ease;
}

.scene .cover.image-loaded,
.entity-card img.image-loaded {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .scene .cover,
  .entity-card img {
    transition: none;
  }
}

.entity-pagination-top {
  margin-top: 0;
  margin-bottom: 20px;
}

/* Scene card vertical alignment */

.scene .content {
  display: flex;
  flex-direction: column;
}

.scene .title {
  min-height: 43px;
  margin-bottom: 8px;
  line-height: 1.2;
}

.scene .status {
  align-self: flex-start;
}

.scene .request-button,
.scene .play-button {
  margin-top: auto;
}

/* Scene card performers */

.scene .scene-performers {
  height: 18px;
  margin-bottom: 9px;
  overflow: hidden;
  color: #aaa;
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Scene card text selection */



/* Library initial placeholders */

.scene-skeleton {
  overflow: hidden;
  border-radius: 12px;
  background: #1c1c1c;
  pointer-events: none;
}

.scene-skeleton-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #222;
}

.scene-skeleton-content {
  padding: 16px;
}

.scene-skeleton-title {
  width: 72%;
  height: 20px;
  margin-bottom: 10px;
  border-radius: 5px;
  background: #292929;
}

.scene-skeleton-text {
  width: 54%;
  height: 14px;
  margin-bottom: 13px;
  border-radius: 4px;
  background: #252525;
}

.scene-skeleton-status {
  width: 78px;
  height: 25px;
  margin-bottom: 12px;
  border-radius: 7px;
  background: #292929;
}

.scene-skeleton-button {
  width: 100%;
  height: 38px;
  border-radius: 7px;
  background: #292929;
}

/* Admin role controls */

.create-user select,
.admin-actions select {
  padding: 8px 10px;
  border: 1px solid #444;
  border-radius: 7px;
  background: #181818;
  color: #eee;
}

.admin-actions select {
  margin-right: 4px;
}


/* Guest permissions */

.play-button.guest-disabled {
  background: #444;
  color: #888;
  opacity: .55;
  cursor: default;
  pointer-events: none;
  transform: none !important;
}


/* Scene card rating */
.scene-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scene-status-row .status {
  min-width: 0;
}

.scene-rating {
  flex: 0 0 auto;
  color: #bbb;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Scene card release date */
.scene .scene-date {
  height: 18px;
  margin-bottom: 9px;
  color: #777;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}


/* Align scene card metadata while keeping actions visible */
.scene .scene-copy-zone {
  display: flex;
  flex-direction: column;
}

.scene .title {
  height: 3.6em;
  min-height: 3.6em;
  max-height: 3.6em;
  overflow: hidden;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scene .scene-performers {
  flex: 0 0 18px;
}

.scene .scene-date {
  flex: 0 0 18px;
}

.scene-status-row {
  flex: 0 0 auto;
}

/* Scene card micro polish */
.scene .scene-date {
  color: #666;
  font-size: 11px;
}

.scene-status-row {
  margin-bottom: 6px;
}

/* Tighten performer/date grouping */
.scene .scene-performers {
  margin-bottom: 2px;
}

.scene .scene-date {
  margin-bottom: 7px;
}
