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

body {
  background: #0a0a0f;
  color: #fff;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}

/* ===== Header ===== */
header {
  text-align: center;
  padding: 32px 16px 16px;
  background: linear-gradient(180deg, #1a0a2e 0%, transparent 100%);
}
header h1 { font-size: 2rem; letter-spacing: 0.1em; color: #f5c518; }
header p  { color: #aaa; margin-top: 6px; font-size: 0.95rem; }

/* ===== Progress ===== */
.progress-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 8px;
}
.progress-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #333;
  transition: background 0.4s;
}
.progress-dot.done   { background: #f5c518; }
.progress-dot.active { background: #e87d0d; box-shadow: 0 0 8px #e87d0d; }

.round-label {
  text-align: center;
  color: #aaa;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* ===== Movie Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.movie-card {
  background: #16162a;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
}
.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(245,197,24,0.2);
  border-color: #f5c518;
}
.movie-card.selected {
  border-color: #f5c518;
  box-shadow: 0 0 20px rgba(245,197,24,0.4);
  transform: scale(1.03);
}

.poster-wrap {
  width: 100%;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #1e1e3a, #2a1a3e);
  color: #f5c518;
}

.movie-info    { padding: 8px 10px 10px; }
.movie-title   { font-size: 0.82rem; font-weight: bold; line-height: 1.3; }
.movie-year    { font-size: 0.72rem; color: #888; margin-top: 2px; }
.movie-genre-tag {
  display: inline-block;
  font-size: 0.65rem;
  background: #2a2a4a;
  color: #aaa;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 4px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: #16162a;
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  display: flex;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid #2a2a4a;
}
.modal-poster-wrap {
  width: 90px; height: 135px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: #222;
  display: flex; align-items: center; justify-content: center;
}
.modal-poster-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.modal-poster-placeholder {
  width: 90px; height: 135px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e1e3a, #2a1a3e);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; flex-shrink: 0;
}

.modal-title  { font-size: 1.1rem; font-weight: bold; line-height: 1.3; }
.modal-meta   { color: #888; font-size: 0.8rem; margin-top: 4px; }
.modal-stars  { color: #f5c518; font-size: 1rem; margin-top: 6px; }

.modal-body   { padding: 16px 20px 20px; }
.modal-section { margin-bottom: 14px; }
.modal-section label {
  font-size: 0.72rem; color: #f5c518;
  text-transform: uppercase; letter-spacing: 0.1em;
  display: block; margin-bottom: 4px;
}
.modal-section p { font-size: 0.85rem; color: #ccc; line-height: 1.6; }

.modal-actions { display: flex; gap: 10px; padding: 0 20px 20px; }

.btn-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none; border: none;
  color: #888; font-size: 1.4rem;
  cursor: pointer; line-height: 1;
}
.btn-close:hover { color: #fff; }

/* ===== Buttons ===== */
.btn {
  flex: 1; padding: 10px;
  border-radius: 8px;
  border: none; cursor: pointer;
  font-size: 0.9rem; font-weight: bold;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary  { background: #f5c518; color: #0a0a0f; }
.btn-primary:hover  { background: #ffd740; }
.btn-secondary { background: #2a2a4a; color: #fff; }
.btn-secondary:hover { background: #3a3a5a; }

/* ===== Result Screen ===== */
#result-screen {
  display: none;
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}
#result-screen h2 {
  text-align: center; color: #f5c518;
  font-size: 1.4rem; margin-bottom: 6px;
}
#result-screen .subtitle {
  text-align: center; color: #aaa;
  font-size: 0.9rem; margin-bottom: 24px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.result-card {
  background: #16162a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2a4a;
  transition: transform 0.2s, border-color 0.2s;
}
.result-card:hover { transform: translateY(-3px); border-color: #f5c518; }

.result-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e1e3a, #2a1a3e);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}
.result-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.result-card-body  { padding: 12px; }
.result-card-title { font-size: 0.9rem; font-weight: bold; }
.result-card-why   { font-size: 0.75rem; color: #aaa; margin-top: 5px; line-height: 1.5; }

/* ===== Loading ===== */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 200;
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 48px; height: 48px;
  border: 4px solid #333;
  border-top-color: #f5c518;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #aaa; font-size: 1rem; }

.restart-btn {
  display: block;
  margin: 24px auto 0;
  padding: 12px 32px;
  background: #2a2a4a; color: #fff;
  border: none; border-radius: 8px;
  font-size: 1rem; cursor: pointer;
  transition: background 0.2s;
}
.restart-btn:hover { background: #3a3a5a; }
