:root {
    --bg-1: #1a1033;
    --bg-2: #2c1a5e;
    --bg-3: #0f2027;
    --card: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --text: #f5f3ff;
    --muted: #b9b3d6;
    --accent: #ff5e7e;
    --accent-2: #ffb648;
    --good: #4ade80;
    --bad: #ff6b6b;
    --warn: #ffd166;
    --primary: #7c5cff;
    --primary-hi: #9b7dff;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'Poppins', system-ui, sans-serif;
    color: var(--text);
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    padding: 24px 16px 48px;
}

.app {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* ---- Hero ---- */
.hero { text-align: center; }

.hero h1 {
    font-family: 'Fredoka', 'Poppins', sans-serif;
    font-size: clamp(2.2rem, 8vw, 3.4rem);
    margin: 6px 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: .5px;
}

.tagline {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

/* ---- Cards ---- */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 26px 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.start-card { text-align: center; }

.instructions {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text);
    margin: 0 0 22px;
}

/* ---- Buttons ---- */
.btn {
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    padding: 12px 22px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
}

.btn:active { transform: translateY(1px) scale(.99); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hi));
    color: #fff;
    box-shadow: 0 8px 22px rgba(124, 92, 255, 0.45);
}

.btn-primary:hover { box-shadow: 0 10px 28px rgba(124, 92, 255, 0.6); transform: translateY(-1px); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--card-border);
}

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

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Scoreboard ---- */
.scoreboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 22px;
}

.stat {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px 6px;
    text-align: center;
}

.stat-value {
    display: block;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-2);
    line-height: 1;
}

.stat-label {
    font-size: .78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .6px;
}

/* ---- Hints ---- */
.hints { text-align: center; margin-bottom: 20px; }

.emojis {
    font-size: clamp(2.6rem, 12vw, 4rem);
    line-height: 1.3;
    min-height: 1.4em;
    letter-spacing: .08em;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

.emojis.pop { animation: pop .35s ease; }

@keyframes pop {
    0%   { transform: scale(.6); opacity: 0; }
    60%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1); }
}

.pips {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 6px;
}

.pip {
    width: 26px;
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.15);
    transition: background .3s ease;
}

.pip.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.hint-note { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }

/* ---- Guess row ---- */
.guess-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

#movieTitle {
    flex: 1;
    font-family: inherit;
    font-size: 1rem;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    outline: none;
    transition: border .2s, box-shadow .2s;
}

#movieTitle::placeholder { color: var(--muted); }

#movieTitle:focus {
    border-color: var(--primary-hi);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.3);
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.controls .btn { flex: 1; min-width: 140px; }

/* ---- Response ---- */
.response {
    min-height: 1.4em;
    margin: 16px 0 0;
    font-weight: 600;
    text-align: center;
    font-size: 1.05rem;
}

.response.good { color: var(--good); }
.response.bad  { color: var(--bad); }
.response.warn { color: var(--warn); }

/* ---- Info card (Wikipedia data) ---- */
.info-card {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    animation: fade-up .4s ease;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.info-poster {
    flex: 0 0 110px;
    align-self: flex-start;
}

.info-poster img {
    width: 110px;
    height: auto;
    border-radius: 10px;
    display: block;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}

.info-card.loading { animation: fade-up .3s ease; }
.info-card.loading .info-body p { color: var(--muted); animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: .55; }
    50%      { opacity: 1; }
}

.info-body { flex: 1; min-width: 0; }

.info-body h3 {
    margin: 2px 0 8px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    color: var(--accent-2);
}

.info-body p {
    margin: 0 0 10px;
    color: var(--text);
    font-size: .92rem;
    line-height: 1.5;
    max-height: 8.5em;
    overflow: auto;
}

.info-link {
    color: var(--primary-hi);
    font-weight: 600;
    text-decoration: none;
    font-size: .9rem;
}

.info-link:hover { text-decoration: underline; }

.next-btn { width: 100%; margin-top: 18px; }

/* ---- Footer ---- */
.foot {
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
}

.foot a { color: var(--primary-hi); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 460px) {
    .info-card { flex-direction: column; align-items: center; text-align: center; }
    /* In the column layout the cross axis is horizontal, so reset the
       desktop's flex-start (which would pin the poster to the left). */
    .info-poster { flex-basis: auto; align-self: center; }
    .controls .btn { min-width: 0; }
}

[hidden] { display: none !important; }
