* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top, #183b2b, #07130e 65%);
    color: #fff;
    min-height: 100vh;
}

.game-shell {
    width: 100%;
    max-width: 1450px;
    margin: auto;
    padding: 18px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(12, 29, 21, .95);
    border: 1px solid rgba(130, 255, 179, .18);
    border-radius: 18px;
    padding: 15px 20px;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    background: #173e2b;
    border-radius: 14px;
    font-size: 28px;
}

.brand h1 {
    font-size: 22px;
}

.brand small {
    color: #75e69b;
    letter-spacing: 3px;
}

.stats {
    display: flex;
    gap: 10px;
}

.stat {
    background: #10281d;
    border: 1px solid #234b37;
    padding: 9px 15px;
    border-radius: 12px;
}

.stat span {
    margin-right: 6px;
}

main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 18px;
}

.game-area {
    min-width: 0;
}

.level-title {
    margin-bottom: 10px;
}

.level-title h2 {
    font-size: 24px;
}

.level-title p {
    color: #9ab7a6;
    margin-top: 5px;
}

.game-frame {
    position: relative;
    width: 100%;
    height: min(70vh, 650px);
    min-height: 430px;
    overflow: hidden;
    border-radius: 20px;
    border: 2px solid #315b43;
    background: #153c29;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.hud {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.detection-box,
.camouflage {
    background: rgba(5, 17, 11, .82);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    padding: 10px 13px;
}

.hud-label {
    display: flex;
    gap: 20px;
    font-size: 12px;
}

#detectionText {
    color: #75e69b;
}

.detection-bar {
    width: 180px;
    height: 8px;
    background: #24382c;
    margin-top: 7px;
    border-radius: 20px;
    overflow: hidden;
}

#detectionFill {
    width: 0%;
    height: 100%;
    background: #53df82;
    transition: width .1s;
}

.camouflage {
    text-align: center;
    font-size: 12px;
}

#colorName {
    font-weight: bold;
    color: #73e69a;
    margin-top: 3px;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(2,10,6,.76);
    display: grid;
    place-items: center;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.hidden {
    display: none !important;
}

.panel {
    width: min(430px, 90%);
    text-align: center;
    background: #10271c;
    border: 1px solid #356747;
    border-radius: 22px;
    padding: 30px;
    box-shadow: 0 20px 70px rgba(0,0,0,.5);
}

.big-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.panel h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.panel p {
    color: #a9c2b2;
    line-height: 1.6;
}

.instructions {
    margin: 20px 0;
    background: #0a1b12;
    border-radius: 12px;
    padding: 15px;
    text-align: left;
    line-height: 2;
    color: #c9dfd1;
}

button {
    border: 0;
    cursor: pointer;
    color: white;
    background: #2eaf62;
    font-weight: bold;
    border-radius: 12px;
    padding: 13px 24px;
    transition: .2s;
}

button:hover {
    transform: translateY(-2px);
    background: #40c875;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.control-group button {
    width: 45px;
    height: 40px;
    padding: 0;
    margin: 2px;
    background: #173524;
    border: 1px solid #31583e;
}

.camouflage-btn {
    min-width: 130px;
    background: #7758d8;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    background: rgba(14, 34, 24, .95);
    border: 1px solid #274a35;
    border-radius: 17px;
    padding: 18px;
}

.card h3 {
    margin-bottom: 14px;
}

.card p {
    color: #98b2a1;
    line-height: 1.55;
    font-size: 14px;
}

.chameleon-preview {
    height: 130px;
    border-radius: 13px;
    background:
        radial-gradient(circle at center, #2e7046, #122c1e);
    display: grid;
    place-items: center;
    margin-bottom: 14px;
}

.preview-chameleon {
    font-size: 75px;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    50% {
        transform: translateY(-8px) rotate(3deg);
    }
}

.mission {
    display: flex;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid #244333;
}

.mission:last-child {
    border-bottom: 0;
}

.mission b {
    color: #77e49b;
}

.tips {
    border-color: #634d9e;
}

.result {
    font-size: 22px;
    margin: 20px 0;
    color: #8cf3ad;
}

footer {
    text-align: center;
    color: #62816d;
    padding: 20px;
    font-size: 13px;
}

@media (max-width: 950px) {

    main {
        grid-template-columns: 1fr;
    }

    .side-panel {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .game-frame {
        height: 65vh;
    }
}

@media (max-width: 650px) {

    .game-shell {
        padding: 8px;
    }

    .topbar {
        padding: 10px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand small {
        font-size: 9px;
    }

    .stats {
        gap: 4px;
    }

    .stat {
        padding: 7px 8px;
        font-size: 12px;
    }

    .stat span {
        margin-right: 2px;
    }

    .side-panel {
        grid-template-columns: 1fr;
    }

    .game-frame {
        min-height: 400px;
        height: 65vh;
        border-radius: 14px;
    }

    .hud {
        top: 8px;
        left: 8px;
        right: 8px;
    }

    .detection-bar {
        width: 125px;
    }

    .level-title h2 {
        font-size: 20px;
    }
}