:root {
  --cream: #fff7e9;
  --cream-deep: #ffe8c4;
  --ink: #1f1f1f;
  --muted: #7d6d66;
  --pink: #ff5c88;
  --pink-dark: #ea3d70;
  --pink-soft: #ff9ab7;
  --yellow: #ffd46a;
  --line: rgba(54, 36, 30, 0.12);
  --card: rgba(255,255,255,.92);
  --shadow: 0 26px 70px rgba(115, 55, 67, .16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 215, 130, .24), transparent 23rem),
    radial-gradient(circle at 85% 16%, rgba(255, 92, 136, .12), transparent 26rem),
    linear-gradient(180deg, #fffaf0 0%, var(--cream) 67%, #ffd5df 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.popcorn-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.popcorn-piece {
  position: absolute;
  bottom: -90px;
  width: var(--size);
  height: var(--size);
  opacity: var(--opacity);
  filter: drop-shadow(0 9px 12px rgba(117, 64, 26, .14));
  animation: float-popcorn var(--duration) linear infinite;
  animation-delay: var(--delay);
}

@keyframes float-popcorn {
  0% { transform: translate3d(0, 14vh, 0) rotate(var(--rotation)); }
  35% { transform: translate3d(var(--drift-a), -35vh, 0) rotate(calc(var(--rotation) + 125deg)); }
  70% { transform: translate3d(var(--drift-b), -78vh, 0) rotate(calc(var(--rotation) + 250deg)); }
  100% { transform: translate3d(0, -125vh, 0) rotate(calc(var(--rotation) + 400deg)); }
}

.pink-wave {
  position: fixed;
  z-index: 0;
  left: -8vw;
  right: -8vw;
  bottom: -18vh;
  height: 38vh;
  border-radius: 50% 50% 0 0 / 30% 30% 0 0;
  background: linear-gradient(180deg, #ff7ca0, #ff4f7f);
  transform: rotate(-1.5deg);
  box-shadow: 0 -18px 70px rgba(255, 92, 136, .18);
}

.list-trigger {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(234,61,112,.14);
  border-radius: 999px;
  padding: 10px 12px 10px 15px;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 30px rgba(108,54,63,.12);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.list-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(108,54,63,.18);
}

.list-trigger img { width: 26px; height: 26px; }

.count-badge {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  color: white;
  background: var(--pink);
  font-size: 13px;
  font-weight: 850;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 920px);
  margin: 0 auto;
  padding: 52px 0 90px;
}

.brand {
  position: relative;
  width: min(100%, 680px);
  margin: 0 auto 18px;
  text-align: center;
  line-height: .82;
}

.brand-pop,
.brand-movie {
  display: block;
  font-weight: 950;
  letter-spacing: -.07em;
}

.brand-pop {
  color: var(--pink);
  font-size: clamp(68px, 11vw, 118px);
  transform: rotate(-2deg);
}

.brand-movie {
  color: var(--ink);
  font-size: clamp(76px, 12vw, 128px);
}

.brand-shuffle {
  display: inline-block;
  margin-top: -12px;
  color: var(--pink);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(55px, 8vw, 88px);
  line-height: .8;
  transform: rotate(-5deg);
  text-decoration: underline;
  text-decoration-thickness: 5px;
  text-underline-offset: 10px;
}

.picker {
  display: grid;
  justify-items: center;
  gap: 20px;
}

.hero-copy {
  position: relative;
  margin-top: 8px;
}

.hero-copy p {
  margin: 0;
  padding: 8px 16px;
  color: #453c38;
  font-family: "Segoe Print", "Bradley Hand", cursive;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  transform: rotate(-2deg);
}

.spark {
  position: absolute;
  color: var(--pink);
  font-size: 22px;
}

.spark-a { left: -18px; top: -10px; }
.spark-b { right: -18px; bottom: -12px; }

.popcorn-button {
  position: relative;
  width: min(82vw, 330px);
  height: 320px;
  margin-top: 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 24px 26px rgba(111,58,65,.20));
  transition: transform 180ms ease;
}

.popcorn-button:hover { transform: translateY(-6px) rotate(-1deg); }
.popcorn-button:active { transform: translateY(0) scale(.98); }
.popcorn-button:disabled { cursor: not-allowed; opacity: .65; }

.bucket-top {
  position: absolute;
  z-index: 2;
  left: 14%;
  right: 14%;
  top: 10px;
  height: 100px;
}

.bucket-top img {
  position: absolute;
  width: 78px;
  height: 78px;
  animation: kernel-bob 2.8s ease-in-out infinite;
}

.bucket-top img:nth-child(1) { left: 0; bottom: 4px; }
.bucket-top img:nth-child(2) { left: 22%; top: 0; animation-delay: -.4s; }
.bucket-top img:nth-child(3) { left: 42%; bottom: 12px; animation-delay: -.8s; }
.bucket-top img:nth-child(4) { right: 15%; top: 2px; animation-delay: -1.2s; }
.bucket-top img:nth-child(5) { right: -2px; bottom: 5px; animation-delay: -1.6s; }

@keyframes kernel-bob {
  0%,100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

.bucket-body {
  position: absolute;
  inset: 74px 22px 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  overflow: hidden;
  border-radius: 38px 38px 24px 24px;
  color: white;
  background:
    linear-gradient(90deg,
      #ff5c88 0 20%,
      #fff8ee 20% 40%,
      #ff5c88 40% 60%,
      #fff8ee 60% 80%,
      #ff5c88 80% 100%);
  border: 6px solid rgba(255,255,255,.72);
}

.bucket-body::before {
  content: "";
  position: absolute;
  inset: auto 28px 44px;
  height: 112px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ff6b94, #ec3e72);
  box-shadow:
    inset 0 0 0 3px rgba(255,255,255,.48),
    0 14px 22px rgba(117,46,63,.24);
}

.shuffle-symbol,
.bucket-body strong {
  position: relative;
  z-index: 1;
}

.shuffle-symbol {
  font-size: 30px;
  font-weight: 900;
}

.bucket-body strong {
  max-width: 220px;
  padding: 0 8px;
  font-size: 29px;
  line-height: 1.05;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.popcorn-button.is-rolling { animation: bucket-shake 520ms ease; }

@keyframes bucket-shake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-4deg) translateY(-3px); }
  40% { transform: rotate(4deg) translateY(-5px); }
  60% { transform: rotate(-3deg) translateY(-2px); }
  80% { transform: rotate(2deg); }
}

.empty-state {
  width: min(100%, 650px);
  padding: 24px 28px;
  border: 1px dashed rgba(234,61,112,.23);
  border-radius: 26px;
  text-align: center;
  background: rgba(255,255,255,.48);
  backdrop-filter: blur(7px);
}

.empty-state h2 { margin: 0 0 7px; font-size: 22px; }
.empty-state p { margin: 0; color: var(--muted); line-height: 1.55; }

.empty-state small {
  display: block;
  margin-top: 15px;
  color: #9a8179;
  font-size: 11px;
}

.starter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 19px;
}

.starter-button,
.starter-button,
.empty-import {
  min-height: 46px;
  margin-top: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-weight: 850;
  cursor: pointer;
}

.starter-button {
  border: 0;
  color: #543714;
  background: linear-gradient(135deg, #ffe298, var(--yellow));
  box-shadow: 0 11px 21px rgba(197,126,17,.16);
}

.starter-button span {
  margin-right: 5px;
  color: var(--pink-dark);
}

.empty-import {
  border: 1px solid rgba(234,61,112,.3);
  color: var(--pink-dark);
  background: white;
}

.movie-card {
  width: min(100%, 700px);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 30px;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  text-align: center;
}

.movie-card.is-entering { animation: card-pop 420ms cubic-bezier(.2,.8,.2,1); }
.movie-card.is-leaving { animation: card-out 340ms ease forwards; }
.is-hidden { display: none !important; }

@keyframes card-pop {
  0% { opacity: 0; transform: translateY(26px) scale(.96); }
  70% { opacity: 1; transform: translateY(-5px) scale(1.01); }
  100% { transform: none; }
}

@keyframes card-out {
  to { opacity: 0; transform: translateY(-20px) scale(.96) rotate(-1deg); }
}

.movie-card-topline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.movie-card h2 {
  margin: 18px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.letterboxd-link {
  display: inline-block;
  margin-top: 4px;
  color: #416355;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.actions {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 13px;
  margin-top: 28px;
}

.watch-button,
.redraw-button {
  min-height: 58px;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease;
}

.watch-button {
  border: 0;
  color: #553714;
  background: linear-gradient(135deg, #ffd97e, var(--yellow));
  box-shadow: 0 13px 24px rgba(197,126,17,.18);
}

.watch-button img { width: 26px; height: 26px; margin-right: 7px; vertical-align: -7px; }

.redraw-button {
  border: 1px solid rgba(234,61,112,.52);
  color: var(--pink-dark);
  background: white;
}

.redraw-button span { margin-right: 6px; font-size: 23px; vertical-align: -2px; }

.watch-button:hover,
.redraw-button:hover { transform: translateY(-2px); }

.watch-note { margin: 11px 0 0; color: var(--muted); font-size: 12px; }

.remaining {
  position: relative;
  z-index: 2;
  margin: 0;
  color: #5e4c47;
  font-size: 14px;
  font-weight: 700;
}

.remaining span { color: var(--ink); font-weight: 950; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 30;
  transform: translate(-50%,25px);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  color: white;
  background: rgba(31,31,31,.92);
  box-shadow: 0 16px 35px rgba(0,0,0,.20);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%,0); }

.list-dialog {
  width: min(92vw, 840px);
  max-height: min(88vh, 920px);
  padding: 0;
  border: 0;
  border-radius: 30px;
  color: var(--ink);
  background: #fffdf8;
  box-shadow: 0 35px 100px rgba(50,29,20,.30);
}

.list-dialog::backdrop {
  background: rgba(50,37,30,.30);
  backdrop-filter: blur(9px);
}

.list-dialog[open] { animation: dialog-in 230ms ease; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
}

.dialog-shell {
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 30px;
}

.dialog-header,
.dialog-footer,
.list-tools,
.import-controls {
  display: flex;
  align-items: center;
}

.dialog-header {
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  display: block;
  color: var(--pink);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.dialog-header h2 {
  margin: 4px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 35px;
}

.icon-button {
  width: 43px;
  height: 43px;
  border: 0;
  border-radius: 50%;
  color: #6a5c52;
  background: #f4eee5;
  font-size: 28px;
  cursor: pointer;
}

.import-panel {
  margin: 25px 0 18px;
  padding: 21px;
  border-radius: 22px;
  background: #fff0f5;
}

.import-panel h3 { margin: 0 0 4px; font-size: 17px; }
.import-panel p { margin: 0; color: #756a60; font-size: 13px; line-height: 1.5; }

.import-controls {
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 15px;
}

.file-button,
.import-controls select,
.list-tools input {
  min-height: 43px;
  border-radius: 999px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  color: var(--pink-dark);
  background: white;
  border: 1px solid rgba(234,61,112,.20);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.file-button input { display: none; }

.import-controls select {
  padding: 0 35px 0 14px;
  border: 1px solid var(--line);
  background: white;
}

.file-name { margin-top: 9px !important; color: #a65a74 !important; }

.starter-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 18px 0;
  padding: 18px 20px;
  border: 1px solid rgba(234,61,112,.13);
  border-radius: 21px;
  background:
    radial-gradient(circle at 92% 12%, rgba(255,212,106,.4), transparent 7rem),
    linear-gradient(135deg, #fff9e9, #fff1f6);
}

.starter-panel h3 {
  margin: 3px 0 4px;
  font-size: 18px;
}

.starter-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.starter-panel-kicker {
  color: var(--pink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.starter-panel-button {
  flex: 0 0 auto;
  min-height: 43px;
  border: 0;
  border-radius: 999px;
  padding: 0 17px;
  color: white;
  background: var(--pink);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(234,61,112,.19);
}

.list-tools {
  gap: 12px;
  margin: 18px 0;
}

.list-tools input {
  flex: 1;
  min-width: 0;
  padding: 0 17px;
  border: 1px solid var(--line);
  background: white;
  outline: none;
}

.ghost-button {
  flex: 0 0 auto;
  border: 0;
  color: var(--pink-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.film-list {
  display: grid;
  gap: 9px;
}

.film-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

.film-row h4 { margin: 0 0 3px; font-size: 15px; }
.film-row p { margin: 0; color: var(--muted); font-size: 12px; }

.row-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #9c4e68;
  background: #fff0f5;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.list-empty {
  padding: 34px 18px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
}

.dialog-footer {
  justify-content: space-between;
  gap: 20px;
  margin-top: 25px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.danger-link {
  padding: 0;
  border: 0;
  color: #9c4e68;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

@media (max-width: 760px) {
  .page-shell { padding-top: 86px; }
  .list-trigger { top: 16px; right: 16px; }
  .brand-pop { font-size: 72px; }
  .brand-movie { font-size: 80px; }
  .brand-shuffle { font-size: 58px; }
  .popcorn-button { width: min(88vw, 315px); height: 300px; }
  .movie-card { padding: 25px 18px; }
  .actions { grid-template-columns: 1fr; }
  .dialog-shell { padding: 22px 17px; }
  .starter-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .starter-panel-button { width: 100%; }
  .list-tools { align-items: stretch; flex-direction: column; }
  .film-row { grid-template-columns: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .popcorn-field { display: none; }
}
