* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background:
        radial-gradient(
            circle at 50% 25%,
            #182016 0%,
            #0b0f09 42%,
            #050705 100%
        );

    color: white;

    font-family:
        Arial,
        sans-serif;
}


/* =========================================
   SHARED
========================================= */

.hidden {
    display: none !important;
}


/* =========================================
   LOGIN / CHECKPOINT
========================================= */

.login-screen {
    width: 100%;
    height: 100vh;
    height: 100dvh;

    padding:
        max(16px, env(safe-area-inset-top))
        16px
        max(16px, env(safe-area-inset-bottom));

    display: flex;

    align-items: center;
    justify-content: center;
}


.checkpoint {
    position: relative;

    width: 100%;
    max-width: 430px;

    padding:
        22px
        26px
        24px;

    text-align: center;

    background:
        linear-gradient(
            180deg,
            #11170f 0%,
            #0b0f0a 100%
        );

    border:
        1px solid
        #3e4d37;

    border-radius: 14px;

    box-shadow:
        0 30px 80px
        rgba(0, 0, 0, 0.55);

    overflow: hidden;
}


.checkpoint::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 3px;

    background: #73ff46;
}


.checkpoint-topline {
    color: #71806a;

    font-size: 9px;

    letter-spacing: 2px;

    margin-bottom: 13px;
}


.login-logo {
    font-size: 50px;

    line-height: 1;

    margin-bottom: 6px;

    filter:
        drop-shadow(
            0 0 15px
            rgba(115, 255, 70, 0.12)
        );
}


.checkpoint h1 {
    margin:
        0
        0
        4px;

    font-size:
        clamp(
            24px,
            6vw,
            32px
        );

    font-weight: 900;

    letter-spacing: 1px;
}


.login-tagline {
    color: #73ff46;

    font-size: 10px;

    letter-spacing: 3px;

    margin-bottom: 20px;
}


.clearance-badge {
    display: inline-block;

    margin-bottom: 12px;

    padding:
        5px
        9px;

    color: #e4b857;

    background:
        rgba(
            228,
            184,
            87,
            0.07
        );

    border:
        1px solid
        rgba(
            228,
            184,
            87,
            0.3
        );

    border-radius: 4px;

    font-size: 9px;

    font-weight: 800;

    letter-spacing: 1.4px;
}


.login-copy {
    max-width: 310px;

    margin:
        0 auto
        18px;

    color: #a6ada2;

    font-size: 13px;

    line-height: 1.45;
}


#connect-form {
    text-align: left;
}


#connect-form label {
    display: block;

    margin-bottom: 6px;

    color: #899383;

    font-size: 9px;

    font-weight: 800;

    letter-spacing: 1.5px;
}


.api-input-wrap {
    position: relative;

    width: 100%;
}


#api-key {
    width: 100%;

    height: 48px;

    padding:
        0
        67px
        0
        13px;

    background: #070a07;

    color: white;

    border:
        1px solid
        #394334;

    border-radius: 7px;

    outline: none;

    font-size: 13px;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}


#api-key::placeholder {
    color: #596056;
}


#api-key:focus {
    border-color: #73ff46;

    box-shadow:
        0 0 0 3px
        rgba(
            115,
            255,
            70,
            0.08
        );
}


#toggle-api-key {
    position: absolute;

    top: 50%;
    right: 8px;

    transform:
        translateY(-50%);

    padding:
        7px
        8px;

    background: #171d15;

    color: #8f9b89;

    border:
        1px solid
        #364030;

    border-radius: 5px;

    font-size: 9px;

    font-weight: 800;

    cursor: pointer;
}


#connect-button {
    width: 100%;

    margin-top: 10px;

    padding: 13px;

    background: #69e43c;

    color: #071006;

    border: none;

    border-radius: 7px;

    font-size: 15px;

    font-weight: 900;

    letter-spacing: 0.6px;

    cursor: pointer;

    transition:
        transform 0.12s ease,
        background 0.12s ease;
}


#connect-button:hover {
    background: #7cff4d;
}


#connect-button:active {
    transform:
        scale(0.99);
}


#connect-button:disabled {
    opacity: 0.55;

    cursor: wait;
}


.connect-status {
    min-height: 18px;

    margin-top: 10px;

    color: #6f796a;

    font-size: 10px;
}


.connect-status.loading {
    color: #e4b857;
}


.connect-status.error {
    color: #ff6b63;
}


.connect-status.success {
    color: #73ff46;
}


.security-note {
    display: flex;

    gap: 9px;

    align-items: flex-start;

    margin-top: 15px;

    padding: 10px;

    text-align: left;

    background: #090d08;

    border:
        1px solid
        #273023;

    border-radius: 7px;
}


.security-icon {
    font-size: 14px;
}


.security-note strong {
    display: block;

    margin-bottom: 3px;

    color: #a8b4a3;

    font-size: 9px;

    letter-spacing: 0.8px;
}


.security-note small {
    display: block;

    color: #697064;

    font-size: 9px;

    line-height: 1.35;
}


.checkpoint-footer {
    margin-top: 16px;

    color: #4e584a;

    font-size: 8px;

    letter-spacing: 2px;
}


/* =========================================
   CLEARANCE TRANSITION
========================================= */

.clearance-screen {
    position: fixed;

    inset: 0;

    z-index: 100;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        rgba(
            5,
            8,
            5,
            0.97
        );
}


.clearance-card {
    width: 100%;
    max-width: 380px;

    text-align: center;

    animation:
        clearanceIn
        0.35s
        ease;
}


.clearance-check {
    width: 68px;
    height: 68px;

    margin:
        0 auto
        16px;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #071006;

    background: #73ff46;

    border-radius: 50%;

    font-size: 36px;

    font-weight: 900;

    box-shadow:
        0 0 40px
        rgba(
            115,
            255,
            70,
            0.18
        );
}


.clearance-label {
    color: #73ff46;

    font-size: 10px;

    font-weight: 900;

    letter-spacing: 3px;
}


.clearance-username {
    margin-top: 9px;

    font-size: 26px;

    font-weight: 900;
}


.clearance-id {
    margin-top: 3px;

    color: #7c8777;

    font-size: 11px;
}


.clearance-granted {
    margin-top: 22px;

    color: #a7b1a2;

    font-size: 10px;

    letter-spacing: 2px;
}


@keyframes clearanceIn {

    from {
        opacity: 0;

        transform:
            scale(0.94);
    }

    to {
        opacity: 1;

        transform:
            scale(1);
    }
}


/* =========================================
   EXISTING GAME
========================================= */

.game {
    width: 100%;
    max-width: 1100px;

    height: 100vh;
    height: 100dvh;

    margin: auto;

    padding:
        10px
        16px;

    display: grid;

    grid-template-rows:
        auto
        minmax(0, 1fr)
        auto;

    gap: 8px;
}


/* HEADER */

header {
    text-align: center;
}


.game-header-row {
    position: relative;

    min-height: 40px;

    display: flex;

    align-items: center;
    justify-content: center;
}


.logo {
    font-size:
        clamp(
            20px,
            2.3vw,
            30px
        );

    font-weight: 900;
}


.tagline {
    color: #73ff46;

    letter-spacing: 3px;

    font-size: 10px;
}


.player-chip {
    position: absolute;

    right: 0;

    top: 50%;

    transform:
        translateY(-50%);

    display: flex;

    align-items: center;

    gap: 7px;

    padding:
        6px
        9px;

    text-align: left;

    background: #11160f;

    border:
        1px solid
        #303a2b;

    border-radius: 7px;
}


.online-dot {
    width: 7px;
    height: 7px;

    background: #73ff46;

    border-radius: 50%;

    box-shadow:
        0 0 7px
        rgba(
            115,
            255,
            70,
            0.6
        );
}


.player-chip small {
    display: block;

    color: #64705f;

    font-size: 7px;

    letter-spacing: 1px;
}


.player-chip strong {
    display: block;

    max-width: 130px;

    color: #dce4d8;

    font-size: 10px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* PANDA AREA */

.game-stage {
    min-height: 0;

    border:
        1px solid
        #35432f;

    border-radius: 12px;

    background: #0c100b;

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;
}


.panda-stage {
    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    overflow: hidden;
}


#panda-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    border-radius: 10px;

    transition:
        opacity 0.12s ease,
        transform 0.18s ease,
        filter 0.18s ease;
}


/* CONTROLS */

.controls {
    text-align: center;
}


.balance {
    color: #aaa;

    font-size: 11px;
}


.balance strong {
    display: inline-block;

    margin-left: 8px;

    color: #73ff46;

    font-size: 18px;
}


.wager-title {
    margin-top: 5px;

    color: #aaa;

    font-size: 10px;
}


/* PLUS / MINUS */

.wager-control {
    display: flex;

    justify-content: center;
    align-items: center;

    gap: 10px;

    margin-top: 4px;
}


.wager-control button {
    width: 42px;
    height: 38px;

    background: #20251d;

    color: white;

    border:
        1px solid
        #56614b;

    border-radius: 6px;

    font-size: 22px;

    cursor: pointer;
}


.wager {
    min-width: 90px;

    font-size: 24px;

    font-weight: bold;
}


.wager small {
    display: block;

    color: #73ff46;

    font-size: 9px;
}


/* QUICK WAGERS */

.quick-wagers {
    display: flex;

    justify-content: center;

    flex-wrap: nowrap;

    gap: 5px;

    margin:
        6px
        0;
}


.quick-wagers button {
    min-width: 42px;

    padding:
        6px
        9px;

    background: #181d16;

    color: #ccc;

    border:
        1px solid
        #414b39;

    border-radius: 5px;

    cursor: pointer;
}


/* OPEN BUTTON */

#open-crate {
    width: 100%;
    max-width: 450px;

    padding: 12px;

    background: #69e43c;

    color: #071006;

    border: none;

    border-radius: 7px;

    font-size: 19px;

    font-weight: 900;

    cursor: pointer;
}


#open-crate:hover {
    background: #7cff4d;
}


#open-crate:disabled {
    opacity: 0.6;

    cursor: not-allowed;
}


/* RESULT */

#result {
    min-height: 18px;

    margin-top: 5px;

    color: #aaa;

    font-size: 12px;
}


/* =========================================
   EXISTING ANIMATIONS
========================================= */

.panda-pop {
    animation:
        pandaPop
        0.35s
        ease;
}


@keyframes pandaPop {

    0% {
        transform:
            scale(1);
    }

    45% {
        transform:
            scale(1.025);
    }

    100% {
        transform:
            scale(1);
    }
}


.crate-shake {
    animation:
        crateShake
        0.38s
        ease;
}


@keyframes crateShake {

    0% {
        transform:
            translateX(0);
    }

    20% {
        transform:
            translateX(-5px);
    }

    40% {
        transform:
            translateX(5px);
    }

    60% {
        transform:
            translateX(-3px);
    }

    80% {
        transform:
            translateX(3px);
    }

    100% {
        transform:
            translateX(0);
    }
}


.crate-flash {
    animation:
        crateFlash
        0.55s
        ease;
}


@keyframes crateFlash {

    0% {
        filter:
            brightness(1);

        transform:
            scale(1);
    }

    35% {
        filter:
            brightness(1.7);

        transform:
            scale(1.02);
    }

    100% {
        filter:
            brightness(1);

        transform:
            scale(1);
    }
}


.win-reveal {
    animation:
        winReveal
        0.6s
        ease;
}


@keyframes winReveal {

    0% {
        filter:
            brightness(1);

        transform:
            scale(1);
    }

    40% {
        filter:
            brightness(1.35);

        transform:
            scale(1.035);
    }

    100% {
        filter:
            brightness(1);

        transform:
            scale(1);
    }
}


.loss-reveal {
    animation:
        lossReveal
        0.55s
        ease;
}


@keyframes lossReveal {

    0% {
        filter:
            brightness(1);

        transform:
            translateY(0);
    }

    35% {
        filter:
            brightness(0.72);

        transform:
            translateY(3px);
    }

    100% {
        filter:
            brightness(1);

        transform:
            translateY(0);
    }
}


/* =========================================
   PHONE / PDA
========================================= */

@media (max-width: 600px) {

    .checkpoint {
        max-width: 390px;

        padding:
            18px
            17px
            19px;
    }


    .login-logo {
        font-size: 43px;
    }


    .checkpoint h1 {
        font-size: 25px;
    }


    .login-copy {
        font-size: 12px;
    }


    .game {
        padding:
            max(
                5px,
                env(
                    safe-area-inset-top
                )
            )
            7px
            max(
                5px,
                env(
                    safe-area-inset-bottom
                )
            );

        gap: 4px;
    }


    .game-header-row {
        min-height: 34px;
    }


    .logo {
        font-size: 18px;
    }


    .tagline {
        font-size: 8px;

        letter-spacing: 2px;
    }


    .player-chip {
        right: 2px;

        padding:
            4px
            6px;
    }


    .player-chip small {
        display: none;
    }


    .player-chip strong {
        max-width: 72px;

        font-size: 8px;
    }


    .online-dot {
        width: 5px;
        height: 5px;
    }


    .balance {
        font-size: 9px;
    }


    .balance strong {
        font-size: 15px;
    }


    .wager-control {
        margin-top: 2px;
    }


    .wager-control button {
        width: 38px;
        height: 34px;
    }


    .wager {
        font-size: 20px;
    }


    .quick-wagers {
        gap: 3px;

        margin:
            4px
            0;
    }


    .quick-wagers button {
        min-width: 0;

        flex: 1;

        padding:
            6px
            2px;

        font-size: 11px;
    }


    #open-crate {
        padding: 10px;

        font-size: 17px;
    }


    #result {
        margin-top: 3px;

        font-size: 10px;
    }

}


/* =========================================
   VERY SHORT PDA VIEWPORT
========================================= */

@media (max-height: 650px) {

    .checkpoint {
        padding:
            12px
            18px;
    }


    .checkpoint-topline {
        margin-bottom: 6px;
    }


    .login-logo {
        font-size: 34px;

        margin-bottom: 2px;
    }


    .checkpoint h1 {
        font-size: 22px;
    }


    .login-tagline {
        margin-bottom: 9px;
    }


    .clearance-badge {
        margin-bottom: 7px;
    }


    .login-copy {
        margin-bottom: 9px;
    }


    .security-note {
        margin-top: 8px;

        padding: 7px;
    }


    .checkpoint-footer {
        margin-top: 8px;
    }


    .game {
        padding-top: 4px;

        padding-bottom: 4px;
    }


    header {
        line-height: 1;
    }


    .logo {
        font-size: 17px;
    }


    .tagline {
        font-size: 7px;
    }


    .wager-title {
        display: none;
    }


    .wager-control button {
        height: 31px;
    }


    .wager {
        font-size: 18px;
    }


    .quick-wagers button {
        padding-top: 4px;

        padding-bottom: 4px;
    }


    #open-crate {
        padding: 8px;
    }


    #result {
        min-height: 14px;
    }

}


/* =========================================
   PLAYER ACCOUNT TERMINAL
========================================= */

.bunker-actions {
    width: 100%;
    max-width: 450px;
    margin: 7px auto 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.bunker-action {
    min-height: 34px;
    padding: 7px 5px;
    background: #11160f;
    color: #aeb8aa;
    border: 1px solid #35412f;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.7px;
    cursor: pointer;
}

.bunker-action span {
    margin-right: 4px;
    color: #73ff46;
}

.bunker-action:hover {
    color: white;
    border-color: #73ff46;
}

.account-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.account-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(3px);
}

.account-card {
    position: relative;
    z-index: 1;
    width: min(520px, calc(100% - 20px));
    max-height: min(78vh, 680px);
    max-height: min(78dvh, 680px);
    margin-bottom: max(10px, env(safe-area-inset-bottom));
    padding: 15px;
    overflow-y: auto;
    background:
        linear-gradient(
            180deg,
            #11170f 0%,
            #090d08 100%
        );
    border: 1px solid #43503c;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

.account-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 11px;
    margin-bottom: 13px;
    border-bottom: 1px solid #293225;
}

.account-card-header small {
    display: block;
    margin-bottom: 3px;
    color: #64705f;
    font-size: 7px;
    letter-spacing: 1.5px;
}

.account-card-header strong {
    display: block;
    font-size: 15px;
    letter-spacing: 0.7px;
}

#close-account-panel {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    background: #171d15;
    color: #9aa595;
    border: 1px solid #35412f;
    border-radius: 6px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.terminal-label {
    margin-bottom: 10px;
    color: #73ff46;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.8px;
}

.terminal-balance {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #080b07;
    color: #788274;
    border: 1px solid #283123;
    border-radius: 7px;
    font-size: 8px;
    letter-spacing: 1px;
}

.terminal-balance strong {
    display: block;
    margin-top: 3px;
    color: white;
    font-size: 18px;
    letter-spacing: 0;
}

.deposit-instructions {
    display: grid;
    gap: 7px;
}

.instruction-step {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 9px;
    align-items: center;
    padding: 9px;
    background: #0a0e09;
    border: 1px solid #273023;
    border-radius: 7px;
}

.instruction-step > span {
    color: #73ff46;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
}

.instruction-step p {
    margin: 0;
    color: #aab3a6;
    font-size: 11px;
    line-height: 1.4;
}

.instruction-step strong {
    color: white;
}

.panda-code {
    display: inline-block;
    padding: 2px 6px;
    color: #071006 !important;
    background: #73ff46;
    border-radius: 4px;
    font-family: monospace;
}

.terminal-warning {
    margin-top: 10px;
    padding: 9px;
    color: #d6b969;
    background: rgba(228, 184, 87, 0.06);
    border: 1px solid rgba(228, 184, 87, 0.25);
    border-radius: 7px;
    font-size: 9px;
    line-height: 1.4;
}

.terminal-primary {
    width: 100%;
    margin-top: 11px;
    padding: 11px;
    background: #69e43c;
    color: #071006;
    border: none;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.terminal-primary:disabled {
    opacity: 0.55;
    cursor: wait;
}

.terminal-input-label {
    display: block;
    margin-bottom: 6px;
    color: #899383;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 1.2px;
}

.withdraw-row {
    display: grid;
    grid-template-columns: 1fr 64px;
    gap: 7px;
}

#withdraw-amount {
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    background: #070a07;
    color: white;
    border: 1px solid #394334;
    border-radius: 7px;
    outline: none;
    font-size: 15px;
}

#withdraw-amount:focus {
    border-color: #73ff46;
}

#withdraw-max {
    background: #181d16;
    color: #73ff46;
    border: 1px solid #414b39;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
}

.withdraw-copy {
    margin: 9px 2px 0;
    color: #687064;
    font-size: 9px;
    line-height: 1.4;
}

.terminal-status {
    min-height: 16px;
    margin-top: 9px;
    color: #7d8779;
    font-size: 10px;
}

.terminal-status.success {
    color: #73ff46;
}

.terminal-status.error {
    color: #ff6b63;
}

.withdrawal-list,
.activity-list {
    display: grid;
    gap: 6px;
    margin-top: 11px;
}

.withdrawal-item,
.activity-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 9px 10px;
    background: #090d08;
    border: 1px solid #283123;
    border-radius: 7px;
}

.withdrawal-item strong,
.activity-item strong {
    display: block;
    color: #dce4d8;
    font-size: 10px;
}

.withdrawal-item small,
.activity-item small {
    display: block;
    margin-top: 2px;
    color: #687064;
    font-size: 8px;
}

.status-pill {
    padding: 4px 6px;
    color: #d6b969;
    background: rgba(228, 184, 87, 0.07);
    border: 1px solid rgba(228, 184, 87, 0.24);
    border-radius: 4px;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: 0.8px;
}

.status-pill.completed {
    color: #73ff46;
    background: rgba(115, 255, 70, 0.06);
    border-color: rgba(115, 255, 70, 0.22);
}

.activity-amount {
    text-align: right;
    font-size: 11px;
    font-weight: 900;
}

.activity-amount.positive {
    color: #73ff46;
}

.activity-amount.negative {
    color: #ff8079;
}

.terminal-empty {
    padding: 18px 10px;
    text-align: center;
    color: #697064;
    background: #090d08;
    border: 1px dashed #2d3629;
    border-radius: 7px;
    font-size: 9px;
}

@media (max-width: 600px) {
    .bunker-actions {
        margin-top: 4px;
        gap: 3px;
    }

    .bunker-action {
        min-height: 30px;
        padding: 5px 2px;
        font-size: 8px;
    }

    .account-card {
        width: calc(100% - 10px);
        max-height: 82vh;
        max-height: 82dvh;
        margin-bottom: max(5px, env(safe-area-inset-bottom));
        padding: 12px;
    }
}

@media (max-height: 650px) {
    .bunker-actions {
        margin-top: 2px;
    }

    .bunker-action {
        min-height: 27px;
        padding-top: 3px;
        padding-bottom: 3px;
    }
}
