@font-face {
  font-family: 'Zpix';
  src: url('../assets/fonts/zpix.woff2') format('woff2');
  font-display: swap;
}

* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
}

/* Loading Screen */
#loading-screen {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #0a0a1a; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
}
#loading-title {
  font-size: 24px; font-weight: bold; color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.4);
}
#loading-subtitle { font-size: 14px; color: #888; }
#loading-bar-wrap {
  width: 260px; height: 8px; background: #1a1a3a;
  border-radius: 4px; overflow: hidden;
  border: 1px solid #2a2a4a;
}
#loading-bar-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, #ffd700, #ff8f00);
  border-radius: 4px; transition: width 0.15s;
}
#loading-progress { font-size: 12px; color: #666; }
#loading-screen.done {
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s;
}

/* Game icon inline helper */
.gi {
  width: 16px; height: 16px;
  vertical-align: middle;
  image-rendering: pixelated;
  display: inline-block;
  margin: 0 1px;
}

body {
  background: #1a1a2e;
  color: #e0e0e0;
  font-family: 'Zpix', 'Press Start 2P', monospace;
  font-size: 20px;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ========== Login Page ========== */

#login-bg {
  display: none;
  position: fixed; inset: 0; z-index: 0;
  background: url('../img/bg.jpeg') center center / cover no-repeat;
}
#login-bg.show { display: block; }

#login-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 380px;
  padding: 36px 32px 28px;
  background: rgba(16, 14, 36, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.06);
  z-index: 1;
}

#login-container.show { display: flex; }

#login-title {
  font-size: 26px;
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 4px;
  text-shadow: 0 0 16px rgba(255, 215, 0, 0.35), 0 2px 4px rgba(0,0,0,0.5);
  letter-spacing: 2px;
}

#login-subtitle {
  font-size: 11px;
  font-family: 'Press Start 2P', monospace;
  color: #7a7a9a;
  margin-bottom: 28px;
  letter-spacing: 1px;
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(20, 18, 48, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.login-input:focus {
  border-color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
}
.login-input::placeholder { color: #4a4a6a; }

.login-btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  font-size: 17px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  margin-top: 4px;
}

.login-btn-primary {
  background: linear-gradient(135deg, #ffd700 0%, #f0a800 100%);
  color: #1a1a2e;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.25);
}
.login-btn-primary:hover {
  background: linear-gradient(135deg, #ffe44d 0%, #ffc107 100%);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.35);
  transform: translateY(-1px);
}
.login-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.login-switch {
  margin-top: 16px;
  font-size: 13px;
  color: #6a6a8a;
}

.login-switch a {
  color: #4fc3f7;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.login-switch a:hover { color: #81d4fa; text-decoration: underline; }

#login-footer {
  margin-top: 20px;
  font-size: 10px;
  font-family: 'Press Start 2P', monospace;
  color: #3a3a5a;
  letter-spacing: 1px;
}

#login-error {
  font-size: 13px;
  color: #f44336;
  min-height: 0;
  text-align: center;
}

#login-error {
  color: #ef5350;
  font-size: 14px;
  min-height: 20px;
  text-align: center;
}

/* ========== Game Container ========== */
#game-container {
  display: none;
  width: 100%;
  height: 100vh;
  flex-direction: column;
  background: #16162b;
  position: relative;
  overflow: hidden;
}

#game-container.show { display: flex; }

/* ========== Main Layer (Split Screen) ========== */
#main-layer {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

/* ========== Enhanced Top Bar (~50px, 2 rows) ========== */
#top-bar {
  background: linear-gradient(180deg, #1e1e3a, #16162b);
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
  padding: 0 10px;
}
.top-bar-row1 {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.top-bar-row2 {
  display: flex;
  flex-direction: column;
  padding-bottom: 3px;
}
.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.top-bar-left {
  align-items: center;
  gap: 8px;
}
.top-bar-left-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.top-avatar {
  width: 46px; height: 46px;
  margin-top: 0;
  border-radius: 12px;
  image-rendering: pixelated;
  cursor: pointer;
  border: 2px solid #444;
  object-fit: cover;
}
.top-char-name {
  font-size: 14px; font-weight: bold; color: #e0e0e0;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top-info {
  font-size: 12px;
  font-weight: bold;
  color: #81c784;
}
.top-info-floor { color: #4fc3f7; font-size: 12px; }
.top-settings-btn { font-size: 16px; cursor: pointer; padding: 2px 4px; }
.top-info-gold { color: #ffd700; }
.top-info-diamond { color: #40c4ff; }
.top-info-mat { color: #ce93d8; }

@keyframes hpFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hp-low { animation: hpFlash 0.8s infinite; }

/* ========== Resource Bars (inside top-bar-row2) ========== */
.bar-row {
  height: 15px;
  background: #111;
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}
.bar-row .bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}
.bar-row .bar-text {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  text-shadow: 0 0 2px #000, 0 0 4px #000;
  pointer-events: none;
}
.bar-hp .bar-fill { background: linear-gradient(90deg, #c62828, #ef5350); }
.bar-mp .bar-fill { background: linear-gradient(90deg, #1565c0, #42a5f5); }
.bar-exp .bar-fill { background: linear-gradient(90deg, #ffa000, #ffd740); }
.bar-exp { height: 15px; }
.bar-exp .bar-text { font-size: 12px; }

/* ========== Upper Half (50%) ========== */
#upper-half {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

/* ========== Lower Half (50%) — Log Area ========== */
#lower-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid #2a2a4a;
  background: url('../img/ui/parchment_bg.png') center/cover no-repeat;
}
#log-tab-bar {
  height: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: rgba(80,60,40,0.5);
  border-bottom: 1px solid #8a7a5a;
  flex-shrink: 0;
}
.log-tab {
  font-size: 16px;
  color: #7a6a4a;
  cursor: pointer;
  position: relative;
}
.log-tab.active {
  color: #000;
  font-weight: bold;
  border-bottom: 2px solid #8a6a2a;
}
.chat-red-dot {
  width: 6px; height: 6px; background: #f44336; border-radius: 50%;
  position: absolute; top: -2px; right: -8px; display: inline-block;
}
#battle-log-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  font-size: 12px;
  color: #000;
  line-height: 1.5;
}
#battle-log-scroll .log-entry {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== Status+Equipment Panel (upper half alternate) ========== */
#status-equip-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url('../img/ui/dungeon_bg.png') center/cover no-repeat;
  z-index: 5;
  overflow-y: auto;
}
.se-panel-inner {
  display: flex;
  height: 100%;
  min-height: 0;
}
.se-left {
  width: 50%;
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border-right: 1px solid #2a2a4a;
  background: url('../img/ui/scroll_bg.png') center/110% 110% no-repeat;
  overflow: hidden;
}
.se-attr-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 2px 0;
}
.se-attr-icon { width: 16px; height: 16px; vertical-align: middle; image-rendering: pixelated; }
.se-attr-label { color: #5a4a3a; }
.se-attr-val { color: #3a2a1a; font-weight: bold; font-size: 13px; }
.se-right {
  width: 50%;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.se-equip-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  justify-items: center;
}
.se-equip-empty {
  border-color: transparent !important;
  background: transparent !important;
  cursor: default;
}
.se-equip-slot {
  width: 42px; height: 42px;
  background: #1e1e3a;
  border: 2px dashed #444;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 10px;
}
.se-equip-slot.has-item {
  border-style: solid;
  border-width: 2px;
}
.se-equip-slot.rarity-epic {
  animation: epicGlow 2s ease-in-out infinite;
}
.se-equip-slot.rarity-legendary {
  animation: legendaryGlow 1.5s ease-in-out infinite;
}
@keyframes epicGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(186,104,200,0.5); }
  50% { box-shadow: 0 0 14px rgba(186,104,200,0.8); }
}
@keyframes legendaryGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,215,0,0.6); }
  50% { box-shadow: 0 0 18px rgba(255,215,0,0.9); }
}
.se-equip-slot .se-slot-label {
  font-size: 8px; color: #666;
}
.se-equip-slot .se-slot-icon {
  width: 28px; height: 28px;
  image-rendering: pixelated;
  object-fit: contain;
}
.se-equip-slot .se-slot-enhance {
  position: absolute;
  top: 1px; right: 2px;
  font-size: 8px;
  font-weight: bold;
  color: #fff;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  padding: 0 2px;
  line-height: 13px;
  text-shadow: none;
}
.se-equip-slot .se-slot-enhance.enh-gold { color: #ffd700; }
.se-equip-slot .se-slot-enhance.enh-red { color: #ff4444; }
.se-equip-slot .se-slot-bonus {
  position: absolute;
  top: 1px; left: 2px;
  font-size: 8px;
  color: #81c784;
  text-shadow: 0 0 2px rgba(0,0,0,0.8);
}
#se-equip-detail {
  position: absolute;
  top: 10px; left: 10px; right: 10px;
  background: rgba(20,20,50,0.95);
  border: 2px solid #555;
  border-radius: 8px;
  padding: 12px;
  z-index: 10;
  max-height: 90%;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
#se-equip-detail .se-detail-stats {
  margin: 6px 0;
  padding: 6px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
}
#se-equip-detail .se-detail-stat-main {
  font-size: 13px; color: #fff; font-weight: bold; margin-bottom: 3px;
}
#se-equip-detail .se-detail-stat-sub {
  font-size: 12px; color: #b0b0b0; margin-bottom: 2px;
}
#se-equip-detail .se-detail-stat-bonus {
  font-size: 12px; color: #81c784; font-weight: bold; margin-top: 4px;
  padding: 3px 6px;
  background: rgba(129,199,132,0.1);
  border-radius: 3px;
  border-left: 2px solid #81c784;
}
.se-detail-close {
  position: absolute; top: 4px; right: 8px;
  cursor: pointer; color: #888; font-size: 16px;
}
.potion-settings-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.6;
  background: rgba(0,0,0,0.6);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
}
.potion-settings-btn:hover { opacity: 1; }

/* ========== Potion Quick Slots ========== */
#potion-slots {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 10;
}
.potion-slot {
  width: 36px;
  height: 36px;
  background: rgba(0,0,0,0.6);
  border: 1px solid #555;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  position: relative;
}
.potion-slot:active { background: rgba(255,255,255,0.15); }
.potion-slot-icon { width: 28px; height: 28px; image-rendering: pixelated; }
.potion-slot-count {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  position: absolute;
  bottom: 0px;
  right: 2px;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 1px 1px 1px #000;
}
#potion-slot-hp { border-color: #c62828; }
#potion-slot-mp { border-color: #1565c0; }

/* ========== Battle Skill Slots ========== */
#skill-slots {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 5px;
  z-index: 10;
}
.skill-slot {
  width: 40px; height: 40px;
  background: rgba(0,0,0,0.65);
  border: 2px solid #444;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  position: relative; cursor: default; user-select: none;
}
.skill-slot.ready { border-color: #ffd700; box-shadow: 0 0 8px rgba(255,215,0,0.4); }
.skill-slot.empty { border-style: dashed; opacity: 0.4; }
.skill-slot-icon { font-size: 18px; z-index: 2; display: flex; align-items: center; justify-content: center; }
.skill-slot-icon img { display: block; }
.skill-cd-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.7);
  border-radius: 0 0 6px 6px;
  z-index: 1;
}
.skill-cd-text {
  position: absolute; bottom: 0; left: 0; right: 0;
  text-align: center; font-size: 10px; color: #ffa; z-index: 3;
}

/* ========== Active Skill Page ========== */
.section-title {
  font-size: 14px; font-weight: bold; color: #ffd700;
  padding: 8px 12px; border-bottom: 1px solid #333;
}
.ask-equip-row {
  display: flex; gap: 8px; padding: 10px 12px; justify-content: center;
}
.ask-equip-slot {
  width: 80px; height: 60px;
  background: #1e1e3a; border: 2px solid #555;
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; gap: 2px;
}
.ask-equip-slot.filled { border-color: #ffd700; background: #2a2a4a; }
.ask-equip-slot.empty { border-style: dashed; opacity: 0.6; }
.ask-equip-icon { font-size: 20px; display: flex; align-items: center; justify-content: center; }
.ask-equip-icon img { display: block; }
.ask-equip-name { font-size: 10px; color: #ccc; text-align: center; }
.ask-card {
  background: #1e1e2e; border: 1px solid #333; border-radius: 8px;
  padding: 10px 12px; margin: 6px 12px;
}
.ask-card.locked { opacity: 0.45; }
.ask-card.equipped { border-color: #ffd700; background: #252540; }
.ask-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ask-card-icon { font-size: 20px; display: flex; align-items: center; justify-content: center; }
.ask-card-icon img { display: block; }
.ask-card-name { font-weight: bold; font-size: 14px; flex: 1; }
.ask-card-lock { font-size: 11px; color: #888; }
.ask-card-level { font-size: 12px; color: #ffd700; }
.ask-card-desc { font-size: 11px; color: #aaa; margin-bottom: 4px; }
.ask-card-stats { font-size: 11px; color: #81c784; margin-bottom: 6px; }
.ask-card-btns { display: flex; gap: 6px; }
.ask-btn {
  padding: 4px 12px; font-size: 11px; border-radius: 4px;
  border: 1px solid #555; background: #2a2a4a; color: #ccc;
  cursor: pointer; font-family: inherit;
}
.ask-btn:hover { background: #353560; }
.ask-btn.upgrade { border-color: #66bb6a; color: #81c784; }
.ask-btn.equip { border-color: #ffa726; color: #ffcc80; }
.ask-btn.unequip { border-color: #888; color: #aaa; }

/* ========== Shop Page ========== */
#shop-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
}
.shop-card {
  background: #1e1e2e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.shop-card-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.shop-card-icon .gi { width: 24px; height: 24px; }
.shop-card-info { flex: 1; min-width: 0; }
.shop-card-name { font-size: 13px; font-weight: bold; }
.shop-card-desc { font-size: 11px; color: #999; margin-top: 2px; }
.shop-card-btns { display: flex; gap: 4px; flex-shrink: 0; }
.shop-full { font-size: 11px; color: #666; }
.shop-btn {
  background: #4a4a6a;
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}
.shop-btn:disabled { opacity: 0.4; cursor: default; }
.shop-btn:not(:disabled):active { background: #6a6a9a; }

/* Shop Tabs */
#shop-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  background: rgba(22,22,43,0.8);
  border-bottom: 1px solid #333;
}
.shop-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: #888;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.shop-tab.active { color: #ffd700; border-bottom-color: #ffd700; }
.shop-tab:not(.active):hover { color: #ccc; }
.shop-tab-recharge { color: #40c4ff !important; }
.shop-tab-recharge.active { border-bottom-color: #40c4ff; }

/* Shop Price Colors */
.shop-price-gold { color: #ffd700; font-weight: bold; }
.shop-price-diamond { color: #40c4ff; font-weight: bold; }
.shop-card-diamond { border-color: #2a3a5a !important; background: #161628; }
.shop-card-sold { opacity: 0.5; }
.shop-btn-diamond { background: #1a3a6a; }
.shop-btn-diamond:not(:disabled):active { background: #2a5a9a; }

/* Daily shop */
.shop-daily-header {
  text-align: center;
  padding: 10px;
  font-size: 13px;
  color: #ccc;
  border-bottom: 1px solid #333;
}
.shop-daily-timer { color: #ffd740; font-weight: bold; }

/* Recharge */
.recharge-gift { border-width: 2px !important; background: #1a1a2e; }
.recharge-btn {
  background: #e65100 !important;
  color: #fff !important;
  font-weight: bold;
  font-size: 13px !important;
  padding: 6px 14px !important;
  border-radius: 6px !important;
}
.recharge-btn:active { background: #ff8f00 !important; }
.recharge-bonus { color: #ffd740; font-size: 11px; margin-left: 4px; }
.recharge-tag {
  background: #e65100;
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.shop-diamond-balance {
  text-align: center;
  padding: 12px;
  font-size: 14px;
  color: #40c4ff;
  font-weight: bold;
}

/* Shop buff display */
.shop-buff-section { padding: 8px 12px; border-top: 1px solid #333; margin-top: 8px; }
.shop-buff-title { font-size: 12px; color: #81c784; font-weight: bold; margin-bottom: 4px; }
.shop-buff-item { font-size: 11px; color: #aaa; padding: 2px 0; }

/* ========== Potion Settings ========== */
.potion-select {
  background: #222;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
}

/* ========== Battle Area (fills upper half) ========== */
#battle-area {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  background: #1a1a2e;
}

#battle-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#kill-progress-overlay {
  position: absolute;
  bottom: 52px; right: 8px;
  font-size: 11px;
  color: #888;
  pointer-events: none;
  z-index: 2;
}

#stay-floor-area {
  position: absolute;
  bottom: 52px; left: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
}
#stay-floor-label {
  font-family: 'Zpix', monospace;
  font-size: 13px;
  color: #ffd740;
  text-shadow: 0 0 4px rgba(255,215,64,0.5);
  display: none;
}
#stay-floor-label.show { display: inline; }
#stay-floor-btn {
  padding: 4px 12px;
  font-family: 'Zpix', monospace;
  font-size: 14px;
  background: rgba(0,0,0,0.6);
  color: #ffd740;
  border: 1px solid #ffd740;
  border-radius: 4px;
  cursor: pointer;
}
#stay-floor-btn.active {
  background: #ffd740;
  color: #000;
}

/* ========== Bottom Navigation Bar (Double Row) ========== */
#bottom-nav {
  height: 100px;
  display: flex;
  flex-direction: column;
  background: rgba(22,22,43,0.95);
  border-top: 2px solid #2a2a4a;
  flex-shrink: 0;
  z-index: 20;
}

.nav-row {
  display: flex;
  flex: 1;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.nav-item:active { background: rgba(255,255,255,0.05); }

.nav-item.active {
  color: #ffd700;
}

.nav-spacer { flex: 1; }

.nav-battle-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid #ffd700;
  background: linear-gradient(135deg, #3a1a0a, #5a2a1a);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  box-shadow: 0 0 12px rgba(255,215,0,0.4), inset 0 0 8px rgba(255,215,0,0.15);
  -webkit-tap-highlight-color: transparent;
  gap: 0;
}
.nav-battle-btn:active { transform: translate(-50%, -50%) scale(0.93); }
.nav-battle-icon { width: 28px; height: 28px; image-rendering: pixelated; }
.nav-battle-label { font-size: 10px; color: #ffd700; font-weight: bold; font-family: inherit; margin-top: -2px; }

#bottom-nav { position: relative; }

.nav-item.nav-placeholder {
  color: #333;
  cursor: default;
  opacity: 0.4;
}

.nav-icon { font-size: 18px; line-height: 1; }
.nav-gi { width: 24px; height: 24px; }
.nav-label { font-size: 10px; }

/* ========== Page Layer (full-screen sub-pages) ========== */
#page-layer {
  position: absolute;
  top: 0; left: 0; right: 0;
  bottom: 100px; /* above double-row bottom nav */
  z-index: 10;
  display: none;
}

#page-layer.show, #page-layer.active { display: flex; }

.sub-page {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #16162b;
}

.sub-page.active { display: flex; }

/* Page Top Nav */
.page-top-nav {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #1e1e3a;
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
  gap: 8px;
}

.page-back-btn {
  border: none;
  background: transparent;
  color: #4fc3f7;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.page-back-btn:active { background: rgba(255,255,255,0.05); }

.page-title {
  flex: 1;
  font-size: 18px;
  font-weight: bold;
  color: #ffd700;
}

.page-title #inv-count { font-size: 14px; color: #888; font-weight: normal; }

.page-currency {
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.page-currency span:nth-child(1) { color: #ffd700; }
.page-currency span:nth-child(2) { color: #40c4ff; }
.page-currency span:nth-child(3) { color: #ce93d8; }

/* Page Content */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}

.page-content::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

/* ========== Status Page ========== */
#hero-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #1a1a30;
  border-radius: 8px;
  margin-bottom: 8px;
}

.hero-info-icon { font-size: 28px; }
.hero-info-name { font-size: 16px; font-weight: bold; color: #fff; }
.hero-info-level { font-size: 12px; color: #81c784; }
.hero-info-dps { font-size: 12px; color: #ff8a65; }
.hero-info-exp { font-size: 11px; color: #aaa; margin-top: 2px; }

#hero-stats-overview { display: flex; flex-direction: column; gap: 2px; }

.stat-row {
  display: flex; align-items: center; padding: 6px 8px;
  background: #1e1e3a; border-radius: 6px; font-size: 13px;
}
.stat-row-label { width: 60px; font-weight: bold; color: #e0e0e0; flex-shrink: 0; }
.stat-row-value { width: 65px; color: #ffd700; font-weight: bold; text-align: right; flex-shrink: 0; }
.stat-row-breakdown { flex: 1; font-size: 11px; color: #888; margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row-breakdown span { margin-right: 6px; }
.stat-src-base { color: #8888cc; }
.stat-src-equip { color: #4fc3f7; }
.stat-src-skill { color: #66bb6a; }

.page-section-title {
  font-size: 13px;
  font-weight: bold;
  color: #888;
  margin-top: 12px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #2a2a4a;
}

/* Battle Log (in status page) */
#battle-log {
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
}

#battle-log::-webkit-scrollbar { width: 4px; }
#battle-log::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.log-entry { font-size: 12px; color: #000; padding: 2px 0; line-height: 1.4; }

/* ========== Inventory Page ========== */
#inv-toolbar { display: flex; gap: 6px; margin-bottom: 10px; width: 100%; justify-content: center; }
.inv-tb-btn {
  padding: 6px 12px; font-size: 12px; border: 1px solid #444; border-radius: 6px;
  background: #1e1e3a; color: #ccc; cursor: pointer; font-family: inherit;
}
.inv-tb-btn:hover:not(:disabled) { border-color: #888; background: #252545; }
.inv-tb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.inv-tb-dismantle:not(:disabled) { border-color: #ab47bc; color: #ce93d8; }
.inv-tb-sell:not(:disabled) { border-color: #ffa726; color: #ffcc80; }

#inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.inv-slot {
  aspect-ratio: 1;
  background: #1e1e3a; border: 2px dashed #333; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: default; position: relative;
}

.inv-slot.has-item { border-style: solid; cursor: pointer; }
.inv-slot.has-item:hover { transform: scale(1.05); z-index: 1; }

.inv-item-icon { width: 36px; height: 36px; border-radius: 3px; }
.inv-item-icon-img { width: 90%; height: 90%; image-rendering: pixelated; object-fit: contain; }

/* Ancient rarity glow effect */
.inv-item-ancient {
  border-color: #FF2222 !important;
  animation: ancient-glow 2s ease-in-out infinite;
}
@keyframes ancient-glow {
  0%, 100% { box-shadow: 0 0 4px #FF222240; }
  50% { box-shadow: 0 0 10px #FF222280; }
}
.eslot-ancient {
  border-color: #FF2222 !important;
  animation: ancient-glow 2s ease-in-out infinite;
}

/* ========== Backpack Page Tabs ========== */
.backpack-tabs {
  display: flex; gap: 4px; margin-bottom: 8px; justify-content: center;
}
.bp-tab {
  padding: 4px 14px; font-size: 12px; border: 1px solid #444; border-radius: 6px;
  background: #1e1e3a; color: #aaa; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.bp-tab:hover { border-color: #888; background: #252545; }
.bp-tab.active { border-color: #ffd700; color: #ffd700; background: #2a2a4a; }
.bp-tab.locked { opacity: 0.45; cursor: pointer; border-style: dashed; }
.bp-tab.locked:hover { opacity: 0.65; border-color: #666; }
.bp-count { font-size: 11px; color: #888; text-align: center; margin-bottom: 6px; }

/* ========== Equipment Page (Human Silhouette) ========== */
#equipment-figure {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 3/4;
  min-height: 400px;
}

.equip-figure-silhouette {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 120px; height: 200px;
  opacity: 0.15;
  background: linear-gradient(180deg,
    transparent 0%,
    #aaa 5%, #aaa 15%, /* head */
    transparent 16%, transparent 20%,
    #888 21%, /* shoulders */
    #888 55%, /* torso */
    transparent 56%, transparent 58%,
    #777 59%, #777 85%, /* legs */
    transparent 86%, transparent 88%,
    #666 89%, #666 100% /* feet */
  );
  border-radius: 50% 50% 0 0 / 20% 20% 0 0;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 200'%3E%3Cellipse cx='60' cy='20' rx='18' ry='20' fill='white'/%3E%3Crect x='30' y='40' width='60' height='70' rx='8' fill='white'/%3E%3Crect x='32' y='110' width='24' height='65' rx='6' fill='white'/%3E%3Crect x='64' y='110' width='24' height='65' rx='6' fill='white'/%3E%3Crect x='10' y='45' width='20' height='50' rx='6' fill='white'/%3E%3Crect x='90' y='45' width='20' height='50' rx='6' fill='white'/%3E%3Crect x='28' y='175' width='28' height='12' rx='4' fill='white'/%3E%3Crect x='64' y='175' width='28' height='12' rx='4' fill='white'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 200'%3E%3Cellipse cx='60' cy='20' rx='18' ry='20' fill='white'/%3E%3Crect x='30' y='40' width='60' height='70' rx='8' fill='white'/%3E%3Crect x='32' y='110' width='24' height='65' rx='6' fill='white'/%3E%3Crect x='64' y='110' width='24' height='65' rx='6' fill='white'/%3E%3Crect x='10' y='45' width='20' height='50' rx='6' fill='white'/%3E%3Crect x='90' y='45' width='20' height='50' rx='6' fill='white'/%3E%3Crect x='28' y='175' width='28' height='12' rx='4' fill='white'/%3E%3Crect x='64' y='175' width='28' height='12' rx='4' fill='white'/%3E%3C/svg%3E");
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
}

.equip-slot-pos {
  position: absolute;
  width: 56px; height: 56px;
  background: #1e1e3a;
  border: 2px dashed #444;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.equip-slot-pos.has-item { border-style: solid; }
.equip-slot-pos:active { transform: scale(0.95); }

/* Slot positions around silhouette */
#eslot-head     { top: 2%;  left: 50%; transform: translateX(-50%); }
#eslot-weapon   { top: 30%; left: 5%; }
#eslot-chest    { top: 28%; left: 50%; transform: translateX(-50%); }
#eslot-ring     { top: 30%; right: 5%; }
#eslot-accessory{ top: 52%; right: 5%; }
#eslot-legs     { top: 55%; left: 50%; transform: translateX(-50%); }
#eslot-boots    { top: 80%; left: 50%; transform: translateX(-50%); }

.eslot-icon { width: 44px; height: 44px; image-rendering: pixelated; }
.eslot-icon-placeholder { width: 40px; height: 40px; border-radius: 4px; }
.eslot-label { font-size: 10px; color: #555; text-align: center; }

/* ========== Skills Page ========== */
#skill-points-display {
  text-align: center; font-size: 14px; font-weight: bold;
  color: #81c784; padding: 4px 0; margin-bottom: 8px;
}

#skill-trees {
  display: flex; gap: 8px; flex: 1; min-height: 0;
}

.skill-tree {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  background: #1a1a30; border-radius: 8px; padding: 6px;
}

.skill-tree-title {
  text-align: center; font-size: 12px; font-weight: bold;
  padding: 4px; border-radius: 4px; margin-bottom: 2px;
}

.skill-tree-title.power { color: #ff8a65; background: #ff8a6515; }
.skill-tree-title.crit { color: #ffd740; background: #ffd74015; }
.skill-tree-title.speed { color: #4fc3f7; background: #4fc3f715; }

.skill-node {
  background: #1e1e3a; border: 2px solid #333; border-radius: 6px;
  padding: 6px 8px; cursor: default; transition: all 0.15s;
  position: relative;
}

.skill-node.unlockable {
  border-color: #ffd700; cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.skill-node.unlockable:hover { background: #252545; }
.skill-node.locked { opacity: 0.4; }
.skill-node.maxed { border-color: #4caf50; }

.skill-node-header {
  display: flex; justify-content: space-between; align-items: center;
}

.skill-node-name { font-size: 12px; font-weight: bold; }
.skill-node-level { font-size: 11px; color: #aaa; }
.skill-node-level.max { color: #4caf50; }
.skill-node-desc { font-size: 10px; color: #888; margin-top: 2px; }
.skill-node-req { font-size: 10px; color: #ef5350; margin-top: 1px; }

.skill-connector {
  text-align: center; color: #444; font-size: 10px; line-height: 1;
  padding: 0;
}

/* ========== More Page ========== */
#user-display-more {
  text-align: center;
  font-size: 13px;
  color: #4fc3f7;
  padding: 12px 0;
  margin-bottom: 8px;
}

.more-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.more-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #1e1e3a;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.more-item:active { background: #252545; }

.more-arrow { color: #555; font-size: 18px; }

.more-danger {
  margin-top: 40px;
  padding-top: 12px;
  border-top: 1px solid #2a2a4a;
}

.more-item-danger { color: #ef5350; font-size: 12px; background: #1a1a2e; }
.more-item-danger:active { background: #2a1a1a; }

/* Sound toggle switch */
.sound-toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.sound-toggle input { opacity: 0; width: 0; height: 0; }
.sound-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #444; border-radius: 20px; transition: 0.3s; }
.sound-slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.sound-toggle input:checked + .sound-slider { background: #ffd700; }
.sound-toggle input:checked + .sound-slider:before { transform: translateX(16px); }

/* ========== Modals ========== */
.modal-overlay {
  display: none; position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 100;
  justify-content: center; align-items: center;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: #1e1e3a; border: 2px solid #4a4a6a;
  border-radius: 12px; padding: 20px;
  min-width: 280px; max-width: 340px;
  max-height: 80vh; overflow-y: auto;
}

/* Item Compare Modal */
.item-modal-compare { min-width: 300px; max-width: 420px; padding: 16px; }
.item-compare-layout { display: flex; gap: 12px; }
.item-compare-side { flex: 1; min-width: 0; }
.item-compare-divider { width: 1px; background: #333; flex-shrink: 0; }

.item-side-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.item-side-icon {
  width: 48px; height: 48px; border-radius: 6px; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  image-rendering: pixelated; flex-shrink: 0;
}
.item-side-icon-inner { width: 36px; height: 36px; border-radius: 4px; }
.item-side-icon-img { width: 40px; height: 40px; image-rendering: pixelated; }
.item-side-info { flex: 1; min-width: 0; overflow: hidden; }
.item-side-name { font-size: 13px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-side-meta { font-size: 11px; color: #888; }
.item-side-label { font-size: 11px; color: #666; margin-bottom: 6px; text-align: center; }

.item-stat-row { font-size: 12px; padding: 2px 0; display: flex; justify-content: space-between; }
.item-stat-name { color: #aaa; }
.item-stat-val { font-weight: bold; }
.item-stat-diff { font-size: 11px; margin-left: 4px; }
.diff-up { color: #4caf50; }
.diff-down { color: #f44336; }
.diff-same { color: #666; }

.item-side-empty { color: #555; font-size: 13px; text-align: center; padding: 20px 0; }

.item-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Enhance Section */
.enhance-section { border-top: 1px solid #333; padding-top: 8px; margin-top: 8px; }
.enhance-info { font-size: 12px; color: #aaa; padding: 2px 0; }
.enhance-rate { font-weight: bold; }
.enhance-rate.high { color: #4caf50; }
.enhance-rate.mid { color: #ffd700; }
.enhance-rate.low { color: #ff8a65; }
.enhance-rate.vlow { color: #ef5350; }

.modal-btn {
  flex: 1; padding: 8px; border: 2px solid; border-radius: 6px;
  font-family: inherit; font-size: 12px; font-weight: bold;
  cursor: pointer; transition: opacity 0.15s; min-width: 60px;
}

.modal-btn:hover { opacity: 0.85; }
.modal-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.modal-btn-equip { background: #2e7d32; border-color: #4caf50; color: #fff; }
.modal-btn-sell { background: #c62828; border-color: #ef5350; color: #fff; }
.modal-btn-close { background: #444; border-color: #666; color: #ccc; }
.modal-btn-decompose { background: #6a1b9a; border-color: #9c27b0; color: #fff; }
.modal-btn-enhance { background: #e65100; border-color: #ff8f00; color: #fff; }
.modal-btn-unequip { background: #455a64; border-color: #78909c; color: #fff; }

/* Offline Report */
#offline-report-modal .modal-box { text-align: center; }
#offline-report-title { font-size: 20px; font-weight: bold; color: #ffd700; margin-bottom: 8px; }
#offline-report-time { font-size: 13px; color: #aaa; margin-bottom: 12px; }
#offline-report-gold { font-size: 24px; font-weight: bold; color: #ffd700; margin: 8px 0; }
#offline-report-equips { font-size: 13px; margin: 8px 0; text-align: left; }
.offline-equip-item { padding: 2px 0; font-size: 12px; }
#offline-report-sold { font-size: 12px; color: #aaa; margin: 4px 0; }
.offline-btn {
  margin-top: 12px; padding: 10px 24px;
  background: #ffd700; border: none; border-radius: 8px;
  color: #1a1a2e; font-size: 16px; font-weight: bold;
  cursor: pointer; font-family: inherit;
}
.offline-btn:hover { background: #ffed4a; }

/* Auto Rule Modal */
.auto-rule-modal { max-width: 360px; }
.auto-rule-section { background: #1a1a35; border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.auto-rule-header { font-size: 14px; font-weight: bold; margin-bottom: 6px; }
.auto-rule-header label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.auto-rule-body { padding-left: 4px; }
.auto-rule-row { font-size: 12px; color: #aaa; margin: 4px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.auto-rule-row label { display: flex; align-items: center; gap: 3px; cursor: pointer; }
.auto-rule-num { width: 40px; padding: 2px 4px; background: #252545; border: 1px solid #444; border-radius: 4px; color: #fff; text-align: center; font-size: 12px; }

/* Enhance level colors */
.enh-white { color: #ccc; }
.enh-green { color: #4caf50; }
.enh-blue { color: #2196f3; }
.enh-gold { color: #ff8f00; }

.monster-level-gray { color: #9E9E9E; }
.monster-level-green { color: #4CAF50; }
.monster-level-white { color: #FFFFFF; }
.monster-level-red { color: #F44336; }

/* Animations */
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); filter: brightness(2); }
  75% { transform: translateX(4px); filter: brightness(1.5); }
}
@keyframes flashFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes enhanceSuccess {
  0% { box-shadow: 0 0 0 rgba(76,175,80,0); }
  50% { box-shadow: 0 0 20px rgba(76,175,80,0.8); }
  100% { box-shadow: 0 0 0 rgba(76,175,80,0); }
}
@keyframes enhanceFail {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes mapClearPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.map-card:hover {
  filter: brightness(1.15);
  transition: filter 0.15s;
}

/* Scrollbars */
.page-content::-webkit-scrollbar, #skill-trees::-webkit-scrollbar { width: 4px; }
.page-content::-webkit-scrollbar-thumb, #skill-trees::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

/* ========== Character Select Page ========== */
#char-select-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 700px;
  padding: 30px 20px;
  max-height: 100vh;
  overflow-y: auto;
}
#char-select-container.show { display: flex; }

.char-select-header {
  position: relative;
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
}
.char-select-title {
  font-size: 24px;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255,215,0,0.3);
}

#char-select-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.char-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #16162b;
  border: 2px solid #2a2a4a;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.char-card:hover { border-color: #ffd700; transform: translateY(-2px); }
.char-card.warrior { border-left: 4px solid #ef5350; background: linear-gradient(90deg, rgba(239,83,80,0.08), #16162b); }
.char-card.mage { border-left: 4px solid #42a5f5; background: linear-gradient(90deg, rgba(66,165,245,0.08), #16162b); }
.char-card.archer { border-left: 4px solid #66bb6a; background: linear-gradient(90deg, rgba(102,187,106,0.08), #16162b); }

.char-card-icon { font-size: 32px; }
.char-card-info { flex: 1; }
.char-card-name { font-size: 16px; font-weight: bold; color: #fff; }
.char-card-meta { font-size: 12px; color: #888; margin-top: 2px; }
.char-card-level { font-size: 14px; color: #ffd700; }

.char-card-delete {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(239,83,80,0.15);
  color: #ef5350;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 22px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.char-card:hover .char-card-delete { opacity: 1; }
.char-card-delete:hover { background: rgba(239,83,80,0.4); }

.char-card-create {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #16162b;
  border: 2px dashed #2a2a4a;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #666;
  font-size: 16px;
}
.char-card-create:hover { border-color: #ffd700; color: #ffd700; }

/* Character Card V2 (upgraded) */
.char-card-v2 {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 14px;
  background: #16162b;
  border: 2px solid #2a2a4a;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 160px;
}
.char-card-v2:hover { border-color: #ffd700; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.char-card-v2.warrior { background: linear-gradient(90deg, rgba(239,83,80,0.12), #16162b 60%); }
.char-card-v2.mage { background: linear-gradient(90deg, rgba(66,165,245,0.12), #16162b 60%); }
.char-card-v2.archer { background: linear-gradient(90deg, rgba(102,187,106,0.12), #16162b 60%); }
.char-card-sprite {
  width: 150px; height: 150px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.char-card-sprite-icon { font-size: 36px; }
.char-card-body { flex: 1; min-width: 0; }
.char-card-row1 { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.char-card-v2 .char-card-name { font-size: 16px; font-weight: bold; color: #fff; }
.char-card-level-badge { font-size: 13px; font-weight: bold; }
.char-card-row2 { font-size: 11px; color: #999; margin-bottom: 4px; }
.char-card-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #aaa;
}
.char-card-enter {
  font-size: 12px;
  color: #ffd700;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
}
.char-card-v2:hover .char-card-enter { color: #fff; }
.char-card-v2 .char-card-delete {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 22px; height: 22px;
  background: rgba(239,83,80,0.15);
  color: #ef5350;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.char-card-v2:hover .char-card-delete { opacity: 1; }
.char-card-v2 .char-card-delete:hover { background: rgba(239,83,80,0.4); }

.char-card-create-v2 {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border: 2px dashed #444;
  border-radius: 12px;
  color: #888;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.char-card-create-v2:hover { border-color: #ffd700; color: #ffd700; }

/* ========== Character Create Page ========== */
#char-create-container {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 600px;
  padding: 30px 20px;
}
#char-create-container.show { display: flex; }

.char-create-title {
  font-size: 22px;
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 16px;
}

/* Avatar Selection Grid (create + change) */
.avatar-select-section {
  width: 100%; max-width: 340px; margin-bottom: 12px; text-align: center;
}
.avatar-select-label {
  font-size: 14px; color: #aaa; margin-bottom: 8px;
}
.avatar-select-grid, .avatar-change-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  justify-items: center;
}
.avatar-option {
  position: relative;
  width: 56px; height: 56px;
  border: 2px solid #2a2a4a;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.avatar-option img {
  width: 48px; height: 48px;
  image-rendering: pixelated;
}
.avatar-option:hover { border-color: #888; }
.avatar-option.selected { border-color: #ffd700; box-shadow: 0 0 8px rgba(255,215,0,0.3); }
.avatar-current-tag {
  position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #ffd700; background: #1a1a2e; padding: 0 4px; border-radius: 2px;
}
.avatar-change-current-img {
  width: 80px; height: 80px; display: block; margin: 8px auto 16px;
  image-rendering: pixelated; border-radius: 8px; border: 2px solid #ffd700;
}
.avatar-current-label {
  font-size: 12px; color: #888; text-align: center;
}

.char-card-avatar-img {
  width: 140px; height: 140px;
  image-rendering: pixelated;
  border-radius: 8px;
  object-fit: cover;
}

.char-create-name-row {
  width: 100%;
  max-width: 300px;
  margin-bottom: 4px;
}

.class-select-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.class-card {
  width: 160px;
  padding: 20px 14px;
  background: #16162b;
  border: 2px solid #2a2a4a;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.class-card:hover { border-color: #555; }
.class-card.selected { border-color: #ffd700; box-shadow: 0 0 12px rgba(255,215,0,0.2); }

.class-icon { font-size: 36px; margin-bottom: 8px; }
.class-gi { width: 36px; height: 36px; }
.class-name { font-size: 16px; font-weight: bold; color: #fff; margin-bottom: 6px; }
.class-desc { font-size: 11px; color: #888; line-height: 1.6; }

.char-create-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 300px;
}
.char-create-actions .login-btn { flex: 1; background: #2a2a4a; color: #ccc; }
.char-create-actions .login-btn:hover { background: #3a3a5a; }
.char-create-actions .login-btn-primary { background: #ffd700; color: #1a1a2e; }
.char-create-actions .login-btn-primary:hover { background: #ffed4a; }

/* ========== Responsive Desktop (>=768px) ========== */
/* ========== Buff Bar (顶部Buff图标栏) ========== */
#buff-bar {
  display: flex;
  gap: 6px;
  padding: 2px 8px;
  min-height: 0;
  align-items: center;
  flex-wrap: wrap;
}
#buff-bar:empty, #buff-bar[style*="display:none"] { display: none !important; }
.buff-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.buff-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
}
.buff-icon .gi { width: 16px; height: 16px; }
.buff-timer {
  font-size: 9px;
  color: #ccc;
  white-space: nowrap;
}

/* Buff加成箭头 (属性面板) */
.se-attr-buff {
  font-size: 11px;
  color: #66bb6a;
  margin-left: 4px;
}

/* ========== 装备格子优化 ========== */
/* 强化标签统一样式：右上角 */
.inv-enhance-tag, .se-slot-enhance-tag {
  position: absolute;
  top: 2px; right: 2px;
  font-size: 9px;
  font-weight: bold;
  color: #fff;
  background: rgba(0,0,0,0.6);
  border-radius: 3px;
  padding: 0px 3px;
  line-height: 14px;
  z-index: 2;
  pointer-events: none;
}
.inv-enhance-tag.enh-gold, .se-slot-enhance-tag.enh-gold { color: #ffd700; }
.inv-enhance-tag.enh-red, .se-slot-enhance-tag.enh-red { color: #ff4444; }

/* 装备等级（左上角） */
.inv-level-tag {
  position: absolute;
  top: 2px; left: 2px;
  font-size: 8px;
  color: #888;
  z-index: 2;
  pointer-events: none;
}

/* ========== 地图卡片重做 ========== */
.map-card-new {
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s;
  position: relative;
}
.map-card-new:hover { filter: brightness(1.1); }
.map-card-new.current { box-shadow: 0 0 0 2px #ffd700; }
.map-card-new.locked { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.6); }

.map-card-bg {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 70px;
  background-size: cover;
  background-position: center;
}
.map-card-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1;
}
.map-card-title {
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
.map-card-meta {
  font-size: 11px;
  color: #ccc;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.map-card-progress {
  font-size: 11px;
  color: #aaa;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
.map-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  z-index: 1;
}
.map-card-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: bold;
}
.map-card-status.cleared { background: #2e7d32; color: #a5d6a7; }
.map-card-status.current-map { background: #e65100; color: #ffcc80; }
.map-card-status.locked-tag { background: #424242; color: #999; }
.map-card-arrow {
  font-size: 16px;
  color: #aaa;
  transition: transform 0.2s;
}
.map-card-new.expanded .map-card-arrow { transform: rotate(90deg); }

/* 层数网格 */
.floor-grid-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(10,10,30,0.9);
}
.map-card-new.expanded .floor-grid-container {
  max-height: 400px;
}
.floor-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px 14px;
}
.floor-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border: 2px solid #444;
  background: #1e1e3a;
  color: #ccc;
  transition: all 0.15s;
  position: relative;
}
.floor-cell:hover:not(.floor-locked) { background: #2a2a5a; border-color: #888; }
.floor-cell.floor-current { border-color: #ffd700; color: #ffd700; background: #2a2a2a; box-shadow: 0 0 8px rgba(255,215,0,0.4); }
.floor-cell.floor-unlocked { border-color: #4caf50; color: #aaa; }
.floor-cell.floor-locked { border-color: #333; background: #111; color: #444; cursor: not-allowed; }
.floor-cell.floor-boss { border-color: #f44336; }
.floor-cell.floor-boss::after {
  content: '💀';
  position: absolute;
  top: -2px; right: -2px;
  font-size: 10px;
}

@media (min-width: 768px) {
  #game-container {
    max-width: 1200px;
    border: 2px solid #2a2a4a;
    height: 100vh;
    max-height: 900px;
  }
}

/* ========== Dungeon System ========== */

/* Dungeon Tickets Bar */
#dungeon-tickets-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 12px; font-size: 13px; color: #ffd740;
  background: rgba(255,215,64,0.08); border-radius: 6px; margin-bottom: 10px;
}

/* Dungeon Cards */
.dungeon-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
}
.dungeon-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0.25; z-index: 0;
  background: var(--dg-bg); border-radius: inherit;
}
.dungeon-card:active { transform: scale(0.98); }
.dungeon-card > * { position: relative; z-index: 1; }

.dungeon-card-icon { font-size: 32px; flex-shrink: 0; }
.dungeon-card-icon .gi { width: 32px; height: 32px; }
.dungeon-card-body { flex: 1; min-width: 0; }
.dungeon-card-name { font-size: 15px; font-weight: bold; color: #fff; }
.dungeon-card-desc { font-size: 11px; color: #aaa; margin-top: 2px; }
.dungeon-card-info { font-size: 11px; color: #888; margin-top: 4px; }
.dungeon-card-right { text-align: right; flex-shrink: 0; }
.dungeon-card-count { font-size: 13px; font-weight: bold; }
.dungeon-card-reward { font-size: 11px; color: #aaa; margin-top: 2px; }

.dungeon-card.locked {
  opacity: 0.45; filter: grayscale(0.6); cursor: default;
}
.dungeon-card.locked::after {
  content: '🔒'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 24px; z-index: 2;
}
.dungeon-card.exhausted { opacity: 0.55; }

/* Dungeon Confirm Modal */
.dg-confirm-title { font-size: 18px; font-weight: bold; text-align: center; margin-bottom: 10px; }
.dg-confirm-info { font-size: 13px; color: #aaa; margin-bottom: 6px; }
.dg-confirm-reward { padding: 8px; background: rgba(255,255,255,0.05); border-radius: 6px; margin: 8px 0; font-size: 13px; }
.dg-confirm-btn-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.dg-confirm-start {
  padding: 10px 28px; font-family: inherit; font-size: 15px; font-weight: bold;
  border: none; border-radius: 6px; cursor: pointer;
  background: #4caf50; color: #fff;
}
.dg-confirm-start:disabled { background: #555; color: #888; cursor: default; }
.dg-confirm-back {
  padding: 10px 20px; font-family: inherit; font-size: 14px;
  border: none; border-radius: 6px; cursor: pointer;
  background: #555; color: #ccc;
}

/* Dungeon HUD (inside battle-area) */
#dungeon-hud {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  z-index: 10; text-align: center; pointer-events: none;
}
#dungeon-hud-name {
  font-size: 14px; font-weight: bold; color: #ffd740;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}
#dungeon-hud-wave {
  font-size: 12px; color: #ccc; margin-top: 2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* Dungeon Settlement */
.dg-settle-title {
  font-size: 24px; font-weight: bold; text-align: center; margin-bottom: 14px;
  animation: dgTitlePop 0.6s ease-out;
}
.dg-settle-title.victory { color: #ffd700; }
.dg-settle-title.defeat { color: #f44336; }

@keyframes dgTitlePop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.dg-reward-list { margin: 10px 0; }
.dg-reward-item {
  padding: 6px 0; font-size: 14px; color: #ddd;
  opacity: 0; animation: dgRewardFade 0.4s ease forwards;
}
.dg-reward-item:nth-child(1) { animation-delay: 0.2s; }
.dg-reward-item:nth-child(2) { animation-delay: 0.5s; }
.dg-reward-item:nth-child(3) { animation-delay: 0.8s; }
.dg-reward-item:nth-child(4) { animation-delay: 1.1s; }
.dg-reward-item:nth-child(5) { animation-delay: 1.4s; }
.dg-reward-item:nth-child(6) { animation-delay: 1.7s; }
.dg-reward-item:nth-child(7) { animation-delay: 2.0s; }
.dg-reward-item:nth-child(8) { animation-delay: 2.3s; }

@keyframes dgRewardFade {
  to { opacity: 1; }
}

.dg-settle-remaining {
  font-size: 12px; color: #888; text-align: center; margin: 10px 0 6px;
}
.dg-settle-btns {
  display: flex; gap: 8px; justify-content: center; margin-top: 10px;
}

/* ========== Goddess System ========== */

.top-info-piety { color: #ce93d8; }

/* Goddess Cards */
.goddess-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px; border-radius: 10px;
  background: #1a1a2e; border: 1px solid #333; overflow: hidden;
}

.goddess-card-icon { font-size: 36px; width: 50px; text-align: center; flex-shrink: 0; }
.goddess-card-icon .gi { width: 32px; height: 32px; }
.goddess-card-body { flex: 1; min-width: 0; }
.goddess-card-name { font-size: 15px; font-weight: bold; color: #fff; }
.goddess-card-attr { font-size: 11px; color: #aaa; margin-top: 2px; }
.goddess-card-level { font-size: 20px; font-weight: bold; color: #ffd700; margin-top: 4px; display: inline-block; }
.goddess-card-total { font-size: 16px; font-weight: bold; margin-top: 4px; }
.goddess-card-next { font-size: 11px; color: #aaa; margin-top: 2px; }
.goddess-card-right { text-align: center; flex-shrink: 0; }

.goddess-pray-btn {
  background: linear-gradient(135deg, #ffd700 0%, #ff9800 100%);
  border: none; border-radius: 6px; color: #1a1a2e; font-weight: bold;
  padding: 8px 18px; cursor: pointer; font-size: 13px; font-family: inherit;
  transition: transform 0.1s;
}
.goddess-pray-btn:active { transform: scale(0.95); }
.goddess-pray-btn:disabled { background: #444; color: #888; cursor: default; }
.goddess-pray-cost { font-size: 10px; color: #aaa; margin-top: 4px; }

/* Pray animations */
@keyframes goddess-pray-pulse {
  0% { box-shadow: 0 0 0 rgba(255,215,0,0); }
  50% { box-shadow: 0 0 20px rgba(255,215,0,0.5); }
  100% { box-shadow: 0 0 0 rgba(255,215,0,0); }
}

@keyframes goddess-level-bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); color: #fff; }
  100% { transform: scale(1); }
}

@keyframes goddess-float-up {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

.goddess-card.praying {
  animation: goddess-pray-pulse 0.5s ease;
}

.goddess-level-bounce {
  animation: goddess-level-bounce 0.5s ease;
}

.goddess-float-text {
  position: absolute; font-size: 14px; font-weight: bold;
  pointer-events: none; animation: goddess-float-up 1s ease forwards;
  right: 20px; top: 10px;
}

/* Goddess bonus in attribute panel */
.se-attr-goddess { color: #4caf50; font-size: 11px; margin-left: 4px; }

/* Goddess piety header */
.goddess-piety-header {
  text-align: center; padding: 14px 0 8px; font-size: 16px; color: #ce93d8;
  border-bottom: 1px solid #2a2a4a; margin-bottom: 10px;
}

/* ========== Top Banner (battle overlay announcements) ========== */
#top-banner {
  position: absolute; top: 0; left: 0; right: 0;
  text-align: center; font-size: 14px; font-weight: bold;
  padding: 6px 12px; z-index: 6;
  background: rgba(0,0,0,0.7);
  pointer-events: none; opacity: 0;
  text-shadow: 0 0 8px currentColor;
}
.top-banner-anim {
  animation: top-banner-slide 4s ease-out forwards;
}
@keyframes top-banner-slide {
  0% { opacity: 0; transform: translateY(-100%); }
  10% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-100%); }
}

/* ========== Chat Ticker (battle overlay) ========== */
#chat-ticker {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 24px; overflow: hidden;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center;
  padding: 0 8px; cursor: pointer;
  z-index: 5; pointer-events: auto;
}
#chat-ticker:empty { display: none; }
#chat-ticker .ticker-msg {
  white-space: nowrap; font-size: 11px; color: #eee;
  animation: ticker-scroll 12s linear infinite;
}
#chat-ticker .ticker-name { font-weight: bold; margin-right: 4px; }
#chat-ticker .ticker-sys { color: #ffd700; font-weight: bold; }
@keyframes ticker-scroll {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ========== Chat System ========== */
#chat-scroll {
  flex: 1; overflow-y: auto; padding: 4px 8px; font-size: 12px;
}
.chat-msg {
  display: flex; align-items: flex-start; gap: 6px; padding: 3px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.chat-msg-avatar { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; margin-top: 2px; image-rendering: pixelated; }
.chat-msg-body { flex: 1; min-width: 0; }
.chat-msg-class { font-size: 9px; padding: 0 3px; border-radius: 3px; margin-right: 3px; font-weight: bold; }
.chat-msg-name { font-weight: bold; font-size: 12px; margin-right: 4px; }
.chat-msg-level { font-size: 10px; color: #888; margin-right: 4px; }
.chat-msg-text { font-size: 12px; color: #222; word-break: break-all; }
.chat-msg-time { font-size: 10px; color: #aaa; flex-shrink: 0; margin-top: 2px; }
.chat-msg-system { justify-content: center; padding: 4px 0; border-bottom: none; }
.chat-msg-content-sys { color: #b8860b; font-size: 12px; font-weight: bold; text-align: center; }

#chat-input-bar {
  display: flex; gap: 4px; padding: 4px 8px; background: rgba(80,60,40,0.3);
  border-top: 1px solid #8a7a5a; flex-shrink: 0;
}
#chat-input {
  flex: 7; height: 28px; border: 1px solid #8a7a5a; border-radius: 4px;
  background: #fff; padding: 0 8px; font-size: 12px; font-family: inherit;
  outline: none;
}
#chat-input.chat-input-error { border-color: #f44336; }
#chat-emoji-btn, #chat-send-btn {
  flex: 1.5; height: 28px; border: none; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-family: inherit;
}
#chat-emoji-btn { background: #e8e0d0; }
#chat-send-btn { background: #8a6a2a; color: #fff; }
#chat-send-btn:active { background: #6a4a1a; }

#emoji-picker {
  position: absolute; bottom: 40px; left: 8px; right: 8px;
  background: #fff; border: 1px solid #8a7a5a; border-radius: 8px;
  padding: 8px; box-shadow: 0 -4px 12px rgba(0,0,0,0.15); z-index: 100;
}
.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.emoji-item {
  font-size: 20px; text-align: center; cursor: pointer; padding: 4px;
  border-radius: 4px; transition: background 0.1s;
}
.emoji-item:hover { background: #f0e8d8; }

/* ========== Leaderboard ========== */
#lb-tab-bar { display: flex; gap: 8px; padding: 8px 12px; }
.lb-tab {
  flex: 1; text-align: center; padding: 6px 0; font-size: 13px;
  color: #888; cursor: pointer; border-radius: 6px; background: #1e1e3a;
}
.lb-tab.active { color: #ffd700; background: #2a2a5a; font-weight: bold; }
#lb-info-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px; font-size: 11px; color: #666; }
#lb-refresh-btn {
  font-size: 11px; padding: 2px 10px; border: 1px solid #444; border-radius: 4px;
  background: #2a2a4a; color: #aaa; cursor: pointer; font-family: inherit;
}
#lb-refresh-btn:disabled { opacity: 0.4; cursor: default; }
#lb-list { flex: 1; overflow-y: auto; padding: 0 12px; }
.lb-entry {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: #1e1e3a; border-radius: 6px; margin-bottom: 4px; font-size: 13px;
}
.lb-entry-top1 { background: rgba(255,215,0,0.1); border: 1px solid rgba(255,215,0,0.3); }
.lb-entry-top2 { background: rgba(192,192,192,0.1); border: 1px solid rgba(192,192,192,0.3); }
.lb-entry-top3 { background: rgba(205,127,50,0.1); border: 1px solid rgba(205,127,50,0.3); }
.lb-entry-rank { width: 30px; font-weight: bold; flex-shrink: 0; }
.lb-rank-1 { color: #ffd700; }
.lb-rank-2 { color: #c0c0c0; }
.lb-rank-3 { color: #cd7f32; }
.lb-entry-avatar { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; image-rendering: pixelated; }
.lb-entry-class { width: 16px; flex-shrink: 0; font-size: 12px; }
.lb-entry-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; }
.lb-entry-level { color: #888; font-size: 11px; flex-shrink: 0; }
.lb-entry-value { color: #ffd700; font-weight: bold; flex-shrink: 0; min-width: 60px; text-align: right; }
#lb-myrank {
  padding: 8px 12px; border-top: 1px solid #2a2a4a; background: #16163a;
  font-size: 13px; color: #aaa; text-align: center;
}
.lb-myrank-label b { color: #ffd700; }
