* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; user-select: none; }
body { background: #141210; display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; color: #f5ebd6; }

.panel-ancient {
    background: linear-gradient(180deg, rgba(48, 36, 26, 0.96), rgba(26, 18, 12, 0.98));
    border: 2px solid #d4af37;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.72), inset 0 0 12px rgba(212, 175, 55, 0.15);
}

/* Auth Screen */
.overlay { position: fixed; inset: 0; background: radial-gradient(circle, #2c2218 0%, #0f0c0a 100%); display: flex; justify-content: center; align-items: center; z-index: 100; }
.auth-box { width: 780px; max-width: 96vw; padding: 20px 26px; text-align: center; }
.game-title { font-size: 28px; color: #ffd700; text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5); letter-spacing: 2px; }
.subtitle { color: #a3e4d7; font-size: 13px; margin-bottom: 12px; }

.auth-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 14px; }
.tab-btn { background: #2b2017; border: 1px solid #8c6239; color: #ccc; padding: 7px 20px; border-radius: 6px; cursor: pointer; font-weight: bold; }
.tab-btn.active { background: #8c6239; color: #ffd700; border-color: #ffd700; }

.auth-form { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.auth-form input { padding: 8px 12px; border-radius: 6px; border: 1px solid #d4af37; background: #1f1711; color: #fff; font-size: 13px; width: 280px; outline: none; }
.reg-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.reg-row input { width: 225px; }

.gender-select { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 13px; color: #e0c999; }
.gender-btn { background: #2b2017; border: 2px solid #6e543c; color: #ddd; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-weight: bold; }
.gender-btn.active { border-color: #ff9ff3; background: #4a235a; color: #fff; box-shadow: 0 0 10px rgba(255, 159, 243, 0.4); }
#btn-gender-male.active { border-color: #00ffcc; background: #1b4f72; box-shadow: 0 0 10px rgba(0, 255, 204, 0.4); }

.class-select-wrap { display: flex; gap: 14px; width: 100%; margin: 4px 0; }
.branch-col { flex: 1; background: rgba(0,0,0,0.25); padding: 9px; border-radius: 8px; border: 1px solid #5c452d; }
.branch-col h4 { font-size: 13px; color: #f1c40f; margin-bottom: 6px; }
.class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.class-card { background: #2b2017; border: 2px solid #6e543c; border-radius: 6px; padding: 6px 4px; cursor: pointer; }
.class-card.active { border-color: #00ffcc; background: #1d3533; }
.class-card .c-icon { font-size: 20px; }
.class-card .c-name { font-size: 11px; font-weight: bold; }
.class-detail { width: 100%; background: rgba(20, 15, 11, 0.85); border: 1px solid #8c6239; border-radius: 6px; padding: 8px; font-size: 12px; text-align: left; }

.btn-gold { background: linear-gradient(180deg, #f1c40f, #b7950b); color: #1a120b; font-weight: bold; font-size: 14px; padding: 9px 26px; border: none; border-radius: 8px; cursor: pointer; margin-top: 4px; }
.auth-message { font-size: 12px; color: #ff7675; margin-top: 8px; min-height: 16px; }
.roadmap-bar { margin-top: 8px; font-size: 11px; color: #76d7c4; border-top: 1px solid #4d3b2a; padding-top: 6px; }

/* Game Container */
#game-container { position: relative; width: 100vw; max-width: 1180px; height: 100vh; max-height: 680px; border: 4px solid #8c6239; border-radius: 12px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.85); }
#gameCanvas { width: 100%; height: 100%; display: block; }
#player-hud { position: absolute; top: 10px; left: 10px; display: flex; gap: 10px; align-items: center; width: 270px; padding: 8px 10px; }
.avatar { width: 46px; height: 46px; background: #3d2e20; border: 2px solid #ffd700; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 24px; }
.stats { flex: 1; }
.name-row { display: flex; justify-content: space-between; align-items: center; font-weight: bold; font-size: 13px; }
.badge { background: #1b4f72; color: #76d7c4; padding: 2px 6px; border-radius: 4px; font-size: 10px; border: 1px solid #76d7c4; }
.sub-info { font-size: 11px; color: #d5c4a1; margin: 2px 0 4px; }
.bar-wrap { position: relative; height: 12px; background: #1a1a1a; border-radius: 6px; margin-bottom: 3px; overflow: hidden; border: 1px solid #4d3b2a; }
.bar-fill { height: 100%; width: 100%; transition: width 0.2s; }
.hp .bar-fill { background: linear-gradient(90deg, #922b21, #e74c3c); }
.mp .bar-fill { background: linear-gradient(90deg, #1f618d, #3498db); }
.exp .bar-fill { background: linear-gradient(90deg, #b9770e, #f1c40f); width: 0%; }
.bar-wrap span { position: absolute; inset: 0; text-align: center; font-size: 9px; line-height: 10px; font-weight: bold; }

#top-center-bar { position: absolute; top: 10px; left: 292px; right: 132px; display: flex; gap: 5px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 5px 8px; font-size: 11px; }
.ver-tag { background: #27ae60; color: #fff; padding: 2px 5px; border-radius: 4px; font-size: 10px; font-weight: bold; }
#top-center-bar button, .admin-btn { background: #5c452d; color: #ffd700; border: 1px solid #d4af37; padding: 3px 7px; border-radius: 4px; font-size: 11px; cursor: pointer; text-decoration: none; }
.btn-event-highlight { background: linear-gradient(180deg, #e74c3c, #922b21) !important; color: #fff !important; border-color: #ffd700 !important; font-weight: bold; }

#top-right-wrap { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
#minimap-panel { padding: 4px; }
#minimapCanvas { border-radius: 50%; border: 2px solid #d4af37; }
#quest-hud { width: 225px; padding: 8px; }
#quest-hud h4 { color: #f1c40f; font-size: 12px; margin-bottom: 3px; border-bottom: 1px solid #5c452d; padding-bottom: 2px; }
#ui-quest-title { font-weight: bold; font-size: 11px; color: #76d7c4; margin-bottom: 2px; }
#ui-quest-desc { font-size: 11px; color: #e5dcc5; line-height: 1.3; }
.progress { font-size: 11px; color: #f39c12; font-weight: bold; margin-top: 3px; }

#chat-hud { position: absolute; bottom: 10px; left: 10px; width: 260px; height: 125px; padding: 7px; display: flex; flex-direction: column; }
#chat-messages { flex: 1; overflow-y: auto; font-size: 11px; line-height: 1.35; margin-bottom: 5px; }
.chat-sys { color: #f1c40f; }
.chat-input-row { display: flex; gap: 4px; }
.chat-input-row input { flex: 1; background: #1a130d; border: 1px solid #6e543c; border-radius: 4px; color: #fff; padding: 3px 6px; font-size: 11px; }
.chat-input-row button { background: #8c6239; color: #fff; border: none; border-radius: 4px; padding: 3px 8px; font-size: 11px; cursor: pointer; }

#bottom-bar { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); }
#skill-bar { display: flex; gap: 6px; align-items: center; padding: 6px 10px; }
.skill-btn { position: relative; width: 44px; height: 44px; background: #2e2116; border: 2px solid #b8860b; border-radius: 8px; color: #fff; cursor: pointer; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.skill-btn .icon { font-size: 20px; }
.skill-btn .key { position: absolute; bottom: 1px; right: 3px; font-size: 9px; font-weight: bold; color: #ffd700; }
.cd-overlay { position: absolute; bottom: 0; left: 0; right: 0; height: 0%; background: rgba(0, 0, 0, 0.72); }
.skill-btn.meditate.active { border-color: #2ecc71; box-shadow: 0 0 12px #2ecc71; }
.divider { width: 2px; height: 30px; background: #6e543c; margin: 0 2px; }

/* Modals & Quality Colors */
.modal-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 420px; max-height: 85vh; padding: 14px; z-index: 50; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #6e543c; padding-bottom: 6px; margin-bottom: 10px; }
.close-btn { background: none; border: none; color: #e74c3c; font-size: 16px; cursor: pointer; }
.scroll-body { max-height: 360px; overflow-y: auto; padding-right: 4px; }

.sub-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.sub-tab-btn { flex: 1; background: #2b2017; border: 1px solid #6e543c; color: #ddd; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: bold; }
.sub-tab-btn.active { background: #8c6239; border-color: #ffd700; color: #ffd700; }

.equip-grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.equip-slot { background: #1f1710; border: 2px solid #6e543c; border-radius: 6px; padding: 7px; font-size: 11px; line-height: 1.35; }
.q-pham { border-color: #bdc3c7 !important; color: #ecf0f1; }
.q-linh { border-color: #2ecc71 !important; color: #58d68d; }
.q-phap { border-color: #9b59b6 !important; color: #d2b4de; }
.q-co { border-color: #f1c40f !important; color: #ffd700; box-shadow: 0 0 8px rgba(241, 196, 15, 0.35); }

.inv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; min-height: 110px; max-height: 180px; overflow-y: auto; }
.inv-slot { background: #1f1710; border: 1px solid #6e543c; border-radius: 6px; height: 62px; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; position: relative; padding: 3px; text-align: center; }
.inv-slot:hover { border-color: #ffd700; }
.inv-slot .item-icon { font-size: 20px; }
.inv-slot .item-name { font-size: 9px; color: #e0c999; line-height: 1.1; }
.inv-slot .item-qty { position: absolute; top: 2px; right: 4px; font-size: 10px; font-weight: bold; color: #2ecc71; }

.list-card { background: rgba(20, 15, 10, 0.85); border: 1px solid #5c452d; border-radius: 6px; padding: 9px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; }
.btn-claim { background: #27ae60; color: #fff; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-weight: bold; font-size: 11px; white-space: nowrap; }
.btn-claim:disabled { background: #555; color: #aaa; cursor: not-allowed; }

.dialog-box { position: absolute; bottom: 75px; left: 50%; transform: translateX(-50%); width: 500px; padding: 14px; z-index: 60; }
.npc-header { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; border-bottom: 1px solid #5c452d; padding-bottom: 6px; }
.npc-avatar { font-size: 28px; background: #3b2b1d; border-radius: 50%; width: 42px; height: 42px; display: flex; justify-content: center; align-items: center; border: 1px solid #d4af37; }
.npc-role { font-size: 11px; color: #76d7c4; }
.dialog-content { font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-btns button { background: #8c6239; border: 1px solid #ffd700; color: #fff; padding: 5px 12px; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: bold; }
