:root {
  color-scheme: dark;
  --bg: #06070b;
  --bg-soft: #0f1119;
  --panel: rgba(16, 18, 28, 0.88);
  --panel-strong: rgba(23, 26, 39, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f8fb;
  --muted: #a6acba;
  --hot: #ef2f67;
  --hot-strong: #ff4778;
  --cyan: #49d3ff;
  --gold: #ffc857;
  --green: #39d98a;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.44);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 86% 0%, rgba(239, 47, 103, 0.16), transparent 31rem),
    radial-gradient(circle at 10% 52%, rgba(73, 211, 255, 0.08), transparent 28rem),
    linear-gradient(135deg, #05060a 0%, #0b0d14 44%, #06070b 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(6, 7, 11, 0.8);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand span,
.brand b {
  font-size: 1.2rem;
}

.brand b {
  margin-left: 1px;
  color: var(--hot);
}

.brand em {
  margin-left: 1px;
  color: var(--text);
  font-size: 1.28rem;
  font-style: normal;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 2vw, 28px);
  color: var(--muted);
  font-size: 0.94rem;
}

.nav-links a {
  transition: color 160ms ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a.is-active {
  color: var(--text);
}

.page[hidden] {
  display: none !important;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.search-box {
  display: grid;
  grid-template-columns: 18px minmax(110px, 220px);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-box input,
.text-field {
  width: 100%;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.text-field {
  min-height: 44px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

select.text-field {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 17px center / 7px 7px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 12px center / 7px 7px no-repeat,
    rgba(255, 255, 255, 0.06);
}

select.text-field option {
  color: var(--text);
  background: #11131d;
}

select.text-field option:checked {
  color: white;
  background: var(--hot);
}

.search-box input::placeholder,
textarea::placeholder {
  color: #747c8e;
}

.icon-button,
.primary-button,
.ghost-button,
.segmented button,
.genre-row button,
.tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border-radius: var(--radius);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.icon-button {
  width: 42px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.primary-button {
  padding: 0 18px;
  color: white;
  background: linear-gradient(135deg, var(--hot), #b31648);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 34px rgba(239, 47, 103, 0.28);
}

.ghost-button {
  padding: 0 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.compact {
  min-height: 38px;
  padding: 0 14px;
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover,
.segmented button:hover,
.genre-row button:hover,
.tabs button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

.hero-stage {
  position: relative;
  display: grid;
  height: clamp(360px, 37.5vw, 620px);
  min-height: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-image {
  object-fit: contain;
  object-position: center;
  filter: saturate(1.04) contrast(1.08);
}

.hero-shade {
  background:
    linear-gradient(180deg, rgba(6, 7, 11, 0.24) 0%, rgba(6, 7, 11, 0.04) 46%, rgba(6, 7, 11, 0.42) 100%);
}

.hero-content {
  position: absolute;
  left: clamp(18px, 4vw, 56px);
  bottom: clamp(18px, 4vw, 44px);
  display: block;
  z-index: 1;
  width: auto;
  margin: 0;
  padding: 0;
}

.hero-content .eyebrow,
.hero-content h1,
.hero-copy {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--hot-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 680px;
  margin-bottom: 16px;
  font-size: clamp(2.55rem, 6.5vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 590px;
  margin-bottom: 28px;
  color: #d7dbe6;
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-strip {
  display: none;
  position: absolute;
  right: clamp(18px, 4vw, 56px);
  bottom: 30px;
  left: clamp(18px, 4vw, 56px);
  z-index: 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  background: rgba(7, 8, 14, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
}

.hero-strip article {
  min-width: 0;
  padding: 18px clamp(16px, 3vw, 30px);
  border-right: 1px solid var(--line);
}

.hero-strip article:last-child {
  border-right: 0;
}

.hero-strip span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.hero-strip strong {
  display: block;
  overflow: hidden;
  font-size: clamp(1rem, 2vw, 1.24rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-section,
.catalog-section,
.profile-section,
.admin-section {
  padding: 46px clamp(18px, 4vw, 56px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.05;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 13px;
  color: #d7fae7;
  background: rgba(57, 217, 138, 0.11);
  border: 1px solid rgba(57, 217, 138, 0.32);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

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

.player-column,
.side-panel {
  min-width: 0;
}

.player-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(135deg, rgba(73, 211, 255, 0.14), transparent 34%),
    linear-gradient(315deg, rgba(239, 47, 103, 0.2), transparent 42%),
    #090a10;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.player-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #05060a;
}

.player-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 26px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5, 6, 10, 0.42), rgba(5, 6, 10, 0.88)),
    url("assets/groovezone-hero.jpg") center / cover;
}

.player-empty.is-hidden {
  display: none;
}

.player-empty svg {
  width: 58px;
  height: 58px;
  color: var(--hot-strong);
}

.player-empty strong {
  font-size: clamp(1.25rem, 3vw, 2rem);
}

.player-empty span {
  max-width: 360px;
  color: #c7ccd8;
  line-height: 1.45;
}

.now-playing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 0;
}

.now-playing h3 {
  margin-bottom: 5px;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
}

.now-playing p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.episode-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 240px));
  gap: 12px;
  margin-top: 18px;
}

.movie-details {
  display: grid;
  gap: 18px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.movie-details p:last-child {
  max-width: 920px;
  margin-bottom: 0;
  color: #d8dde8;
  line-height: 1.65;
}

.actors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actor-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 5px 10px 5px 6px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

button.actor-pill {
  font-weight: 700;
  text-align: left;
}

.actor-pill img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.like-button.is-active,
.movie-card .icon-button.is-active {
  color: white;
  background: rgba(239, 47, 103, 0.24);
  border-color: rgba(239, 47, 103, 0.55);
}

.side-panel,
.admin-editor,
.admin-saved,
.auth-card,
.admin-locked {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h3,
.admin-saved h3 {
  margin-bottom: 0;
}

.profile-state {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-state span {
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.tabs,
.segmented {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.tabs {
  margin-bottom: 12px;
}

.tabs button,
.segmented button,
.genre-row button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.tabs button.active,
.segmented button.active,
.genre-row button.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.16);
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 7px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.mini-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: stretch;
}

.mini-item:hover,
.mini-item.is-active {
  border-color: rgba(239, 47, 103, 0.45);
  background: rgba(239, 47, 103, 0.11);
}

.mini-poster {
  width: 44px;
  height: 44px;
  background: center / cover no-repeat var(--poster-fallback);
  border-radius: 6px;
}

.mini-item strong,
.mini-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.mini-item svg {
  width: 17px;
  color: var(--hot-strong);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: 20px;
}

.admin-locked {
  display: grid;
  gap: 6px;
}

.admin-locked span {
  color: var(--muted);
}

.episode-admin-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.episode-admin-panel[hidden] {
  display: none !important;
}

.admin-edit-form,
.episode-form,
.episode-list {
  display: grid;
  gap: 10px;
}

.episode-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
  gap: 8px;
  align-items: stretch;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-actions button {
  flex: 1 1 160px;
}

.admin-content[hidden],
.admin-locked[hidden] {
  display: none !important;
}

.field-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-grid label {
  min-width: 0;
}

textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
}

textarea:focus,
.text-field:focus,
.search-box:focus-within {
  border-color: rgba(73, 211, 255, 0.46);
}

.tool-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

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

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

.poster-button {
  position: relative;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  padding: 0;
  color: white;
  text-align: left;
  background: url("assets/groovezone-hero.jpg") center / cover;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.poster-button::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(135deg, rgba(239, 47, 103, 0.16), transparent 42%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.74) 0%, transparent 44%);
}

.poster-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-button:hover,
.poster-button:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(239, 47, 103, 0.52);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.poster-content {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.poster-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.poster-badge {
  justify-self: start;
  padding: 4px 7px;
  color: white;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 800;
}

.poster-badge.video {
  color: #d7fae7;
  border-color: rgba(57, 217, 138, 0.36);
}

.poster-title {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.36em;
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.poster-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #d9deea;
  font-size: 0.78rem;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.card-actions button {
  flex: 1;
  min-height: 36px;
}

.empty-results {
  margin: 30px 0 0;
  color: var(--muted);
}

.benefits-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 16px clamp(18px, 4vw, 56px) 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.benefits-band div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 78px;
  padding: 16px;
  color: #d9deea;
  background: rgba(255, 255, 255, 0.045);
  text-align: center;
}

.benefits-band svg {
  color: var(--hot-strong);
  flex: 0 0 auto;
}

.auth-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
}

.admin-dialog {
  width: min(560px, calc(100% - 28px));
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  display: grid;
  gap: 10px;
}

.add-movie-card {
  gap: 12px;
}

.auth-card h2 {
  margin-bottom: 8px;
}

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
}

.form-message {
  min-height: 20px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(380px, calc(100% - 36px));
  padding: 13px 15px;
  color: var(--text);
  background: rgba(15, 17, 25, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .watch-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 12px;
    padding: 14px;
  }

  .brand span,
  .brand b {
    font-size: 1rem;
  }

  .brand em {
    font-size: 1.08rem;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .search-box {
    grid-template-columns: 18px minmax(0, 1fr);
    min-height: 38px;
    padding: 0 10px;
    flex: 1;
  }

  .icon-button {
    width: 38px;
    min-height: 38px;
  }

  .hero-stage {
    height: clamp(160px, 37.5vw, 360px);
    min-height: 160px;
  }

  .hero-content {
    left: 14px;
    bottom: 14px;
  }

  .hero-copy {
    max-width: 94%;
  }

  .hero-strip {
    grid-template-columns: 1fr;
    bottom: 18px;
  }

  .hero-strip article {
    padding: 13px 15px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-strip article:last-child {
    border-bottom: 0;
  }

  .watch-section,
  .catalog-section,
  .profile-section,
  .admin-section {
    padding: 34px 14px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segmented button {
    flex: 1 0 auto;
  }

  .tool-actions {
    grid-template-columns: 1fr;
  }

  .profile-grid,
  .field-grid,
  .episode-controls {
    grid-template-columns: 1fr;
  }

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

  .poster-content {
    padding: 12px;
  }

  .poster-title {
    font-size: 0.94rem;
  }

  .benefits-band {
    grid-template-columns: 1fr 1fr;
    margin: 8px 14px 36px;
  }

  .benefits-band div {
    min-height: 68px;
    font-size: 0.9rem;
  }
}

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

  .movie-grid {
    grid-template-columns: 1fr;
  }

  .benefits-band {
    grid-template-columns: 1fr;
  }
}
