:root {
    color-scheme: dark;
    --cyan: #18e9ff;
    --green: #22e090;
    --yellow: #f0d76a;
    --pink: #ff57cf;
    --ink: #f3fbff;
    --glass: rgba(6, 13, 20, 0.82);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #05080c;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

.game-shell {
    position: relative;
    width: 100vw;
    height: 100vh;
    min-height: 560px;
    overflow: hidden;
    background: #05080c;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    cursor: crosshair;
}

.hud,
.mission-brief,
.quest-panel,
.dialogue-panel,
.customizer,
.touch-controls {
    position: absolute;
    border: 1px solid rgba(24, 233, 255, 0.42);
    background: var(--glass);
    box-shadow: 0 0 20px rgba(24, 233, 255, 0.22), inset 0 0 18px rgba(24, 233, 255, 0.06);
    backdrop-filter: blur(8px);
}

.hud {
    left: 16px;
    right: 16px;
    top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 12px 14px;
    pointer-events: none;
}

.hud span,
.quest-panel h2,
.transmitter,
.customizer strong {
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hud strong {
    display: block;
    margin-top: 4px;
    color: white;
    font-size: clamp(1.35rem, 4vw, 2.4rem);
    line-height: 0.9;
    text-shadow: 0 0 18px rgba(24, 233, 255, 0.85);
}

.meter {
    width: min(240px, 34vw);
    height: 12px;
    border: 1px solid rgba(24, 233, 255, 0.58);
}

.meter span {
    display: block;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, var(--pink), var(--yellow), var(--green));
}

.mission-brief {
    left: 16px;
    top: 96px;
    width: min(420px, calc(100vw - 32px));
    padding: 14px;
    pointer-events: none;
}

.transmitter {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.transmitter strong {
    color: var(--cyan);
}

.mission-brief p {
    margin: 0 0 8px;
    color: rgba(243, 251, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.35;
}

.mission-brief a {
    color: var(--yellow);
    text-decoration: none;
}

.mission-brief .recipient {
    color: var(--green);
}

.mission-brief .formula {
    color: white;
    font-size: clamp(1rem, 3vw, 1.45rem);
    font-weight: 800;
    text-shadow: 0 0 16px rgba(24, 233, 255, 0.8);
}

.quest-panel {
    right: 16px;
    top: 96px;
    width: min(360px, calc(100vw - 32px));
    padding: 14px;
    pointer-events: none;
}

.quest-panel h2 {
    margin: 0 0 8px;
}

.quest-panel p {
    margin: 0 0 8px;
    color: rgba(243, 251, 255, 0.9);
    line-height: 1.35;
}

#statusText {
    color: var(--yellow);
}

.dialogue-panel {
    left: 50%;
    bottom: 98px;
    width: min(640px, calc(100vw - 32px));
    min-height: 70px;
    padding: 14px 16px;
    transform: translateX(-50%);
    color: rgba(243, 251, 255, 0.94);
    line-height: 1.45;
    pointer-events: none;
}

.dialogue-panel:empty {
    display: none;
}

.customizer {
    left: 16px;
    bottom: 98px;
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
}

.customizer label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(243, 251, 255, 0.78);
    font-size: 0.78rem;
}

.customizer input {
    width: 34px;
    height: 28px;
    border: 0;
    padding: 0;
    background: transparent;
}

.touch-controls {
    left: 16px;
    right: 16px;
    bottom: 14px;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
}

.touch-controls button {
    min-height: 42px;
    border: 1px solid rgba(24, 233, 255, 0.45);
    color: var(--ink);
    background: rgba(3, 7, 12, 0.76);
    font-weight: 800;
    letter-spacing: 0.08em;
}

.touch-controls button:hover,
.touch-controls button:focus {
    border-color: var(--yellow);
    box-shadow: 0 0 18px rgba(240, 215, 106, 0.42);
}

@media (max-width: 900px) {
    .mission-brief,
    .quest-panel {
        top: 86px;
        width: calc(50vw - 24px);
    }

    .touch-controls {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .customizer {
        grid-template-columns: repeat(2, auto);
        bottom: 142px;
    }
}

@media (max-width: 620px) {
    .mission-brief {
        display: none;
    }

    .quest-panel {
        left: 16px;
        right: 16px;
        width: auto;
    }

    .customizer {
        display: none;
    }
}
