﻿/* ============================================================
   EmojiGuessr â€“ styles (matches timeline.css conventions)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Lilita One', cursive;
    background: #1e0340;
    color: #fff;
    overflow: hidden;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 40%, #7c3aed 0%, #5b21b6 30%, #3b0764 65%, #1e0340 100%);
    pointer-events: none;
}
body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 250vmax;
    height: 250vmax;
    transform: translate(-50%, -50%);
    background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.03) 0deg 5deg, transparent 5deg 10deg);
    animation: bg-spin 240s linear infinite;
    z-index: 0;
    pointer-events: none;
}
@keyframes bg-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body::after { animation: none; } }

#startScreen,
#gameArea,
#endScreen {
    position: relative;
    z-index: 1;
}

.hidden { display: none !important; }

/* ---- Start / countdown screen ---- */
#startScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #fff;
}

.countdown-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cg-mode-badge {
    font-family: 'Lilita One', cursive;
    font-size: 0.85rem;
    color: #a855f7;
    border: 1px solid rgba(167,139,250,0.4);
    padding: 3px 12px;
    border-radius: 999px;
    background: rgba(168,85,247,0.1);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.countdown-number {
    font-size: 120px;
    font-weight: 700;
    background: linear-gradient(135deg, #c084fc, #a855f7, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(168,85,247,0.6));
    animation: 1s infinite alternate pulse;
    font-family: 'Lilita One', cursive;
}

.countdown-text {
    font-size: 22px;
    font-weight: 500;
    margin-top: 20px;
    letter-spacing: 2px;
    color: #c4b5fd;
    text-shadow: 0 0 12px rgba(168,85,247,0.4);
    font-family: 'Lilita One', cursive;
}

@keyframes pulse {
    0%   { transform: scale(.95); opacity: .7; }
    100% { transform: scale(1.05); opacity: 1; }
}

/* ---- Quit button ---- */
#quitBtn {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 50;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}
#quitBtn:hover { background: rgba(0,0,0,0.7); }
#quitBtn img {
    height: 1.2rem;
    width: auto;
    vertical-align: middle;
    display: block;
}

/* ---- Circular timer (centered) ---- */
#timer-circle-container {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30,10,60,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid rgba(167,139,250,0.35);
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(124,58,237,0.4), 0 4px 16px rgba(0,0,0,0.5);
}
#timer-circle-container.hidden { display: none !important; }

#timer-svg {
    position: absolute;
    top: 0; left: 0;
}
#timer-bg { opacity: .7; }
#timer-progress-circle {
    transition: stroke-dashoffset 1s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    filter: drop-shadow(0 0 6px rgba(168,85,247,0.6));
}
#timer-number {
    position: absolute;
    font-size: 2.2rem;
    font-weight: 700;
    color: #e9d5ff;
    font-family: 'Lilita One', cursive;
    text-shadow: 0 0 12px rgba(168,85,247,0.6), 0 0 24px rgba(124,58,237,0.3);
    pointer-events: none;
}

/* ---- Question indicator (top-right) ---- */
#questionIndicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
    font-size: 1.4rem;
    color: rgba(255,255,255,0.95);
    background: rgba(10,1,24,0.7);
    padding: 10px 22px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    font-family: 'Lilita One', cursive;
    pointer-events: none;
    white-space: nowrap;
}
#questionIndicator.hidden { display: none !important; }

/* ---- Score (top-right, below round indicator) ---- */
#runningScore {
    position: fixed;
    top: 82px;
    right: 20px;
    font-size: 1.4rem;
    color: rgba(255,255,255,0.95);
    background: rgba(10,1,24,0.7);
    padding: 10px 22px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(8px);
    z-index: 20;
    white-space: nowrap;
    font-family: 'Lilita One', cursive;
    pointer-events: none;
}
#runningScore.hidden { display: none !important; }

/* ---- Game area ---- */
#gameArea {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 265px 6px 20px;
}


/* ---- Emoji display ---- */
#emojiDisplay {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: center;
    min-height: 90px;
}
.eg-emoji {
    font-size: 6rem;
    line-height: 1;
    filter: drop-shadow(0 0 18px rgba(168,85,247,0.5));
    animation: egPop 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.eg-emoji-new {
    animation: egBounce 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes egPop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1);   opacity: 1; }
}
@keyframes egBounce {
    0%   { transform: scale(0.2) rotate(-12deg); opacity: 0; }
    55%  { transform: scale(1.25) rotate(5deg); }
    100% { transform: scale(1)   rotate(0deg); opacity: 1; }
}

/* ---- Next emoji bar ---- */
.eg-next-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 460px;
    margin-bottom: 28px;
}
.eg-next-label {
    font-size: 1rem;
    color: rgba(255,255,255,0.95);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 700;
    text-shadow: 0 0 14px rgba(168,85,247,0.8), 0 1px 4px rgba(0,0,0,0.8);
}
.eg-reveal-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(168,85,247,0.5);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(168,85,247,0.5);
}
.eg-reveal-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* ---- Choices grid (cover cards) ---- */
#choicesGrid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 1fr;
    gap: 10px;
    width: min(99vw, 1600px);
    height: clamp(300px, 44vh, 420px);
    flex-shrink: 0;
}
.eg-choice-btn {
    background: rgba(255,255,255,0.07);
    border: 2px solid rgba(168,85,247,0.25);
    color: #fff;
    font-family: 'Lilita One', cursive;
    font-size: 0.88rem;
    padding: 0;
    border-radius: 14px;
    cursor: url('/static/cursor/select.cur'), pointer;
    transition: background 0.18s, border-color 0.18s, transform 0.1s;
    text-align: center;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.eg-choice-btn:hover:not(:disabled) {
    background: rgba(168,85,247,0.18);
    border-color: #a855f7;
    transform: translateY(-2px);
}
.eg-choice-btn:disabled { cursor: default; opacity: 0.85; }
.eg-choice-cover {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px 12px 0 0;
    background: rgba(0,0,0,0.3);
}
.eg-choice-btn.eg-no-cover .eg-choice-name {
    flex: 1 1 0;
    min-height: 60px;
    font-size: 0.9rem;
}
.eg-choice-name {
    padding: 10px 14px;
    line-height: 1;
    font-size: 1rem;
    font-family: 'Lilita One', cursive;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.eg-choice-btn.eg-correct {
    background: rgba(34,197,94,0.22);
    border-color: #22c55e;
    color: #86efac;
}
.eg-choice-btn.eg-wrong {
    background: rgba(239,68,68,0.22);
    border-color: #ef4444;
    color: #fca5a5;
}

/* ---- Answer reveal panel (like #gameInfo in survival) ---- */
#answerReveal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px;
    background: rgba(14,5,32,0.92);
    backdrop-filter: blur(8px);
}
#answerReveal.eg-correct-reveal {
    background: rgba(5, 30, 15, 0.93);
}
#answerReveal.eg-wrong-reveal {
    background: rgba(30, 5, 5, 0.93);
}
.eg-reveal-verdict {
    font-size: 2rem;
    color: #facc15;
    text-shadow: 0 0 20px rgba(250,204,21,0.5);
}
.eg-reveal-emojis {
    font-size: 2.2rem;
    letter-spacing: 6px;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(168,85,247,0.4));
}
.eg-reveal-verdict.eg-v-correct { color: #4ade80; text-shadow: 0 0 20px rgba(74,222,128,0.5); }
.eg-reveal-verdict.eg-v-wrong   { color: #f87171; text-shadow: 0 0 20px rgba(248,113,113,0.5); }
.eg-reveal-cover {
    width: 250px;
    border-radius: 16px;
    box-shadow: 0 0 28px rgba(124,58,237,0.5), 0 0 8px rgba(168,85,247,0.6);
    border: 2px solid rgba(167,139,250,0.3);
}
.eg-reveal-name {
    font-size: 2rem;
    font-family: 'Lilita One', cursive;
    color: #e9d5ff;
    text-shadow: 0 2px 12px rgba(168,85,247,0.6), 0 0 6px rgba(124,58,237,0.4);
    text-align: center;
}
.eg-reveal-details {
    font-size: 1.25rem;
    color: rgba(255,255,255,0.85);
    text-align: center;
    line-height: 2;
    font-family: system-ui, sans-serif;
    font-weight: 400;
}
.eg-reveal-details strong {
    color: #c4b5fd;
    font-weight: 600;
    font-family: system-ui, sans-serif;
}
.eg-reveal-score {
    font-size: 1.6rem;
    font-family: 'Lilita One', cursive;
    color: rgba(255,255,255,0.9);
}
#answerNextBtn {
    font-size: 1.3rem;
    font-family: 'Lilita One', cursive;
    padding: 14px 50px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    cursor: url('/static/cursor/select.cur'), pointer;
    box-shadow: 0 0 20px rgba(124,58,237,0.5), 0 8px 24px rgba(0,0,0,0.4);
    transition: all 0.2s;
    margin-top: 8px;
}
#answerNextBtn:hover {
    background: linear-gradient(135deg, #a855f7, #c084fc);
    transform: scale(1.05) translateY(-2px);
}

/* ---- Score pop animation ---- */
.eg-score-pop {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.8rem; color: #facc15;
    animation: egScorePop 0.85s ease forwards;
    pointer-events: none; z-index: 300;
    text-shadow: 0 2px 12px rgba(250,204,21,0.5);
    font-family: 'Lilita One', cursive;
}
.eg-score-pop.eg-pop-wrong { color: #ef4444; font-size: 2rem; }
@keyframes egScorePop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    30%  { opacity: 1; transform: translate(-50%, -62%) scale(1.2); }
    65%  { opacity: 1; transform: translate(-50%, -72%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -88%) scale(0.9); }
}

/* ---- End screen ---- */
#endScreen {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 20px; padding: 24px;
    z-index: 50;
}
.eg-end-crown { font-size: 4rem; }
.eg-end-title { font-size: 2.2rem; color: #facc15; }
.eg-final-score { font-size: 1.7rem; color: #e9d5ff; }

.eg-final-breakdown {
    max-width: 480px; width: 100%;
    background: rgba(255,255,255,0.05);
    border-radius: 16px; padding: 14px 18px;
    display: flex; flex-direction: column; gap: 6px;
    max-height: 300px; overflow-y: auto;
}
.eg-bd-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.88rem; color: rgba(255,255,255,0.65);
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.eg-bd-row:last-child { border-bottom: none; }
.eg-bd-row.eg-bd-correct { color: #86efac; }
.eg-bd-row.eg-bd-wrong   { color: #fca5a5; }
.eg-bd-row span:last-child { flex-shrink: 0; margin-left: 12px; font-size: 0.82rem; }

.eg-end-actions {
    display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 6px;
}
.eg-end-btn {
    padding: 12px 30px; border-radius: 12px;
    font-family: 'Lilita One', cursive; font-size: 1rem;
    border: none; cursor: url('/static/cursor/select.cur'), pointer;
    transition: transform 0.15s, opacity 0.15s;
}
.eg-end-btn:hover { transform: translateY(-2px); opacity: 0.9; }
.eg-btn-play { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.eg-btn-home { background: rgba(255,255,255,0.1); color: #fff; border: 2px solid rgba(255,255,255,0.2); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    #choicesGrid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: 1fr 1fr;
        height: clamp(380px, 56vh, 540px);
        width: 100%;
    }
}
@media (max-width: 700px) {
    #choicesGrid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr 1fr;
        width: 100%;
        height: clamp(420px, 62vh, 580px);
    }
}
@media (max-width: 520px) {
    .eg-emoji              { font-size: 3.5rem; }
    #emojiDisplay          { min-height: 0; gap: 12px; }
    .eg-next-hint          { margin-bottom: 4px; }
    #choicesGrid           { gap: 6px; height: clamp(240px, 50vh, 380px); }
    .eg-choice-btn         { font-size: 0.85rem; border-radius: 10px; }
    .eg-choice-name        { white-space: normal; font-size: 0.78rem; padding: 6px 6px; min-height: 36px; line-height: 1.2; }
    .eg-reveal-cover       { width: 160px; }
    .eg-reveal-name        { font-size: 1.5rem; }
    .eg-reveal-verdict     { font-size: 1.5rem; }
    .eg-reveal-score       { font-size: 1.2rem; }
    .eg-reveal-details     { font-size: 0.95rem; }
    #answerNextBtn         { font-size: 1.1rem; padding: 11px 32px; }
    #gameArea              { gap: 8px; padding: 125px 8px 10px; }
    .eg-final-breakdown    { max-height: 200px; }
    .eg-end-title          { font-size: 1.8rem; }
    .eg-final-score        { font-size: 1.3rem; }
    #timer-circle-container { width: 90px; height: 90px; top: 14px; }
    #questionIndicator     { top: 14px; right: 10px; font-size: 1rem; padding: 7px 14px; }
    #runningScore          { top: 68px; right: 10px; font-size: 0.9rem; padding: 5px 12px; }
}
@media (max-width: 380px) {
    .eg-emoji              { font-size: 2.8rem; }
    #gameArea              { padding-top: 110px; }
    #choicesGrid           { height: clamp(200px, 48vh, 320px); }
    .eg-reveal-cover       { width: 120px; }
    #timer-circle-container { width: 78px; height: 78px; }
    #timer-number          { font-size: 1.8rem; }
    #questionIndicator     { font-size: 0.85rem; padding: 5px 10px; top: 18px; }
    #runningScore          { font-size: 0.8rem; padding: 4px 10px; top: 62px; }
}
@media (max-height: 500px) and (orientation: landscape) {
    #timer-circle-container { width: 70px; height: 70px; top: 8px; }
    #timer-number          { font-size: 1.6rem; }
    #questionIndicator     { top: 8px; font-size: 0.85rem; padding: 4px 10px; }
    #runningScore          { top: 50px; font-size: 0.8rem; padding: 4px 10px; }
    .eg-emoji              { font-size: 2.5rem; }
    #emojiDisplay          { min-height: 0; gap: 10px; }
    .eg-next-hint          { margin-bottom: 2px; }
    .eg-next-label         { font-size: 0.8rem; }
    #gameArea              { padding: 88px 8px 6px; gap: 6px; }
    #choicesGrid           { height: clamp(160px, 38vh, 260px); }
    .eg-choice-name        { white-space: normal; font-size: 0.75rem; padding: 4px 6px; min-height: 30px; line-height: 1.2; }
    #answerReveal          { gap: 10px; padding: 16px; }
    .eg-reveal-cover       { width: 100px; }
    .eg-reveal-name        { font-size: 1.2rem; }
    .eg-reveal-verdict     { font-size: 1.2rem; }
    .eg-reveal-details     { font-size: 0.85rem; line-height: 1.5; }
    #answerNextBtn         { font-size: 1rem; padding: 9px 24px; }
}
