@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;900&display=swap');
:root {
    --mint: #a8e6cf;
    --pink: #ffaaa5;
    --brown: #8b5a2b;
    --bg-color: #fdf6e3;
}

body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    max-height: 850px;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#main-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}


/* MAP SCENES & TỌA ĐỘ */

#game-scenes {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.scene-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

.npc-item {
    position: absolute;
    z-index: 5;
    object-fit: contain;
    filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.3));
}

.scene-hidden {
    display: none !important;
}

.scene-active {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #f1f2f6;
}

.overlay-dn {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    transition: background-color 3s ease;
}

.room-item {
    position: absolute;
    transition: transform 0.2s ease;
}

.interactable:hover {
    cursor: pointer;
    transform: translateY(-5px) scale(1.02);
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.interactable:active {
    transform: translateY(0);
}


/* TỌA ĐỘ PHÒNG & NHÂN VẬT CHUNG */

#item-bed {
    width: 75%;
    bottom: 12%;
    left: 12%;
    z-index: 2;
}

#item-cat {
    width: 12%;
    bottom: 45%;
    left: 45%;
    z-index: 3;
}

#item-pig {
    width: 16%;
    bottom: 8%;
    left: 5%;
    z-index: 4;
}

.player-avatar {
    position: absolute;
    bottom: 5%;
    left: 20%;
    width: 38%;
    z-index: 6;
    object-fit: contain;
    filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.3));
}

#npc-long {
    bottom: 10%;
    right: 20%;
    width: 30%;
}

#npc-lover {
    bottom: 10%;
    right: 25%;
    width: 28%;
}

#npc-hung {
    bottom: 15%;
    right: 20%;
    width: 25%;
}

#npc-chutro {
    bottom: 15%;
    right: 25%;
    width: 25%;
}

#npc-sepcuong {
    bottom: 15%;
    right: 20%;
    width: 25%;
}


/* NÚT TRÊN CÁC KHU VỰC MAP */

.btn-scene {
    position: absolute;
    bottom: 45%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 25px;
    font-weight: 900;
    font-size: 16px;
    border-radius: 12px;
    border: 3px solid #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    z-index: 30;
    cursor: pointer;
    color: #fff;
    transition: 0.2s;
}

.btn-scene:active {
    transform: translate(-50%, 4px);
    box-shadow: none;
}

#btn-net {
    background: var(--mint);
    color: var(--brown);
}

#btn-market {
    background: #fff;
    color: var(--brown);
}

#btn-school {
    background: var(--pink);
}

#btn-office {
    background: #e74c3c;
}


/* =========================================
   PREMIUM HUD UI TBOYTECH
========================================= */

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#message-box,
.interactable {
    pointer-events: auto;
}


/* Top Status Bar */

.premium-hud-top {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 50;
    pointer-events: none;
}

.premium-hud-top>* {
    pointer-events: auto;
}


/* Panels chung */

.hud-panel {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 240, 0.85));
    backdrop-filter: blur(8px);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), inset 0 -3px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 6px 12px;
}


/* Panel Tiền */

.money-panel {
    gap: 8px;
    min-width: 110px;
}

.money-icon {
    filter: drop-shadow(0 2px 4px rgba(241, 196, 15, 0.4));
}

.money-val {
    font-size: 16px;
    font-weight: 900;
    color: var(--brown);
    line-height: 1;
}

.debt-val {
    font-size: 11px;
    font-weight: 700;
    color: #e74c3c;
    line-height: 1;
    margin-top: 3px;
}


/* Panel Thời gian */

.time-panel {
    flex-direction: column;
    gap: 2px;
    padding: 6px 15px;
    background: linear-gradient(135deg, var(--mint), #76c7a9);
    border-color: #fff;
    color: var(--brown);
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.time-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-text {
    font-size: 16px;
    font-weight: 900;
}

.day-badge {
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 900;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}


/* Khối Progress Bars */

.hud-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-container {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #fff;
}

.bar-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.energy-bg {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
}

.health-bg {
    background: linear-gradient(135deg, #ffaaa5, #ff6b6b);
}

.progress-track {
    width: 70px;
    height: 16px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    margin-right: 4px;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.energy-fill {
    background: linear-gradient(90deg, #f1c40f, #f39c12);
}

.health-fill {
    background: linear-gradient(90deg, #ffaaa5, #ff7675);
}

.progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), transparent);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 9px;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    width: 100%;
    text-align: center;
}


/* BOTTOM NAV BAR (FLOATING) */


/* BOTTOM NAV BAR (FLOATING) */

.premium-hud-bottom {
    position: absolute;
    bottom: max(15px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    /* Bổ sung chiều rộng để thanh trải dài ra */
    max-width: 420px;
    /* Giới hạn để không bị quá to trên màn hình rộng */
    box-sizing: border-box;
    /* Giúp padding không làm tràn khung */
    display: flex;
    justify-content: space-between;
    /* Đổi từ center thành space-between để dàn đều các nút */
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    padding: 12px 25px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 50;
    pointer-events: auto;
}

.hud-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.btn-card {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #ffffff, #e6e6e6);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--brown);
    border: 2px solid #fff;
    box-shadow: 0 6px 0 #b3b3b3, 0 10px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-btn span {
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    transition: color 0.15s;
}

.hud-btn:hover .btn-card {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #b3b3b3, 0 15px 20px rgba(0, 0, 0, 0.25);
    color: var(--mint);
}

.hud-btn:active .btn-card {
    transform: translateY(6px);
    box-shadow: 0 0 0 #b3b3b3, 0 2px 5px rgba(0, 0, 0, 0.2);
    color: var(--brown);
}


/* THÔNG BÁO VÀ CHAT */

#center-notification {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--pink);
    color: white;
    padding: 15px 30px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 18px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid white;
    z-index: 20;
    text-align: center;
}

#message-box {
    position: absolute;
    top: max(100px, 15%);
    left: 15px;
    right: 15px;
    background: rgba(253, 246, 227, 0.98);
    border: 4px solid var(--mint);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 15px;
    align-items: flex-start;
    cursor: pointer;
    z-index: 45;
}

#speaker-avatar {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    border: 3px solid var(--brown);
    object-fit: cover;
    flex-shrink: 0;
    background-color: white;
}

#message-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#npc-name {
    display: inline-block;
    align-self: flex-start;
    background: var(--mint);
    color: var(--brown);
    padding: 3px 12px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 14px;
    margin-bottom: 8px;
}

#npc-text {
    color: #333;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}


/* MODALS */

.overlay-modal-full,
.overlay-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 100;
}

.overlay-modal-full {
    background: rgba(0, 0, 0, 0.8);
}

.overlay-modal {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 999;
}

.modal-content {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 20px;
    border: 5px solid var(--mint);
    text-align: center;
    width: 95%;
    max-height: 90vh;
    overflow-y: hidden;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.modal-content input {
    width: 90%;
    padding: 10px;
    margin-bottom: 15px;
    border: 2px solid var(--brown);
    border-radius: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
}

.hidden {
    display: none !important;
}


/* BẢNG VIỆC LÀM */

.job-content {
    width: 90%;
    max-width: 400px;
    padding: 20px;
}

.job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 5px;
    overflow-y: auto;
    flex-grow: 1;
}

.job-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border: 3px solid var(--mint);
    background: white;
    border-radius: 12px;
    width: 100%;
    text-align: left;
    box-sizing: border-box;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: 0.1s;
}

.job-card:hover {
    transform: translateY(-2px);
    border-color: var(--brown);
}

.job-icon {
    font-size: 30px;
    flex-shrink: 0;
}

.job-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.job-info strong {
    font-size: 16px;
    color: var(--brown);
}

.job-info span {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}

.job-card.locked {
    opacity: 0.6;
    filter: grayscale(100%);
    border-color: #ccc;
    cursor: not-allowed;
}

.job-list::-webkit-scrollbar {
    width: 6px;
}

.job-list::-webkit-scrollbar-thumb {
    background: var(--mint);
    border-radius: 10px;
}

.btn-close {
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 12px;
    padding: 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 900;
    color: #333;
    cursor: pointer;
}


/* ĐIỆN THOẠI */

.phone-wrapper {
    width: 300px;
    height: 100%;
    max-height: 600px;
    background: #fff;
    border-radius: 40px;
    border: 12px solid #222;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.phone-header {
    flex-shrink: 0;
    background: var(--pink);
    color: #fff;
    position: relative;
    padding-top: 10px;
}

.phone-notch {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #222;
    border-radius: 0 0 15px 15px;
}

.phone-status-bar {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 5px 20px;
    font-size: 12px;
    font-weight: bold;
}

.phone-title {
    text-align: center;
    font-weight: 900;
    font-size: 18px;
    padding-bottom: 10px;
    letter-spacing: 1px;
}

.phone-tabs {
    display: flex;
    background: #fffcf5;
    border-bottom: 1px solid #ddd;
}

.phone-tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-weight: bold;
    color: var(--brown);
    cursor: pointer;
}

.phone-tab-btn.border-left {
    border-left: 1px solid #ddd;
}

.phone-body {
    flex-grow: 1;
    overflow-y: auto;
    background: #eafaf1;
    position: relative;
}

#phone-contacts-list {
    padding: 10px;
    background: #fff;
    height: 100%;
}

#phone-chat-history {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.phone-chat-hint {
    text-align: center;
    color: #999;
    margin-top: 20px;
    font-size: 12px;
}

.phone-home-bar {
    flex-shrink: 0;
    background: #fff;
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.home-indicator {
    width: 100px;
    height: 6px;
    background: #ccc;
    border-radius: 10px;
}

.msg-bubble {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.msg-npc {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 5px;
    align-self: flex-start;
}

.msg-player {
    background: var(--mint);
    color: var(--brown);
    border-bottom-right-radius: 5px;
    align-self: flex-end;
}


/* BẢN ĐỒ MỚI */

.map-card {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.map-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--brown) !important;
}


/* MINIGAME EFFECTS */

.mg-floating-text {
    position: absolute;
    font-size: 20px;
    font-weight: 900;
    pointer-events: none;
    animation: floatUp 0.8s ease-out forwards;
    z-index: 100;
    text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-40px) scale(1.5);
        opacity: 0;
    }
}

.shake {
    animation: shakeEffect 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeEffect {
    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }
    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }
    30%,
    50%,
    70% {
        transform: translate3d(-6px, 0, 0);
    }
    40%,
    60% {
        transform: translate3d(6px, 0, 0);
    }
}


/* SÒNG BÀI LỐC CASINO CAO CẤP */

#loc-game {
    position: relative;
    flex-grow: 1;
    min-height: 380px;
    background: radial-gradient(circle at center, #27ae60 0%, #145a32 100%);
    border-radius: 15px;
    border: 6px solid #2c3e50;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 5px 15px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin-top: 10px;
}

#loc-table {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 120px;
    background: rgba(0, 0, 0, 0.25);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: -15px;
    padding: 5px;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.3);
}


/* =========================================
   CHẶN BÔI ĐEN KÝ TỰ VÀ ZOOM KHÔNG MONG MUỐN
========================================= */


/* Chặn bôi đen văn bản toàn bộ game trừ các ô nhập liệu (input) */

body,
* {
    -webkit-user-select: none;
    /* Safari */
    -moz-user-select: none;
    /* Firefox */
    -ms-user-select: none;
    /* IE/Edge */
    user-select: none;
    /* Standard */
    -webkit-touch-callout: none;
    /* Chặn hiện menu copy trên iOS */
}


/* Cho phép bôi đen/nhập liệu lại bên trong các ô input hoặc textarea */

input,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}


/* Chặn hành vi double-click zoom trên toàn bộ container game */

#game-container,
button,
.interactable,
.hud-btn {
    touch-action: manipulation;
}