/**
 * CINECUT - CINEMATIC TRAILER QUIZ STYLES
 * Built on MostlyMovies tokens with responsive, mobile-first design.
 */

:root {
  --cut-bg: #050508;
  --cut-surface: rgba(18, 18, 24, 0.85);
  --cut-surface-elevated: #1a1a24;
  --cut-gold: #e5a93b;
  --cut-gold-glow: rgba(229, 169, 59, 0.35);
  --cut-cyan: #00f2fe;
  --cut-border: rgba(255, 255, 255, 0.08);
  --cut-border-hover: rgba(255, 255, 255, 0.2);
  --cut-text: #f8f8fc;
  --cut-text-secondary: #a2a2b4;
  --cut-text-muted: #646476;
  --cut-radius: 16px;
  --cut-radius-sm: 8px;
  --cut-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--cut-bg);
  color: var(--cut-text);
  font-family: var(--cut-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 50% 10%, rgba(229, 169, 59, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(123, 97, 255, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* MAIN LAYOUT */
.game-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* HEADER */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--cut-border);
}

.brand-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.brand-section h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 40%, var(--cut-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.game-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  background: rgba(229, 169, 59, 0.15);
  color: var(--cut-gold);
  border: 1px solid rgba(229, 169, 59, 0.3);
  border-radius: 9999px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: var(--cut-surface);
  color: var(--cut-text-secondary);
  border: 1px solid var(--cut-border);
  padding: 0.45rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--cut-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--cut-surface-elevated);
  color: var(--cut-text);
  border-color: var(--cut-border-hover);
}

/* VIDEO VIEWPORT & ANTI-SPOILER SHIELD */
.video-card {
  background: var(--cut-surface);
  border: 1px solid var(--cut-border);
  border-radius: var(--cut-radius);
  padding: 0.75rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}

.video-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: calc(var(--cut-radius) - 6px);
  overflow: hidden;
}

/* YouTube Iframe Masking to cut off title banner */
.video-player-frame {
  position: absolute;
  top: -65px; /* Crops out YouTube's top title bar completely */
  left: -8%;
  width: 116%;
  height: calc(100% + 120px);
  pointer-events: none;
}

/* When game is won/lost, show normal player controls without crop */
.video-viewport.unlocked .video-player-frame {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* Invisible pointer-events shield over video during quiz */
.video-shield {
  position: absolute;
  inset: 0;
  z-index: 10;
  cursor: pointer;
  background: transparent;
}

.video-viewport.unlocked .video-shield {
  display: none;
}

/* Standard Opaque Mystery Screen / Curtain (Zero Spoiler Leak) */
.video-curtain {
  position: absolute;
  inset: 0;
  z-index: 15;
  background-color: #06060a;
  background-image: url('../images/mystery-screen.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 1rem;
  text-align: center;
}

.video-curtain.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.curtain-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cut-gold);
  background: rgba(10, 10, 16, 0.85);
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid rgba(229, 169, 59, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.curtain-play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cut-gold) 0%, #c48c26 100%);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 25px var(--cut-gold-glow);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.curtain-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 35px rgba(229, 169, 59, 0.6);
}

.curtain-play-btn:active {
  transform: scale(0.96);
}

.curtain-text {
  font-size: 0.9rem;
  color: var(--cut-text);
  font-weight: 600;
  max-width: 420px;
  background: rgba(10, 10, 16, 0.85);
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* TIMELINE PROGRESS BAR */
.timeline-container {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.timeline-bar-wrapper {
  position: relative;
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cut-gold), #ffd479);
  border-radius: 9999px;
  transition: width 0.05s linear;
  box-shadow: 0 0 10px var(--cut-gold-glow);
}

.timeline-segments {
  display: flex;
  width: 100%;
  gap: 2px;
}

.timeline-segment {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--cut-text-muted);
  transition: all 0.2s ease;
  user-select: none;
}

.timeline-segment.unlocked {
  background: rgba(229, 169, 59, 0.12);
  color: var(--cut-gold);
}

.timeline-segment.active {
  background: rgba(229, 169, 59, 0.28);
  color: #fff;
  border: 1px solid rgba(229, 169, 59, 0.5);
  box-shadow: 0 0 10px var(--cut-gold-glow);
}

/* PLAY CONTROLS ROW */
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  gap: 0.75rem;
}

.btn-play {
  flex: 1;
  background: linear-gradient(135deg, var(--cut-gold) 0%, #c48c26 100%);
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.8rem 1.2rem;
  border-radius: var(--cut-radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 18px var(--cut-gold-glow);
  transition: all 0.2s ease;
}

.btn-play:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(229, 169, 59, 0.5);
}

.btn-play:active {
  transform: translateY(1px);
}

.time-counter {
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cut-text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem 0.8rem;
  border-radius: var(--cut-radius-sm);
  border: 1px solid var(--cut-border);
  white-space: nowrap;
}

/* INPUT & SEARCH SECTION */
.search-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  background: var(--cut-surface);
  border: 1px solid var(--cut-border);
  border-radius: var(--cut-radius-sm);
  padding: 0.85rem 1rem;
  color: var(--cut-text);
  font-family: var(--cut-font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--cut-gold);
  box-shadow: 0 0 0 3px rgba(229, 169, 59, 0.15);
}

.search-input::placeholder {
  color: var(--cut-text-muted);
}

.btn-submit {
  background: linear-gradient(135deg, var(--cut-gold) 0%, #c48c26 100%);
  color: #000;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 1.25rem;
  border-radius: var(--cut-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(229, 169, 59, 0.25);
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(229, 169, 59, 0.5);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-skip {
  background: var(--cut-surface-elevated);
  color: var(--cut-text-secondary);
  border: 1px solid var(--cut-border-hover);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0 1.15rem;
  border-radius: var(--cut-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-skip:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cut-text);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-skip:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-submit:disabled,
.btn-skip:disabled,
.search-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* AUTOCOMPLETE DROPDOWN */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #15151e;
  border: 1px solid var(--cut-border-hover);
  border-radius: var(--cut-radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8);
  margin-top: 4px;
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
  background: rgba(229, 169, 59, 0.12);
}

.autocomplete-poster {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: #20202c;
  flex-shrink: 0;
}

.autocomplete-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.autocomplete-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.autocomplete-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cut-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-meta {
  font-size: 0.75rem;
  color: var(--cut-text-secondary);
}

/* GUESS SLOTS LIST */
.guesses-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.guess-slot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--cut-surface);
  border: 1px solid var(--cut-border);
  border-radius: var(--cut-radius-sm);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.guess-slot.empty {
  opacity: 0.35;
  border-style: dashed;
}

.guess-slot.current {
  opacity: 0.85;
  border-color: rgba(229, 169, 59, 0.4);
  background: rgba(229, 169, 59, 0.04);
}

.guess-slot.wrong {
  border-color: rgba(255, 71, 87, 0.4);
  background: rgba(255, 71, 87, 0.08);
}

.guess-slot.correct {
  border-color: rgba(46, 204, 113, 0.4);
  background: rgba(46, 204, 113, 0.12);
  color: #2ecc71;
  font-weight: 700;
}

.guess-slot.skipped {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--cut-text-muted);
}

.slot-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cut-text-muted);
  width: 16px;
  text-align: center;
}

.slot-status {
  font-size: 1rem;
}

.slot-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #111117;
  border: 1px solid var(--cut-border-hover);
  border-radius: var(--cut-radius);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--cut-text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.result-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.result-status-badge {
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.result-status-badge.win {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}

.result-status-badge.loss {
  background: rgba(255, 71, 87, 0.15);
  color: #ff4757;
  border: 1px solid rgba(255, 71, 87, 0.4);
}

.result-movie-box {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem;
  border-radius: var(--cut-radius-sm);
  border: 1px solid var(--cut-border);
}

.result-poster {
  width: 90px;
  height: 135px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.result-movie-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
}

.result-movie-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.result-movie-meta {
  font-size: 0.8rem;
  color: var(--cut-gold);
  font-weight: 600;
}

.result-movie-director {
  font-size: 0.8rem;
  color: var(--cut-text-secondary);
}

.result-movie-overview {
  font-size: 0.75rem;
  color: var(--cut-text-muted);
  line-height: 1.4;
  margin-top: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.btn-watch-trailer {
  background: linear-gradient(135deg, var(--cut-gold) 0%, #c48c26 100%);
  color: #000;
  font-weight: 800;
  padding: 0.85rem;
  border-radius: var(--cut-radius-sm);
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 18px var(--cut-gold-glow);
  transition: all 0.2s ease;
}

.btn-watch-trailer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(229, 169, 59, 0.55);
}

.btn-share {
  background: var(--cut-surface-elevated);
  color: var(--cut-text);
  border: 1px solid var(--cut-border-hover);
  font-weight: 700;
  padding: 0.85rem;
  border-radius: var(--cut-radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-share:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-next {
  background: var(--cut-surface-elevated);
  color: var(--cut-text);
  border: 1px solid var(--cut-border-hover);
  padding: 0.85rem;
  border-radius: var(--cut-radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.btn-next:hover {
  background: rgba(255, 255, 255, 0.08);
}

.copy-toast {
  text-align: center;
  font-size: 0.8rem;
  color: #2ecc71;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-toast.visible {
  opacity: 1;
}

.next-puzzle-note {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cut-text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

/* HOW TO PLAY LIST */
.howto-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: var(--cut-text-secondary);
  line-height: 1.5;
}

.howto-list li strong {
  color: var(--cut-text);
}

/* RESPONSIVE MOBILE TWEAKS */
@media (max-width: 480px) {
  .game-container {
    padding: 1rem 0.75rem 2rem;
  }

  .brand-section h1 {
    font-size: 1.35rem;
  }

  .input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .search-input {
    grid-column: 1 / -1;
  }

  .btn-submit,
  .btn-skip {
    padding: 0.85rem 0.5rem;
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
  }

  .result-movie-box {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .result-poster {
    width: 100px;
    height: 150px;
  }
}

/* FOOTER */
.game-footer {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--cut-text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--cut-border);
  margin-top: auto;
}

.game-footer a {
  color: var(--cut-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.game-footer a:hover {
  color: var(--cut-gold);
}
