/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* Range Slider Styling */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px; width: 16px;
    border-radius: 50%;
    background: #10b981;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px;
    cursor: pointer;
    background: #e2e8f0;
    border-radius: 2px;
}
.dark input[type=range]::-webkit-slider-runnable-track {
    background: #334155;
}
[x-cloak] { display: none !important; }

/* Ticker Animation */
.ticker-wrap {
    overflow: hidden;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.dark .ticker-wrap {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}
.ticker-track {
    display: inline-flex;
    animation: ticker 100s linear infinite;
}
.ticker-track:hover {
    animation-play-state: paused;
}
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Tooltip Styles */
.tooltip-wrap {
    position: relative;
    display: inline-flex;
    margin-left: 6px;
    cursor: help;
}
.tooltip-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #94a3b8;
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.tooltip-box {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    padding: 12px;
    background: #1e293b;
    color: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
}
.tooltip-box::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}
.tooltip-wrap:hover .tooltip-box {
    opacity: 1;
    visibility: visible;
    bottom: 140%;
}

/* Slider Number Combo */
.slider-number-combo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.slider-number-combo input[type=number] {
    width: 70px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}
.dark .slider-number-combo input[type=number] {
    border-color: #334155;
    background: #1e293b;
    color: white;
}


/* Crazy Gold Legendary Display */
.assessment-gold {
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #fbbf24, #d97706);
    background-size: 300% 300%;
    animation: gold-shimmer 2s ease infinite, sparkle 0.5s ease-in-out infinite alternate;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
    font-weight: 900;
    border: 2px solid #fcd34d;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}
@keyframes gold-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes sparkle {
    from { box-shadow: 0 0 10px #fbbf24; }
    to { box-shadow: 0 0 25px #fcd34d, 0 0 5px #fff; }
}

/* Pulse Glow for Inputs/Buttons */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); border-color: rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); border-color: rgba(16, 185, 129, 1); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); border-color: rgba(16, 185, 129, 0.4); }
}
.pulse-glow {
    animation: pulse-glow 2s infinite;
}

/* Perfect Release Animations */
@keyframes perfectFlash {
  0%   { background: #0f172a; } /* Assuming dark bg */
  20%  { background: #332100; box-shadow: inset 0 0 100px rgba(245, 158, 11, 0.4); }
  100% { background: #0f172a; box-shadow: inset 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes perfectShake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px) rotate(-0.5deg); }
  40%  { transform: translateX(6px) rotate(0.5deg); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}

.perfect-flash { animation: perfectFlash 0.6s ease-out; }
.perfect-shake { animation: perfectShake 0.4s ease-out; }

.perfect-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  color: #1C1917;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0;
  transform: scale(0.5);
  animation: badgePop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

@keyframes badgePop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.perfect-number {
  color: #F59E0B !important;
  text-shadow: 0 0 20px rgba(245, 158, 11, 0.8) !important;
  transition: color 0.3s, text-shadow 0.3s;
}

/* Leaderboard Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0; /* Starts hidden before animation kicks in */
}

/* ── JUICE: confetti burst (mega-hit) + screen shake (bomb) ───────────── */
.confetti-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    top: -14px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.95;
    will-change: transform, opacity;
    animation-name: confetti-fall;
    animation-timing-function: cubic-bezier(0.25, 0.6, 0.4, 1);
    animation-fill-mode: forwards;
}
@keyframes confetti-fall {
    0%   { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-9px, 4px) rotate(-0.6deg); }
    30% { transform: translate(8px, -5px) rotate(0.6deg); }
    45% { transform: translate(-7px, 3px); }
    60% { transform: translate(6px, -3px); }
    75% { transform: translate(-4px, 2px); }
    90% { transform: translate(3px, -1px); }
}
.screen-shake { animation: screenShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@media (prefers-reduced-motion: reduce) {
    .confetti-piece { display: none; }
    .screen-shake { animation: none; }
}


/* Deep-linked film row pulse (#cinema/<slug>) */
@keyframes filmRowPulse {
    0%   { background-color: rgba(16, 185, 129, 0.35); box-shadow: inset 3px 0 0 rgb(16, 185, 129); }
    60%  { background-color: rgba(16, 185, 129, 0.18); box-shadow: inset 3px 0 0 rgb(16, 185, 129); }
    100% { background-color: transparent; box-shadow: none; }
}
.film-row-highlight { animation: filmRowPulse 2.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .film-row-highlight { animation: none; background-color: rgba(16, 185, 129, 0.18); }
}

/* Visible keyboard focus (buttons, links, inputs) without affecting mouse clicks */
:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Dual-handle range sliders (Cinema Vault filters): two overlaid native
   inputs share one visual track; only the thumbs receive pointer events. */
.range-dual input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    background: transparent;
    pointer-events: none;
    z-index: 20;
}
.range-dual input[type="range"]:focus-visible {
    outline: none; /* the ring goes on the thumb, not the invisible input */
}
.range-dual input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 9999px;
    background: #fff;
    border: 2px solid #10b981;
    box-shadow: 0 1px 4px rgba(2, 6, 23, 0.35);
    cursor: grab;
}
.range-dual input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }
.range-dual input[type="range"]:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}
.range-dual input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 12px;  /* moz excludes the border from the box */
    height: 12px;
    border-radius: 9999px;
    background: #fff;
    border: 2px solid #10b981;
    box-shadow: 0 1px 4px rgba(2, 6, 23, 0.35);
    cursor: grab;
}
.range-dual input[type="range"]:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4);
}

/* --- What-if mode: dreamy echo rings radiating from the film poster frame --- */
/* Rectangular "sonar ping" outlines that scale out from the poster and fade,   */
/* signaling the numbers on screen have drifted from recorded history.          */
.dream-echo { position: relative; }
.dream-echo img {
    box-shadow: 0 0 22px rgba(255, 255, 255, 0.35);
    filter: brightness(1.06);
    transition: box-shadow 0.6s ease, filter 0.6s ease;
}
.dream-echo::before,
.dream-echo::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    border-radius: 0.5rem; /* match the poster's rounded-lg */
    filter: blur(1.5px);
    pointer-events: none;
    animation: dream-echo-ping 2.6s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}
.dream-echo::after { animation-delay: -1.3s; }
@keyframes dream-echo-ping {
    0%   { transform: scale(1);    opacity: 0.55; }
    100% { transform: scale(1.35); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .dream-echo::before,
    .dream-echo::after {
        animation: none;
        transform: scale(1.08);
        opacity: 0.25;
    }
}

/* Card-scale variant: the echo radiates from the entire breakeven card. */
/* Applied to a wrapper around the card (the card clips its own children  */
/* with overflow-hidden, so the rings must live outside it).              */
.dream-echo-card { position: relative; }
.dream-echo-card > div {
    box-shadow: 0 0 44px rgba(255, 255, 255, 0.16);
    transition: box-shadow 0.6s ease;
}
.dream-echo-card::before,
.dream-echo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 0.75rem; /* match the card's rounded-xl */
    filter: blur(2px);
    pointer-events: none;
    animation: dream-echo-card-ping 3.2s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}
.dream-echo-card::after { animation-delay: -1.6s; }
@keyframes dream-echo-card-ping {
    0%   { transform: scale(1);     opacity: 0.5; }
    100% { transform: scale(1.045); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .dream-echo-card::before,
    .dream-echo-card::after {
        animation: none;
        transform: scale(1.015);
        opacity: 0.22;
    }
}
