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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background: #151c18;
    color: #dce3d8;
    font-family: Arial, Helvetica, sans-serif;
}

/* MILITARY BACKGROUND */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(83,105,76,0.22), transparent 65%),
        linear-gradient(135deg, #202b23, #101713 55%, #19231c);
}

.background-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    opacity: 0.15;
    background-image:
        linear-gradient(rgba(160,180,145,0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(160,180,145,0.12) 1px, transparent 1px);
    background-size: 45px 45px;
}

.background-grid::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            125deg,
            transparent 0px,
            transparent 90px,
            rgba(90,110,80,0.10) 90px,
            rgba(90,110,80,0.10) 140px
        );
}

.scanline {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: linear-gradient(
        transparent 50%,
        rgba(0,0,0,0.035) 50%
    );
    background-size: 100% 4px;
}

/* MAIN MENU */

.menu {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 35px 20px 30px;
    position: relative;
}

.top-label {
    margin-bottom: 30px;
    text-align: center;
    color: #8c9c87;
    font-size: 10px;
    letter-spacing: 4px;
    font-weight: bold;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #91a77c;
    border-radius: 50%;
    margin-right: 9px;
    box-shadow: 0 0 10px #91a77c;
}

.title-area {
    text-align: center;
    margin-bottom: 48px;
}

.title-line {
    width: 380px;
    max-width: 85vw;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        #718365,
        transparent
    );
    margin: 15px auto;
}

.title-area h1 {
    font-size: clamp(38px, 6vw, 68px);
    font-weight: 900;
    letter-spacing: 5px;
    color: #e0e5dc;
    text-shadow: 0 4px 25px rgba(0,0,0,0.6);
}

.title-area h1 span {
    color: #91a77c;
}

.title-area p {
    font-size: 10px;
    letter-spacing: 5px;
    color: #84927e;
    margin-top: 17px;
}

/* BUTTONS */

.menu-buttons {
    display: flex;
    flex-direction: column;
    width: 350px;
    max-width: 90vw;
    gap: 13px;
}

.menu-button {
    position: relative;
    height: 64px;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 18px;
    text-decoration: none;
    color: #dce3d8;
    background: rgba(36,48,39,0.88);
    border: 1px solid #53634f;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: 0.2s;
}

.menu-button:hover {
    background: #526448;
    border-color: #a3b795;
    transform: translateX(5px);
}

.button-number {
    color: #84977a;
    font-size: 12px;
    letter-spacing: 1px;
}

.button-text {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    flex: 1;
}

.button-description {
    position: absolute;
    left: 56px;
    bottom: 9px;
    font-size: 9px;
    letter-spacing: 1.5px;
    color: #899786;
}

.button-arrow {
    font-size: 22px;
    color: #a5b895;
}

/* FOOTER */

.bottom-info {
    width: 84%;
    max-width: 900px;
    margin-top: 45px;
    gap: 10px;
    display: flex;
    justify-content: space-between;
    color: #68776a;
    font-size: 9px;
    letter-spacing: 2px;
}

/* POPUP WINDOWS */

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0,0,0,0.82);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.dialog {
    position: relative;
    width: 540px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 42px;
    background: #202a23;
    border: 1px solid #687c5d;
    box-shadow: 0 20px 80px #000;
}

.section-label {
    color: #91a77c;
    font-size: 10px;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

.dialog h2 {
    font-size: 30px;
    letter-spacing: 3px;
    margin-bottom: 30px;
}

.close {
    position: absolute;
    right: 20px;
    top: 12px;
    background: none;
    border: none;
    color: #aab6a4;
    font-size: 30px;
    cursor: pointer;
}

.instruction-list {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.instruction-list div {
    display: flex;
    gap: 18px;
    border-bottom: 1px solid #39483a;
    padding-bottom: 15px;
}

.instruction-list span {
    color: #91a77c;
    font-size: 13px;
}

.instruction-list p {
    color: #b5c0b1;
    font-size: 13px;
    line-height: 1.7;
}

.instruction-list b {
    color: #e0e5dc;
    letter-spacing: 1px;
}

.back-button {
    margin-top: 30px;
    padding: 14px 25px;
    background: #718365;
    border: none;
    color: #101510;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
}

.back-button:hover {
    background: #a5b895;
}

.coming-soon {
    border: 1px solid #718365;
    padding: 20px;
    color: #a5b895;
    letter-spacing: 4px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 20px;
}

.coming-text {
    color: #aeb8aa;
    line-height: 1.8;
    font-size: 14px;
}

/* SMALL SCREENS */

@media (max-width: 600px) {
    .title-area {
        margin-bottom: 35px;
    }

    .title-area h1 {
        letter-spacing: 2px;
    }

    .title-area p {
        letter-spacing: 2px;
        font-size: 8px;
    }

    .menu-button {
        height: 60px;
    }

    .bottom-info {
        font-size: 7px;
        letter-spacing: 1px;
    }

    .dialog {
        padding: 30px 22px;
    }

    .overlay {
        padding: 10px;
    }

    .dialog h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .room-code-area strong {
        font-size: 26px;
        letter-spacing: 6px;
    }

    .bottom-info {
        margin-top: 30px;
    }
}

/* Phone held sideways: little height, so use two columns of buttons */
@media (max-height: 520px) {
    .menu {
        padding: 18px 20px 18px;
    }

    .top-label {
        margin-bottom: 12px;
    }

    .title-area {
        margin-bottom: 18px;
    }

    .title-area h1 {
        font-size: 34px;
    }

    .title-line {
        margin: 8px auto;
    }

    .title-area p {
        margin-top: 8px;
    }

    .menu-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        width: 92vw;
        max-width: 720px;
    }

    .menu-button {
        width: calc(50% - 7px);
        height: 52px;
    }

    .bottom-info {
        margin-top: 18px;
    }

    .dialog {
        padding: 24px 26px;
    }
}

/* YOUR ARMY */

.army-dialog {
    width: 850px;
}

.army-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.unit-card {
    background: #29372d;
    border: 1px solid #53634f;
    padding: 15px;
    min-height: 125px;
}

.unit-card h3 {
    color: #a5b895;
    font-size: 20px;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.unit-card p {
    color: #dce3d8;
    font-size: 12px;
    margin-bottom: 12px;
}

.unit-card div {
    color: #c4d2b9;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
}

.unit-card small {
    display: block;
    color: #9eaa99;
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 650px) {
    .army-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* MULTIPLAYER ROOM */
.multiplayer-dialog {
    width: 540px;
}

.room-button {
    width: 100%;
    padding: 15px;
    margin-top: 12px;
    background: #718365;
    border: 1px solid #91a77c;
    color: #101510;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
}

.room-button:hover {
    background: #a5b895;
}

.room-separator {
    margin: 25px 0 12px;
    color: #91a77c;
    text-align: center;
    font-size: 10px;
    letter-spacing: 2px;
}

.room-input {
    width: 100%;
    padding: 15px;
    background: #111a14;
    border: 1px solid #53634f;
    color: #e0e5dc;
    text-align: center;
    font-size: 18px;
    letter-spacing: 5px;
    outline: none;
}

.room-result {
    margin-top: 22px;
    padding: 14px;
    background: #17221a;
    border: 1px solid #39483a;
    color: #a5b895;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
}

.room-code-area {
    margin-top: 18px;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #aeb8aa;
    font-size: 11px;
    letter-spacing: 2px;
}

.room-code-area strong {
    color: #e0e5dc;
    font-size: 32px;
    letter-spacing: 8px;
}


/* SINGLE-PAGE GAME VIEW */
.game-shell {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 20;
    flex-direction: column;
    background: #000;
}

.game-topbar {
    height: 46px;
    flex: 0 0 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
    color: #aeb8aa;
    background: #101411;
    border-bottom: 1px solid #354237;
    font-size: 11px;
    letter-spacing: 2px;
}

.game-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#fullscreen-button {
    color: #cbd5c4;
    background: #263329;
    border: 1px solid #52634f;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
}

.game-topbar button {
    color: #cbd5c4;
    background: #263329;
    border: 1px solid #596b52;
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
}

#game-frame {
    display: block;
    width: 100%;
    flex: 1;
    min-height: 0;
    border: 0;
    background: #000;
    touch-action: none;
}

#net-status {
    color: #e0a070;
    font-size: 10px;
    letter-spacing: 1px;
}

.game-topbar button {
    min-height: 32px;
}

@media (max-width: 700px), (max-height: 520px) {
    .game-topbar {
        height: 40px;
        flex-basis: 40px;
        padding: 0 10px;
        font-size: 9px;
        letter-spacing: 1px;
    }

    .game-topbar button {
        padding: 6px 10px;
        font-size: 10px;
    }
}
