:root {
  color-scheme: dark;
  --bg: #0f0b18;
  --panel: #181126;
  --panel-2: #211634;
  --text: #f7f1ff;
  --muted: #b9abc9;
  --line: #35264a;
  --accent: #b982ff;
  --accent-2: #d9b7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(120deg, rgba(185, 130, 255, 0.16), transparent 38%),
    radial-gradient(circle at 90% 10%, rgba(105, 70, 180, 0.22), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.admin-box {
  display: grid;
  grid-template-columns: auto auto 44px;
  align-items: center;
  gap: 10px;
  justify-content: end;
}

.admin-box span {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.admin-box span.active {
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 7vw, 5.8rem);
  line-height: 0.92;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 24px;
  padding-top: 24px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px;
  gap: 10px;
  margin-bottom: 18px;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 15px;
  color: #130d1f;
  background: var(--accent);
  font-weight: 800;
}

.app-hidden {
  display: none !important;
}

.lock-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
}

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

.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

.profile-switcher {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  width: min(320px, 100%);
  max-width: 100%;
}

.profile-switcher select {
  flex: 1 1 auto;
  width: auto;
  height: 44px;
  min-width: 0;
  padding-block: 8px;
}

.profile-switcher .icon-button {
  flex: 0 0 44px;
}

.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.movie-tile {
  min-height: 270px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid transparent;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.movie-tile:hover,
.movie-tile.active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--panel-2);
}

.movie-tile img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: #241936;
}

.movie-tile span,
.movie-tile small {
  display: block;
  padding: 0 12px;
}

.movie-tile span {
  margin-top: 10px;
  font-weight: 900;
}

.movie-tile small {
  margin-top: 5px;
  margin-bottom: 12px;
  color: var(--muted);
}

.details {
  position: sticky;
  top: 20px;
  align-self: start;
  min-height: calc(100svh - 132px);
  background: rgba(23, 27, 25, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.player {
  background: #0b0712;
}

.player-select-row {
  padding: 12px;
  background: #0b0712;
  border-bottom: 1px solid var(--line);
}

.player-select-row select {
  max-width: 100%;
  background: rgba(255, 255, 255, 0.08);
}

.player iframe,
.no-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.detail-body {
  padding: 22px;
}

.detail-body h2 {
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: 8px;
}

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

.source-link {
  color: var(--accent-2);
}

.primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.danger-button {
  background: #402427;
  color: #ffd7d7;
  border: 1px solid #7f3a42;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  gap: 10px;
  margin: 20px 0;
}

.note-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.empty-state {
  min-height: calc(100svh - 132px);
  display: grid;
  place-content: center;
  padding: 30px;
  text-align: center;
}

.empty-state span {
  font-size: 2rem;
  font-weight: 900;
}

dialog {
  width: min(620px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

dialog form,
dialog label {
  display: grid;
  gap: 10px;
}

dialog form {
  gap: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.field-label {
  margin-bottom: 10px;
  color: var(--muted);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 10px;
}

.avatar-choice {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  font-size: 1.55rem;
}

.avatar-choice:hover,
.avatar-choice.active {
  border-color: var(--accent);
  background: rgba(185, 130, 255, 0.2);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.error {
  color: #ff9f9f;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  border-color: var(--accent);
}

.toast.error {
  border-color: #ff9f9f;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .details {
    position: static;
    min-height: auto;
  }

  .toolbar,
  .controls-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-box {
    grid-template-columns: 1fr 44px;
    align-items: center;
    justify-content: stretch;
  }

  .admin-box span {
    display: none;
  }

  .profile-switcher {
    width: 100%;
  }

}
