/* =============================================
   BEE THEME — Welcome / Help Screens
   Phong cách: Ong vàng chăm chỉ, hoa hướng dương ngập nắng
   ============================================= */

:root {
    --intro-bg:     #fefce8;
    --intro-panel:  rgba(255, 255, 255, 0.9);
    --intro-border: rgba(202, 138, 4, 0.2);
    --intro-text:   #713f12;
    --intro-muted:  #854d0e;
    --c-primary:    #ca8a04;
    --c-primary-shadow: #a16207;
    --c-primary-glow:   rgba(202, 138, 4, 0.25);
    --c-fullscreen: #78350f;
    --c-fullscreen-shadow: #451a03;
    --c-fullscreen-glow:   rgba(120, 53, 15, 0.2);
    --c-play:       #f97316;
    --c-play-shadow:#ea580c;
    --c-play-glow:  rgba(249, 115, 22, 0.25);
    --c-box-shadow: rgba(113, 63, 18, 0.05);
    --c-link-hover-bg: rgba(202, 138, 4, 0.1);
    --c-game-bg:    linear-gradient(160deg, #fefce8 0%, #fef9c3 100%);
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: "Quicksand", Arial, sans-serif;
    background: linear-gradient(160deg, #fefce8 0%, #fef9c3 50%, #fef08a 100%);
    color: var(--intro-text);
}

/* ---- Welcome & Help screens ---- */
#welcomeScreen,
#helpScreen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    color: var(--intro-text);
    background: linear-gradient(160deg, #fefce8 0%, #fef9c3 45%, #fde047 100%);
}

#helpScreen {
    z-index: 99998;
    display: none;
}

#welcomeScreen.fade-out,
#helpScreen.fade-out {
    pointer-events: none;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* ---- Falling Candy Sprinkles ---- */
.stars {
    position: absolute;
    top: 0; left: 0;
    z-index: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.stars::before,
.stars::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 24px;
    border-radius: 12px;
    opacity: 0.3;
    animation: floatSprinkle 11s linear infinite;
}

.stars1::before { background: #facc15; left: 10%; top: -30px; animation-duration: 9s; }
.stars1::after { background: #fb923c; left: 78%; top: -30px; animation-duration: 12s; animation-delay: 2.2s; }
.stars2::before { background: #f59e0b;  left: 55%; top: -30px; animation-duration: 14s; animation-delay: 1.2s; }
.stars2::after { background: #ca8a04;left: 24%; top: -30px; animation-duration: 10s; animation-delay: 3.2s; }
.stars3::before { background: #fef08a;  left: 88%; top: -30px; animation-duration: 13s; animation-delay: 0.5s; }
.stars3::after { background: #b45309;              left: 45%; top: -30px; animation-duration: 8s;  animation-delay: 4.2s; }

@keyframes floatSprinkle {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    8%  { opacity: 0.35; }
    92%  { opacity: 0.35; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}

/* Emoji Trang Trí Kẹo Ngọt */
#welcomeScreen::before {    content: "🐝";
    position: absolute; top: 6%; right: 9%;
    font-size: 3.5rem; z-index: 1;
    animation: floatSweetEmoji 5s ease-in-out infinite;
    animation-delay: 0.3s;
}
#welcomeScreen::after {    content: "🌻";
    position: absolute; bottom: 15%; left: 7%;
    font-size: 3.4rem; z-index: 1;
    animation: floatSweetEmoji 6s ease-in-out infinite;
    animation-delay: 1.3s;
}

@keyframes floatSweetEmoji {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50%       { transform: translateY(-14px) rotate(6deg); }
}

/* ---- Header / Logo ---- */
.ws-header {
    position: absolute;
    top: 0; left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
}

.ws-logo-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    margin-left: 15px;
}

.ws-logo-container::before {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    z-index: -1;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(236,72,153,0.35) 0, rgba(244,63,94,0.15) 50%, rgba(0,0,0,0) 70%);
    filter: blur(12px);
    transform: translate(-50%, -50%);
    animation: pulseSweetGlow 4s ease-in-out infinite alternate;
}

.ws-logo {
    max-width: 120px;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(236,72,153,0.25));
    animation: floatLogoSweet 6s ease-in-out infinite;
}

@keyframes pulseSweetGlow {
    from { opacity: 0.5; transform: translate(-50%, -50%) scale(0.9); }
    to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes floatLogoSweet {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-5px); }
}

/* ---- Main layout ---- */
.ws-main {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ws-content-wrapper {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    text-align: center;
    animation: fadeInScaleSweet 1s ease-out forwards;
}

@keyframes fadeInScaleSweet {
    from { opacity: 0; transform: scale(0.93); }
    to   { opacity: 1; transform: scale(1); }
}

.ws-game-title {
    margin: 0;
    font-family: "Baloo 2", "Quicksand", Arial, sans-serif;
    font-size: clamp(2.4rem, 7vw, 5rem);
    line-height: 1.15;
    color: var(--intro-text);
    background: linear-gradient(to right, var(--c-primary), var(--c-play), var(--c-primary));
    background-size: 200% auto;
    filter: drop-shadow(0 4px 6px rgba(112,26,60,0.2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: sweetGradientText 5s linear infinite;
}

#helpScreen .ws-game-title {
    font-size: clamp(2rem, 6vw, 3rem);
}

@keyframes sweetGradientText {
    from { background-position: 0 center; }
    to   { background-position: 200% center; }
}

.ws-game-subtitle {
    max-width: 740px;
    margin: 0.5rem auto 0;
    color: var(--intro-muted);
    font-size: clamp(1.1rem, 3.2vw, 1.35rem);
    font-weight: 700;
    line-height: 1.6;
    opacity: 0;
    animation: fadeInSweet 2s ease-out 0.5s forwards;
}

@keyframes fadeInSweet {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 0.95; transform: translateY(0); }
}

.ws-button-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

/* Nút Jelly dẻo ngọt phồng xốp */
.ws-btn-primary-cosmic,
#helpScreen .btn-fullscreen,
#helpScreen .btn-play {
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-height: 56px;
    padding: 1rem 2.5rem;
    color: #fff;
    font-family: "Quicksand", Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: none;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.ws-btn-primary-cosmic {
    border-radius: 50px;
    padding: 1rem 3rem;
    font-size: clamp(1.1rem, 4vw, 1.45rem);
}

/* Kích hoạt ::before làm viền phát sáng gradient chuyển động */
.ws-btn-primary-cosmic::before,
#helpScreen .btn-fullscreen::before,
#helpScreen .btn-play::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    background-size: 400%;
    border-radius: inherit;
    opacity: 0.9;
    animation: animateBorder 4s linear infinite;
    display: block;
}

.ws-btn-primary-cosmic::before {
    background: linear-gradient(45deg, var(--c-primary), var(--c-play), var(--c-primary-shadow), var(--c-primary));
}
#helpScreen .btn-fullscreen::before {
    background: linear-gradient(45deg, var(--c-fullscreen), var(--c-primary), var(--c-fullscreen-shadow), var(--c-fullscreen));
}
#helpScreen .btn-play::before {
    background: linear-gradient(45deg, var(--c-play), var(--c-primary), var(--c-play-shadow), var(--c-play));
}

/* Kích hoạt ::after làm nền trong của nút */
.ws-btn-primary-cosmic::after,
#helpScreen .btn-fullscreen::after,
#helpScreen .btn-play::after {
    content: "";
    position: absolute;
    inset: 2px;
    z-index: -1;
    border-radius: inherit;
    transition: background 0.3s ease;
    display: block;
}

.ws-btn-primary-cosmic::after {
    background: var(--c-primary-shadow);
}
#helpScreen .btn-fullscreen::after {
    background: var(--c-fullscreen-shadow);
}
#helpScreen .btn-play::after {
    background: var(--c-play-shadow);
}

.ws-btn-primary-cosmic span,
#helpScreen .btn-fullscreen span,
#helpScreen .btn-play span {
    position: relative;
    z-index: 2;
    display: inline-block;
    transition: transform 0.1s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Hover effects */
.ws-btn-primary-cosmic:hover,
#helpScreen .btn-fullscreen:hover,
#helpScreen .btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.25);
}

.ws-btn-primary-cosmic:hover::after {
    background: var(--c-primary);
}
#helpScreen .btn-fullscreen:hover::after {
    background: var(--c-fullscreen);
}
#helpScreen .btn-play:hover::after {
    background: var(--c-play);
}

/* Active effects */
.ws-btn-primary-cosmic:active,
#helpScreen .btn-fullscreen:active,
#helpScreen .btn-play:active {
    transform: translateY(2px);
    box-shadow: none;
}

.ws-more-games-link {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    color: var(--intro-muted);
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 20px;
    transition: all 0.25s ease;
}

.ws-more-games-link:hover {
    color: var(--intro-text);
    background: var(--c-link-hover-bg);
}

.ws-credit {
    position: absolute;
    bottom: 1rem;
    left: 0;
    z-index: 10;
    width: 100%;
    color: var(--intro-muted);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

.ws-credit a {
    color: var(--c-primary);
    text-decoration: none;
}

.ws-credit a:hover {
    text-decoration: underline;
}

/* ---- Help Screen Box ---- */
.instruction-box,
.question-count {
    border: 3px solid var(--intro-border);
    border-radius: 18px;
    background: var(--intro-panel);
    box-shadow: 0 8px 24px var(--c-box-shadow);
}

.instruction-box h5 {
    color: var(--intro-text);
    font-family: "Baloo 2", Arial, sans-serif;
    font-size: 1.25rem;
}

.instruction-box p {
    color: var(--intro-muted) !important;
    font-size: 1rem;
    font-weight: 600;
}

.check-icon {
    margin-top: 2px;
    color: var(--c-primary);
    font-size: 1.5rem;
}

.question-count {
    border-color: var(--intro-border);
    color: var(--c-primary);
    background: var(--intro-panel);
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}

.game-screen-root {
    min-height: 100vh;
    padding: 2rem;
    background: var(--c-game-bg);
}

.game-placeholder {
    display: flex;
    min-height: calc(100vh - 4rem);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
}

@media (max-width: 575.98px) {
    .ws-logo-container {
        margin-top: 4px;
        margin-left: 4px;
    }

    .ws-logo {
        max-width: 96px;
    }

    .ws-content-wrapper {
        padding: 1rem;
    }

    .instruction-box {
        padding: 1.25rem !important;
    }

    .ws-credit {
        font-size: 0.85rem;
    }
}


@keyframes animateBorder {
    0% { background-position: 0 0; }
    50% { background-position: 300% 0; }
    100% { background-position: 0 0; }
}
