html, body {
  width: 100%;
  height: 100%;
  position: absolute;
  background: #000000;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  overflow: hidden;
}

/* Allow text selection in input fields within UI */
.ui input,
.ui textarea,
.ui select {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Fullscreen button in top-right corner */
.fullscreen-button {
  position: fixed;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: background 0.2s ease;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.fullscreen-button:hover {
  background: rgba(0, 0, 0, 0.7);
}

.fullscreen-button svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
  pointer-events: none;
}

.container {
  width: 100%;
  height: 100%;
  position: relative;
}

.ui {
  width: 100%;
  height: 100%;            
  position: absolute;
  top: 0;
  left: 0;
  font-family: 'Cinzel', serif;
  /* Prevent text selection on UI elements */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Allow clicks to pass through UI layer to 3D canvas, children with pointer-events: auto will still receive events */
  pointer-events: none;
}

/* Re-enable pointer events for UI elements that need interaction */
.icon-bar,
.health-ui,
.quest-journal,
.inventory,
.stats,
.guild,
.settings,
.chat-ui,
.minimap-container,
.fullmap-container,
.target-info-panel,
.login-screen,
.character-selection-screen,
.loading-screen,
.pwa-install-overlay,
.performance-monitor-panel {
  pointer-events: auto;
}

#game-ui {
  visibility: hidden;
}

#login-ui {
  visibility: hidden;
}

.login-screen {
  position: absolute;
  width: 100%;
  height: 100%;            
  top: 0;
  left: 0;
  font-family: 'Cinzel', serif;
  background-image: url('/client/resources/background-5.png');
  background-size: cover;
}

.ui.fadeOut {
  opacity: 1.0;
  animation: fadeOut 1s ease-in-out forwards;
}



@keyframes fadeOut {
  from {
    opacity: 1.0;
    visibility: visible;
  }
  to {
    opacity: 0.0;
    visibility: hidden;
  }
}

.logo {
  text-align: center;
  margin-bottom: -20px;
}

.login-screen-layout {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.login-screen-layout.window {
  min-height: 400px;
  max-height: 90vh;
  width: 500px;
  border-radius: 15px;
  border: 2px solid #4a4a4a;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 40, 60, 0.95));
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.login-button {
  height: 50px;
  width: 200px;
  border-radius: 5px;
  box-sizing: border-box;
  text-align: center;
  background-color: rgba(130, 130, 130, 0.5);
  display: inline-block;
  font-size: 1.5em;
  text-shadow: 2px 2px 5px black;
  color: white;
  margin: 5px;
  transition: all 0.2s;
}

.login-button:hover {
  color: #000000;
  background-color: rgba(255, 255, 255, 0.5);
}

.login-input {
  background: rgba(0, 0, 0, 0);
  width: 300px;
  font-size: 1.5em;
  text-shadow: 2px 2px 5px black;
  color: white;
  margin: 15px;
  display: block;
  text-align: center;
}

.login-text {
  font-size: 2.0em;
  text-shadow: 2px 2px 5px black;
  color: white;
  text-align: center;
}

#create-player-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.saved-player-button {
  height: 50px;
  width: 100%;
  border-radius: 5px;
  box-sizing: border-box;
  text-align: center;
  background-color: rgba(100, 100, 100, 0.5);
  display: block;
  font-size: 1.2em;
  text-shadow: 2px 2px 5px black;
  color: white;
  margin: 5px 0;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.saved-player-button:hover {
  color: #000000;
  background-color: rgba(255, 215, 0, 0.7);
  border-color: #ffd700;
}

.continue-existing-section {
  display: none;
  margin-top: 30px;
  width: 100%;
  text-align: center;
}

.continue-existing-title {
  margin-bottom: 15px;
  text-align: center;
}

.saved-players-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 0 30px;
}

#character-selection-ui {
  visibility: hidden;
}

.character-selection-screen {
  position: absolute;
  width: 100%;
  height: 100%;            
  top: 0;
  left: 0;
  font-family: 'Cinzel', serif;
  background-image: url('/client/resources/background-5.png');
  background-size: cover;
  background-position: center;
}

.character-selection-layout {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.character-selection-title {
  font-size: 3.5em;
  text-shadow: 3px 3px 8px black;
  color: #ffd700;
  margin-bottom: 40px;
  text-align: center;
}

.character-panels {
  display: flex;
  gap: 40px;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
}

.character-panel {
  width: 400px;
  border-radius: 10px;
  border: 3px solid #4a4a4a;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.character-panel:hover {
  border-color: #ffd700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
  transform: translateY(-5px);
}

.character-model-container {
  width: 100%;
  height: 300px;
  background: rgba(20, 20, 20, 0.5);
  border-radius: 5px;
  margin-bottom: 15px;
  border: 2px solid #333;
}

.character-name {
  font-size: 2.5em;
  text-shadow: 2px 2px 5px black;
  color: #ffd700;
  margin-bottom: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.character-name:hover {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8), 2px 2px 5px black;
}

.character-stats {
  width: 100%;
  margin-bottom: 20px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 15px;
  margin: 5px 0;
  background: rgba(40, 40, 40, 0.6);
  border-radius: 5px;
  font-size: 1.2em;
  color: white;
  text-shadow: 1px 1px 3px black;
}

.stat-label {
  font-weight: bold;
  color: #aaa;
}

.character-select-button {
  width: 100%;
  height: 50px;
  border-radius: 5px;
  box-sizing: border-box;
  text-align: center;
  background-color: rgba(130, 130, 130, 0.5);
  display: inline-block;
  font-size: 1.5em;
  text-shadow: 2px 2px 5px black;
  color: white;
  border: 2px solid #4a4a4a;
  cursor: pointer;
  transition: all 0.2s;
}

.character-select-button:hover {
  color: #000000;
  background-color: rgba(255, 215, 0, 0.7);
  border-color: #ffd700;
}

#loading-ui {
  visibility: hidden;
  z-index: 1000;
}

.loading-screen {
  position: absolute;
  width: 100%;
  height: 100%;            
  top: 0;
  left: 0;
  font-family: 'Cinzel', serif;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
}

.loading-screen-layout {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.loading-screen-layout.window {
  height: 300px;
  width: 500px;
  border-radius: 5px;
  border-color: #4a4a4a;
  border-style: solid;
  border-width: 2px;
  background: rgba(0, 0, 0, 0.85);
  padding: 30px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.loading-title {
  font-size: 2.5em;
  text-shadow: 3px 3px 8px black;
  color: #ffd700;
  margin-bottom: 30px;
  text-align: center;
}

.loading-message {
  font-size: 1.3em;
  text-shadow: 2px 2px 5px black;
  color: #ffffff;
  margin-bottom: 20px;
  text-align: center;
  min-height: 40px;
  transition: opacity 0.3s ease;
}

.loading-bar-container {
  width: 100%;
  height: 30px;
  background: rgba(50, 50, 50, 0.7);
  border-radius: 15px;
  border: 2px solid #4a4a4a;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A, #4CAF50);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: 15px;
  width: 0%;
  transition: width 0.3s ease;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-controls-panel {
  margin-top: 30px;
  padding: 20px 30px;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 5px;
  border: 2px solid #4a4a4a;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.loading-controls-title {
  font-size: 1.5em;
  text-shadow: 2px 2px 5px black;
  color: #ffd700;
  margin-bottom: 15px;
  text-align: center;
  border-bottom: 1px solid #4a4a4a;
  padding-bottom: 10px;
}

.loading-controls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.loading-control-key {
  background: rgba(50, 50, 70, 0.8);
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  padding: 4px 10px;
  color: #ffd700;
  font-size: 0.9em;
  text-shadow: 1px 1px 2px black;
  min-width: 120px;
  text-align: center;
}

.loading-control-desc {
  color: #ffffff;
  font-size: 1em;
  text-shadow: 1px 1px 2px black;
  margin-left: 20px;
  flex: 1;
  text-align: left;
}

.chat-ui {
  position: absolute;
  left: 10px;
  bottom: 10px; 
  background: rgba(1.0, 1.0, 1.0, 0.0);
  width: 400px;
  height: 200px;
  padding: 10px 10px;
  border-radius: 10px;
}

.chat-ui-text-area {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: flex-end;
}

.chat-text {
  font-size: .75em;
  text-shadow: 2px 2px 5px black;
  color: white;
}

.chat-text-server {
  color: rgb(116, 235, 87);
}

.chat-text-action {
  color: rgb(247, 20, 20);
}

.chat-input {
  background: rgba(0, 0, 0, 0);
  width: 280px;
  margin-top: 5px;
}


.quest-ui-layout {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.quest-ui {
  background: rgba(1.0, 1.0, 1.0, 0.75);
  padding: 20px 20px;
  width: 700px;
}

.quest-title {
  font-size: 3em;
  color: white;
  text-shadow: 4px 4px black;
}

.quest-text-title {
  font-size: 3em;
  color: white;
  padding-bottom: 10px;
}

.quest-text {
  font-size: 1em;
  color: white;
}

.quest-journal {
  position: absolute;
  right: 0px;
  top: 0px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border: 2px solid #4a4a4a;
  border-radius: 10px;
  margin: 30px;
  padding: 15px 20px;
  padding-top: 5px;
  width: 300px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  z-index: 500;
}

.quest-journal-title {
  font-size: 2.5em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  margin-bottom: 5px;
}

.quest-journal-coming-soon {
  font-size: 1.2em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  border: 1px dashed #4a4a4a;
  border-radius: 5px;
}

.quest-entry {
  font-size: 1.3em;
  color: white;
  text-shadow: 1px 1px 3px black;
  border: 2px solid #333;
  border-radius: 5px;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 8px;
  margin: 5px 0;
  transition: all 0.2s ease;
}

.quest-entry:hover {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.icon-bar {
  position: absolute;
  bottom: 0px;
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  z-index: 100;
  pointer-events: auto;
}

.icon-bar-item {
  background-size: cover;
  width: 75px;
  height: 75px;
  margin: 2px;
  cursor: pointer;
  pointer-events: auto;
}

.health-ui {
  position: absolute;
  top: 0px;
  left: 0px; 
  width: 25vw;
  min-width: 300px;
  max-width: 500px;
  height: 15vw;
  min-height: 180px;
  max-height: 300px;
  z-index: 1;
  background-size: contain;
  background-repeat: no-repeat;
}

.bars-container {
  position: relative;
  top: calc(43% - 70px);
  left: calc(52% - 70px);
  width: 40%;
  display: flex;
  flex-direction: column;
  gap: 0.3vw;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.5vw;
}

.bar-icon {
  width: 1.5vw;
  height: 1.5vw;
  min-width: 15px;
  min-height: 15px;
  max-width: 24px;
  max-height: 24px;
  flex-shrink: 0;
}

.health-bar-container, .stamina-bar-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 1vw;
  min-height: 15px;
  max-height: 20px;
  background: rgba(50, 50, 50, 0.7);
  border-style: solid;
  border-width: 2px;
  border-color: black;
  border-radius: 5px;
}

.health-bar, .stamina-bar {
  position: absolute;
  top: 0;
  left: 0;
  background: greenyellow;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.stamina-bar {
  background: #4da6ff;
}

.health-bar-text, .stamina-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: clamp(8px, 0.6vw, 14px);
  text-shadow: 1px 1px 2px black;
  white-space: nowrap;
  pointer-events: none;
}

.xp-bar-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 1vw;
  min-height: 15px;
  max-height: 20px;
  background: rgba(50, 50, 50, 0.7);
  border-style: solid;
  border-width: 2px;
  border-color: black;
  border-radius: 5px;
}

.xp-bar {
  background: linear-gradient(90deg, #ffd700, #ffaa00, #ffd700);
  background-size: 200% 100%;
  animation: xpShimmer 3s infinite;
  width: 0%;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

@keyframes xpShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.xp-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: clamp(8px, 0.6vw, 14px);
  text-shadow: 1px 1px 2px black;
  white-space: nowrap;
  pointer-events: none;
}

.player-level-indicator {
  position: absolute;
  top: 15%;
  left: 15%;
  background: linear-gradient(135deg, #3344aa, #2233aa);
  border: 3px solid #ffd700;
  border-radius: 50%;
  width: 3vw;
  height: 3vw;
  min-width: 40px;
  min-height: 40px;
  max-width: 60px;
  max-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  z-index: 2;
}

.player-level-text {
  color: #ffffff;
  font-size: clamp(10px, 0.8vw, 16px);
  font-weight: bold;
  text-shadow: 1px 1px 2px black;
  white-space: nowrap;
}

.stats-tooltip {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.stats-tooltip .stats-tooltiptext {
  visibility: hidden;
  width: 200px;
  background-color: black;
  opacity: 0.75;
  text-align: center;
  padding: 1em;
  border-radius: 6px;
  color: white;
  font-size: medium;
  position: absolute;
  z-index: 1;
  top: -5px;
  right: 105%;
}

.stats-tooltip:hover .stats-tooltiptext {
  visibility: visible;
}

.stats-title {
  font-size: 2.5em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  margin-bottom: 5px;
}

.stats {
  position: absolute;
  right: 0px;
  top: 0px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin: 30px;
  z-index: 500;
}

.stats-inner {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border: 2px solid #4a4a4a;
  border-radius: 10px;
  padding: 15px 20px;
  padding-top: 5px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  width: 250px;
}

.stats-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  font-size: 1.3em;
  color: white;
  text-shadow: 1px 1px 3px black;
  padding: 5px 0;
}

/* Guild Panel Styles */
.guild {
  position: absolute;
  right: 0px;
  top: 0px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin: 30px;
  z-index: 500;
}

.guild-inner {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border: 2px solid #4a4a4a;
  border-radius: 10px;
  padding: 15px 20px;
  padding-top: 5px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  width: 280px;
}

.guild-title {
  font-size: 2.5em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  margin-bottom: 5px;
}

.guild-coming-soon {
  font-size: 1.2em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  border: 1px dashed #4a4a4a;
  border-radius: 5px;
}

.inventory-title {
  font-size: 2.5em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  margin-bottom: 5px;
}

.inventory-section-label {
  font-size: 1em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  text-align: center;
  margin: 8px 0 5px 0;
  border-bottom: 1px solid #444;
  padding-bottom: 5px;
}

.inventory {
  position: absolute;
  top: 0px;
  right: 0px;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  margin: 20px;
  z-index: 500;
}

.inventory-inner {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border: 2px solid #4a4a4a;
  border-radius: 10px;
  padding: 15px 20px;
  padding-top: 5px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.inventory-row {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
}

.inventory-column {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}

.inventory-character {
  background-image: url('/client/resources/icons/ui/inventory-character.png');
  background-size: cover;
  width: 200px;
  height: 350px;
  background-color: rgba(20, 20, 20, 0.5);
  border-radius: 5px;
  border: 2px solid #333;
  overflow: hidden;
}

.inventory-item {
  border: 2px solid #333;
  border-radius: 10%;
  background-color: rgba(0, 0, 0, 0.7);
  width: 50px;
  height: 50px;
  margin: 2px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.inventory-item:hover {
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
  transform: scale(1.05);
}

.inventory-item-filled {
  background-color: rgba(50, 50, 50, 0.8);
}

.inventory-item-dragging {
  opacity: 0.5;
  transform: scale(0.95);
  border-color: #ff6600;
}

.inventory-item-dragover {
  border-color: #66ff66;
  box-shadow: 0 0 15px rgba(102, 255, 102, 0.7);
  transform: scale(1.1);
}

.inventory-item-valid-target {
  border-color: #4488ff;
  box-shadow: 0 0 8px rgba(68, 136, 255, 0.4);
}

.inventory-item-consume-target {
  border-color: #ff4444;
  box-shadow: 0 0 12px rgba(255, 68, 68, 0.6);
  animation: consumePulse 0.8s ease-in-out infinite;
}

@keyframes consumePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 68, 68, 0.4); }
  50% { box-shadow: 0 0 16px rgba(255, 68, 68, 0.8); }
}

@keyframes consumeFeedback {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1);
  }
}

/* Inventory Tooltip */
.inventory-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #ffd700;
  border-radius: 8px;
  padding: 10px 15px;
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  z-index: 10000;
  pointer-events: none;
  display: none;
  max-width: 250px;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Consume feedback animation */
.inventory-consume-feedback {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #66ff66;
  font-family: 'Cinzel', serif;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 2px 2px 4px black;
  z-index: 10000;
  pointer-events: none;
  animation: consumeFeedback 1.5s ease-out forwards;
}

/* Equipment slot styling */
.inventory-equip-slot {
  border-color: #5555aa;
  background-color: rgba(30, 30, 80, 0.7);
  position: relative;
}

.inventory-equip-slot::after {
  content: attr(title);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #888;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
}

.inventory-equip-slot:hover::after {
  opacity: 1;
}

.inventory-equip-slot:hover {
  border-color: #8866ff;
  box-shadow: 0 0 10px rgba(136, 102, 255, 0.5);
}

.inventory-equipment-row {
  margin-bottom: 10px;
}

/* Equipment slot visual differentiation */
.inventory-column .inventory-item {
  border-color: #4a4a4a;
  background-color: rgba(30, 30, 60, 0.7);
}

.inventory-column .inventory-item:hover {
  border-color: #8866ff;
  box-shadow: 0 0 10px rgba(136, 102, 255, 0.5);
}

/* Touch Controls */
.touch-joystick-container {
  position: absolute;
  bottom: 40px;
  left: 40px;
  width: 150px;
  height: 150px;
  z-index: 1000;
  pointer-events: auto;
}

.touch-joystick-base {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(100, 100, 100, 0.3) 100%);
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}

.touch-joystick-stick {
  position: absolute;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(200, 200, 200, 0.6) 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Invisible camera control area - positioned to the left of action buttons */
.touch-camera-control {
  position: absolute;
  bottom: 40px;
  right: 110px; /* To the left of action buttons (10px right margin + 80px button + 20px gap) */
  width: 150px;
  height: 280px;
  z-index: 999;
  pointer-events: auto;
  /* Invisible but touchable */
  background: transparent;
  touch-action: none;
}

.touch-actions-container {
  position: absolute;
  bottom: 40px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 1000;
  pointer-events: auto;
}

.touch-action-button {
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255, 100, 100, 0.6) 0%, rgba(150, 50, 50, 0.8) 100%);
  border: 3px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.touch-action-button:active,
.touch-action-button-active {
  background: radial-gradient(circle, rgba(255, 150, 150, 0.9) 0%, rgba(200, 100, 100, 0.9) 100%);
  transform: scale(0.95);
  box-shadow: 0 0 30px rgba(255, 100, 100, 0.8);
}

.touch-action-label {
  font-family: 'Cinzel', serif;
  color: white;
  font-size: 14px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

#touch-run-button {
  background: radial-gradient(circle, rgba(100, 255, 100, 0.6) 0%, rgba(50, 150, 50, 0.8) 100%);
}

#touch-run-button:active,
#touch-run-button.touch-action-button-active {
  background: radial-gradient(circle, rgba(150, 255, 150, 0.9) 0%, rgba(100, 200, 100, 0.9) 100%);
  box-shadow: 0 0 30px rgba(100, 255, 100, 0.8);
}

#touch-dance-button {
  background: radial-gradient(circle, rgba(100, 100, 255, 0.6) 0%, rgba(50, 50, 150, 0.8) 100%);
}

#touch-dance-button:active,
#touch-dance-button.touch-action-button-active {
  background: radial-gradient(circle, rgba(150, 150, 255, 0.9) 0%, rgba(100, 100, 200, 0.9) 100%);
  box-shadow: 0 0 30px rgba(100, 100, 255, 0.8);
}

/* Minimap Styles */
.minimap-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 300px;
  height: 300px;
  z-index: 100;
  border-radius: 10px;
  overflow: visible;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
}

.minimap-canvas {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

/* Minimap expand button (triangle in bottom-left corner) */
.minimap-expand-button {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 215, 0, 0.8);
  border-radius: 5px;
  color: #ffd700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 101;
}

.minimap-expand-button:hover {
  background: rgba(255, 215, 0, 0.3);
  transform: scale(1.1);
}

/* Full Map Overlay Styles */
.fullmap-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fullmap-canvas {
  border: 3px solid rgba(255, 215, 0, 0.8);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
  max-width: 90vw;
  max-height: 90vh;
}

/* Full map close button (top-right corner) */
.fullmap-close-button {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 215, 0, 0.8);
  border-radius: 50%;
  color: #ffd700;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: sans-serif;
}

.fullmap-close-button:hover {
  background: rgba(255, 215, 0, 0.3);
  transform: scale(1.1);
}

/* Settings Panel Styles */
.settings {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.settings-inner {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.95), rgba(40, 40, 60, 0.95));
  border: 2px solid #4a4a4a;
  border-radius: 15px;
  padding: 25px 35px;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.settings-title {
  font-size: 2.2em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #4a4a4a;
}

/* Settings Tab Navigation */
.settings-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  border-bottom: 2px solid #4a4a4a;
  padding-bottom: 0;
}

.settings-tab {
  padding: 10px 15px;
  background: rgba(40, 40, 60, 0.6);
  border: 2px solid #4a4a4a;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  color: #aaaaaa;
  font-family: 'Cinzel', serif;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  bottom: -2px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-tab:hover {
  background: rgba(60, 60, 80, 0.8);
  color: #ffffff;
}

.settings-tab.active {
  background: linear-gradient(135deg, rgba(80, 70, 0, 0.8), rgba(100, 90, 0, 0.8));
  border-color: #ffd700;
  color: #ffd700;
}

/* Settings Tab Content */
.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

/* Settings Controls List (for Controls tab) */
.settings-controls-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.settings-control-key {
  background: rgba(50, 50, 70, 0.8);
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  padding: 6px 12px;
  color: #ffd700;
  font-size: 0.9em;
  text-shadow: 1px 1px 2px black;
  min-width: 140px;
  text-align: center;
}

.settings-control-desc {
  color: #ffffff;
  font-size: 1em;
  text-shadow: 1px 1px 2px black;
  margin-left: 15px;
  flex: 1;
  text-align: left;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section-title {
  font-size: 1.3em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  margin-bottom: 12px;
  padding-bottom: 5px;
  border-bottom: 1px solid #333;
}

.settings-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
}

.settings-label {
  flex: 0 0 140px;
  color: white;
  font-size: 1em;
  text-shadow: 1px 1px 2px black;
}

.settings-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(50, 50, 70, 0.8);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
  transition: all 0.2s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.settings-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.settings-value {
  flex: 0 0 45px;
  color: #ffd700;
  font-size: 0.9em;
  text-align: right;
  text-shadow: 1px 1px 2px black;
}

.settings-text-input {
  flex: 1;
  background: rgba(30, 30, 50, 0.9);
  border: 2px solid #4a4a4a;
  border-radius: 5px;
  padding: 8px 12px;
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 1em;
  outline: none;
  transition: border-color 0.2s;
}

.settings-text-input:focus {
  border-color: #ffd700;
}

.settings-text-input::placeholder {
  color: #666;
}

.settings-checkbox {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #ffd700;
}

.settings-select {
  flex: 1;
  background: rgba(30, 30, 50, 0.9);
  border: 2px solid #4a4a4a;
  border-radius: 5px;
  padding: 8px 12px;
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 1em;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  /* Ensure proper touch interaction on mobile */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-select:focus {
  border-color: #ffd700;
}

.settings-select option {
  background: #2a2a3a;
  color: white;
}

.settings-placeholder-badge {
  background: rgba(100, 100, 100, 0.6);
  color: #888;
  font-size: 0.7em;
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 5px;
}

.settings-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #4a4a4a;
}

.settings-button {
  padding: 10px 20px;
  background: rgba(60, 60, 80, 0.8);
  border: 2px solid #4a4a4a;
  border-radius: 5px;
  color: white;
  font-family: 'Cinzel', serif;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-button:hover {
  background: rgba(80, 80, 100, 0.9);
  border-color: #666;
}

.settings-button-primary {
  background: linear-gradient(135deg, rgba(100, 80, 0, 0.8), rgba(150, 120, 0, 0.8));
  border-color: #ffd700;
}

.settings-button-primary:hover {
  background: linear-gradient(135deg, rgba(130, 100, 0, 0.9), rgba(180, 140, 0, 0.9));
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

/* Floating damage number animation */
@keyframes damageFeedback {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1);
  }
}

/* Floating damage feedback (same pattern as heal feedback) */
.floating-damage-feedback {
  position: fixed;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 2px 2px 4px black;
  z-index: 10000;
  pointer-events: none;
  animation: damageFeedback 1.5s ease-out forwards;
}

/* Orange/yellow color for player-dealt damage */
.damage-number-player {
  color: #ffaa00;
}

/* Red color for enemy-dealt damage */
.damage-number-enemy {
  color: #ff4444;
}

/* Blue color for water damage */
.damage-number-water {
  color: #4488ff;
}

/* Orange color for blocked attacks */
.damage-number-blocked {
  color: #ff8800;
  font-size: 32px;
}

/* Vibrant blue color for critical hits */
.damage-number-critical {
  color: #00ccff;
  font-size: 32px;
  text-shadow: 0 0 10px #00ccff, 2px 2px 4px black;
}

/* Floating item pickup text animation */
@keyframes itemPickupFeedback {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1);
  }
}

/* Floating item pickup feedback */
.floating-item-pickup {
  position: fixed;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 2px 2px 4px black;
  z-index: 10000;
  pointer-events: none;
  animation: itemPickupFeedback 1.5s ease-out forwards;
  color: #44ff44;
}

/* Floating XP gain text animation */
@keyframes xpGainFeedback {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1);
  }
}

/* Floating XP gain feedback */
.floating-xp-gain {
  position: fixed;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 32px;
  font-weight: bold;
  text-shadow: 2px 2px 4px black;
  z-index: 10000;
  pointer-events: none;
  animation: xpGainFeedback 1.5s ease-out forwards;
  color: #ffd700;
}

/* Level Up notification animation */
@keyframes levelUpFeedback {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -80%) scale(1);
  }
}

/* Level Up notification */
.floating-level-up {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Cinzel', serif;
  font-size: 48px;
  font-weight: bold;
  text-shadow: 3px 3px 6px black, 0 0 20px rgba(255, 215, 0, 0.8);
  z-index: 10001;
  pointer-events: none;
  animation: levelUpFeedback 2.5s ease-out forwards;
  color: #ffd700;
  text-align: center;
}

.level-up-sub-text {
  font-size: 24px;
  color: #ffffff;
  display: block;
  margin-top: 10px;
}

/* Performance Monitor Panel */
.performance-monitor-panel {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 8px;
  padding: 10px;
  font-family: 'Courier New', monospace;
  color: #00ff00;
  z-index: 10003;
  min-width: 200px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  user-select: none;
}

.performance-monitor-title {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  color: #ffd700;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.performance-monitor-stats {
  margin-bottom: 8px;
}

.performance-monitor-info {
  font-size: 11px;
  line-height: 1.4;
  color: #ffffff;
}

.performance-monitor-info-row {
  margin: 4px 0;
}

.performance-monitor-hint {
  font-size: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 8px;
  font-style: italic;
}

/* PWA Install Dialog Styles */
.pwa-install-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: 'Cinzel', serif;
  backdrop-filter: blur(5px);
}

.pwa-install-overlay.visible {
  display: flex;
}

.pwa-install-dialog {
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.98), rgba(40, 40, 60, 0.98));
  border: 3px solid #ffd700;
  border-radius: 15px;
  padding: 25px 35px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.3), 0 0 100px rgba(0, 0, 0, 0.8);
  animation: pwaDialogSlideIn 0.3s ease-out;
}

@keyframes pwaDialogSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-install-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #4a4a4a;
}

.pwa-install-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.pwa-install-title {
  font-size: 1.6em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
}

.pwa-install-body {
  margin-bottom: 20px;
}

.pwa-install-description {
  color: #ffffff;
  font-size: 1.1em;
  margin-bottom: 15px;
  text-shadow: 1px 1px 2px black;
}

.pwa-install-benefits {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pwa-install-benefits li {
  color: #cccccc;
  font-size: 1em;
  padding: 8px 0;
  border-bottom: 1px solid rgba(74, 74, 74, 0.5);
}

.pwa-install-benefits li:last-child {
  border-bottom: none;
}

.pwa-ios-steps {
  padding-left: 20px;
  margin: 0;
}

.pwa-ios-steps li {
  color: #cccccc;
  font-size: 1em;
  padding: 10px 0;
  line-height: 1.5;
}

.pwa-ios-steps strong {
  color: #ffd700;
}

.pwa-ios-share-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: #007AFF;
  color: white;
  border-radius: 4px;
  text-align: center;
  line-height: 24px;
  font-size: 14px;
  vertical-align: middle;
  margin-left: 5px;
}

.pwa-install-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #4a4a4a;
}

.pwa-install-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-family: 'Cinzel', serif;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid;
}

.pwa-install-btn-secondary {
  background: rgba(60, 60, 80, 0.8);
  border-color: #4a4a4a;
  color: #aaaaaa;
}

.pwa-install-btn-secondary:hover {
  background: rgba(80, 80, 100, 0.9);
  border-color: #666;
  color: white;
}

.pwa-install-btn-primary {
  background: linear-gradient(135deg, rgba(100, 80, 0, 0.8), rgba(150, 120, 0, 0.8));
  border-color: #ffd700;
  color: #ffd700;
}

.pwa-install-btn-primary:hover {
  background: linear-gradient(135deg, rgba(130, 100, 0, 0.9), rgba(180, 140, 0, 0.9));
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  color: white;
}

/* Settings installed text */
.settings-installed-text {
  color: #4CAF50;
  font-size: 1em;
  text-align: center;
  padding: 10px;
  text-shadow: 1px 1px 2px black;
}

/* Mobile responsive adjustments for PWA dialog 
   Uses max-height to also capture mobile landscape */
@media (max-width: 480px), 
       ((hover: none) and (pointer: coarse) and (max-height: 480px)) {
  .pwa-install-dialog {
    padding: 20px;
  }
  
  .pwa-install-title {
    font-size: 1.3em;
  }
  
  .pwa-install-icon {
    width: 48px;
    height: 48px;
  }
  
  .pwa-install-footer {
    flex-direction: column;
  }
  
  .pwa-install-btn {
    width: 100%;
    text-align: center;
  }
}

/* Target Info Panel Styles */
.target-info-panel {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  visibility: hidden;
  z-index: 100;
  pointer-events: none;
}

.target-info-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 60, 0.9));
  border: 2px solid #ffcc00;
  border-radius: 10px;
  padding: 12px 25px;
  min-width: 200px;
  box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
}

.target-name {
  font-size: 1.5em;
  color: #ffcc00;
  text-shadow: 2px 2px 4px black;
  margin-bottom: 5px;
}

.target-level {
  font-size: 0.9em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  margin-bottom: 3px;
}

.target-health-container {
  position: relative;
  width: 180px;
  height: 16px;
  background: rgba(50, 50, 50, 0.7);
  border: 2px solid #333;
  border-radius: 8px;
  overflow: hidden;
}

.target-health-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4444, #ff6666);
  transition: width 0.3s ease;
  border-radius: 6px;
}

.target-health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 10px;
  text-shadow: 1px 1px 2px black;
  white-space: nowrap;

}

/* Character Portrait Styles */
.character-portrait-container {
  position: absolute;
  top: 5%;
  left: 3%;
  width: 35%;
  aspect-ratio: 1;
  max-width: 140px;
  max-height: 140px;
  min-width: 80px;
  min-height: 80px;
  border-radius: 50%;
  border: 3px solid #4a4a4a;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 3;
}

.character-portrait-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* ========================================
   RESPONSIVE STYLES - Account Name Screen
   ======================================== */

/* Prevent scrolling on login screen - make it fit the viewport */
.login-screen {
  overflow: hidden;
}

.login-screen-layout {
  overflow: hidden;
}

/* Make the window responsive and fit within viewport */
.login-screen-layout.window {
  min-height: auto;
  max-height: calc(100vh - 40px);
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
}

/* Scrollable saved players list with styled scrollbar */
.saved-players-list {
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ffd700 rgba(50, 50, 50, 0.5);
  -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}

.saved-players-list::-webkit-scrollbar {
  width: 8px;
}

.saved-players-list::-webkit-scrollbar-track {
  background: rgba(50, 50, 50, 0.5);
  border-radius: 4px;
}

.saved-players-list::-webkit-scrollbar-thumb {
  background: #ffd700;
  border-radius: 4px;
}

.saved-players-list::-webkit-scrollbar-thumb:hover {
  background: #ffcc00;
}

/* ========================================
   RESPONSIVE STYLES - Character Selection
   ======================================== */

/* Prevent scrolling on character selection screen */
.character-selection-screen {
  overflow: hidden;
}

.character-selection-layout {
  overflow: hidden;
  box-sizing: border-box;
  padding: 10px;
}

/* ========================================
   RESPONSIVE STYLES - Loading Screen
   ======================================== */

/* Prevent scrolling on loading screen */
.loading-screen {
  overflow: hidden;
}

/* Make loading panels same width */
.loading-screen-layout.window,
.loading-controls-panel {
  width: 500px;
  max-width: calc(100vw - 40px);
  box-sizing: border-box;
}

/* ========================================
   ROTATE DEVICE PROMPT (Mobile)
   ======================================== */

.rotate-device-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10001;
  font-family: 'Cinzel', serif;
}

.rotate-device-icon {
  font-size: 80px;
  margin-bottom: 20px;
  animation: rotateDeviceAnim 2s ease-in-out infinite;
}

@keyframes rotateDeviceAnim {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

.rotate-device-text {
  font-size: 1.5em;
  color: #ffd700;
  text-shadow: 2px 2px 4px black;
  text-align: center;
  padding: 0 20px;
}

.rotate-device-subtext {
  font-size: 1em;
  color: #aaaaaa;
  text-shadow: 1px 1px 2px black;
  text-align: center;
  margin-top: 10px;
  padding: 0 20px;
}

/* ========================================
   MOBILE STYLES
   Uses max-height: 768px to capture mobile in BOTH orientations
   (in landscape, height is the constraining dimension)
   Combined with touch device detection via hover: none
   ======================================== */

@media (max-width: 768px), 
       ((hover: none) and (pointer: coarse) and (max-height: 768px)) {
  /* === Fullscreen Button Mobile - Larger touch target === */
  .fullscreen-button {
    width: 44px;
    height: 44px;
    padding: 10px;
  }
  
  .fullscreen-button svg {
    width: 24px;
    height: 24px;
  }
  
  /* === Login Screen Mobile === */
  .logo-image {
    width: 280px;
    max-width: 80vw;
  }
  
  .logo {
    margin-bottom: -30px;
  }
  
  .login-screen-layout.window {
    width: 90vw;
    max-width: 400px;
    padding: 15px;
    max-height: calc(100vh - 20px);
  }
  
  .login-text {
    font-size: 1.5em;
  }
  
  .login-input {
    width: 100%;
    max-width: 260px;
    font-size: 1.2em;
    margin: 10px auto;
  }
  
  .login-button {
    width: 160px;
    height: 44px;
    font-size: 1.2em;
  }
  
  .continue-existing-title {
    font-size: 1.2em;
  }
  
  .saved-players-list {
    max-height: 120px;
    padding: 0 15px;
  }
  
  .saved-player-button {
    height: 44px;
    font-size: 1em;
  }
  
  /* === Character Selection Mobile === */
  .character-selection-title {
    font-size: 2em;
    margin-bottom: 15px;
  }
  
  .character-panels {
    gap: 15px;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow: hidden;
    max-width: 100%;
  }
  
  .character-panel {
    width: calc(50vw - 20px);
    max-width: 200px;
    min-width: 140px;
    padding: 10px;
  }
  
  .character-model-container {
    height: 120px;
    margin-bottom: 8px;
  }
  
  .character-name {
    font-size: 1.2em;
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: rgba(130, 130, 130, 0.5);
    border: 2px solid #4a4a4a;
    border-radius: 5px;
  }
  
  .character-name:hover,
  .character-name:active {
    color: #000000;
    background-color: rgba(255, 215, 0, 0.7);
    border-color: #ffd700;
  }
  
  .character-stats {
    margin-bottom: 10px;
  }
  
  .stat-row {
    padding: 4px 8px;
    margin: 2px 0;
    font-size: 0.75em;
  }
  
  /* Hide select button on mobile - character name is clickable */
  .character-select-button {
    display: none;
  }
  
  /* === Loading Screen Mobile === */
  .loading-screen-layout.window {
    height: auto;
    min-height: 200px;
    padding: 20px;
  }
  
  .loading-title {
    font-size: 1.8em;
    margin-bottom: 20px;
  }
  
  .loading-message {
    font-size: 1em;
    margin-bottom: 15px;
    min-height: 30px;
  }
  
  .loading-controls-panel {
    padding: 15px 20px;
    margin-top: 20px;
  }
  
  .loading-controls-title {
    font-size: 1.2em;
    margin-bottom: 10px;
  }
  
  .loading-control-key {
    min-width: 80px;
    font-size: 0.8em;
    padding: 3px 6px;
  }
  
  .loading-control-desc {
    font-size: 0.85em;
    margin-left: 10px;
  }
  
  /* === Mobile Menu Panels Z-Index Fix ===
     Ensure panels appear above touch action buttons (Attack, Run, Dance)
     Touch action buttons have z-index: 1000, so panels need z-index: 1001 */
  .stats,
  .quest-journal,
  .guild,
  .inventory,
  .minimap-container,
  .fullmap-container {
    z-index: 1001;
  }

  /* === Minimap Mobile - 1/3 Size (100px vs 300px desktop) === */
  .minimap-container {
    width: 100px;
    height: 100px;
    bottom: 10px;
    right: 10px;
  }
  
  .minimap-expand-button {
    width: 24px;
    height: 24px;
    font-size: 12px;
    bottom: 4px;
    left: 4px;
  }
  
  /* === Hide Player Avatar on Mobile === */
  .character-portrait-container {
    display: none;
  }
  
  /* === Icon Bar Touch Fix for Mobile === */
  .icon-bar {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .icon-bar-item {
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* === Mobile Health UI - Move left 20px === */
  .health-ui {
    left: -20px;
  }
  
  /* === Mobile Player Level Indicator - 10px from top and left of screen ===
     Using position: fixed to position relative to viewport, not parent container */
  .player-level-indicator {
    position: fixed;
    top: 10px;
    left: 10px;
  }
  
  /* === Mobile Joystick - Vertically centered, 10px from left edge === */
  .touch-joystick-container {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    left: 10px;
  }
  
  /* === Mobile Action Buttons - 10px from right edge === */
  .touch-actions-container {
    right: 10px;
  }
  
  /* === Mobile Camera Control - Position to left of action buttons === */
  .touch-camera-control {
    right: 110px; /* 10px margin + 80px button width + 20px gap */
  }
  
  /* === Mobile Chat - Below joystick, 60% width === */
  .chat-ui {
    width: 60%;
    max-width: 240px;
    left: 10px;
    bottom: 10px;
    height: auto;
    max-height: 120px;
  }
  
  /* === Mobile Chat - Show only last 8 lines === */
  .chat-ui-text-area {
    max-height: 100px;
    overflow: hidden;
  }
  
  .chat-ui-text-area .chat-text:nth-last-child(n+9) {
    display: none;
  }
  
  /* === Compact Target Info Panel for Mobile - One-liner === */
  .target-info-panel {
    top: 10px;
    width: 90%;
    max-width: 320px;
  }
  
  .target-info-inner {
    flex-direction: row;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    min-width: auto;
  }
  
  .target-name {
    font-size: 1em;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
  }
  
  .target-level {
    font-size: 0.75em;
    margin-bottom: 0;
    white-space: nowrap;
  }
  
  .target-health-container {
    width: 100px;
    height: 12px;
    flex-shrink: 0;
  }
  
  .target-health-text {
    font-size: 8px;
  }
}

/* ========================================
   MOBILE LANDSCAPE STYLES
   Uses orientation: landscape with max-height to detect mobile landscape
   Note: These are more specific layout adjustments for landscape orientation
   ======================================== */

@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  /* === Login Screen Landscape === */
  .logo-image {
    width: 200px;
  }
  
  .logo {
    margin-bottom: -40px;
  }
  
  .login-screen-layout.window {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-height: calc(100vh - 20px);
    padding: 10px 20px;
    width: auto;
    max-width: 90vw;
  }
  
  #create-player-section {
    margin-right: 20px;
  }
  
  .continue-existing-section {
    margin-top: 0;
    max-width: 200px;
  }
  
  .login-text {
    font-size: 1.3em;
  }
  
  .login-input {
    margin: 8px;
    font-size: 1.1em;
    width: 200px;
  }
  
  .login-button {
    height: 40px;
    font-size: 1.1em;
    width: 160px;
  }
  
  .saved-players-list {
    max-height: 80px;
    padding: 0 10px;
  }
  
  .saved-player-button {
    height: 36px;
    font-size: 0.9em;
  }
  
  /* === Character Selection Landscape Mobile === */
  .character-selection-layout {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 5px;
  }
  
  .character-selection-title {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.3em;
    margin-bottom: 0;
  }
  
  .character-panels {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
    margin-top: 30px;
    max-height: calc(100vh - 50px);
  }
  
  .character-panel {
    width: calc(50vw - 30px);
    max-width: 300px;
    min-width: 180px;
    padding: 8px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  .character-model-container {
    height: 80px;
    min-height: 60px;
    flex-shrink: 1;
    margin-bottom: 5px;
  }
  
  .character-name {
    font-size: 1em;
    margin-bottom: 5px;
    padding: 6px 10px;
    background-color: rgba(130, 130, 130, 0.5);
    border: 2px solid #4a4a4a;
    border-radius: 5px;
    flex-shrink: 0;
  }
  
  .character-name:hover,
  .character-name:active {
    color: #000000;
    background-color: rgba(255, 215, 0, 0.7);
    border-color: #ffd700;
  }
  
  .character-stats {
    margin-bottom: 5px;
    flex-shrink: 0;
  }
  
  .stat-row {
    padding: 2px 6px;
    margin: 1px 0;
    font-size: 0.65em;
  }
  
  /* Hide select button on mobile landscape - character name is clickable */
  .character-select-button {
    display: none;
  }
  
  /* === Loading Screen Landscape === */
  .loading-screen-layout {
    flex-direction: row;
    gap: 20px;
  }
  
  .loading-screen-layout.window {
    height: auto;
    min-height: auto;
    width: auto;
    max-width: 45vw;
    padding: 15px;
  }
  
  .loading-controls-panel {
    margin-top: 0;
    width: auto;
    max-width: 45vw;
    padding: 15px;
  }
  
  .loading-title {
    font-size: 1.5em;
    margin-bottom: 15px;
  }
  
  .loading-message {
    font-size: 0.9em;
    min-height: 25px;
    margin-bottom: 10px;
  }
  
  .loading-controls-title {
    font-size: 1em;
    margin-bottom: 8px;
    padding-bottom: 5px;
  }
  
  .loading-control-row {
    padding: 2px 0;
  }
  
  .loading-control-key {
    min-width: 70px;
    font-size: 0.75em;
    padding: 2px 5px;
  }
  
  .loading-control-desc {
    font-size: 0.8em;
    margin-left: 8px;
  }
  
  /* === Mobile Landscape Menu Panels Z-Index Fix ===
     Ensure panels appear above touch action buttons (Attack, Run, Dance)
     Touch action buttons have z-index: 1000, so panels need z-index: 1001 */
  .stats,
  .quest-journal,
  .guild,
  .inventory,
  .minimap-container,
  .fullmap-container {
    z-index: 1001;
  }

  /* === Minimap Landscape Mobile - 1/3 Size === */
  .minimap-container {
    width: 100px;
    height: 100px;
    bottom: 8px;
    right: 8px;
  }
  
  .minimap-expand-button {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  /* === Hide Player Avatar on Mobile Landscape === */
  .character-portrait-container {
    display: none;
  }

  /* === Icon Bar Touch Fix for Mobile Landscape === */
  .icon-bar {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  
  .icon-bar-item {
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* === Mobile Landscape Health UI - Move left 20px === */
  .health-ui {
    left: -20px;
  }
  
  /* === Mobile Landscape Player Level Indicator - 10px from top and left of screen ===
     Using position: fixed to position relative to viewport, not parent container */
  .player-level-indicator {
    position: fixed;
    top: 10px;
    left: 10px;
  }
  
  /* === Mobile Landscape Joystick - Vertically centered, 10px from left edge === */
  .touch-joystick-container {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    left: 10px;
  }
  
  /* === Mobile Landscape Action Buttons - 10px from right edge === */
  .touch-actions-container {
    right: 10px;
  }
  
  /* === Mobile Landscape Camera Control - Position to left of action buttons === */
  .touch-camera-control {
    right: 110px; /* 10px margin + 80px button width + 20px gap */
  }
  
  /* === Mobile Landscape Chat - Below joystick, 60% width === */
  .chat-ui {
    width: 60%;
    max-width: 240px;
    left: 10px;
    bottom: 10px;
    height: auto;
    max-height: 100px;
  }
  
  /* === Mobile Landscape Chat - Show only last 8 lines === */
  .chat-ui-text-area {
    max-height: 80px;
    overflow: hidden;
  }
  
  .chat-ui-text-area .chat-text:nth-last-child(n+9) {
    display: none;
  }
  
  /* === Compact Target Info Panel for Mobile Landscape - One-liner === */
  .target-info-panel {
    top: 8px;
    width: 90%;
    max-width: 280px;
  }
  
  .target-info-inner {
    flex-direction: row;
    align-items: center;
    padding: 4px 10px;
    gap: 6px;
    min-width: auto;
  }
  
  .target-name {
    font-size: 0.9em;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
  }
  
  .target-level {
    font-size: 0.7em;
    margin-bottom: 0;
    white-space: nowrap;
  }
  
  .target-health-container {
    width: 80px;
    height: 10px;
    flex-shrink: 0;
  }
  
  .target-health-text {
    font-size: 7px;
  }
}

/* ========================================
   SMALL MOBILE (max-width: 480px) - Portrait
   ======================================== */

@media (max-width: 480px) and (orientation: portrait) {
  .logo-image {
    width: 220px;
  }
  
  .logo {
    margin-bottom: -35px;
  }
  
  .login-screen-layout.window {
    padding: 12px;
    max-height: calc(100vh - 15px);
  }
  
  .login-text {
    font-size: 1.3em;
  }
  
  .login-input {
    font-size: 1.1em;
    margin: 8px auto;
  }
  
  .login-button {
    width: 140px;
    height: 40px;
    font-size: 1.1em;
  }
  
  .continue-existing-section {
    margin-top: 20px;
  }
  
  .continue-existing-title {
    font-size: 1em;
  }
  
  .saved-players-list {
    max-height: 100px;
    padding: 0 10px;
  }
  
  .saved-player-button {
    height: 40px;
    font-size: 0.9em;
  }
  
  /* Character panels even smaller on tiny screens */
  .character-panel {
    width: calc(50vw - 15px);
    min-width: 130px;
    padding: 8px;
  }
  
  .character-model-container {
    height: 100px;
  }
  
  .character-name {
    font-size: 1em;
  }
  
  .stat-row {
    font-size: 0.65em;
    padding: 3px 6px;
  }
  
  /* Hide select button on small mobile - character name is clickable */
  .character-select-button {
    display: none;
  }
  
  /* Loading screen adjustments */
  .loading-title {
    font-size: 1.5em;
  }
  
  .loading-message {
    font-size: 0.9em;
  }
  
  /* Minimap 1/3 size on tiny screens */
  .minimap-container {
    width: 100px;
    height: 100px;
  }
}

/* ========================================
   DESKTOP RESPONSIVE (ensure no scrolling)
   ======================================== */

@media (min-width: 769px) {
  /* Ensure character selection fits on desktop */
  .character-selection-layout {
    max-height: 100vh;
    justify-content: center;
  }
  
  .character-panels {
    max-height: calc(100vh - 150px);
  }
  
  .character-panel {
    max-height: calc(100vh - 180px);
    overflow: hidden;
  }
  
  /* Scale down if viewport is shorter */
  @media (max-height: 800px) {
    .character-selection-title {
      font-size: 2.5em;
      margin-bottom: 20px;
    }
    
    .character-model-container {
      height: 200px;
    }
    
    .character-name {
      font-size: 1.8em;
      margin-bottom: 10px;
    }
    
    .stat-row {
      padding: 5px 12px;
      font-size: 1em;
    }
    
    .character-select-button {
      height: 40px;
      font-size: 1.2em;
    }
  }
  
  @media (max-height: 650px) {
    .character-selection-title {
      font-size: 2em;
      margin-bottom: 15px;
    }
    
    .character-model-container {
      height: 150px;
    }
    
    .character-name {
      font-size: 1.5em;
      margin-bottom: 8px;
    }
    
    .stat-row {
      padding: 4px 10px;
      margin: 3px 0;
      font-size: 0.9em;
    }
    
    .character-select-button {
      height: 36px;
      font-size: 1em;
    }
    
    .character-panel {
      padding: 12px;
    }
  }
}

/* ========================================
   MOBILE SETTINGS PANEL - Full-screen with tabs
   ======================================== */

@media (max-width: 768px), 
       ((hover: none) and (pointer: coarse) and (max-height: 768px)) {
  /* Mobile Settings - Full screen overlay */
  .settings {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
  }
  
  .settings-inner {
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-width: auto;
    border-radius: 0;
    border: none;
    padding: 15px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .settings-title {
    font-size: 1.6em;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }
  
  /* Mobile tabs styling */
  .settings-tabs {
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 15px;
  }
  
  .settings-tab {
    padding: 8px 12px;
    font-size: 0.8em;
    flex: 1 1 auto;
    min-width: 70px;
    text-align: center;
  }
  
  .settings-section-title {
    font-size: 1.1em;
    margin-bottom: 8px;
  }
  
  .settings-row {
    margin-bottom: 8px;
    gap: 8px;
  }
  
  .settings-label {
    flex: 0 0 100px;
    font-size: 0.85em;
  }
  
  .settings-value {
    flex: 0 0 40px;
    font-size: 0.8em;
  }
  
  .settings-checkbox {
    width: 28px;
    height: 28px;
  }
  
  /* Mobile controls styling */
  .settings-control-key {
    min-width: 100px;
    font-size: 0.8em;
    padding: 5px 8px;
  }
  
  .settings-control-desc {
    font-size: 0.85em;
    margin-left: 10px;
  }
  
  .settings-buttons {
    margin-top: 10px;
    padding-top: 10px;
  }
  
  .settings-button {
    padding: 12px 16px;
    font-size: 0.9em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Mobile Settings - Landscape layout with tabs */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  /* Landscape settings - 50% width positioned on the right */
  .settings {
    left: auto;
    right: 0;
    width: 50%;
    justify-content: flex-end;
  }
  
  .settings-inner {
    display: flex;
    flex-direction: column;
    padding: 10px 20px;
  }
  
  .settings-title {
    font-size: 1.4em;
    margin-bottom: 8px;
    padding-bottom: 5px;
  }
  
  /* Landscape tabs - more compact */
  .settings-tabs {
    margin-bottom: 10px;
    gap: 3px;
  }
  
  .settings-tab {
    padding: 6px 10px;
    font-size: 0.75em;
    min-width: 60px;
  }
  
  /* Landscape sections - no multi-column for tabs */
  .settings-sections-container {
    display: block;
    flex: 1;
  }
  
  .settings-section {
    margin-bottom: 10px;
  }
  
  .settings-section-title {
    font-size: 1em;
    margin-bottom: 6px;
  }
  
  .settings-row {
    margin-bottom: 6px;
    gap: 6px;
  }
  
  .settings-label {
    flex: 0 0 80px;
    font-size: 0.75em;
  }
  
  .settings-value {
    flex: 0 0 35px;
    font-size: 0.75em;
  }
  
  .settings-slider {
    height: 6px;
  }
  
  .settings-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
  }
  
  .settings-checkbox {
    width: 22px;
    height: 22px;
  }
  
  .settings-select {
    padding: 6px 8px;
    font-size: 0.85em;
  }
  
  .settings-text-input {
    padding: 6px 8px;
    font-size: 0.85em;
  }
  
  /* Landscape controls tab - two column layout */
  .settings-controls-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
  }
  
  .settings-control-row {
    padding: 4px 0;
  }
  
  .settings-control-key {
    min-width: 70px;
    font-size: 0.75em;
    padding: 3px 5px;
  }
  
  .settings-control-desc {
    font-size: 0.75em;
    margin-left: 6px;
  }
  
  .settings-buttons {
    margin-top: 8px;
    padding-top: 8px;
  }
  
  .settings-button {
    padding: 8px 14px;
    font-size: 0.85em;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ========================================
   MOBILE INVENTORY - Compact without character model
   ======================================== */

@media (max-width: 768px), 
       ((hover: none) and (pointer: coarse) and (max-height: 768px)) {
  /* Mobile Inventory - Compact half-width panel */
  .inventory {
    position: fixed;
    top: 0;
    right: 0;
    margin: 10px;
    z-index: 1001;
  }
  
  .inventory-inner {
    width: calc(50vw - 20px);
    max-width: 200px;
    min-width: 160px;
    padding: 10px;
    box-sizing: border-box;
  }
  
  .inventory-title {
    font-size: 1.4em;
    margin-bottom: 5px;
  }
  
  .inventory-section-label {
    font-size: 0.8em;
    margin: 5px 0 3px 0;
  }
  
  /* Hide the character model section entirely on mobile */
  .inventory-character {
    display: none !important;
  }
  
  /* Reorganize equipment row without character in center */
  .inventory-equipment-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 5px;
  }
  
  .inventory-equipment-row .inventory-column {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  /* Smaller inventory items on mobile */
  .inventory-item {
    width: 36px;
    height: 36px;
    margin: 2px;
  }
  
  /* Backpack section - horizontal scrolling */
  .inventory-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .inventory-row::-webkit-scrollbar {
    display: none;
  }
  
  /* Ensure items don't shrink */
  .inventory-row .inventory-item {
    flex-shrink: 0;
  }
}

/* Mobile Inventory - Landscape adjustments */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (max-height: 600px) {
  .inventory {
    margin: 5px;
  }
  
  .inventory-inner {
    width: calc(40vw - 10px);
    max-width: 180px;
    min-width: 140px;
    padding: 8px;
  }
  
  .inventory-title {
    font-size: 1.2em;
  }
  
  .inventory-item {
    width: 32px;
    height: 32px;
    margin: 1px;
  }
}
