/* Suggestey — popcorn-box red, clean white UI. */

:root {
  --popcorn: #ff1e2e;
  --popcorn-dark: #c4121e;
  --popcorn-deep: #7d1717;
  --bg: var(--popcorn);
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #8a7f74;
  --line: #f3e3e3;
  --accent: var(--popcorn);
  --accent-dark: var(--popcorn-dark);
  --accent-soft: #fdecec;
  --white-70: rgba(255, 255, 255, 0.72);
  --white-40: rgba(255, 255, 255, 0.38);
  --radius: 16px;
  --shadow: 0 6px 22px rgba(125, 23, 23, 0.28);
  --font: "Afacad", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Mochiy Pop One", "Arial Rounded MT Bold", sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  letter-spacing: 0.02em;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

/* ---------- header ---------- */

.site-header {
  text-align: center;
  padding: 2.4rem 1.25rem 1.2rem;
}

.brand h1 {
  margin: 0 0 0.3rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: 3.2rem;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 4px 4px 0 rgba(125, 23, 23, 0.4);
}

.tagline {
  margin: 0;
  color: #fff;
  font-size: 1.05rem;
}

/* ---------- layout ---------- */

main#app {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
}

.card {
  background: var(--card);
  color: var(--ink);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.center { text-align: center; }

/* ---------- buttons ---------- */

button, .btn {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: 2px solid #fff;
  font-size: 1rem;
  font-weight: 700;
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 2px 8px rgba(125, 23, 23, 0.25);
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(125, 23, 23, 0.3);
}

.btn:active { transform: scale(0.98); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 2px solid var(--accent);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  box-shadow: none;
  transform: none;
}

/* ghost buttons sitting directly on the red background (results toolbar) */
.toolbar .btn-ghost {
  color: #fff;
  border-color: #fff;
}

.toolbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-small {
  min-height: 40px;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
}

.linklike {
  background: none;
  border: none;
  color: var(--accent-dark);
  text-decoration: underline;
  font-size: 0.95rem;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
}

:focus-visible {
  outline: 3px solid #fff;
  box-shadow: 0 0 0 6px var(--accent-dark);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- question view ---------- */

.qwrap {
  max-width: 36rem;
  margin: 0 auto;
  position: relative;
}

.qcard {
  padding: 0.5rem 0.25rem;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* pull-down-to-refresh hint — touch devices only */
.pull-hint {
  display: none;
  text-align: center;
  color: #fff;
  font-size: 0.85rem;
  margin: 1.2rem 0 0;
}

@media (hover: none) {
  .pull-hint { display: block; }
}

.qcard.q-exit {
  opacity: 0;
  transform: translateX(-28px);
}

.qcard.q-enter {
  opacity: 0;
  transform: translateX(28px);
}

.qcard.q-enter.q-enter-active {
  opacity: 1;
  transform: none;
}

.q-text {
  font-size: 1.85rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 8px rgba(125, 23, 23, 0.35);
  margin: 0 0 1.3rem;
  letter-spacing: -0.01em;
}

.q-subtext {
  color: #fff;
  text-align: center;
  margin: 0 0 1.2rem;
  font-size: 0.98rem;
}

.q-options {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.2rem;
}

.q-extra {
  display: grid;
  gap: 0.65rem;
}

.q-extra[hidden] { display: none; }

/* tiny "more" link under the visible options */
.q-options .more-link {
  color: #fff;
  display: block;
  margin: 0.1rem auto 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 400;
}

.opt {
  text-align: center;
  background: linear-gradient(to bottom, #ffffff 50%, #f9f9f9 50%);
  border: 4px solid #fff;
  border-radius: var(--radius);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.85), 0 6px 16px rgba(125, 23, 23, 0.35);
  padding: 0.85rem 1.1rem;
  min-height: 44px;
  width: 100%;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.opt:hover {
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

.opt-label {
  display: block;
  font-weight: 650;
  font-size: 1.05rem;
}

.opt-detail {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.15rem;
}

.q-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  justify-content: space-between;
}

.q-nav .spacer { flex: 1; }

/* icon nav row under the answer buttons */
.q-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.75rem;
  margin-top: 1.25rem;
}

.qicon {
  background: none;
  border: none;
  color: #fff;
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.qicon:hover { background: rgba(255, 255, 255, 0.14); }

.qicon:disabled {
  opacity: 0.35;
  cursor: default;
}

.qicon:disabled:hover { background: none; }

/* question nav sits directly on the red background */
.q-nav .btn-ghost {
  color: #fff;
  border-color: #fff;
  box-shadow: none;
}

.q-nav .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
}

.q-nav .btn-ghost:disabled {
  opacity: 0.4;
}

.q-nav .linklike { color: #fff; }

/* progress dots — sit directly on the red background */

.dots {
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  margin: 0 0 1.25rem;
  flex-wrap: wrap;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--white-40);
  border: 1px solid var(--white-70);
  transition: background 0.2s ease, transform 0.2s ease;
}

.dot.filled {
  background: #fff;
  border-color: #fff;
  transform: scale(1.1);
}

/* ---------- loading / error ---------- */

.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: #fff;
}

.spinner {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  border: 4px solid var(--popcorn-dark);
  border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-card p { margin-top: 0; }

/* ---------- results toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.toolbar label {
  font-size: 0.92rem;
  color: #fff;
}

select.region {
  font-family: inherit;
  font-size: 1rem;
  min-height: 44px;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  border: 2px solid #fff;
  background: #fff;
  color: var(--ink);
}

.toolbar .grow { flex: 1; }

/* ---------- adjust answers panel ---------- */

.adjust-panel {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
}

.adjust-panel h2 {
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}

.adjust-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.adjust-row:first-of-type { border-top: none; }

.adjust-q {
  flex: 1;
  min-width: 12rem;
  font-size: 0.93rem;
}

.adjust-q strong { display: block; font-size: 0.95rem; }
.adjust-q span { color: var(--muted); }

/* ---------- movie cards ---------- */

.results { display: grid; gap: 1rem; }

.movie {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1.25rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.movie.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

.rank {
  position: absolute;
  top: -0.7rem;
  left: -0.7rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  border: 2px solid #fff;
}

.poster img {
  width: 100%;
  border-radius: 10px;
  display: block;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--line);
}

.poster-fallback {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.seen-note {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-weight: 600;
}

.m-title {
  margin: 0 0 0.15rem;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.m-meta {
  color: var(--muted);
  font-size: 0.93rem;
  margin: 0 0 0.5rem;
}

.m-rating { color: var(--ink); font-weight: 650; }

.synopsis { margin: 0.5rem 0; }

.synopsis.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.more-link {
  background: none;
  border: none;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  min-height: 0;
  text-decoration: underline;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0.22rem 0.75rem;
  font-size: 0.83rem;
  font-weight: 600;
}

.chip.genre { background: #f3e9e9; color: var(--accent-dark); }
.chip.provider { background: #e9eef5; color: #37507a; }

.why {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 0.7rem 0;
}

.why h3 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  color: var(--accent-dark);
}

.why p { margin: 0 0 0.4rem; font-size: 0.94rem; }

.read-note {
  font-size: 0.83rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.35rem;
}

.trailer {
  display: inline-block;
  margin: 0.3rem 0;
  font-weight: 700;
  color: var(--accent-dark);
  min-height: 44px;
  line-height: 44px;
}

.providers h3 {
  font-size: 0.95rem;
  margin: 0.6rem 0 0.25rem;
}

.prov-group { margin-bottom: 1rem; }

.prov-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.4rem;
}

.approx-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}

.m-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.action {
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.action:hover { border-color: var(--accent); }

.action.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.action.danger:hover {
  border-color: var(--accent-dark);
  color: var(--accent-dark);
}

.similar-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: underline;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
}

/* ---------- footer ---------- */

.site-footer {
  background: #2b2b30;
  padding: 1.2rem 1rem 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
}

.footer-brand {
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0;
  color: #fff;
  margin: 0 0 0.7rem;
}

.footer-attr {
  font-size: 0.6rem;
  margin: 0.4rem 0 0;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  main#app { padding: 0.75rem 0.9rem 2rem; }

  .brand h1 { font-size: 2.6rem; }

  .movie {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .poster img, .poster-fallback {
    max-width: 200px;
    margin: 0 auto;
  }

  .q-text { font-size: 1.2rem; }

  .q-nav { justify-content: flex-start; }

  .toolbar .btn-small { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .qcard, .movie, .btn, .opt, .action { transition: none; }
  .spinner { animation-duration: 2s; }
}
