* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f1117;
  color: #e8e8e8;
  margin: 0;
  padding: 40px 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  margin-bottom: 4px;
}

.subtitle {
  text-align: center;
  color: #9a9ca5;
  margin-top: 0;
  margin-bottom: 28px;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#movieInput {
  flex: 1;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #33353f;
  background: #1a1c24;
  color: #e8e8e8;
  font-size: 15px;
}

#searchBtn {
  padding: 12px 22px;
  border-radius: 8px;
  border: none;
  background: #e50914;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
}

#searchBtn:hover { background: #ff2530; }

.mode-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.mode-btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #33353f;
  background: #1a1c24;
  color: #9a9ca5;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover {
  border-color: #e50914;
  color: #e8e8e8;
}

.mode-btn.active {
  background: #e50914;
  border-color: #e50914;
  color: white;
}

.alpha-caption {
  color: #6a6c76;
  font-size: 12px;
  margin: 0 0 24px 0;
  font-style: italic;
}

#alphaSlider { flex: 1; }

#status {
  text-align: center;
  color: #9a9ca5;
  min-height: 20px;
  margin-bottom: 10px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  background: #1a1c24;
  border: 1px solid #2a2c36;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #e50914;
}

.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 12px;
  background: #0f1117;
}

.poster-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
  background: linear-gradient(135deg, #262933, #1a1c24);
  color: #8a8c96;
}

.poster-icon {
  font-size: 32px;
  opacity: 0.6;
}

.poster-title {
  font-size: 13px;
  font-weight: 600;
  color: #b5b7c0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card h3 {
  margin: 0 0 6px 0;
  font-size: 17px;
}

.card .meta {
  color: #9a9ca5;
  font-size: 13px;
  margin-bottom: 10px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 4px;
}

.score-row span:first-child { color: #9a9ca5; }

.final-score {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a2c36;
  font-weight: 600;
  font-size: 14px;
  color: #4ade80;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.open { display: flex; }
.modal-content {
  background: #1a1c24;
  border: 1px solid #2a2c36;
  border-radius: 12px;
  padding: 28px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: #9a9ca5;
  font-size: 24px;
  cursor: pointer;
}
.modal-poster {
  width: 140px;
  border-radius: 8px;
  float: left;
  margin: 0 16px 12px 0;
}
.modal-content h2 { margin-top: 0; }
.tagline { color: #9a9ca5; font-style: italic; }
.modal-meta { color: #9a9ca5; font-size: 13px; }

.reference-label {
  color: #9a9ca5;
  font-size: 13px;
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reference-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
  max-width: none;
  margin-bottom: 28px;
  border-color: #e50914 !important;
}

.reference-poster-wrap .poster {
  width: 160px;
  margin-bottom: 0;
}

.reference-info {
  flex: 1;
}

.reference-scores {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 6px 24px;
  margin-top: 14px;
  max-width: 500px;
}

.modal-loading {
  color: #6a6c76;
  font-style: italic;
  font-size: 13px;
}

.modal-poster.poster-placeholder {
  aspect-ratio: 2 / 3;
}

#landingView {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-collage {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  background: radial-gradient(circle at 50% 30%, #2a1f24 0%, #0c0d11 75%);
  box-sizing: border-box;
}

.hero-tile {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #1e2029, #12131a);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.06);
}

.hero-tile-1 { grid-column: 1; grid-row: 1 / 3; }
.hero-tile-2 { grid-column: 2; grid-row: 1; }
.hero-tile-3 { grid-column: 3; grid-row: 1; }
.hero-tile-4 { grid-column: 2; grid-row: 2; }
.hero-tile-5 { grid-column: 3; grid-row: 2; }

.hero-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: brightness(0.75) saturate(1.05);
  transition: opacity 1.4s ease-in-out;
}

.hero-tile-img.loaded { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .hero-tile-img { animation: kenburns 24s ease-in-out infinite alternate; }
  .hero-tile-2 .hero-tile-img { animation-duration: 28s; }
  .hero-tile-3 .hero-tile-img { animation-duration: 20s; }
  .hero-tile-4 .hero-tile-img { animation-duration: 26s; }
  .hero-tile-5 .hero-tile-img { animation-duration: 22s; }
}

@keyframes kenburns {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.1) translate(-1.5%, -1.5%); }
}

.landing-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8,9,12,0.35) 0%, rgba(8,9,12,0.55) 55%, rgba(8,9,12,0.85) 100%);
  z-index: 1;
  pointer-events: none;
}

.landing-panel {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 620px;
  margin: 24px;
  padding: 56px 48px;
  background: rgba(14, 15, 19, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.landing-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 56px;
  letter-spacing: 0.3px;
  margin: 0 0 14px 0;
  color: #f5f0e8;
}

.landing-tagline {
  font-family: 'Inter', sans-serif;
  color: #c7c8d1;
  font-size: 17px;
  font-weight: 400;
  margin: 0 0 32px 0;
}

.landing-search {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.landing-search input {
  flex: 1;
  padding: 15px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f0f2;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}

.landing-search input:focus {
  outline: none;
  border-color: #e50914;
}

.landing-search button {
  padding: 15px 30px;
  border-radius: 10px;
  border: none;
  background: #e50914;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s, transform 0.15s;
}

.landing-search button:hover {
  background: #ff2530;
  transform: translateY(-1px);
}

.rotating-quote {
  font-family: 'Fraunces', serif;
  font-style: italic;
  color: #9c9dab;
  font-size: 14px;
  min-height: 22px;
  margin: 0 0 22px 0;
  transition: opacity 0.6s;
}

.landing-skip { margin: 0; }

.landing-skip a {
  color: #7a7c86;
  font-size: 13px;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
}

.landing-skip a:hover {
  color: #cfd0d8;
  text-decoration: underline;
}

.fade-up {
  opacity: 0;
  transform: translateY(16px);
  animation: fadeUp 0.7s ease-out forwards;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}
