/* ---- Star Wars Watch Party ----------------------------------------------
   Deep space background, yellow "logo" treatment, sci-fi panels with
   glowing corner brackets. All class names preserved from the original
   so the JS keeps working. */

:root {
  --bg:           #03040a;
  --panel:        #0a0f1f;
  --panel-2:      #141a30;
  --ink:          #f5f6fb;
  --muted:        #9aa3bf;
  --muted-2:      #5e6786;
  --accent:       #ffe81f;   /* Star Wars yellow */
  --accent-2:     #ffd400;
  --accent-dim:   rgba(255, 232, 31, 0.55);
  --danger:       #ff6b6b;
  --ok:           #7ee787;
  --radius:       6px;
  --mono:         ui-monospace, "JetBrains Mono", "Fira Code", Menlo, monospace;
  --display:      "Helvetica Neue", "Arial Black", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 1200px 700px at 50% -10%, rgba(58, 38, 140, 0.45), transparent 60%),
    radial-gradient(ellipse 900px 500px at 95% 110%, rgba(140, 40, 90, 0.18), transparent 60%),
    radial-gradient(ellipse 800px 600px at 5% 50%,  rgba(20, 60, 130, 0.22), transparent 60%),
    url("../img/stars.svg");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  background-attachment: fixed;
  background-size: 100% 100%, 100% 100%, 100% 100%, 600px 600px;
}

/* Subtle "scanline" tint over the whole page */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 232, 31, 0.018) 0px,
      rgba(255, 232, 31, 0.018) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: screen;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---- Brand / title ----------------------------------------------------- */
.hero {
  text-align: center;
  padding: 22px 0 18px;
  margin-bottom: 6px;
}
.brand {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 0.95;
  margin: 0;
  text-shadow:
    0 0 14px rgba(255, 232, 31, 0.55),
    0 0 36px rgba(255, 232, 31, 0.18),
    0 4px 0 rgba(0, 0, 0, 0.45);
  transform: skewX(-8deg);
  display: inline-block;
}
.brand-sub {
  margin-top: 14px;
  color: var(--ink);
  font-family: var(--mono);
  letter-spacing: 0.42em;
  font-size: 0.78rem;
  text-transform: uppercase;
  opacity: 0.78;
}
.opener {
  margin: 26px auto 0;
  color: var(--accent);
  font-family: var(--display);
  font-style: italic;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  opacity: 0.88;
  text-shadow: 0 0 8px rgba(255, 232, 31, 0.35);
  max-width: 520px;
}

/* Decorative divider under the title — like the frame around the logo */
.hero-divider {
  display: block;
  margin: 18px auto 0;
  width: min(560px, 80%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}

/* ---- Headings ---------------------------------------------------------- */
h1 { font-size: clamp(1.7rem, 2.5vw, 2.4rem); margin: 0 0 4px; letter-spacing: 0.5px; }
h2 {
  font-size: 0.82rem;
  margin: 0 0 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-family: var(--mono);
  font-weight: 600;
  position: relative;
  padding-left: 14px;
}
h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
  transform: translateY(-50%) rotate(45deg);
}
h3.trilogy {
  margin: 22px 0 10px;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-family: var(--mono);
  font-weight: 500;
}

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

/* ---- Panels ------------------------------------------------------------ */
.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(20, 26, 50, 0.88) 0%, rgba(10, 14, 28, 0.94) 100%);
  border: 1px solid rgba(255, 232, 31, 0.18);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 18px 0;
  box-shadow:
    inset 0 0 0 1px rgba(255, 232, 31, 0.04),
    0 12px 32px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
/* Corner brackets for sci-fi feel */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.85;
}
.panel::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  box-shadow: -1px -1px 8px rgba(255, 232, 31, 0.4);
}
.panel::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  box-shadow: 1px 1px 8px rgba(255, 232, 31, 0.4);
}

/* ---- Forms / buttons --------------------------------------------------- */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
input[type="text"], input:not([type]) {
  flex: 1 1 160px;
  min-width: 0;
  padding: 10px 14px;
  background: rgba(3, 5, 14, 0.7);
  color: var(--ink);
  border: 1px solid #2a3454;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  letter-spacing: 0.04em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--muted-2); letter-spacing: 0.08em; }
input:focus {
  border-color: var(--accent);
  background: rgba(3, 5, 14, 0.9);
  box-shadow: 0 0 0 3px rgba(255, 232, 31, 0.18), inset 0 0 12px rgba(255, 232, 31, 0.06);
}
button {
  appearance: none;
  border: 1px solid #2a3454;
  background: rgba(15, 22, 44, 0.85);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 4px;
  font: inherit;
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(255, 232, 31, 0.18);
}
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  color: #1a1600;
  border-color: var(--accent-2);
  font-weight: 700;
  box-shadow: 0 0 22px rgba(255, 232, 31, 0.35);
}
button.primary:hover {
  background: var(--accent-2);
  color: #1a1600;
  box-shadow: 0 0 28px rgba(255, 232, 31, 0.55);
}
button[disabled] { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ---- Movie list -------------------------------------------------------- */
.movie-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.movie-btn {
  width: 100%;
  text-align: left;
  padding: 0;
  background: rgba(10, 16, 32, 0.7);
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: none;
  border-radius: 4px;
  border: 1px solid #2a3454;
  color: var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.movie-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  border-bottom: 1px solid rgba(255, 232, 31, 0.15);
}
.movie-title {
  display: block;
  padding: 12px 16px;
  text-align: left;
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.movie-btn:hover {
  background: rgba(20, 30, 60, 0.95);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(255, 232, 31, 0.2);
}
.movie-btn:hover .movie-thumb { border-bottom-color: var(--accent); }

/* Rogue One block: "current priority" highlight. */
.trilogy-block.priority {
  border: 1px solid rgba(255, 232, 31, 0.35);
  border-radius: var(--radius);
  padding: 14px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 232, 31, 0.06) 0%, rgba(255, 232, 31, 0.015) 100%);
  margin-top: 22px;
}
.priority-badge {
  display: inline-block;
  background: var(--accent);
  color: #1a1600;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  padding: 3px 10px;
  border-radius: 2px;
  margin-left: 12px;
  vertical-align: middle;
  font-family: var(--mono);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(255, 232, 31, 0.4);
}
.movie-btn.priority {
  background: linear-gradient(180deg, rgba(31, 38, 70, 0.95) 0%, rgba(22, 28, 56, 0.95) 100%);
  border-color: rgba(255, 232, 31, 0.55);
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 12px rgba(255, 232, 31, 0.25);
}
.movie-btn.priority:hover {
  background: linear-gradient(180deg, rgba(46, 56, 100, 0.95) 0%, rgba(34, 42, 86, 0.95) 100%);
  color: var(--accent-2);
}

/* ---- Status messages -------------------------------------------------- */
.msg { margin: 12px 0 0; min-height: 1.2em; color: var(--muted); font-size: 0.85rem; font-family: var(--mono); letter-spacing: 0.04em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---- Party head ------------------------------------------------------- */
.party-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  padding: 18px 22px;
  background:
    linear-gradient(180deg, rgba(20, 26, 50, 0.88) 0%, rgba(10, 14, 28, 0.94) 100%);
  border: 1px solid rgba(255, 232, 31, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  position: relative;
}
.party-head::before, .party-head::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.85;
}
.party-head::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}
.party-head::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}
.party-head h1 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-transform: uppercase;
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-shadow: 0 0 16px rgba(255, 232, 31, 0.4);
  margin: 0;
}
.code-block {
  display: flex;
  align-items: center;
  gap: 12px;
}
.code-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}
.code {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  background: var(--accent);
  color: #1a1600;
  border: none;
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  text-shadow: none;
  box-shadow: 0 0 22px rgba(255, 232, 31, 0.45);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.code:hover {
  background: var(--accent-2);
  color: #1a1600;
  box-shadow: 0 0 32px rgba(255, 232, 31, 0.7);
}
.code.copied { background: var(--ok); color: #06270f; box-shadow: 0 0 24px rgba(126, 231, 135, 0.5); }

/* ---- Player ----------------------------------------------------------- */
.player-shell {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 232, 31, 0.25);
  box-shadow:
    0 0 0 1px rgba(255, 232, 31, 0.06) inset,
    0 12px 36px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(255, 232, 31, 0.06);
}
#player {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #000;
}
.player-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.85));
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.2s;
  text-shadow: 0 0 12px rgba(255, 232, 31, 0.4);
}
.player-overlay.hidden { opacity: 0; }

/* Native controls should stay visible. */
#player::-webkit-media-controls-panel { background: rgba(0, 0, 0, 0.7); }

/* ---- Custom sync controls -------------------------------------------- */
.controls-panel .row { gap: 10px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.host-only {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 232, 31, 0.18);
}

/* Name-gate panel — shown before the visitor enters a display name. */
#name-gate {
  border-color: rgba(255, 232, 31, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 232, 31, 0.08) 0%, rgba(255, 232, 31, 0.02) 100%),
    linear-gradient(180deg, rgba(20, 26, 50, 0.88) 0%, rgba(10, 14, 28, 0.94) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 232, 31, 0.08),
    0 0 28px rgba(255, 232, 31, 0.1),
    0 12px 32px rgba(0, 0, 0, 0.55);
}
#name-gate input {
  flex: 1 1 200px;
}

/* ---- Members list ----------------------------------------------------- */
.members {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.members li {
  background: rgba(10, 16, 32, 0.7);
  padding: 6px 14px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  border: 1px solid #2a3454;
}
.members li.host {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 232, 31, 0.3);
  box-shadow: 0 0 12px rgba(255, 232, 31, 0.15);
}