:root {
  color-scheme: dark;
  --bg: #050208;
  --text: #e9f6ff;
  --muted: #9a93b5;
  --cyan: #2ef2f2;
  --purple: #a43bff;
  --danger: #ff4d8d;
  --field: rgba(255, 255, 255, 0.04);
  --line: rgba(46, 242, 242, 0.22);
  --radius: 14px;
  --font: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}


body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg); /* the glow is a fixed layer: see body::after */
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
}

/* CRT scanlines over the whole page, echoing the logo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.025) 0 1px,
    transparent 1px 3px
  );
  z-index: 10;
}

main {
  width: 100%;
  max-width: 26rem;
  text-align: center;
}

a {
  color: var(--cyan);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- logo ---------- */

.logo {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 0 auto;
  /* the logo sits on pure black; "screen" drops that black onto the page background */
  mix-blend-mode: screen;
  animation: flicker-in 1.4s steps(1, end) both;
}

.logo-sm {
  width: 140px;
  margin-bottom: 1rem;
}

@keyframes flicker-in {
  0% { opacity: 0; }
  8% { opacity: 1; }
  12% { opacity: 0.2; }
  18% { opacity: 1; }
  22% { opacity: 0.5; transform: translateX(2px); }
  26% { opacity: 1; transform: none; }
  100% { opacity: 1; }
}

/* ---------- type ---------- */

.hello {
  margin: 1.75rem 0 0.5rem;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow:
    -2px 0 rgba(164, 59, 255, 0.75),
    2px 0 rgba(46, 242, 242, 0.75),
    0 0 18px rgba(46, 242, 242, 0.35);
}

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

.sub strong {
  color: var(--cyan);
  font-weight: 600;
}

h1.title {
  margin: 0 0 1.5rem;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(46, 242, 242, 0.45);
}

/* ---------- buttons ---------- */

.actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 9rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(90deg, var(--purple), #5b6cff 55%, var(--cyan));
  box-shadow: 0 0 22px rgba(164, 59, 255, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 0 30px rgba(46, 242, 242, 0.45);
}

.btn-ghost {
  color: var(--cyan);
  background: transparent;
  border-color: rgba(46, 242, 242, 0.55);
}
.btn-ghost:hover {
  background: rgba(46, 242, 242, 0.08);
  box-shadow: 0 0 18px rgba(46, 242, 242, 0.25);
}

.btn-block {
  width: 100%;
}

/* ---------- auth card ---------- */

.card {
  position: relative;
  padding: 2rem 1.5rem 1.75rem;
  border-radius: var(--radius);
  background: rgba(14, 8, 26, 0.72);
  backdrop-filter: blur(8px);
  text-align: left;
  /* gradient neon border */
  border: 1px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--purple), transparent 45%, transparent 55%, var(--cyan));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card h1.title {
  text-align: center;
}

form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

input {
  font: inherit;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(46, 242, 242, 0.15), 0 0 18px rgba(46, 242, 242, 0.2);
}

form .btn {
  margin-top: 0.5rem;
}

.error {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 77, 141, 0.45);
  background: rgba(255, 77, 141, 0.08);
  color: #ffb3cf;
  font-size: 0.95rem;
}

.switch {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.inline-form {
  display: inline;
}

@media (prefers-reduced-motion: reduce) {
  .logo {
    animation: none;
  }
  .btn {
    transition: none;
  }
}

/* =====================================================================
   Admin
   ===================================================================== */

body.wide {
  place-items: start center;
  padding-top: 1.25rem;
}

body.wide main {
  max-width: 60rem;
  text-align: left;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.top-bar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.top-bar .brand:hover {
  text-decoration: none;
}
.top-bar .brand img {
  border-radius: 8px;
}

.top-bar nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.95rem;
}

.who {
  color: var(--muted);
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.admin-head .title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

h2.title {
  font-size: 1.15rem;
  margin: 0 0 1rem;
}

.admin-section {
  margin-top: 2.5rem;
}

/* ---------- film grid ---------- */

.film-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem;
}

.film-card {
  display: block;
  height: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(14, 8, 26, 0.72);
  border: 1px solid var(--line);
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.film-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(46, 242, 242, 0.18);
}

.film-card img {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #0d0816;
}

.film-meta {
  display: grid;
  gap: 0.35rem;
  padding: 0.75rem 0.85rem 0.9rem;
}

.film-meta strong {
  font-weight: 600;
  line-height: 1.25;
}

.badge {
  justify-self: start;
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: middle;
}
.badge-feature {
  color: var(--cyan);
  border: 1px solid rgba(46, 242, 242, 0.5);
  background: rgba(46, 242, 242, 0.08);
}
.badge-series {
  color: #d9b3ff;
  border: 1px solid rgba(164, 59, 255, 0.6);
  background: rgba(164, 59, 255, 0.12);
}

.empty {
  padding: 2.5rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.empty p {
  margin: 0;
}

/* ---------- episodes ---------- */

.episode-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.episode-list a {
  display: grid;
  grid-template-columns: 6.5rem 2.5rem 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 1rem 0.5rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 8, 26, 0.72);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.episode-list a:hover {
  text-decoration: none;
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(46, 242, 242, 0.15);
}
.episode-list img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #0d0816;
}
.ep-num {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--cyan);
  text-align: center;
  text-shadow: 0 0 12px rgba(46, 242, 242, 0.4);
}
.ep-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 34rem) {
  .episode-list a {
    grid-template-columns: 5rem 2rem 1fr;
  }
  .episode-list a .hint {
    display: none;
  }
}

/* ---------- admin forms ---------- */

.admin-form {
  max-width: 36rem;
  gap: 1.25rem;
}

label em,
.field-label em {
  font-style: normal;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
  opacity: 0.8;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

textarea {
  font: inherit;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  resize: vertical;
  min-height: 7rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(46, 242, 242, 0.15), 0 0 18px rgba(46, 242, 242, 0.2);
}

input[type="file"] {
  padding: 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
}
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-right: 0.9rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(46, 242, 242, 0.55);
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
  background: rgba(46, 242, 242, 0.08);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.cover-preview {
  display: block;
  max-width: 12rem;
  max-height: 16rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.choices {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.choices legend {
  margin-bottom: 0.5rem;
  padding: 0;
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--field);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.choice strong {
  color: var(--text);
  font-weight: 600;
}
.choice small {
  color: var(--muted);
  font-size: 0.85rem;
}
.choice input:checked + span {
  border-color: var(--cyan);
  background: rgba(46, 242, 242, 0.07);
  box-shadow: 0 0 18px rgba(46, 242, 242, 0.18);
}
.choice input:focus-visible + span {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.choice input:disabled + span {
  opacity: 0.4;
  cursor: not-allowed;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
}

.notice {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(46, 242, 242, 0.45);
  background: rgba(46, 242, 242, 0.07);
  color: var(--cyan);
}

.error div + div {
  margin-top: 0.25rem;
}

/* ---------- delete ---------- */

.danger-zone {
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 77, 141, 0.2);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(90deg, #ff4d8d, #c2185b);
  box-shadow: 0 0 20px rgba(255, 77, 141, 0.35);
}

.btn-danger-ghost {
  color: var(--danger);
  background: transparent;
  border-color: rgba(255, 77, 141, 0.5);
}
.btn-danger-ghost:hover {
  background: rgba(255, 77, 141, 0.08);
}

.confirm {
  max-width: 30rem;
}
.confirm p:first-child {
  margin-top: 0;
}

.row-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
  .film-card {
    transition: none;
  }
}

/* =====================================================================
   Public site: catalog + film detail
   ===================================================================== */

.btn-sm {
  min-width: 0;
  padding: 0.45rem 1rem;
  font-size: 0.78rem;
}

.link-btn {
  font: inherit;
  color: var(--cyan);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.catalog h1.title,
.episodes-public h2.title {
  margin-bottom: 1.25rem;
}

.film-grid .film-card .film-meta strong {
  font-size: 1.02rem;
}

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
}

.film-detail {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.film-poster {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: 0 0 40px rgba(164, 59, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.5);
  background: #0d0816;
}

.film-info {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}
.film-info .hint {
  margin: 0;
  font-size: 0.95rem;
}

.film-title {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow:
    -2px 0 rgba(164, 59, 255, 0.55),
    2px 0 rgba(46, 242, 242, 0.55),
    0 0 22px rgba(46, 242, 242, 0.25);
}

.prose {
  margin: 0;
  max-width: 40rem;
  color: #cfd8ea;
  line-height: 1.6;
  white-space: pre-line; /* keep the line breaks typed in admin */
  overflow-wrap: anywhere;
}

.episodes-public {
  margin-top: 3rem;
}

.episode-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.episode-card {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(14, 8, 26, 0.72);
}
.episode-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  background: #0d0816;
}
.episode-card .prose {
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.ep-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}
.ep-head .ep-num {
  text-align: left;
}
.ep-head strong {
  font-size: 1.1rem;
  font-weight: 600;
}

@media (max-width: 40rem) {
  .film-detail {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .film-poster {
    max-width: 16rem;
    margin: 0 auto;
  }
  .episode-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .top-bar .brand span {
    display: none;
  }
  .top-bar nav {
    gap: 0.9rem;
  }
  .film-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

/* =====================================================================
   Language flags
   ===================================================================== */

.film-card {
  position: relative;
}

.flag {
  display: inline-block;
  height: auto;
  border-radius: 3px;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

.flag-overlay {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  width: 28px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 2px 10px rgba(0, 0, 0, 0.55);
}

/* the film-card img rule would otherwise stretch the flag to full width */
.film-card img.flag-overlay {
  width: 28px;
  aspect-ratio: 4 / 3;
  background: none;
}

.flag-inline {
  width: 20px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.film-tags {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- select (language picker) ---------- */

select {
  font: inherit;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  background-color: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 2.4rem 0.75rem 0.9rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--cyan) 50%),
    linear-gradient(135deg, var(--cyan) 50%, transparent 50%);
  background-position:
    calc(100% - 1.15rem) 55%,
    calc(100% - 0.8rem) 55%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(46, 242, 242, 0.15), 0 0 18px rgba(46, 242, 242, 0.2);
}
select option {
  background: #120b1f;
  color: var(--text);
}

/* ---------- language filter ---------- */

.catalog h1.title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.catalog h1.title .flag-inline {
  width: 30px;
}

.lang-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.25rem 0 1.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.chip:hover {
  text-decoration: none;
  border-color: rgba(46, 242, 242, 0.6);
}
.chip-on {
  border-color: var(--cyan);
  background: rgba(46, 242, 242, 0.08);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(46, 242, 242, 0.18);
}
.chip .flag-inline {
  width: 18px;
}

a.lang:hover {
  color: var(--cyan);
  text-decoration: none;
}

/* =====================================================================
   Episode choices
   ===================================================================== */

.choice-letter {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 1px solid rgba(164, 59, 255, 0.7);
  background: rgba(164, 59, 255, 0.14);
  color: #e3c7ff;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 0 12px rgba(164, 59, 255, 0.25);
}

/* admin form */
.choices-field {
  border: 0;
  margin: 0;
  padding: 0;
  gap: 0.6rem;
}
.choices-field legend {
  padding: 0;
  margin-bottom: 0.25rem;
}
.choices-field .hint {
  margin-bottom: 0.25rem;
}
.choice-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

/* public episode card */
.ep-choices {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(164, 59, 255, 0.35);
  background: linear-gradient(135deg, rgba(164, 59, 255, 0.1), rgba(46, 242, 242, 0.05));
}
.ep-choices-q {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}
.ep-choices ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.ep-choices li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  color: #dfe6f5;
  line-height: 1.45;
}
.ep-choices li > span:last-child {
  padding-top: 0.25rem;
  overflow-wrap: anywhere;
}

/* =====================================================================
   Viewer picks
   ===================================================================== */

/* public: pickable choices */
.ep-choices ol li {
  display: block;
}
/* read-only rows are the <li> itself, so they need flex back (beats the rule above) */
.ep-choices ol li.choice-static {
  display: flex;
}
.choice-btn,
.choice-static {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #dfe6f5;
  font: inherit;
  text-align: left;
  line-height: 1.4;
}
.choice-btn {
  cursor: pointer;
  border-color: rgba(164, 59, 255, 0.25);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.choice-btn:hover {
  border-color: var(--cyan);
  background: rgba(46, 242, 242, 0.06);
}
.choice-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.choice-btn.picked,
.choice-static.picked {
  border-color: var(--cyan);
  background: rgba(46, 242, 242, 0.09);
  box-shadow: 0 0 16px rgba(46, 242, 242, 0.18);
}
.choice-btn.picked .choice-letter,
.choice-static.picked .choice-letter {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #04020a;
  box-shadow: 0 0 14px rgba(46, 242, 242, 0.5);
}
.choice-text {
  flex: 1;
  overflow-wrap: anywhere;
}
.your-pick {
  flex: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cyan);
}
.ep-choices-note {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.ep-choices.closed {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.ep-choices.closed .ep-choices-q {
  color: var(--muted);
}
.ep-choices.closed .choice-static:not(.picked) {
  opacity: 0.6;
}

/* admin: results */
.pick-results {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
  max-width: 36rem;
}
.pick-results li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.pick-bar-wrap {
  flex: 1;
  display: grid;
  gap: 0.4rem;
}
.pick-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.2rem;
}
.pick-count {
  flex: none;
  color: var(--cyan);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
progress.pick-bar {
  appearance: none;
  width: 100%;
  height: 0.5rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
progress.pick-bar::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
progress.pick-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 999px;
}
progress.pick-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  border-radius: 999px;
}

/* =====================================================================
   "Continues" marker
   ===================================================================== */

/* admin form: letter | text | continues */
.choice-row {
  grid-template-columns: auto 1fr auto;
}
label.continues {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
label.continues input {
  accent-color: var(--cyan);
  margin: 0;
}
label.continues:hover {
  border-color: rgba(46, 242, 242, 0.6);
}
label.continues:has(input:checked) {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(46, 242, 242, 0.08);
}
label.continues:has(input:focus-visible) {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
@media (max-width: 34rem) {
  label.continues span {
    display: none; /* radio only on narrow screens */
  }
}

/* admin results + list */
.tag-continues,
.outcome {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  vertical-align: 0.1em;
  white-space: nowrap;
}
.tag-continues,
.outcome-continued {
  color: var(--cyan);
  border: 1px solid rgba(46, 242, 242, 0.55);
  background: rgba(46, 242, 242, 0.08);
}
.outcome-ended {
  color: var(--muted);
  border: 1px solid rgba(154, 147, 181, 0.35);
}
.needs {
  color: #ffb3cf;
}

/* public, closed: the continuing choice stays bright even if it wasn't your pick */
.ep-choices.closed .choice-static.continued {
  opacity: 1;
}

/* admin view of episode choices on the public page */
.ep-choices.admin-view {
  border-style: dashed;
}
.ep-choices.admin-view .choice-static:not(.continued) {
  opacity: 0.75;
}
.admin-only {
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 207, 0.5);
  color: #ffb3cf;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  vertical-align: 0.1em;
}

/* =====================================================================
   Episode page
   ===================================================================== */

.episode-detail {
  display: grid;
  gap: 1.75rem;
}

.episode-hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #0d0816;
  box-shadow: 0 0 50px rgba(164, 59, 255, 0.22), 0 24px 70px rgba(0, 0, 0, 0.55);
}

.episode-info {
  display: grid;
  gap: 0.85rem;
  justify-items: start;
  max-width: 46rem;
}
.episode-info > .hint {
  margin: 0;
  font-size: 0.95rem;
}
.episode-info .ep-choices {
  width: 100%;
  margin-top: 0.5rem;
}

.ep-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.ep-nav-link {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 8, 26, 0.72);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ep-nav-link:hover {
  text-decoration: none;
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(46, 242, 242, 0.15);
}
.ep-nav-next {
  grid-column: 2;
  text-align: right;
}

/* film page: episode cards link to their page */
.ep-thumb {
  display: block;
}
.ep-thumb img {
  transition: box-shadow 0.2s ease;
}
.ep-thumb:hover img {
  box-shadow: 0 0 0 1px var(--cyan), 0 0 18px rgba(46, 242, 242, 0.25);
}
.ep-link {
  color: var(--text);
}
.ep-link:hover {
  color: var(--cyan);
  text-decoration: none;
}

@media (max-width: 40rem) {
  .ep-nav {
    grid-template-columns: 1fr;
  }
  .ep-nav-next {
    grid-column: 1;
  }
}

/* =====================================================================
   Points + leaderboard
   ===================================================================== */

.points-pill {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 90, 0.55);
  background: rgba(255, 210, 90, 0.1);
  color: #ffd25a;
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.points-pill:hover {
  text-decoration: none;
  box-shadow: 0 0 14px rgba(255, 210, 90, 0.3);
}

.pts {
  color: #ffd25a;
}
.pts-zero {
  color: var(--muted);
}

.lb-intro {
  text-align: left;
  max-width: 44rem;
  margin: -0.5rem 0 1.5rem;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  max-width: 44rem;
}
.lb-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 8, 26, 0.72);
}
.lb-rank {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.lb-1 .lb-rank { color: #ffd25a; text-shadow: 0 0 12px rgba(255, 210, 90, 0.5); }
.lb-2 .lb-rank { color: #d8e1ee; }
.lb-3 .lb-rank { color: #e0a070; }
.lb-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-points {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffd25a;
  font-variant-numeric: tabular-nums;
}
.lb-points small {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}
.lb-me {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(46, 242, 242, 0.15);
}
@media (max-width: 34rem) {
  .lb-row {
    grid-template-columns: 2rem 1fr auto;
  }
  .lb-correct {
    display: none;
  }
}

/* =====================================================================
   Language switcher + footer
   ===================================================================== */

.auth-lang {
  margin: 1.25rem 0 0;
  text-align: center;
}

/* main takes the free space, footer sits at the bottom */
body {
  grid-template-rows: 1fr auto;
}

.site-footer {
  margin: 3rem auto 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.7;
}
.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
body:not(.wide) .site-footer {
  margin-top: 2rem;
}

/* top bar on phones: keep labels on one line and let the items wrap under each other */
.top-bar nav > a,
.top-bar .who {
  white-space: nowrap;
}
@media (max-width: 40rem) {
  .top-bar {
    align-items: flex-start;
  }
  .top-bar nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.6rem;
    column-gap: 0.9rem;
  }
}


/* =====================================================================
   Responsive fixes (audited at 320–1024px)
   ===================================================================== */

/* Background glow as a fixed layer. background-attachment: fixed is ignored or
   janky on mobile browsers and left a hard edge partway down long pages. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(164, 59, 255, 0.22), transparent 60%),
    radial-gradient(50rem 40rem at 110% 110%, rgba(46, 242, 242, 0.14), transparent 60%);
}

/* Form controls must be able to shrink: a <select> otherwise sizes to its longest
   option and an <input> to its default size, pushing forms wider than a phone. */
input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
}
select {
  width: 100%;
}
form,
label,
.field {
  grid-template-columns: minmax(0, 1fr);
}
.choice-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.choices {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.episode-list a {
  grid-template-columns: 6.5rem 2.5rem minmax(0, 1fr) auto;
}
.pick-row .choice-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.admin-head .title,
.film-title {
  overflow-wrap: anywhere;
  min-width: 0;
}
.who {
  overflow-wrap: anywhere;
}

/* Comfortable tap targets for links and small buttons */
.top-bar nav > a:not(.btn),
.top-bar .link-btn,
.back,
.admin-head > a:not(.btn),
a.lang,
.ep-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
}
.back {
  margin-bottom: 1rem;
}
.points-pill {
  padding: 0.3rem 0.65rem;
}

/* Small labels stay readable */
.outcome,
.tag-continues,
.admin-only,
.your-pick,
.badge {
  font-size: 0.75rem;
}

/* Choice text and its tag wrap as a unit instead of a ragged line */
.choice-text {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
}
.choice-text .outcome,
.choice-text .tag-continues {
  margin-left: 0;
}

@media (max-width: 34rem) {
  .episode-list a {
    grid-template-columns: 5rem 2rem minmax(0, 1fr);
  }
  /* "Your pick · +55 pts" goes under the choice instead of squeezing it */
  .choice-btn,
  .choice-static {
    flex-wrap: wrap;
  }
  .your-pick {
    margin-left: auto;
  }
}
.points-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}
label.continues {
  min-height: 2.25rem;
}

/* =====================================================================
   Language dropdown (replaces the EN | ID switch)
   ===================================================================== */

.lang-menu {
  position: relative;
}
.lang-menu > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lang-menu > summary::-webkit-details-marker {
  display: none;
}
.lang-menu > summary:hover,
.lang-menu[open] > summary {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(46, 242, 242, 0.18);
}
.lang-menu > summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.lang-menu .caret {
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}
.lang-menu[open] .caret {
  transform: translateY(1px) rotate(-135deg);
}

.lang-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 20; /* above the scanline overlay */
  min-width: 13rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #120b1f;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(164, 59, 255, 0.15);
}
.lang-menu-list a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  white-space: nowrap;
}
.lang-menu-list a:hover,
.lang-menu-list a:focus-visible {
  text-decoration: none;
  background: rgba(46, 242, 242, 0.08);
  outline: none;
}
.lang-menu-list a.on {
  color: var(--cyan);
}
.lang-menu-list a.on::after {
  content: "✓";
  margin-left: auto;
  padding-left: 0.75rem;
}

/* on the centred login/signup pages, open the menu centred under the button */
.auth-lang .lang-menu {
  display: inline-block;
}
.auth-lang .lang-menu-list {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  text-align: left;
}
/* the login/signup button sits at the bottom of the screen: open the menu upwards */
.auth-lang .lang-menu-list {
  top: auto;
  bottom: calc(100% + 0.4rem);
}

/* =====================================================================
   Continue with Google (dark variant of Google's branding guidelines)
   ===================================================================== */

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 2.9rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid #8e918f;
  background: #131314;
  color: #e3e3e3;
  font-family: Roboto, Arial, sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn-google:hover {
  text-decoration: none;
  background: #1f1f20;
  box-shadow: 0 0 16px rgba(46, 242, 242, 0.12);
}
.btn-google:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.g-logo {
  flex: none;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.card-intro {
  margin: -0.5rem 0 1.25rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.card-intro strong {
  color: var(--text);
}
