@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap');

body {
    margin: 0;
}

#HUD {
    position: absolute;
    top: 0;
    left: 0;
}

@font-face {
    font-family: 'MyCustomFont';
    src: local('Silkscreen');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'NVNPixelFJVerdana8pt';
    src: local('Silkscreen');
    font-weight: normal;
    font-style: normal;
}

* {
    font-family: 'Silkscreen', 'MyCustomFont', monospace, sans-serif;
}

      body {
          background-size: cover;
      }

      body {
          background-color: white;
          margin: 0px;
          text-align: center;
      }

      html,
      body {
          margin: 0;
          height: 100%;
          overflow: hidden;
          /* background-color: black; */
      }

      html {
          scrollbar-width: none;
          -ms-overflow-style: none;
      }

      html {
          overflow-y: hidden;
      }

/* ── Mobile/Tablet Virtual Controller ──────────────────────────────────────── */
#touch-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    font-family: 'Silkscreen', monospace, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* Top bar buttons */
.touch-top-bar {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    pointer-events: auto;
    z-index: 1001;
    max-width: 95vw;
}

.touch-bar-btn {
    background: rgba(15, 20, 30, 0.75);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: manipulation;
    transition: background 0.15s, transform 0.1s;
}

.touch-bar-btn:active,
.touch-bar-btn.active {
    background: rgba(0, 180, 255, 0.7);
    transform: scale(0.92);
}

/* D-Pad (Left Thumb) */
.touch-dpad {
    position: absolute;
    left: 20px;
    bottom: 25px;
    width: 160px;
    height: 160px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 4px;
    pointer-events: auto;
    touch-action: none;
}

.dpad-btn {
    background: rgba(20, 25, 40, 0.75);
    color: #00ffff;
    border: 1.5px solid rgba(0, 255, 255, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background 0.1s, transform 0.1s;
}

.dpad-up    { grid-column: 2; grid-row: 1; border-radius: 14px 14px 6px 6px; }
.dpad-left  { grid-column: 1; grid-row: 2; border-radius: 14px 6px 6px 14px; }
.dpad-center{ grid-column: 2; grid-row: 2; background: rgba(10, 15, 25, 0.5); border-radius: 6px; border: 1px dashed rgba(255, 255, 255, 0.15); pointer-events: none; }
.dpad-right { grid-column: 3; grid-row: 2; border-radius: 6px 14px 14px 6px; }
.dpad-down  { grid-column: 2; grid-row: 3; border-radius: 6px 6px 14px 14px; }

.dpad-btn:active,
.dpad-btn.active {
    background: rgba(0, 220, 255, 0.75);
    color: #ffffff;
    transform: scale(0.92);
}

/* Action button: Switch Clone / Space (Right Thumb) */
.touch-actions {
    position: absolute;
    right: 25px;
    bottom: 35px;
    pointer-events: auto;
    touch-action: none;
}

.action-btn.space-btn {
    width: 105px;
    height: 105px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 180, 255, 0.5) 0%, rgba(10, 30, 60, 0.8) 100%);
    border: 2px solid rgba(0, 220, 255, 0.8);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    text-align: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    touch-action: none;
    box-shadow: 0 4px 20px rgba(0, 150, 255, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}

.action-btn.space-btn i {
    font-size: 26px;
    margin-bottom: 4px;
    color: #00ffff;
}

.action-btn.space-btn small {
    font-size: 9px;
    opacity: 0.8;
}

.action-btn.space-btn:active,
.action-btn.space-btn.active {
    background: radial-gradient(circle, rgba(0, 255, 255, 0.8) 0%, rgba(0, 120, 200, 0.9) 100%);
    transform: scale(0.92);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
}

/* Semi-transparent on desktop, full visibility on mobile/tablet */
@media (min-width: 1025px) and (hover: hover) {
    #touch-controls {
        opacity: 0.7;
        transition: opacity 0.2s;
    }
    #touch-controls:hover {
        opacity: 1;
    }
}

/* ── MÀN HÌNH QUAY DỌC (PORTRAIT): NÚT TO GẤP ĐÔI DỄ BẤM CỰC ĐÃ ── */
@media (orientation: portrait), (max-aspect-ratio: 1/1) {
    /* Top bar buttons to gấp đôi so với landscape */
    .touch-top-bar {
        top: 14px;
        gap: 14px;
    }
    .touch-bar-btn {
        padding: 12px 24px;
        font-size: 26px;
        border-radius: 14px;
    }

    /* D-Pad to gấp đôi (~2× so với 160px landscape) */
    .touch-dpad {
        left: 10px;
        bottom: 18px;
        width: 320px;
        height: 320px;
        gap: 8px;
    }
    .dpad-btn {
        font-size: 40px;
        border-radius: 18px;
    }
    .dpad-up    { border-radius: 22px 22px 8px 8px; }
    .dpad-left  { border-radius: 22px 8px 8px 22px; }
    .dpad-center{ border-radius: 8px; }
    .dpad-right { border-radius: 8px 22px 22px 8px; }
    .dpad-down  { border-radius: 8px 8px 22px 22px; }

    /* Nút Space đổi bản sao — GIỮ NGUYÊN */
    .touch-actions {
        right: 12px;
        bottom: 25px;
    }
    .action-btn.space-btn {
        width: 145px;
        height: 145px;
        font-size: 13px;
        border-width: 3px;
        box-shadow: 0 6px 25px rgba(0, 150, 255, 0.5);
    }
    .action-btn.space-btn i {
        font-size: 38px;
        margin-bottom: 6px;
    }
    .action-btn.space-btn small {
        font-size: 10px;
    }
}

/* Màn hình dọc kích thước lớn (Tablet portrait / điện thoại màn to > 430px) */
@media (orientation: portrait) and (min-width: 430px) {
    .touch-dpad {
        width: 360px;
        height: 360px;
    }
    .dpad-btn {
        font-size: 48px;
    }
    .action-btn.space-btn {
        width: 160px;
        height: 160px;
        font-size: 14px;
    }
    .action-btn.space-btn i {
        font-size: 42px;
    }
}