:root {
    --bg-1: #081c3a;
    --bg-2: #0b2c5b;
    --bg-3: #123d7a;

    --card-bg: rgba(255, 255, 255, 0.14);
    --card-border: rgba(255, 255, 255, 0.28);

    --panel-bg: rgba(255, 255, 255, 0.16);
    --panel-strong: rgba(255, 255, 255, 0.22);

    --cyan: #00eaff;
    --cyan-soft: #8ff8ff;
    --yellow: #ffd93d;
    --orange: #ff9f43;
    --pink: #ff6ec7;
    --green: #36f1a7;
    --red: #ff5c6c;
    --white: #ffffff;
    --text: #f7fbff;
    --text-soft: rgba(255, 255, 255, 0.84);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, #1f73ff 0%, transparent 30%),
        radial-gradient(circle at top right, #00d9ff 0%, transparent 28%),
        radial-gradient(circle at bottom left, #7a5cff 0%, transparent 24%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    overflow: hidden;
}

.hidden {
    display: none !important;
}

#main-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.screen {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Háttér dekor */
.bg-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.65), rgba(255,255,255,0.08));
    box-shadow: 0 0 40px rgba(255,255,255,0.12);
    animation: floatBubble 8s ease-in-out infinite;
}

.b1 { width: 120px; height: 120px; top: 8%; left: 8%; animation-delay: 0s; }
.b2 { width: 70px; height: 70px; top: 18%; right: 10%; animation-delay: 1s; }
.b3 { width: 150px; height: 150px; bottom: 12%; left: 10%; animation-delay: 2s; }
.b4 { width: 90px; height: 90px; bottom: 18%; right: 16%; animation-delay: 3s; }
.b5 { width: 60px; height: 60px; top: 42%; left: 50%; animation-delay: 4s; }

@keyframes floatBubble {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-16px) scale(1.06); }
}

/* Menü */
#menu-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.menu-shell {
    width: min(980px, 96vw);
    padding: 28px;
    border-radius: 34px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.10));
    border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    text-align: center;
}

.brand-badge {
    display: inline-block;
    padding: 10px 16px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--yellow), var(--orange));
    color: #3d2a00;
    font-weight: 900;
    font-size: 0.95rem;
    box-shadow: 0 10px 24px rgba(255, 196, 0, 0.28);
}

#menu-screen h1 {
    margin: 0;
    font-size: clamp(2.3rem, 5vw, 4.2rem);
    line-height: 1;
    letter-spacing: 1px;
    color: var(--white);
    text-shadow: 0 4px 18px rgba(0,0,0,0.22);
}

.subtitle {
    margin: 14px auto 0;
    max-width: 640px;
    font-size: 1.05rem;
    color: var(--text-soft);
    line-height: 1.5;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 34px;
}

.task-card {
    border: none;
    border-radius: 28px;
    padding: 24px 20px;
    cursor: pointer;
    color: var(--white);
    background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
    border: 2px solid rgba(255,255,255,0.18);
    box-shadow: 0 16px 40px rgba(0,0,0,0.20);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    text-align: center;
}

.task-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 22px 48px rgba(0,0,0,0.28);
}

.task-card.multiply:hover {
    border-color: rgba(255, 217, 61, 0.8);
}

.task-card.divide:hover {
    border-color: rgba(0, 234, 255, 0.85);
}

.task-icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 14px;
    border-radius: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.72));
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.48), 0 12px 24px rgba(0,0,0,0.18);
}

.multiply .task-icon {
    color: #b66a00;
    background: linear-gradient(180deg, #fff3a6, #ffd93d);
}

.divide .task-icon {
    color: #006f88;
    background: linear-gradient(180deg, #c8fcff, #73efff);
}

.task-title {
    font-size: 1.45rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.task-desc {
    font-size: 0.98rem;
    color: var(--text-soft);
    line-height: 1.45;
}

/* Eredmények */
.stats-container {
    margin-top: 28px;
    padding: 22px;
    border-radius: 26px;
    background: linear-gradient(180deg, rgba(9, 26, 62, 0.44), rgba(9, 26, 62, 0.28));
    border: 1px solid rgba(255,255,255,0.16);
    text-align: left;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stats-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.stats-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--pink), #ff9bdf);
    color: white;
    font-weight: 800;
    font-size: 0.85rem;
}

#history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* HUD */
#hud {
    position: absolute;
    top: 18px;
    left: 18px;
    right: 18px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 20;
    pointer-events: none;
}

#back-btn,
.hud-pill {
    pointer-events: auto;
}

#back-btn {
    padding: 14px 22px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff, #dff9ff);
    color: #0a4c66;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0,0,0,0.20);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(0,0,0,0.26);
}

.hud-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.hud-pill {
    min-width: 120px;
    text-align: center;
    padding: 12px 16px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.72));
    color: #0d446e;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
}

#gameCanvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

/* Eredmény overlay */
.result-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 16, 38, 0.72);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 30;
}

.card-content {
    width: min(460px, 92vw);
    padding: 34px 28px;
    border-radius: 30px;
    background: linear-gradient(180deg, #ffffff, #e9fbff);
    color: #0f456b;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.30);
    border: 5px solid rgba(255, 217, 61, 0.75);
}

.result-emoji {
    font-size: 3rem;
    margin-bottom: 8px;
}

.card-content h2 {
    margin: 0 0 14px 0;
    font-size: 2rem;
    color: #0f456b;
}

.card-content p {
    margin: 10px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.result-btn {
    width: 100%;
    margin-top: 18px;
    background: linear-gradient(135deg, var(--yellow), var(--orange));
    color: #4b3000;
    font-weight: 900;
    border: none;
}

/* Mobil */
@media (max-width: 768px) {
    .menu-shell {
        padding: 20px;
        border-radius: 24px;
    }

    .task-grid {
        grid-template-columns: 1fr;
    }

    .task-icon {
        width: 82px;
        height: 82px;
        font-size: 2.2rem;
    }

    #hud {
        top: 12px;
        left: 12px;
        right: 12px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .hud-right {
        align-items: stretch;
    }

    .hud-pill {
        min-width: 0;
    }

    #back-btn {
        align-self: flex-start;
    }
}
#main-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px 18px;
    z-index: 50;

    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.08),
        rgba(255,255,255,0.04)
    );

    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.12);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;

    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
}

.footer-center {
    text-align: center;
    opacity: 0.9;
}

.footer-left,
.footer-right {
    opacity: 0.7;
}
#game-screen #main-footer {
    display: none;
}
.name-box {
    margin-top: 20px;
    margin-bottom: 10px;
}

#player-name {
    width: 100%;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 16px;
    border: none;

    font-size: 1rem;
    font-weight: 800;
    text-align: center;

    background: rgba(255,255,255,0.9);
    color: #0f456b;

    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    outline: none;
}
.weight .task-icon {
    color: #005f6b;
    background: linear-gradient(180deg, #d2faff, #00eaff);
}