* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Poppins", system-ui, sans-serif, "inter";
    background: radial-gradient(circle at top, #233040, #0b1020);
    color: #E5ECF5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

#mainHeader {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 50;
}

.handjet-title {
    font-family: "Handjet", system-ui, sans-serif;
    font-size: 2.4rem;
    letter-spacing: 0.12em;
    color: #F9FAFB;
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(255, 122, 26, 0.8);
}

.game-subtitle {
    font-size: 0.9rem;
    color: #B6C3D3;
    margin-top: 0.25rem;
}

.screen {
    width: min(960px, 100%);
    min-height: 70vh;
    background: rgba(11, 16, 32, 0.9);
    border-radius: 1.5rem;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.3);
    display: none;
    position: relative;
    overflow: hidden;
}

.screen-active {
    display: block;
}

.screen-hidden {
    display: none;
}

.screen-inner {
    padding: 5rem 2.5rem 2.5rem;
    position: relative;
    height: 100%;
}

.start-heading {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #F9FAFB;
}

.start-text {
    font-size: 0.95rem;
    color: #C7D2E0;
    max-width: 32rem;
    line-height: 1.5;
    margin-bottom: 1.75rem;
}

.start-copy {
    position: relative;
    z-index: 2;
}

.start-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.bubble-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.bubble {
    position: absolute;
    bottom: -80px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #E3FFF1, #A5F3C1);
    opacity: 0.4;
    animation: floatUp 12s linear infinite;
}

.bubble:nth-child(1) { left: 8%;  animation-delay: 0s;  animation-duration: 11s; }
.bubble:nth-child(2) { left: 20%; animation-delay: 2s;  animation-duration: 13s; }
.bubble:nth-child(3) { left: 35%; animation-delay: 4s;  animation-duration: 10s; }
.bubble:nth-child(4) { left: 50%; animation-delay: 1s;  animation-duration: 14s; }
.bubble:nth-child(5) { left: 65%; animation-delay: 3s;  animation-duration: 12s; }
.bubble:nth-child(6) { left: 78%; animation-delay: 5s;  animation-duration: 9s;  }
.bubble:nth-child(7) { left: 88%; animation-delay: 0.5s;animation-duration: 15s; }
.bubble:nth-child(8) { left: 92%; animation-delay: 6s;  animation-duration: 13s; }

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.4;
    }
    80% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-120vh) scale(1.4);
        opacity: 0;
    }
}

.section-heading {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #F9FAFB;
}

.instructions-layout {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1.25rem;
}

.info-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.8);
}

.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #E5ECF5;
}

.info-card p,
.info-card li {
    font-size: 0.9rem;
    color: #CBD5E1;
    line-height: 1.45;
}

.info-card ul {
    margin-left: 1rem;
}

.info-icon {
    width: 64px;
    height: 64px;
    display: block;
    margin-bottom: 0.75rem;
}

.rules-card {
    margin-top: 0.5rem;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 1rem;
    padding: 1rem 1.2rem;
    border: 1px dashed rgba(148, 163, 184, 0.6);
}

.rules-card p {
    font-size: 0.9rem;
    color: #E2E8F0;
    line-height: 1.5;
}

.info-icon-big {
    width: 80px;
    height: 80px;
    display: block;
    margin-bottom: 0.75rem;
}

.icon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.icon-box {
    text-align: center;
    width: 70px;
}

.icon-box p {
    font-size: 0.75rem;
    color: #E2E8F0;
}

.icon-box span {
    font-size: 0.65rem;
    color: #94A3B8;
}

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

#hud {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.hud-pill {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.7));
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 0.9rem;
    color: #E5ECF5;
}

#playSpace {
    width: 600px;
    height: 600px;
    position: relative;
    margin-top: 0.5rem;
    border-radius: 1.2rem;
    background: radial-gradient(circle at top, #1E293B, #020617);
    border: 2px solid rgba(148, 163, 184, 0.7);
    box-shadow:
        0 0 0 1px rgba(15, 23, 42, 0.9),
        0 18px 40px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.tile {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid rgba(15, 23, 42, 0.7);
    transition: background 0.3s ease;
}

.tile.dirty {
    background: radial-gradient(circle at center, rgba(148, 81, 42, 0.7), rgba(15, 23, 42, 0.95));
}

.tile.clean {
    background: radial-gradient(circle at center, rgba(165, 243, 193, 0.9), rgba(15, 23, 42, 0.95));
}

.entity {
    position: absolute;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#hero {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, #E3FFF1, #A5F3C1);
}

.controls-hint {
    font-size: 0.85rem;
    color: #9CA3AF;
    margin-top: 0.5rem;
}

.end-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.end-summary-card {
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.4), rgba(15, 23, 42, 0.95));
    padding: 1rem 1.4rem;
    border-radius: 1rem;
    border: 1px solid rgba(129, 140, 248, 0.7);
    text-align: center;
    min-width: 240px;
}

.end-summary-card p {
    font-size: 0.95rem;
    color: #E5ECF5;
    margin-bottom: 0.25rem;
}

.end-buttons {
    display: flex;
    gap: 0.75rem;
}

.ui-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.55rem 1.4rem;
    border-radius: 999px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ui-btn-primary {
    background: linear-gradient(135deg, #FF7A1A, #FF9A45);
    color: #0B1020;
    box-shadow: 0 8px 18px rgba(248, 149, 64, 0.55);
}

.ui-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(248, 149, 64, 0.7);
}

.ui-btn-ghost {
    background: transparent;
    color: #E5ECF5;
    border: 1px solid rgba(148, 163, 184, 0.7);
}

.ui-btn-ghost:hover {
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-1px);
}

.small-btn {
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .screen-inner {
        padding: 4.5rem 1.25rem 1.75rem;
    }

    #playSpace {
        width: 90vw;
        height: 90vw;
        max-width: 600px;
        max-height: 600px;
    }

    #hud {
        flex-wrap: wrap;
    }

    .start-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
}