/* Reset and base */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  color: #eee;
  font-family: 'Segoe UI', system-ui, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/* Loading Screen */
#loading-screen {
  position: fixed; inset: 0;
  background: #0a0a1a;
  z-index: 1000;
  overflow: hidden;
}
.loading-world {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0.6;
}
.loading-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10,10,26,0.3) 0%, rgba(10,10,26,0.85) 70%);
  z-index: 1;
}
.loading-title {
  font-size: clamp(3rem, 10vw, 6rem);
  color: #e94560;
  text-shadow: 0 0 40px rgba(233,69,96,0.6), 0 0 80px rgba(233,69,96,0.3);
  letter-spacing: 1rem;
  animation: titlePulse 3s ease-in-out infinite;
}
.loading-subtitle {
  font-size: clamp(0.8rem, 2vw, 1.2rem);
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.4rem;
  margin-top: 0.5rem;
  text-transform: uppercase;
}
@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 40px rgba(233,69,96,0.6), 0 0 80px rgba(233,69,96,0.3); }
  50% { text-shadow: 0 0 60px rgba(233,69,96,0.8), 0 0 120px rgba(233,69,96,0.5); }
}
.progress-bar {
  width: 80%; max-width: 400px; height: 6px;
  background: rgba(255,255,255,0.08); border-radius: 3px;
  overflow: hidden; margin-top: 2rem;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #e94560, #c94080, #e94560);
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: 3px; transition: width 0.3s;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.loading-text { margin-top: 1rem; color: #666; font-size: 0.85rem; }

/* Main Menu */
#main-menu {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  z-index: 900;
}
#main-menu h1 {
  font-size: clamp(2rem, 8vw, 4rem);
  color: #e94560; letter-spacing: 0.5rem;
  text-shadow: 0 0 30px rgba(233,69,96,0.5);
  margin-bottom: 2rem;
}
.menu-container {
  width: 90%; max-width: 400px;
  background: rgba(255,255,255,0.05);
  border-radius: 16px; padding: 2rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}
.menu-btn {
  display: block; width: 100%;
  padding: 14px; margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; background: rgba(255,255,255,0.05);
  color: #eee; font-size: 1rem; cursor: pointer;
  transition: all 0.2s;
}
.menu-btn:hover, .menu-btn:active {
  background: rgba(233,69,96,0.2);
  border-color: #e94560;
}
.menu-btn.primary {
  background: #e94560; border-color: #e94560;
  font-weight: 600;
}
.menu-btn.primary:hover { background: #d63651; }
.menu-screen input[type="text"],
.menu-screen input[type="email"],
.menu-screen input[type="password"] {
  display: block; width: 100%;
  padding: 12px; margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; background: rgba(0,0,0,0.3);
  color: #eee; font-size: 1rem;
}
.menu-screen input:focus {
  outline: none; border-color: #e94560;
}
.menu-screen h2 {
  text-align: center; margin-bottom: 1rem;
  color: #e94560;
}
.gender-select {
  display: flex; gap: 1.5rem; justify-content: center;
  padding: 8px 0;
}
.gender-select label { color: #ccc; cursor: pointer; }
.error-msg {
  color: #e94560; text-align: center;
  font-size: 0.85rem; min-height: 1.2rem;
}

/* Game View */
#game-view {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

/* Canvas Container */
#canvas-container {
  flex: 1; position: relative;
  overflow: hidden; background: #111;
}
#canvas-container canvas {
  position: absolute; top: 0; left: 0;
}
#game-bg { z-index: 1; }
#game-canvas { z-index: 2; }

/* Touch Controls */
#touch-controls {
  position: fixed;
  bottom: 320px;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 20px;
  pointer-events: none;
  z-index: 50;
}
#dpad {
  display: grid;
  grid-template-columns: 60px 60px 60px;
  grid-template-rows: 60px 60px 60px;
  gap: 4px;
  pointer-events: auto;
}
.dpad-btn {
  width: 60px; height: 60px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.7);
  font-size: 1.5rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.dpad-btn:active {
  background: rgba(233,69,96,0.4);
  border-color: #e94560;
}
/* D-pad layout: up=row1 col2, left=row2 col1, right=row2 col3, down=row3 col2 */
.dpad-btn[data-dir="1"] { grid-column: 2; grid-row: 1; }
.dpad-btn[data-dir="2"] { grid-column: 1; grid-row: 2; }
.dpad-btn[data-dir="0"] { grid-column: 3; grid-row: 2; }
.dpad-btn[data-dir="3"] { grid-column: 2; grid-row: 3; }

#action-buttons {
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
}
#attack-btn, #voice-btn {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-tap-highlight-color: transparent;
}
#attack-btn:active {
  background: rgba(233,69,96,0.5);
  border-color: #e94560;
}
#voice-btn.active {
  background: rgba(46,204,113,0.4);
  border-color: #2ecc71;
}
#voice-btn.muted {
  background: rgba(231,76,60,0.4);
  border-color: #e74c3c;
}

/* Hide touch controls on desktop */
@media (hover: hover) and (pointer: fine) {
  #touch-controls { display: none; }
}

/* HUD */
#hud {
  position: fixed; top: 10px; left: 10px; right: 10px;
  display: flex; flex-wrap: wrap; gap: 8px;
  z-index: 40; pointer-events: none;
}
.stat-bar {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,0.6);
  border-radius: 6px; padding: 4px 10px;
  backdrop-filter: blur(4px);
  min-width: 150px;
}
.stat-bar .label {
  font-size: 0.75rem; font-weight: 700;
  color: rgba(255,255,255,0.7);
  width: 30px;
}
.bar-bg {
  flex: 1; height: 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 6px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 6px;
  transition: width 0.3s;
}
.bar-fill.hp { background: linear-gradient(90deg, #e74c3c, #e94560); width: 100%; }
.bar-fill.tp { background: linear-gradient(90deg, #3498db, #9b59b6); width: 100%; }
.bar-fill.exp { background: linear-gradient(90deg, #3498db, #2ecc71); width: 0%; }

/* Spell Bar */
#spell-bar {
  position: fixed;
  bottom: 240px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 45;
  pointer-events: auto;
}
.spell-slot {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #eee;
  font-size: 0.6rem;
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.spell-slot:hover {
  border-color: rgba(155,89,182,0.6);
  background: rgba(155,89,182,0.15);
}
.spell-slot:active {
  border-color: #9b59b6;
  background: rgba(155,89,182,0.3);
}
.spell-slot.no-tp {
  opacity: 0.4;
  cursor: default;
}
.spell-slot .spell-icon { font-size: 1.2rem; line-height: 1; }
.spell-slot .spell-name { font-size: 0.45rem; color: #aaa; line-height: 1; margin-top: 2px; }
.spell-slot .spell-cost { font-size: 0.4rem; color: #9b59b6; line-height: 1; }

/* Responsive spell bar adjustments */
@media (max-width: 480px) {
  #spell-bar { bottom: 200px; }
  .spell-slot { width: 38px; height: 38px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #spell-bar { bottom: 160px; }
  .spell-slot { width: 36px; height: 36px; }
}

#gold-display {
  font-size: 0.8rem; font-weight: 700; color: #FFD700;
  background: rgba(0,0,0,0.6); border-radius: 6px;
  padding: 4px 10px; backdrop-filter: blur(4px);
}
#ping-display {
  font-size: 0.7rem; color: rgba(255,255,255,0.5);
  padding: 4px 8px; background: rgba(0,0,0,0.4);
  border-radius: 4px;
}

/* Bottom Panel */
#bottom-panel {
  height: 180px;
  background: rgba(15,15,30,0.95);
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; flex-direction: column;
  z-index: 60;
}
#panel-tabs {
  display: flex; overflow-x: auto;
  background: rgba(0,0,0,0.3);
  -webkit-overflow-scrolling: touch;
}
.tab {
  flex: 0 0 auto; padding: 8px 16px;
  border: none; background: transparent;
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  position: relative;
}
.tab.active {
  color: #e94560;
  border-bottom-color: #e94560;
}
#panel-content {
  flex: 1; overflow: hidden;
  position: relative;
}
.panel {
  position: absolute; inset: 0;
  padding: 8px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.panel h3 {
  font-size: 0.9rem; color: #e94560;
  margin-bottom: 8px;
}

/* Chat */
#chat-channels {
  display: flex; gap: 4px; margin-bottom: 4px;
}
.channel-btn {
  padding: 4px 12px; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px; background: transparent;
  color: rgba(255,255,255,0.5); font-size: 0.75rem;
  cursor: pointer;
}
.channel-btn.active {
  background: rgba(233,69,96,0.2);
  border-color: #e94560; color: #e94560;
}
#chat-messages {
  height: calc(100% - 70px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.msg-list {
  list-style: none; padding: 0;
}
.msg-list li {
  padding: 2px 0; font-size: 0.8rem;
  line-height: 1.3;
}
.msg-list .username {
  font-weight: 700; color: #e94560;
}
.msg-list .msg-text { color: #ccc; }
.msg-list li.system { color: #f39c12; }
.msg-list li.global .username { color: #3498db; }
.msg-list li.broadcast { color: #e74c3c; font-weight: 600; }
.msg-list li.chat-whisper { color: #c084fc; font-style: italic; }
.msg-list li.chat-whisper .username { color: #a855f7; }
.msg-list li.system-inline { color: #aab; font-style: italic; font-size: 0.9em; }
.msg-list li.system-inline .sys-prefix { color: #7af; font-weight: bold; }
.msg-list li.system-inline .sys-text { color: #aab; }
#chat-input-area {
  display: flex; gap: 4px; padding-top: 4px;
}
#chat-input {
  flex: 1; padding: 8px; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; background: rgba(0,0,0,0.3);
  color: #eee; font-size: 0.85rem;
}
#chat-input:focus { outline: none; border-color: #e94560; }
#chat-send {
  padding: 8px 16px; border: none;
  border-radius: 6px; background: #e94560;
  color: white; font-weight: 600; cursor: pointer;
}

/* Context Messages */
#context-messages {
  position: fixed; top: 60px; left: 50%;
  transform: translateX(-50%);
  list-style: none; z-index: 45;
  pointer-events: none;
}
#context-messages li {
  background: rgba(0,0,0,0.7);
  color: #f39c12; padding: 6px 16px;
  border-radius: 4px; margin-bottom: 4px;
  font-size: 0.85rem; text-align: center;
  animation: fadeUp 3.5s forwards;
}
@keyframes fadeUp {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* Chat Bubbles */
#chat-bubbles {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 35;
}
.chat-bubble {
  position: absolute; z-index: 30;
  background: rgba(255,255,255,0.95);
  color: #1a1a2e;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  max-width: 200px; word-wrap: break-word;
  pointer-events: none;
  animation: bubbleFade 2.5s forwards;
  text-align: center;
  text-shadow: none;
  border-radius: 14px;
}
.chat-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(255,255,255,0.95);
}
.chat-bubble.broadcast {
  background: rgba(255,220,100,0.95);
  color: #1a1a2e;
}
.chat-bubble.broadcast::after {
  border-top-color: rgba(255,220,100,0.95);
}
@keyframes bubbleFade {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Disconnect Modal */
#disconnect-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center;
  justify-content: center; z-index: 999;
}
.modal-content {
  background: #1a1a2e; padding: 2rem;
  border-radius: 16px; text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}
.modal-content button {
  margin-top: 1rem; padding: 12px 24px;
  border: none; border-radius: 8px;
  background: #e94560; color: white;
  font-size: 1rem; cursor: pointer;
}

/* Stats Panel - horizontal grid */
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 4px 0;
}
.stat-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #ccc;
  white-space: nowrap;
}
.stat-label {
  color: #888;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.stat-val {
  color: #e94560;
  font-weight: 600;
}
.stat-alloc-btn {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1px solid #e94560;
  background: rgba(233,69,96,0.2);
  color: #e94560;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

/* Settings */
.settings-layout {
  display: flex; gap: 16px; height: 100%; overflow-y: auto;
}
.settings-col { flex: 0 0 auto; min-width: 0; }
.settings-actions {
  display: flex; flex-direction: column; gap: 6px;
  justify-content: flex-start; margin-left: auto;
}
.settings-actions .menu-btn {
  width: auto; min-width: 120px; padding: 8px 14px;
  font-size: 0.8rem; margin: 0;
}
.setting { margin: 4px 0; }
.setting label {
  display: block; font-size: 0.8rem;
  color: #aaa; margin-bottom: 2px;
}
.setting input[type="range"] {
  width: 180px; accent-color: #e94560;
}
.setting-divider {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.setting h4 {
  color: #e94560; font-size: 0.85rem; margin-bottom: 6px;
}
.setting input[type="password"] {
  display: block; width: 100%;
  padding: 8px; margin: 4px 0;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; background: rgba(0,0,0,0.3);
  color: #eee; font-size: 0.8rem;
}
.setting input[type="password"]:focus {
  outline: none; border-color: #e94560;
}
.success-msg {
  color: #2ecc71; text-align: center;
  font-size: 0.85rem; min-height: 1.2rem;
}

/* Online List */
#online-list {
  list-style: none;
}
#online-list li {
  display: flex; align-items: center;
  padding: 6px 4px; gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.8rem;
}
#online-list .player-name { flex: 1; color: #eee; }
#online-list .player-level { color: #e94560; }
#online-list .role-admin { color: #f39c12; font-weight: bold; font-size: 0.7rem; }

/* Responsive adjustments */

/* Small phones (iPhone SE, etc.) */
@media (max-width: 380px) {
  #bottom-panel { height: 140px; }
  #touch-controls { bottom: 280px; }
  .dpad-btn { width: 44px; height: 44px; font-size: 1.2rem; }
  #dpad {
    grid-template-columns: 44px 44px 44px;
    grid-template-rows: 44px 44px 44px;
    gap: 2px;
  }
  #attack-btn, #voice-btn { width: 54px; height: 54px; font-size: 0.8rem; }
  .tab { padding: 6px 10px; font-size: 0.7rem; }
  #chat-input { font-size: 0.8rem; padding: 6px; }
}

/* Standard phones */
@media (max-width: 480px) {
  #bottom-panel { height: 160px; }
  #touch-controls { bottom: 300px; }
  .dpad-btn { width: 50px; height: 50px; }
  #dpad {
    grid-template-columns: 50px 50px 50px;
    grid-template-rows: 50px 50px 50px;
  }
  #attack-btn, #voice-btn { width: 60px; height: 60px; }
}

/* Tablets (iPad Mini, iPad) */
@media (min-width: 768px) {
  #bottom-panel { height: 200px; }
  #touch-controls { bottom: 360px; }
  .tab { padding: 10px 20px; font-size: 0.85rem; }
  #chat-input { font-size: 0.9rem; }
  .msg-list li { font-size: 0.85rem; }
}

/* Desktop and large tablets */
@media (min-width: 1024px) {
  #bottom-panel { height: 220px; }
  #touch-controls { bottom: 380px; }
}

/* Landscape phones - shrink bottom panel */
@media (max-height: 500px) and (orientation: landscape) {
  #bottom-panel { height: 120px; }
  #touch-controls { bottom: 260px; }
  .dpad-btn { width: 40px; height: 40px; font-size: 1rem; }
  #dpad {
    grid-template-columns: 40px 40px 40px;
    grid-template-rows: 40px 40px 40px;
    gap: 2px;
  }
  #attack-btn, #voice-btn { width: 50px; height: 50px; }
  .tab { padding: 6px 12px; }
}

/* Inventory & Equipment */
.inv-layout {
  display: flex;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
}
.inv-section { flex: 1; min-width: 0; }
.inv-section h4 {
  font-size: 11px;
  color: #8af;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.equip-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.equip-slot {
  width: 70px;
  padding: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  font-size: 9px;
  color: #999;
  text-align: center;
  cursor: default;
  position: relative;
}
.equip-slot.filled {
  border-color: #4a9;
  background: rgba(74,153,136,0.15);
  color: #afd;
  cursor: pointer;
}
.equip-slot .slot-label {
  font-size: 8px;
  color: #666;
  display: block;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.equip-slot .slot-item { font-size: 10px; }
.inventory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
}
.inventory-slot {
  width: 48px;
  height: 48px;
  background: rgba(30, 30, 50, 0.8);
  border: 1px solid #444;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 9px;
  color: #ccc;
  text-align: center;
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}
.inventory-slot:hover {
  border-color: #d4af37;
  background: rgba(50, 50, 70, 0.9);
}
.inventory-slot.gold-slot {
  border-color: #d4af37;
  background: rgba(60, 50, 20, 0.8);
}
.inventory-slot.equippable {
  border-color: rgba(74,153,136,0.4);
}
.inventory-slot.gender-locked {
  border-color: rgba(200,80,80,0.4);
  color: #a88;
  cursor: not-allowed;
}
.inventory-slot .item-icon {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  margin-bottom: 1px;
  flex-shrink: 0;
}
.inventory-slot .item-amount {
  position: absolute;
  bottom: 1px;
  right: 3px;
  font-size: 8px;
  color: #fff;
  text-shadow: 1px 1px 1px #000;
}
.inventory-slot .item-name {
  font-size: 7px;
  line-height: 1;
  max-width: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inventory-space-info {
  font-size: 10px;
  color: #888;
  padding: 2px 8px;
  text-align: right;
}
.empty-msg { color: #555; text-align: center; padding: 1rem; font-size: 11px; }

/* Force landscape on mobile - rotate overlay */
#rotate-overlay {
  display: none;
  position: fixed; inset: 0;
  background: #0a0a1a;
  z-index: 10000;
  flex-direction: column;
  align-items: center; justify-content: center;
  color: #eee; text-align: center;
  padding: 2rem;
}
#rotate-overlay .rotate-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: rotateHint 2s ease-in-out infinite;
}
#rotate-overlay .rotate-text {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.1rem;
}
#rotate-overlay .rotate-subtitle {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.5rem;
}
@keyframes rotateHint {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(90deg); }
  50% { transform: rotate(90deg); }
  75% { transform: rotate(0deg); }
}

/* Show rotate overlay only on mobile in portrait */
@media (max-width: 768px) and (orientation: portrait) {
  #rotate-overlay { display: flex !important; }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

/* Animated star field for menu backgrounds - 3 parallax layers */
.stars-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  background-image:
    radial-gradient(1px 1px at 15px 25px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 85px 55px, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 140px 95px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 200px 35px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 260px 130px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 50px 160px, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 310px 80px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 180px 190px, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 330px 145px, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 100px 10px, rgba(255,255,255,0.35), transparent);
  background-size: 350px 220px;
  animation: starDrift1 180s linear infinite;
}
.stars-bg::before {
  content: '';
  position: absolute; inset: -50%;
  width: 200%; height: 200%;
  background-image:
    radial-gradient(1.5px 1.5px at 30px 50px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 110px 130px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 200px 70px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 60px 120px, rgba(255,255,255,0.4), transparent),
    radial-gradient(1.5px 1.5px at 170px 30px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 240px 170px, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 80px 190px, rgba(255,255,255,0.55), transparent),
    radial-gradient(1.5px 1.5px at 270px 100px, rgba(255,255,255,0.45), transparent);
  background-size: 280px 200px;
  animation: starDrift2 100s linear infinite, starTwinkle 4s ease-in-out infinite alternate;
}
.stars-bg::after {
  content: '';
  position: absolute; inset: -50%;
  width: 200%; height: 200%;
  background-image:
    radial-gradient(2px 2px at 70px 90px, #fff, transparent),
    radial-gradient(2px 2px at 180px 40px, rgba(255,255,255,0.9), transparent),
    radial-gradient(2px 2px at 250px 150px, #fff, transparent),
    radial-gradient(2.5px 2.5px at 120px 180px, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 40px 10px, rgba(255,255,255,0.85), transparent),
    radial-gradient(2.5px 2.5px at 300px 60px, rgba(255,255,255,0.9), transparent);
  background-size: 320px 220px;
  animation: starDrift3 60s linear infinite, starTwinkle 3s ease-in-out infinite alternate-reverse;
}
@keyframes starDrift1 {
  from { background-position: 0 0; }
  to { background-position: -350px -220px; }
}
@keyframes starDrift2 {
  from { background-position: 0 0; }
  to { background-position: 280px 200px; }
}
@keyframes starDrift3 {
  from { background-position: 0 0; }
  to { background-position: -320px 220px; }
}
@keyframes starTwinkle {
  0% { opacity: 0.3; }
  100% { opacity: 0.7; }
}

/* Character Select Screen */
#char-select {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  z-index: 900;
  padding: 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#char-select h1 {
  font-size: clamp(1.8rem, 6vw, 3rem);
  color: #e94560; letter-spacing: 0.5rem;
  text-shadow: 0 0 30px rgba(233,69,96,0.5);
  margin-bottom: 0.5rem;
}
.char-select-title {
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: rgba(255,255,255,0.7);
  margin-bottom: 1rem;
}
.char-slots {
  width: 100%; max-width: 500px;
  display: flex; flex-direction: column;
  gap: 10px; margin-bottom: 1rem;
}
.char-slot {
  display: flex; align-items: center;
  padding: 14px 16px; gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; cursor: pointer;
  transition: all 0.2s;
}
.char-slot:hover, .char-slot:active {
  background: rgba(233,69,96,0.15);
  border-color: #e94560;
}
.char-slot .char-info { flex: 1; }
.char-slot .char-name {
  font-size: 1.1rem; font-weight: 700;
  color: #eee;
}
.char-slot .char-detail {
  font-size: 0.8rem; color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.char-slot .delete-char-btn {
  width: 36px; height: 36px;
  border: 1px solid rgba(231,76,60,0.4);
  border-radius: 8px; background: rgba(231,76,60,0.1);
  color: #e74c3c; font-size: 1.2rem;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.char-slot .delete-char-btn:hover {
  background: rgba(231,76,60,0.3);
  border-color: #e74c3c;
}
.char-slot-empty {
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 12px; text-align: center;
  color: rgba(255,255,255,0.2); font-size: 0.85rem;
}
.char-slot-info {
  flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.char-slot-name {
  font-size: 1.05rem; font-weight: 700; color: #eee;
}
.char-slot-class {
  font-size: 0.8rem; color: #e94560;
  text-transform: capitalize;
}
.char-slot-level {
  font-size: 0.75rem; color: rgba(255,255,255,0.5);
}
.char-slot-actions {
  display: flex; gap: 6px; align-items: center;
}
.char-slot-actions .menu-btn {
  width: auto; min-width: 60px; padding: 8px 12px;
  margin: 0; font-size: 0.85rem;
}
.char-actions {
  display: flex; gap: 10px; width: 100%;
  max-width: 500px; margin-bottom: 1rem;
}
.char-actions .menu-btn { flex: 1; }

/* Create Character Form */
#create-char-form {
  width: 95%; max-width: 800px;
  background: rgba(255,255,255,0.05);
  border-radius: 16px; padding: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  margin-top: 0.5rem;
  position: relative;
}
#create-char-form h2 {
  text-align: center; color: #e94560;
  margin-bottom: 1rem;
}
#create-char-form input[type="text"] {
  display: block; width: 100%;
  padding: 12px; margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; background: rgba(0,0,0,0.3);
  color: #eee; font-size: 1rem;
}
#create-char-form input[type="text"]:focus {
  outline: none; border-color: #e94560;
}

/* Back arrow button */
.back-arrow-btn {
  background: none; border: 1px solid rgba(255,255,255,0.2);
  color: #ccc; cursor: pointer; font-size: 0.9rem;
  padding: 6px 14px; border-radius: 6px;
  transition: all 0.2s; margin-bottom: 8px;
}
.back-arrow-btn:hover {
  border-color: #e94560; color: #e94560;
  background: rgba(233,69,96,0.1);
}

/* Two-column layout for character creation */
.create-char-layout {
  display: flex; gap: 24px;
}
.create-left {
  flex: 1; min-width: 0;
}
.create-right {
  flex: 1; min-width: 0;
}

.class-select { margin: 12px 0; }
.class-select > label {
  display: block; color: #aaa;
  font-size: 0.85rem; margin-bottom: 8px;
}
.class-options {
  display: flex; gap: 8px;
}
.class-option {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 12px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; cursor: pointer;
  transition: all 0.2s;
}
.class-option:hover {
  background: rgba(255,255,255,0.06);
}
.class-option.selected {
  background: rgba(233,69,96,0.15);
  border-color: #e94560;
}
.class-icon { font-size: 1.6rem; }
.class-name {
  font-size: 0.85rem; font-weight: 700;
  color: #eee;
}
.class-desc {
  font-size: 0.65rem; color: rgba(255,255,255,0.4);
  text-align: center;
}

/* Race Select (replaces old skin-select) */
.race-select { margin: 0 0 12px; }
.race-select > label,
.skin-tone-select > label {
  display: block; color: #aaa;
  font-size: 0.85rem; margin-bottom: 8px;
}
.race-options {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
}
.race-btn {
  display: flex; flex-direction: column; align-items: center;
  width: 90px; padding: 8px 6px 6px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px; cursor: pointer;
  font-size: 0.75rem; font-weight: 600;
  color: #ccc; background: rgba(0,0,0,0.3);
  transition: all 0.2s; gap: 4px;
}
.race-btn canvas.race-preview {
  width: 68px; height: 100px; object-fit: contain;
  image-rendering: pixelated;
}
.race-btn span { white-space: nowrap; }
.race-btn.selected {
  border-color: #e94560;
  box-shadow: 0 0 10px rgba(233,69,96,0.4);
  background: rgba(233,69,96,0.15);
}
.race-btn:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
}

/* Skin Tone Sub-selector (shown only for Human race) */
.skin-tone-select { margin-top: 12px; }
.skin-tone-options {
  display: flex; gap: 10px; justify-content: center;
}
.skin-tone-btn {
  display: flex; flex-direction: column; align-items: center;
  width: 90px; padding: 8px 6px 6px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px; cursor: pointer;
  background: rgba(0,0,0,0.3);
  transition: all 0.2s;
}
.skin-tone-btn canvas.skin-tone-preview {
  width: 68px; height: 100px; object-fit: contain;
  image-rendering: pixelated;
}
.skin-tone-btn.selected {
  border-color: #e94560;
  box-shadow: 0 0 10px rgba(233,69,96,0.4);
  background: rgba(233,69,96,0.15);
}
.skin-tone-btn:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.1);
}

/* Hair style selector */
.hair-select { margin-top: 12px; }
.hair-select > label {
  display: block; margin-bottom: 6px; font-size: 0.95rem; color: #ddd;
}
.hair-options {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.hair-btn {
  padding: 6px 12px; border: 2px solid rgba(255,255,255,0.15);
  border-radius: 8px; cursor: pointer; background: rgba(0,0,0,0.3);
  color: #ddd; font-size: 0.85rem; transition: all 0.2s;
}
.hair-btn.selected {
  border-color: #e94560; box-shadow: 0 0 10px rgba(233,69,96,0.4);
  background: rgba(233,69,96,0.15); color: #fff;
}
.hair-btn:hover {
  border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.1);
}

/* Responsive: stack layout on narrow screens */
@media (max-width: 600px) {
  .create-char-layout {
    flex-direction: column;
    gap: 12px;
  }
  #create-char-form {
    max-width: 95%;
    padding: 1rem;
  }
  .race-btn {
    width: 70px;
  }
  .race-btn canvas.race-preview {
    width: 50px; height: 74px;
  }
  .skin-tone-btn {
    width: 70px;
  }
  .skin-tone-btn canvas.skin-tone-preview {
    width: 50px; height: 74px;
  }
}

/* Delete Char Modal */
#delete-char-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex; align-items: center;
  justify-content: center; z-index: 999;
}
#delete-char-modal .modal-content {
  width: 90%; max-width: 360px;
}
#delete-char-modal input[type="text"] {
  display: block; width: 100%;
  padding: 12px; margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px; background: rgba(0,0,0,0.3);
  color: #eee; font-size: 1rem; text-align: center;
}
#delete-char-modal input:focus {
  outline: none; border-color: #e74c3c;
}
.menu-btn.danger {
  background: #e74c3c; border-color: #e74c3c;
  font-weight: 600;
}
.menu-btn.danger:hover { background: #c0392b; }

/* HUD player info */
#player-info {
  display: flex; gap: 8px; align-items: center;
  background: rgba(0,0,0,0.6);
  border-radius: 6px; padding: 4px 10px;
  backdrop-filter: blur(4px);
}
#hud-name {
  font-weight: 700; color: #eee;
  font-size: 0.85rem;
}
#hud-class {
  color: #e94560; font-size: 0.75rem;
  font-weight: 600; text-transform: capitalize;
}
#hud-level {
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
}
.bar-text {
  font-size: 0.65rem; color: rgba(255,255,255,0.6);
  min-width: 50px; text-align: right;
}

/* Music mute button on menu/char-select screens */
.mute-btn {
  position: absolute;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.7);
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
  line-height: 1;
}
.mute-btn:hover {
  background: rgba(233,69,96,0.2);
  border-color: #e94560;
  color: #fff;
}
.mute-btn.muted {
  color: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.1);
}

/* Stat Allocation Buttons */
.stat-alloc-btn {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: #e94560;
  border: 1px solid #ff6b81;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  vertical-align: middle;
  transition: background 0.15s, transform 0.1s;
}
.stat-alloc-btn:hover {
  background: #ff6b81;
  transform: scale(1.15);
}
.stat-alloc-btn:active {
  transform: scale(0.95);
}

/* Player Context Menu */
#player-context-menu {
  position: fixed;
  z-index: 1000;
  background: rgba(13, 13, 26, 0.95);
  border: 1px solid #e94560;
  border-radius: 8px;
  padding: 8px;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}
.ctx-menu-header {
  padding: 4px 8px 8px;
  border-bottom: 1px solid rgba(233, 69, 96, 0.3);
  margin-bottom: 6px;
}
#ctx-player-name {
  display: block;
  font-weight: bold;
  color: #e94560;
  font-size: 14px;
}
#ctx-player-info {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}
.ctx-menu-btn {
  display: block;
  width: 100%;
  padding: 6px 10px;
  margin: 2px 0;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.ctx-menu-btn:hover {
  background: rgba(233, 69, 96, 0.3);
}
.ctx-menu-btn.ctx-close {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  text-align: center;
}

#item-context-menu {
  position: fixed;
  z-index: 1000;
  background: rgba(13, 13, 26, 0.95);
  border: 1px solid rgba(233, 69, 96, 0.5);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 160px;
  box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}
.ctx-menu-btn.ctx-delete {
  color: #ff6b6b;
}
.ctx-menu-btn.ctx-delete:hover {
  background: rgba(255, 80, 80, 0.3);
}

/* Party Invite Dialog */
#party-invite-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  background: rgba(13, 13, 26, 0.97);
  border: 1px solid #e94560;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 30px rgba(233, 69, 96, 0.4);
  color: #fff;
}
#party-invite-dialog p {
  margin: 0 0 14px;
  font-size: 14px;
}
#party-invite-dialog .menu-btn {
  margin: 0 6px;
  min-width: 80px;
}

/* Trade Window */
#trade-window {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  background: rgba(10,10,26,0.95);
  border: 2px solid #e94560;
  border-radius: 8px;
  min-width: 340px;
  max-width: 90vw;
}
.trade-container { padding: 12px; }
.trade-header {
  display: flex; justify-content: space-between; align-items: center;
  color: #eee; font-size: 0.9rem; font-weight: 600;
  padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.trade-x-btn {
  background: none; border: none; color: #e94560; font-size: 1rem; cursor: pointer;
}
.trade-body { display: flex; gap: 12px; padding: 10px 0; }
.trade-side { flex: 1; }
.trade-side h4 { color: #888; font-size: 0.75rem; text-transform: uppercase; margin-bottom: 6px; }
.trade-items {
  min-height: 80px; background: rgba(0,0,0,0.3); border-radius: 4px; padding: 6px;
  display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start;
}
.trade-item {
  width: 40px; height: 40px; border-radius: 4px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.6rem; color: #ccc; position: relative;
}
.trade-item:hover { border-color: #e94560; }
.trade-item .trade-item-icon {
  width: 20px; height: 20px; border-radius: 2px; margin-bottom: 1px;
}
.trade-item .trade-item-name {
  font-size: 6px; line-height: 1; max-width: 38px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trade-item .trade-item-amount {
  position: absolute; bottom: 1px; right: 2px; font-size: 0.5rem; color: #e94560;
}
.trade-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.1);
}
.trade-status { font-size: 0.75rem; color: #888; }
.trade-status.agreed { color: #2ecc71; }
.trade-footer .menu-btn {
  width: auto; min-width: 80px; padding: 8px 16px; margin: 0;
}

.trade-gold-row {
  margin-top: 6px; padding: 4px 6px;
  background: rgba(0,0,0,0.2); border-radius: 4px;
}
.trade-gold-display {
  font-size: 0.75rem; color: #d4af37; font-weight: 600;
}
.trade-gold-input-row {
  display: flex; gap: 4px; margin-top: 4px; align-items: center;
}
.trade-gold-input {
  width: 80px; padding: 3px 6px; font-size: 0.75rem;
  background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px; color: #d4af37; outline: none;
}
.trade-gold-input:focus { border-color: #d4af37; }
.trade-gold-input::placeholder { color: rgba(212,175,55,0.4); }
.trade-gold-btn {
  padding: 3px 8px; font-size: 0.7rem; cursor: pointer;
  background: rgba(212,175,55,0.2); border: 1px solid rgba(212,175,55,0.4);
  border-radius: 3px; color: #d4af37;
}
.trade-gold-btn:hover { background: rgba(212,175,55,0.35); }
.trade-gold-btn.remove {
  background: rgba(233,69,96,0.2); border-color: rgba(233,69,96,0.4);
  color: #e94560;
}
.trade-gold-btn.remove:hover { background: rgba(233,69,96,0.35); }

/* Trade Request Dialog */
#trade-request-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  background: rgba(13, 13, 26, 0.97);
  border: 1px solid #e94560;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 30px rgba(233, 69, 96, 0.4);
  color: #fff;
}
#trade-request-dialog p {
  margin: 0 0 14px;
  font-size: 14px;
}
#trade-request-dialog .menu-btn {
  margin: 0 6px;
  min-width: 80px;
}

/* NPC Dialog */
.npc-dialog-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.npc-dialog-content {
  background: #1a1a2e;
  border: 2px solid #e94560;
  border-radius: 8px;
  padding: 20px;
  max-width: 400px;
  width: 90%;
  color: #eee;
  position: relative;
}
.npc-dialog-close {
  position: absolute;
  top: 6px;
  right: 10px;
  font-size: 18px;
  color: #888;
  cursor: pointer;
  line-height: 1;
}
.npc-dialog-close:hover {
  color: #e94560;
}
.npc-dialog-header {
  font-size: 18px;
  font-weight: bold;
  color: #e94560;
  margin-bottom: 12px;
  text-align: center;
}
.npc-dialog-text {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
  min-height: 60px;
}
.npc-dialog-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Quest Tracker */
#quest-tracker {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #555;
  border-radius: 4px;
  padding: 8px 12px;
  color: #fff;
  font-size: 12px;
  z-index: 100;
  min-width: 150px;
  pointer-events: none;
}
.quest-tracker-title {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 4px;
  font-size: 13px;
}
.quest-tracker-item {
  color: #ccc;
  margin: 2px 0;
}

/* Quests Panel */
#quests-panel {
  padding: 8px 12px;
  overflow-y: auto;
}
.quests-empty {
  color: #666;
  font-size: 0.8rem;
  text-align: center;
  padding: 16px 0;
}
.quests-section-title {
  color: #ffd700;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  margin: 0 0 6px 0;
}
.quest-entry {
  padding: 4px 8px;
  margin-bottom: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
}
.quest-entry.primary {
  border-left: 2px solid #ffd700;
}
.quest-entry.completed {
  opacity: 0.6;
}
.quest-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.quest-entry-name {
  color: #ddd;
  font-size: 0.78rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quest-set-primary-btn {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
}
.quest-set-primary-btn:hover {
  background: rgba(255, 215, 0, 0.3);
}
.quest-primary-badge {
  color: #ffd700;
  font-size: 0.65rem;
  font-weight: 600;
  flex-shrink: 0;
}
.quest-entry-progress {
  color: #aaa;
  font-size: 0.7rem;
  text-align: right;
  flex-shrink: 0;
  margin-left: 10px;
}
.quest-progress-bar {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 2px;
}
.quest-progress-fill {
  height: 100%;
  background: #e94560;
  border-radius: 2px;
  transition: width 0.3s;
}
.quest-entry-done {
  color: #2ecc71;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 10px;
}
.quests-completed-toggle {
  color: #888;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 6px 0 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
  user-select: none;
}
.quests-completed-toggle::before {
  content: '\25B6  ';
  font-size: 0.55rem;
  vertical-align: middle;
}
.quests-completed-toggle.open::before {
  content: '\25BC  ';
}
.quests-completed-toggle:hover {
  color: #bbb;
}

/* Shop Modal */
.shop-modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}
.shop-content {
  background: #1a1a2e;
  border: 2px solid #555;
  border-radius: 8px;
  padding: 16px;
  width: 420px;
  max-height: 500px;
  overflow-y: auto;
}
.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: #ffd700;
  font-size: 16px;
  font-weight: bold;
}
.shop-close-btn {
  padding: 2px 8px;
  font-size: 12px;
}
.shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.shop-tab {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
}
.shop-tab.active {
  background: #3a3a5e;
}
.shop-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  color: #ddd;
  font-size: 12px;
}
.shop-item-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.shop-item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}
.shop-item-info {
  flex: 1;
  min-width: 0;
}
.shop-item-name {
  font-size: 12px;
  color: #eee;
}
.shop-item-stats {
  font-size: 10px;
  color: #aaa;
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.stat-badge {
  padding: 0 3px;
  border-radius: 2px;
  font-size: 9px;
}
.stat-str { color: #ff6b6b; }
.stat-armor { color: #6bb5ff; }
.stat-magic { color: #c06bff; }
.stat-spd { color: #6bff6b; }
.stat-heal { color: #ff9e6b; }
.stat-tp { color: #6bb5ff; }
.shop-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.shop-item-price {
  color: #ffd700;
  font-size: 11px;
}
.shop-buy-btn {
  padding: 2px 8px;
  font-size: 11px;
}
.shop-item.class-locked {
  opacity: 0.5;
}

/* Stat point notification badge */
.stat-points-badge {
  display: inline-block;
  margin-left: 4px;
  background: #e94560;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  padding: 0 3px;
  vertical-align: middle;
  animation: statBadgePulse 1.5s ease-in-out infinite;
}
@keyframes statBadgePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 4px rgba(233,69,96,0.5); }
  50% { transform: scale(1.15); box-shadow: 0 0 8px rgba(233,69,96,0.8); }
}

/* Item tooltip */
#item-tooltip {
  position: fixed;
  z-index: 5000;
  background: rgba(15, 15, 30, 0.95);
  border: 1px solid #555;
  border-radius: 6px;
  padding: 8px 10px;
  pointer-events: none;
  max-width: 220px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
#item-tooltip .tt-name {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 3px;
}
#item-tooltip .tt-type {
  color: #888;
  font-size: 10px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
#item-tooltip .tt-stat {
  color: #7f7;
  font-size: 10px;
}
#item-tooltip .tt-restrict {
  color: #f88;
  font-size: 9px;
  margin-top: 4px;
  font-style: italic;
}


/* Party panel (right side) */
#party-panel {
  position: fixed;
  top: 80px;
  right: 8px;
  width: 140px;
  background: rgba(10, 10, 25, 0.85);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 6px;
  z-index: 200;
  font-size: 10px;
}
#party-panel .party-title {
  color: #8af;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  text-align: center;
}
#party-panel .party-member {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
#party-panel .party-member:last-child {
  border-bottom: none;
}
#party-panel .pm-name {
  color: #ccc;
  font-weight: bold;
  font-size: 10px;
}
#party-panel .pm-info {
  color: #888;
  font-size: 8px;
}
#party-panel .pm-hp-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}
#party-panel .pm-hp-fill {
  height: 100%;
  background: #4a4;
  border-radius: 2px;
  transition: width 0.3s;
}

/* PVP zone indicator */
#pvp-indicator {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(200, 30, 30, 0.8);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 16px;
  border-radius: 4px;
  border: 1px solid #f44;
  letter-spacing: 2px;
  z-index: 300;
  animation: pvpPulse 2s ease-in-out infinite;
}
@keyframes pvpPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Arena HUD */
#arena-hud {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 310;
  pointer-events: none;
}
#arena-status {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 10px rgba(233,69,96,0.8), 2px 2px 4px rgba(0,0,0,0.8);
  letter-spacing: 3px;
}
#arena-countdown {
  font-size: 48px;
  font-weight: bold;
  color: #e94560;
  text-shadow: 0 0 20px rgba(233,69,96,0.6);
}
#arena-players {
  font-size: 12px;
  color: #aaa;
  margin-top: 4px;
}
