/* =============================================
   CINESLICE — style.css (Versión Renderizado OK)
   ============================================= */

:root {
  --bg-dark: #0e0e1c;
  --bg-card: #16162a;
  --bg-input: #1f1f3a;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --primary: #1a6cff;
  --accent: #00d4ff;
  --accent-glow: rgba(0, 212, 255, 0.2);
  --error: #ef4444;
  --font-title: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-x: hidden;
  padding: 20px;
}

/* --- Estructura de Pantallas --- */
.screen {
  display: none; /* Oculto por defecto */
  width: 100%;
  max-width: 540px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 10;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.active {
  display: block; /* CORREGIDO: Fuerza al navegador a mostrar la pantalla activa */
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

/* --- Componentes Globales --- */
.btn-back {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  transition: color 0.2s;
}

.btn-back:hover {
  color: var(--text-main);
}

/* --- PANTALLA DE BÚSQUEDA --- */
.search-hero {
  text-align: center;
  padding: 20px 0;
}

.logo-area {
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-main) 30%, var(--accent));
  background-clip: text;
  color: transparent;
}

.logo-tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.search-container {
  position: relative;
  margin-bottom: 16px;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 16px 16px 16px 48px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 108, 255, 0.2);
}

.search-spinner {
  position: absolute;
  right: 16px;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  opacity: 0;
  transition: opacity 0.2s;
}

.search-spinner.active {
  opacity: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 100;
}

.result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 14px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background: var(--bg-input);
}

.result-thumb, .result-thumb-placeholder {
  width: 40px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: #252542;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.result-info {
  flex: 1;
  text-align: left;
}

.result-name {
  font-weight: 500;
  font-size: 0.95rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-type {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

.result-item-loading {
  padding: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.search-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- Historial Recientes --- */
.recent-section {
  margin-top: 40px;
  text-align: left;
}

.recent-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.recent-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-pill {
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.03);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.recent-pill:hover {
  background: #2b2b4d;
  border-color: rgba(255,255,255,0.1);
}

/* FONDOS GLOW DECORATIVOS */
.bg-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  z-index: 1;
  pointer-events: none;
}
.bg-glow-1 { top: -100px; left: -100px; }
.bg-glow-2 { bottom: -100px; right: -100px; }

/* --- PANTALLA DETALLE PELÍCULA (SCREEN-SEEN) --- */
.movie-card-hero {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}

.movie-poster-wrapper {
  position: relative;
  width: 140px;
  flex-shrink: 0;
}

.movie-poster {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  position: relative;
  z-index: 2;
}

.poster-glow {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 100%;
  height: 100%;
  background: var(--accent);
  filter: blur(20px);
  opacity: 0.15;
  z-index: 1;
}

.movie-info {
  flex: 1;
}

.movie-genre-badge {
  display: inline-block;
  background: rgba(26, 108, 255, 0.15);
  color: #5c9eff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.movie-title {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.movie-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.meta-dot { color: rgba(255,255,255,0.15); }

.movie-plot {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d1d5db;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.imdb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5c518;
  color: #000;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.imdb-label {
  font-size: 0.7rem;
  opacity: 0.6;
}

.decision-question {
  text-align: center;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.decision-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-decision {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.05);
  padding: 16px;
  border-radius: 16px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-decision:hover {
  background: #242444;
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}

.btn-decision-icon { font-size: 1.5rem; }
.btn-decision-text { font-weight: 600; font-size: 1rem; display: block;}
.btn-decision-sub { font-size: 0.8rem; color: var(--text-muted); display: block; margin-top: 2px;}

.btn-saw:hover { border-color: rgba(0, 214, 150, 0.3); }
.btn-want:hover { border-color: rgba(26, 108, 255, 0.3); }


/* --- PANTALLA RECOLECCIÓN DE OPINIONES (SCREEN-REVIEWS) --- */
.reviews-movie-mini {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.rv-poster {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.rv-title { font-family: var(--font-title); font-size: 1.2rem; font-weight: 600; }
.rv-year { font-size: 0.85rem; color: var(--text-muted); }

.score-section {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255,255,255,0.02);
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 24px;
}

.score-circle-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}

.score-ring {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-ring-bg { fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 8; }
.score-ring-fill {
  fill: none;
  stroke: url("#score-gradient");
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-center {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-num { font-family: var(--font-title); font-size: 1.4rem; font-weight: 700; }
.score-max { font-size: 0.8rem; color: var(--text-muted); }

.score-labels .score-title { font-weight: 500; font-size: 1rem; }
.score-votes { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.section-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.keywords-section { margin-bottom: 28px; }
.keywords-grid { display: flex; gap: 8px; }

.keyword-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.03);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.keyword-count { color: var(--accent); font-weight: 600; margin-left: 4px; font-size: 0.75rem; }

/* Lista de reseñas comunitarias */
.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.no-reviews-msg {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 0;
}

.review-card {
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.02);
}

.review-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.reviewer-name { font-size: 0.85rem; font-weight: 600; }
.review-rating-sandwichs { font-size: 1rem; letter-spacing: 2px; }
.review-text { font-size: 0.9rem; line-height: 1.4; color: #d1d5db; }
.review-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; text-align: right; }

.awards-section p {
  background: rgba(245, 197, 24, 0.05);
  border: 1px dashed rgba(245, 197, 24, 0.2);
  padding: 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #fae082;
}


/* --- PANTALLA CALIFICAR (SCREEN-RATE) --- */
.rate-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.rate-poster-mini { width: 44px; height: 60px; object-fit: cover; border-radius: 6px; }
.rate-movie-name { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; }
.rate-subtitle { font-size: 0.85rem; color: var(--text-muted); }

.rate-form { display: flex; flex-direction: column; gap: 24px; }

/* Contenedor interactivo de sándwiches */
.sandwich-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.sandwich-wrapper {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 48px;
  font-size: 2.6rem;
  line-height: 1;
  user-select: none;
}

.sandwich-full {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, filter 0.2s ease;
}

.sandwich-wrapper.filled .sandwich-full {
  transform: scale(1.1);
}

.sandwich-score-display {
  text-align: center;
  font-family: var(--font-title);
  margin-top: 8px;
}

#sandwich-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sandwich-of { font-size: 1.1rem; color: var(--text-muted); margin-left: 4px; }
.sandwich-hint { font-size: 0.8rem; color: var(--text-muted); text-align: center; }
.sandwich-label, .review-label { text-align: center; margin-bottom: 6px; font-size: 0.95rem;}

/* Área de Texto de la Reseña */
.review-textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  padding: 14px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.4;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.review-textarea:focus { border-color: var(--primary); }

.char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), #104ec2);
  border: none;
  padding: 16px;
  border-radius: 14px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(26, 108, 255, 0.3);
  transition: filter 0.2s, transform 0.2s;
}

.btn-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}


/* --- MOTOR DE JUEGO INTEGRADO (SCREEN-GAME) --- */
.game-wrapper {
  text-align: center;
}

.game-top {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.game-score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 400px;
  margin: 0 auto 10px auto;
}

.game-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.game-score-num, .game-level-num { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.game-lives { font-size: 1.1rem; letter-spacing: 2px; }
.game-title-bar { font-size: 0.9rem; color: var(--text-muted); font-style: italic; }
.game-instruction { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }

.game-canvas-wrapper {
  position: relative;
  width: 480px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 15px 35px rgba(0,0,0,0.6);
}

#game-canvas {
  display: block;
  background: #0e0e1c;
}

/* Capa de interfaz sobre el Canvas */
.game-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(14, 14, 28, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.2s;
}

.game-overlay-content {
  padding: 24px;
  max-width: 320px;
}

.game-start-emoji { font-size: 3rem; margin-bottom: 12px; }
.game-overlay h2 { font-family: var(--font-title); font-size: 1.8rem; margin-bottom: 8px; }
.game-overlay p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 20px; }

.btn-start-game {
  background: var(--text-main);
  color: var(--bg-dark);
  border: none;
  padding: 12px 28px;
  border-radius: 12px;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-start-game:hover { background: var(--accent); }

.game-bottom-actions { margin-top: 24px; }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); color: var(--text-main); }