* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  background: linear-gradient(135deg, #0a0612 0%, #1a0f2e 50%, #0d0a1a 100%);
  color: #e8d4a0;
  overflow: hidden;
  height: 100vh;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  max-width: 100vw;
}

.screen {
  display: none;
  width: 100vw;
  height: 100vh;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.screen.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

#game {
  display: none !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
}

#game.active {
  display: flex !important;
}

#game .game-container {
  width: 100%;
  height: 100%;
}

/* Splash Screen */
.splash-container {
  text-align: center;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, rgba(10, 6, 30, 0.95), rgba(40, 20, 60, 0.9));
  position: relative;
  overflow: hidden;
}

.splash-container::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(138, 103, 255, 0.15), transparent);
  border-radius: 50%;
  top: -100px;
  right: -100px;
  animation: float 6s ease-in-out infinite;
}

.splash-container::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(218, 165, 32, 0.12), transparent);
  border-radius: 50%;
  bottom: -50px;
  left: -50px;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(30px);
  }
}

.splash-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  padding: 40px;
  border: 3px solid #daa520;
  background: rgba(20, 10, 35, 0.95);
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.4), inset 0 0 30px rgba(138, 103, 255, 0.15);
  border-radius: 8px;
}

.splash-title {
  font-size: 3.5em;
  margin-bottom: 10px;
  text-shadow: 0 0 20px #daa520, 0 0 40px #daa520;
  letter-spacing: 3px;
  animation: pulse 2s ease-in-out infinite;
  color: #f4e4c1;
  font-weight: 700;
}

@keyframes pulse {
  0%, 100% {
    text-shadow: 0 0 20px #daa520, 0 0 40px #daa520;
  }
  50% {
    text-shadow: 0 0 30px #daa520, 0 0 60px #daa520, 0 0 80px rgba(218, 165, 32, 0.5);
  }
}

.splash-subtitle {
  font-size: 1.3em;
  margin-bottom: 20px;
  color: #c9a870;
  font-style: italic;
  opacity: 0.95;
}

.splash-decorative {
  font-size: 1.5em;
  margin-bottom: 30px;
  color: #daa520;
  letter-spacing: 10px;
  animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

.splash-button {
  display: inline-block;
  padding: 15px 40px;
  font-size: 1.3em;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #daa520;
  cursor: pointer;
  transition: all 0.4s;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
  margin: 20px 0;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.splash-button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 30px #daa520, inset 0 0 20px rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  border-color: #f4e4c1;
}

.splash-button:active {
  transform: scale(0.98);
}

.splash-hint {
  font-size: 0.9em;
  margin-top: 20px;
  color: #c9a870;
  opacity: 0.8;
  animation: fade 1.5s ease-in-out infinite;
}

@keyframes fade {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Main Menu */
.menu-container {
  text-align: center;
  border: 2px solid #daa520;
  padding: 40px;
  background: rgba(20, 10, 35, 0.95);
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.3);
}

.menu-container h1 {
  font-size: 3em;
  margin-bottom: 40px;
  text-shadow: 0 0 15px #daa520;
  color: #f4e4c1;
}

.menu-options button {
  display: block;
  width: 300px;
  margin: 15px auto;
  padding: 15px;
  font-size: 1.2em;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.menu-options button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 20px #daa520;
  border-color: #daa520;
  transform: translateY(-2px);
}

.connection-status {
  margin-top: 30px;
  font-size: 0.9em;
  color: #c9a870;
}

/* Character Creation */
.creation-container {
  border: 2px solid #daa520;
  padding: 30px;
  background: rgba(20, 10, 35, 0.95);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.3);
}

.creation-container h2 {
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 0 15px #daa520;
  color: #f4e4c1;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 1em;
  background: rgba(10, 5, 20, 0.7);
  color: #e8d4a0;
  border: 1px solid #8a67ff;
  border-radius: 4px;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #daa520;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.3);
  background: rgba(15, 8, 30, 0.9);
}

.form-group.portrait-carousel-section {
  margin: 30px 0;
}

.form-group.portrait-carousel-section h4 {
  margin-bottom: 15px;
  color: #daa520;
}

.portrait-carousel-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.carousel-arrow {
  width: 50px;
  height: 50px;
  font-size: 1.5em;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.carousel-arrow:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
}

.carousel-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-arrow.active {
  color: #daa520;
  border-color: #daa520;
}

.carousel-arrow.active:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
}

.portrait-carousel {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.carousel-portrait {
  width: 100px;
  height: 130px;
  border: 2px solid #8a67ff;
  background: #0a0612;
  object-fit: contain;
  cursor: pointer;
  transition: all 0.3s;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 4px;
}

.carousel-portrait:hover {
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: scale(1.05);
}

.carousel-portrait.selected {
  border: 3px solid #daa520;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
}

.form-group.portrait-display {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 30px 0;
}

.form-group.portrait-display img {
  width: 120px;
  height: 150px;
  border: 2px solid #8a67ff;
  background: #0a0612;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  border-radius: 4px;
}

.stats-container {
  margin: 20px 0;
  padding: 15px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.stats-container h3 {
  margin-bottom: 15px;
  color: #daa520;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button-group button {
  flex: 1;
  padding: 10px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.button-group button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: translateY(-2px);
}

/* Party Menu - Updated */
.party-container {
  border: 2px solid #daa520;
  padding: 30px;
  background: rgba(20, 10, 35, 0.95);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.3);
}

.party-container h2 {
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 0 15px #daa520;
  font-size: 2em;
  color: #f4e4c1;
}

.party-container h3 {
  margin-bottom: 15px;
  color: #daa520;
  border-bottom: 1px solid #8a67ff;
  padding-bottom: 10px;
}

.party-section {
  margin-bottom: 30px;
  padding: 15px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.character-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.character-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  transition: all 0.3s;
  border-radius: 4px;
}

.character-item:hover {
  background: rgba(61, 36, 99, 0.9);
  box-shadow: 0 0 15px rgba(138, 103, 255, 0.3);
  border-color: #daa520;
  transform: translateX(5px);
}

.char-summary {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.char-summary strong {
  font-size: 1.1em;
}

.char-class {
  font-size: 0.9em;
  color: #c9a870;
}

.character-item button {
  padding: 8px 16px;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  font-size: 0.9em;
  border-radius: 4px;
  font-weight: 600;
}

.character-item button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

.character-item button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.party-display {
  margin: 15px 0;
  padding: 15px;
  background: rgba(10, 5, 20, 0.7);
  border: 1px solid #8a67ff;
  border-radius: 4px;
}

.party-member-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.party-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: rgba(20, 10, 35, 0.7);
  border-left: 2px solid #8a67ff;
  padding-left: 10px;
  cursor: move;
  user-select: none;
  transition: all 0.2s;
  border-radius: 2px;
}

.party-member:hover {
  background: rgba(61, 36, 99, 0.9);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
  border-left-color: #daa520;
}

.party-member .drag-handle {
  color: #8a67ff;
  margin-right: 8px;
  cursor: grab;
}

.party-member .drag-handle:active {
  cursor: grabbing;
}

.party-member .line-indicator {
  font-size: 0.85em;
  color: #c9a870;
  font-style: italic;
  margin-left: auto;
  padding-left: 10px;
}

.member-class {
  color: #c9a870;
  font-size: 0.9em;
}

.party-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px 0;
}

.party-actions button {
  padding: 12px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95em;
  border-radius: 4px;
  font-weight: 600;
}

.party-actions button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

.party-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.party-item {
  padding: 15px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
}

.party-item:hover {
  background: rgba(61, 36, 99, 0.9);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
  transform: translateX(5px);
  border-color: #daa520;
}

.party-container button:not(.party-actions button):not(.character-item button):not(.remove-char-btn) {
  padding: 12px 20px;
  width: 100%;
  margin-top: 15px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1em;
  border-radius: 4px;
  font-weight: 600;
}

.party-container button:not(.party-actions button):not(.character-item button):not(.remove-char-btn):hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* Character I/O Buttons */
.character-io-section {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.character-io-section h3 {
  margin-bottom: 15px;
  color: #daa520;
}

.character-io-section button {
  display: inline-block;
  padding: 10px 20px;
  margin-right: 10px;
  margin-bottom: 10px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95em;
  border-radius: 4px;
  font-weight: 600;
}

.character-io-section button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

.character-io-buttons {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: flex-start;
}

.character-io-buttons button {
  padding: 8px 16px;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
  font-size: 0.9em;
  border-radius: 4px;
  font-weight: 600;
}

.character-io-buttons button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.3);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* Settings Screen */
.settings-container {
  border: 2px solid #daa520;
  padding: 30px;
  background: rgba(20, 10, 35, 0.95);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.3);
}

.settings-container h2 {
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 0 15px #daa520;
  font-size: 2em;
  color: #f4e4c1;
}

.settings-section {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.settings-section h3 {
  margin-bottom: 20px;
  color: #daa520;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
}

.volume-control {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.volume-control label {
  font-weight: bold;
  color: #daa520;
  text-shadow: 0 0 5px rgba(218, 165, 32, 0.3);
}

.volume-slider-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.volume-label {
  min-width: 30px;
  text-align: center;
  color: #f4e4c1;
  font-weight: bold;
}

.volume-slider {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #5a3a8a, #daa520);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #daa520, #f4c430);
  cursor: pointer;
  border: 2px solid #f4e4c1;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.6);
  transition: all 0.2s;
}

.volume-slider::-webkit-slider-thumb:hover {
  background: linear-gradient(135deg, #f4c430, #daa520);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
  transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #daa520, #f4c430);
  cursor: pointer;
  border: 2px solid #f4e4c1;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.6);
  transition: all 0.2s;
}

.volume-slider::-moz-range-thumb:hover {
  background: linear-gradient(135deg, #f4c430, #daa520);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
  transform: scale(1.2);
}

.volume-value-display {
  text-align: center;
  color: #e8d4a0;
  font-size: 1.1em;
  padding: 10px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.volume-value-display span {
  color: #daa520;
  font-weight: bold;
}

.settings-container button {
  width: 100%;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 1em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 20px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.settings-container button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* Game Screen */
.game-container {
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  gap: 15px;
  width: 100%;
  height: 100%;
  padding: 15px;
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}

.party-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.character-slot {
  border: 2px solid #8a67ff;
  padding: 8px;
  background: rgba(20, 10, 35, 0.8);
  display: grid;
  grid-template-columns: 80px 1fr;
  grid-template-rows: auto 1fr;
  gap: 4px 8px;
  flex: 1;
  position: relative;
  border-radius: 4px;
  transition: all 0.3s;
}

.character-slot:hover {
  background: rgba(30, 15, 50, 0.9);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
}

.portrait-container {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  grid-row: 2;
  grid-column: 1;
}

.portrait-health-container {
  position: relative;
  display: inline-block;
  width: fit-content;
}

.char-portrait {
  width: 80px;
  height: 80px;
  border: 2px solid #8a67ff;
  object-fit: contain;
  background: #0a0612;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block;
  border-radius: 4px;
}

.portrait-health-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 0, 0, 0.25);
  transition: height 0.3s ease;
}

.skill-point-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border: 2px solid #f4e4c1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1em;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.8);
  padding: 0;
  animation: pulse-skill 2s ease-in-out infinite;
}

@keyframes pulse-skill {
  0%, 100% {
    box-shadow: 0 0 15px rgba(218, 165, 32, 0.8);
  }
  50% {
    box-shadow: 0 0 25px rgba(218, 165, 32, 1), 0 0 35px rgba(218, 165, 32, 0.6);
  }
}

/* Portrait attack & hit animations */
@keyframes swing-right {
  0% { transform: translateX(0) rotate(0deg); }
  30% { transform: translateX(6px) rotate(10deg); }
  60% { transform: translateX(-4px) rotate(-6deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes swing-left {
  0% { transform: translateX(0) rotate(0deg); }
  30% { transform: translateX(-6px) rotate(-10deg); }
  60% { transform: translateX(4px) rotate(6deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

@keyframes hit-shake {
  0% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

@keyframes slash {
  0% { opacity: 0; transform: rotate(-20deg) scale(0.8); }
  20% { opacity: 1; transform: rotate(-10deg) scale(1.05); }
  60% { opacity: 1; transform: rotate(10deg) scale(1.0); }
  100% { opacity: 0; transform: rotate(20deg) scale(1.2); }
}

.combat-portrait.attack-swing { z-index: 30; }
.combat-portrait.attack-swing .portrait-image {
  will-change: transform;
}
.combat-portrait.attack-swing.attack-right .portrait-image {
  transform-origin: left center;
  animation: swing-right 420ms cubic-bezier(.2,.8,.2,1) both;
}
.combat-portrait.attack-swing.attack-left .portrait-image {
  transform-origin: right center;
  animation: swing-left 420ms cubic-bezier(.2,.8,.2,1) both;
}

.combat-portrait.hit-shake .portrait-image {
  animation: hit-shake 380ms ease-out both;
}

/* Make attack and hit visuals more obvious on the container too */
.combat-portrait.attack-swing {
  transform: translateY(-8px) scale(1.12);
  transition: transform 160ms ease-out;
  box-shadow: 0 6px 24px rgba(255,255,255,0.15), 0 0 18px rgba(255,200,50,0.12);
  border-color: #ffd700;
}

.combat-portrait.hit-shake {
  animation: hit-shake 420ms ease-out both;
}

.combat-portrait.attack-swing .portrait-name,
.combat-portrait.attack-swing .portrait-hp {
  text-shadow: 0 0 6px rgba(255,215,0,0.8);
}

/* Weapon slash overlay (simple, CSS-only flourish) */
.combat-portrait.weapon-sword {
  overflow: visible;
}
.combat-portrait.weapon-sword .portrait-image {
  position: relative;
}
.combat-portrait.weapon-sword .portrait-image::after {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 80%;
  height: 80%;
  background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.2));
  opacity: 0;
  transform: rotate(-20deg) scale(0.8);
  pointer-events: none;
}
.combat-portrait.weapon-sword.attack-swing .portrait-image::after {
  animation: slash 380ms ease-out both;
}

/* Subtle cast glow for spells/heavy abilities */
.combat-portrait.cast-glow {
  box-shadow: 0 0 18px rgba(100,180,255,0.9), inset 0 0 8px rgba(100,180,255,0.4);
  transform: scale(1.08);
}

.character-detail-container .skill-point-indicator {
  padding-right: 0;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 4.5px;
}

.detail-skill-indicator {
  display: inline-block;
  margin-left: 8px;
  color: #ff0;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 5px #ff0;
}

.char-info {
  display: contents;
}

.char-name {
  font-weight: bold;
  font-size: 0.85em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  grid-column: 1 / -1;
  grid-row: 1;
}

.char-stats {
  font-size: 0.85em;
  line-height: 1.3;
  grid-column: 2;
  grid-row: 2;
}

.game-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.view-and-map {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.scene-container {
  border: 2px solid #8a67ff;
  padding: 10px;
  background: rgba(20, 10, 35, 0.8);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}

#scene-canvas {
  margin-left: auto;
  margin-right: auto;
  display: block;
  background: #0a0612;
  border: 1px solid #8a67ff;
  object-fit: contain;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border-radius: 2px;
}

.minimap-container {
  border: 2px solid #8a67ff;
  padding: 8px;
  background: rgba(20, 10, 35, 0.8);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 160px;
  flex-shrink: 0;
  border-radius: 4px;
}

.minimap-container h4 {
  text-align: center;
  margin: 0;
  font-size: 0.9em;
  color: #daa520;
}

#minimap-canvas {
  border: 1px solid #8a67ff;
  background: #0a0612;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 2px;
}

.minimap-legend {
  font-size: 0.75em;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.minimap-legend div {
  display: flex;
  align-items: center;
  gap: 4px;
}

.minimap-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.minimap-controls button {
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.9em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.minimap-controls button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

.legend-tile {
  width: 8px;
  height: 8px;
  display: inline-block;
  border: 1px solid #8a67ff;
}

.legend-tile.visited {
  background: rgba(90, 58, 138, 0.5);
}

.legend-tile.current {
  background: #daa520;
}

.legend-tile.wall {
  background: #8a67ff;
}

.scene-info {
  margin-top: 8px;
  display: flex;
  justify-content: space-around;
  font-size: 0.9em;
  flex-shrink: 0;
}

.controls {
  text-align: center;
  flex-shrink: 0;
  border: 1px solid #8a67ff;
  padding: 10px;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.control-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 5px 0;
}

.controls button {
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 100px;
  border-radius: 4px;
  font-weight: 600;
}

.controls button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  transform: translateY(-2px);
}

.keyboard-hint {
  font-size: 0.75em;
  color: #c9a870;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #8a67ff;
}

.message-log {
  border: 2px solid #8a67ff;
  padding: 10px;
  background: rgba(10, 5, 20, 0.8);
  height: auto;
  min-height: 120px;
  max-height: 150px;
  overflow-y: auto;
  flex-shrink: 0;
  font-size: 0.9em;
  border-radius: 4px;
  color: #c9a870;
}

.message-log p {
  margin: 3px 0;
  line-height: 1.4;
}

/* Combat Modal */
.combat-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 6, 18, 0.98);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.combat-modal.active {
  display: flex;
}

.combat-effects-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1100;
  overflow: hidden;
}

.screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.screen-shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.spell-projectile {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent);
  box-shadow: 0 0 10px #fff;
  z-index: 1101;
  transform: translate(-50%, -50%);
}

.spell-impact {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent);
  animation: impactFade 0.5s ease-out forwards;
  z-index: 1101;
  transform: translate(-50%, -50%);
}

@keyframes impactFade {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}


.combat-container {
  border: 3px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  width: 99vw;
  height: 98vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 15px;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid #daa520;
}

.combat-header h2 {
  margin: 0;
  text-shadow: 0 0 15px #daa520;
  font-size: 2em;
  color: #f4e4c1;
}

.turn-indicator {
  font-size: 1.2em;
  color: #daa520;
  font-weight: bold;
}

/* Formations - TOP */
.combat-formations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  padding: 15px;
  background: rgba(10, 5, 20, 0.6);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  flex-shrink: 0;
}

.formation-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.formation-title {
  font-weight: bold;
  color: #daa520;
  font-size: 1.1em;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #8a67ff;
}

.formation-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.party-formation .formation-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.enemy-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.enemy-lines .formation-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-label {
  min-width: 70px;
  padding: 6px 10px;
  background: rgba(138, 103, 255, 0.2);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  font-size: 0.9em;
  color: #c9a870;
  text-align: center;
  font-weight: bold;
}

.front-row .row-label {
  background: rgba(218, 68, 83, 0.3);
  border-color: #da4453;
  color: #ff8a80;
}

.back-row .row-label {
  background: rgba(70, 130, 180, 0.3);
  border-color: #6a8caf;
  color: #87ceeb;
}

.combat-character-action {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
  transition: all 0.3s;
}

.combat-character-action:hover {
  background: rgba(20, 10, 35, 0.7);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
}

.combat-character-action.completed {
  background: rgba(90, 58, 138, 0.3);
  border-color: #5a3a8a;
}

.combat-character-action.disabled {
  opacity: 0.5;
}

.combat-character-header {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.combat-char-portrait {
  width: 40px;
  height: 50px;
  border: 1px solid #8a67ff;
  object-fit: contain;
  background: #0a0612;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  border-radius: 2px;
}

.combat-character-info {
  flex: 1;
  min-width: 0;
}

.combat-char-name {
  font-weight: bold;
  font-size: 0.9em;
  color: #f4e4c1;
}

.combat-char-stats {
  font-size: 0.75em;
  line-height: 1.2;
  margin-top: 2px;
}

.combat-char-status {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  font-size: 0.7em;
}

.combat-actions-buttons {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: 5px;
}

.combat-actions-buttons button {
  width: 100%;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.8em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 4px;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.combat-actions-buttons button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(218, 165, 32, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.combat-actions-buttons button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.combat-actions-buttons button:hover:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

.combat-actions-buttons button.selected {
  background: linear-gradient(135deg, #daa520, #c89020);
  color: #1a0f2e;
  border-color: #f4e4c1;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
  font-weight: 700;
}

.combat-actions-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
  border-color: #4a3a5a;
}

.combat-target-select {
  width: 100%;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.8em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.3s;
}

.combat-target-select:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
}

.combat-target-select:focus {
  outline: none;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
  border-color: #daa520;
}

.combat-target-buttons {
  display: flex;
  gap: 5px;
  width: 100%;
}

.combat-target-row-btn {
  flex: 1;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.8em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.3s;
  text-transform: uppercase;
}

.combat-target-row-btn:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: translateY(-2px);
}

.combat-target-row-btn.active {
  background: linear-gradient(135deg, #daa520, #c89020);
  color: #1a0f2e;
  border-color: #f4e4c1;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
}

.combat-center-view {
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow: hidden;
}

.enemy-lines-display {
  border: 1px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  max-height: 180px;
  border-radius: 4px;
}

.combat-settings {
  display: none;
}

.enemy-lines-display h3 {
  margin-bottom: 10px;
  color: #daa520;
}

.enemy-lines {
  display: flex;
  flex-direction: row;
  gap: 10px;
  justify-content: space-around;
}

.enemy-line {
  border: 1px solid #8a67ff;
  padding: 8px;
  background: rgba(10, 5, 20, 0.7);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex: 1;
  min-width: 0;
  border-radius: 4px;
}

.enemy-line:hover {
  background: rgba(61, 36, 99, 0.5);
  box-shadow: 0 0 10px rgba(138, 103, 255, 0.3);
  transform: translateY(-2px);
}

.enemy-line.selected {
  background: rgba(90, 58, 138, 0.6);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
}

.line-header {
  font-weight: bold;
  margin-bottom: 5px;
  color: #daa520;
}

.enemy-group-list {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.enemy-line {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.enemy-group {
  margin: 0;
  padding: 2px 3px;
  background: rgba(138, 103, 255, 0.15);
  border: 1px solid rgba(138, 103, 255, 0.4);
  border-radius: 2px;
  font-size: 0.7em;
  white-space: nowrap;
  flex-shrink: 0;
  color: #c9a870;
}

.enemy-group.empty {
  color: #666;
  background: transparent;
  border: none;
}

.combat-log-section {
  border: 1px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  overflow-y: auto;
  flex: 1;
  border-radius: 4px;
}

.combat-log-section h3 {
  margin-bottom: 10px;
  color: #daa520;
}

.combat-log {
  margin: 0;
  padding: 0;
  border: none;
  height: auto;
  font-size: 0.85em;
  line-height: 1.3;
}

.combat-log p {
  margin: 2px 0;
}

/* Old character actions styling - no longer used */
.character-actions-section {
  display: none;
}

.combat-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 10px;
  border-top: 1px solid #8a67ff;
}

.combat-settings {
  display: flex;
  align-items: center;
}

.combat-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.combat-settings input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.combat-actions button {
  padding: 12px 20px;
  font-family: inherit;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.combat-actions button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #daa520;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.6);
  transform: translateY(-2px);
}

.combat-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #1a0f2e, #2a1f3e);
}

#submit-turn-button {
  flex: 0 0 auto;
  min-width: 150px;
  font-weight: bold;
  font-size: 1.1em;
  padding: 14px 24px;
  background: linear-gradient(135deg, #c89020, #daa520);
  border-color: #f4e4c1;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.5);
}

#submit-turn-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 35px rgba(218, 165, 32, 0.8);
  transform: scale(1.05);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(10, 5, 20, 0.8);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border: 1px solid #daa520;
  border-radius: 4px;
  transition: all 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

/* Spell Selection Modal */
.spell-selection-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.95);
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.spell-selection-modal.active {
  display: flex;
}

.spell-selection-container {
  border: 2px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.6);
  border-radius: 8px;
}

.spell-selection-container h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.spell-list-container {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spell-option {
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(61, 36, 99, 0.4);
  color: #e8d4a0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.3s;
  text-align: left;
  border-radius: 4px;
  font-weight: 600;
}

.spell-option:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateX(5px);
  color: #f4e4c1;
}

.spell-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(60, 30, 30, 0.3);
  border-color: #8a4a4a;
  color: #999;
}

.spell-option-name {
  font-weight: bold;
  display: block;
}

.spell-option-details {
  font-size: 0.85em;
  color: #c9a870;
  margin-top: 3px;
}

.spell-modal-close {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.spell-modal-close:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
}

/* Ability Selection Modal */
.ability-selection-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.95);
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.ability-selection-modal.active {
  display: flex;
}

.ability-selection-container {
  border: 2px solid #daa520;
  padding: 20px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.6);
  border-radius: 8px;
}

.ability-selection-container h3 {
  text-align: center;
  margin-bottom: 15px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.ability-list-container {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ability-option {
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(61, 36, 99, 0.4);
  color: #e8d4a0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.3s;
  text-align: left;
  border-radius: 4px;
  font-weight: 600;
}

.ability-option:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateX(5px);
  color: #f4e4c1;
}

.ability-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(60, 30, 30, 0.3);
  border-color: #8a4a4a;
  color: #999;
}

.ability-option-name {
  font-weight: bold;
  display: block;
}

.ability-option-details {
  font-size: 0.85em;
  color: #c9a870;
  margin-top: 3px;
}

/* Combat Initiative Timeline Display */
.combat-timeline-display {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 300px;
  max-height: 400px;
  background: rgba(20, 10, 35, 0.95);
  border: 2px solid #daa520;
  padding: 10px;
  z-index: 999;
  display: none;
  overflow-y: auto;
  box-shadow: 0 0 30px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.combat-timeline-display.active {
  display: block;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #0ff;
}

.timeline-header h3 {
  margin: 0;
  font-size: 1.1em;
  color: #0ff;
  text-shadow: 0 0 5px #0ff;
}

.current-tick {
  font-size: 0.9em;
  color: #ff0;
  font-weight: bold;
}

.timeline-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.timeline-action {
  display: grid;
  grid-template-columns: 50px 1fr 80px;
  gap: 8px;
  padding: 8px;
  background: rgba(61, 36, 99, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  font-size: 0.85em;
}

.timeline-action.current {
  background: rgba(255, 255, 0, 0.2);
  border-color: #ff0;
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.timeline-action.casting {
  background: rgba(255, 100, 0, 0.2);
  border-color: #f80;
  animation: pulse-casting 1s infinite;
}

@keyframes pulse-casting {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.timeline-action.queued {
  opacity: 0.8;
}

.action-tick {
  font-weight: bold;
  color: #daa520;
  text-align: center;
}

.action-actor {
  color: #e8d4a0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-type {
  color: #daa520;
  text-align: right;
}

/* Action Request Modal (Initiative Turn) */
.action-request-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.98);
  justify-content: center;
  align-items: center;
  z-index: 1002;
}

.action-request-modal.active {
  display: flex;
}

.action-request-content {
  border: 3px solid #daa520;
  padding: 25px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 50px rgba(218, 165, 32, 0.7);
  animation: modal-appear 0.3s ease-out;
  border-radius: 8px;
}

@keyframes modal-appear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.action-request-content h2 {
  text-align: center;
  margin-bottom: 10px;
  color: #f4e4c1;
  text-shadow: 0 0 15px #daa520;
}

.action-timer {
  text-align: center;
  font-size: 1.3em;
  font-weight: bold;
  color: #daa520;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

.action-options,
.target-options {
  margin-bottom: 20px;
}

.action-options h3,
.target-options h3 {
  color: #daa520;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.action-btn,
.target-btn {
  padding: 12px;
  border: 2px solid #8a67ff;
  background: rgba(61, 36, 99, 0.6);
  color: #f4e4c1;
  cursor: pointer;
  font-family: inherit;
  font-size: 1em;
  transition: all 0.3s;
  text-align: center;
  border-radius: 4px;
  font-weight: 600;
}

.action-btn:hover,
.target-btn:hover {
  background: linear-gradient(135deg, #5a3a8a, #8a67ff);
  border-color: #daa520;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  transform: scale(1.05);
}

.action-btn.selected,
.target-btn.selected {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  border-color: #f4e4c1;
  font-weight: bold;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.7);
}

.target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upcoming-actors {
  background: rgba(10, 5, 20, 0.5);
  padding: 12px;
  border: 1px solid #8a67ff;
  margin-bottom: 15px;
  border-radius: 4px;
}

.upcoming-actors h4 {
  color: #daa520;
  margin-bottom: 8px;
  font-size: 0.95em;
}

.upcoming-actors ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upcoming-actors li {
  color: #e8d4a0;
  font-size: 0.9em;
  padding: 4px 0;
  border-bottom: 1px solid #4a3a5a;
}

.upcoming-actors li:last-child {
  border-bottom: none;
}

.submit-action-btn {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #c89020, #daa520);
  border: 2px solid #f4e4c1;
  color: #1a0f2e;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.submit-action-btn:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  box-shadow: 0 0 35px rgba(218, 165, 32, 0.8);
  transform: translateY(-2px);
}

/* Casting Progress Bar (in character action cards) */
.casting-progress {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 100, 0, 0.2);
  border: 1px solid #f80;
  border-radius: 3px;
}

.casting-header {
  display: flex;
  justify-content: space-between;
  color: #f80;
  font-size: 0.9em;
  margin-bottom: 5px;
}

.casting-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #666;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}

.casting-fill {
  height: 100%;
  background: linear-gradient(90deg, #f80 0%, #ff0 100%);
  transition: width 0.3s ease-out;
  box-shadow: 0 0 10px #f80;
}

.casting-ticks {
  font-size: 0.85em;
  color: #ff0;
  text-align: center;
}

.ability-modal-close {
  width: 100%;
  padding: 10px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.ability-modal-close:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
}

.available-abilities {
  margin-top: 15px;
}

.available-abilities button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.available-abilities button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateX(5px);
}

.available-abilities button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Character Detail Modal */
.character-detail-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 6, 18, 0.9);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.character-detail-modal.active {
  display: flex;
}

.character-detail-container {
  border: 2px solid #daa520;
  padding: 30px;
  background: rgba(20, 10, 35, 0.98);
  max-width: 1000px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.character-detail-container h2 {
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 0 15px #daa520;
  font-size: 1.8em;
  color: #f4e4c1;
}

.detail-section {
  margin-bottom: 25px;
  padding: 15px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.detail-section h3 {
  margin-bottom: 15px;
  color: #daa520;
  text-shadow: 0 0 8px rgba(218, 165, 32, 0.5);
}

.detail-section h4 {
  margin-top: 15px;
  margin-bottom: 10px;
  color: #c9a870;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(138, 103, 255, 0.2);
}

.detail-row span:first-child {
  font-weight: bold;
  color: #daa520;
}

.detail-row span:last-child {
  color: #e8d4a0;
}

.exp-bar {
  width: 100%;
  height: 20px;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  margin-top: 10px;
  overflow: hidden;
  border-radius: 3px;
}

.exp-progress {
  height: 100%;
  background: linear-gradient(90deg, #5a3a8a, #8a67ff);
  transition: width 0.3s;
  width: 0%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat-display {
  text-align: center;
  padding: 10px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  border-radius: 4px;
}

.stat-label {
  display: block;
  font-size: 0.8em;
  color: #c9a870;
  margin-bottom: 5px;
}

.stat-value {
  display: block;
  font-size: 1.3em;
  font-weight: bold;
  color: #f4e4c1;
}

.spells-list {
  padding: 10px;
  background: rgba(10, 5, 20, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  margin-bottom: 15px;
}

.spell-item {
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(61, 36, 99, 0.4);
  border-left: 3px solid #8a67ff;
  border-radius: 2px;
}

.spell-item-name {
  font-weight: bold;
  color: #daa520;
}

.spell-item-details {
  font-size: 0.9em;
  color: #c9a870;
  margin-top: 3px;
}

.ability-item {
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(61, 36, 99, 0.4);
  border-left: 3px solid #8a67ff;
  border-radius: 2px;
}

.ability-item-name {
  font-weight: bold;
  color: #daa520;
}

.ability-item-details {
  font-size: 0.9em;
  color: #c9a870;
  margin-top: 3px;
}

.available-spells {
  margin-top: 15px;
}

.available-spells button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.95em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 1px solid #8a67ff;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.available-spells button:hover:not(:disabled) {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateX(5px);
}

.available-spells button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.detail-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.detail-actions button {
  padding: 10px 20px;
  font-family: inherit;
  font-size: 1em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.detail-actions button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* 2-Column Layout for Skills Modal */
.skills-columns-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

#detail-spellbook-section {
  grid-column: 1;
}

#detail-abilitybook-section {
  grid-column: 2;
}

/* Responsive adjustments for skills in narrow viewports */
@media (max-width: 1100px) {
  .skills-columns-wrapper {
    grid-template-columns: 1fr;
  }
  
  #detail-spellbook-section {
    grid-column: 1;
  }
  
  #detail-abilitybook-section {
    grid-column: 1;
  }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .game-container {
    grid-template-columns: 150px 1fr 150px;
    gap: 10px;
    padding: 10px;
  }
  
  .char-info {
    font-size: 0.75em;
  }
  
  .controls button {
    padding: 8px 15px;
    font-size: 0.85em;
    min-width: 70px;
  }
}

/* Inventory & Equipment Modal */
.inventory-container {
  background: rgba(20, 10, 35, 0.98);
  border: 3px solid #daa520;
  padding: 30px;
  max-width: 1200px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(218, 165, 32, 0.5);
  border-radius: 8px;
}

.inventory-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 30px;
  margin: 20px 0;
}

.equipment-section h3,
.inventory-section h3 {
  color: #daa520;
  margin-bottom: 15px;
  font-size: 1.3em;
  text-shadow: 0 0 12px rgba(218, 165, 32, 0.6);
}

.equipment-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.equipment-slot {
  border: 2px solid #8a67ff;
  padding: 8px;
  background: rgba(10, 5, 20, 0.5);
  transition: all 0.3s;
  border-radius: 4px;
}

.equipment-slot:hover {
  border-color: #daa520;
  box-shadow: 0 0 10px rgba(218, 165, 32, 0.4);
}

.slot-label {
  font-size: 0.85em;
  color: #c9a870;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 600;
}

.slot-content {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #8a67ff;
  background: rgba(10, 5, 20, 0.5);
  cursor: pointer;
  padding: 5px;
  border-radius: 2px;
}

.slot-content:hover {
  background: rgba(90, 58, 138, 0.3);
  border-color: #daa520;
}

.empty-slot {
  color: #c9a870;
  opacity: 0.5;
  font-style: italic;
  font-size: 0.9em;
}

.equipped-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.equipped-item-name {
  font-weight: bold;
  color: #daa520;
  margin-bottom: 3px;
  font-size: 0.9em;
}

.equipped-item-stats {
  font-size: 0.75em;
  color: #c9a870;
}

.equipment-stats {
  border: 2px solid #8a67ff;
  padding: 15px;
  background: rgba(10, 5, 20, 0.5);
  border-radius: 4px;
}

.equipment-stats h4 {
  color: #daa520;
  margin-bottom: 10px;
  font-size: 1.1em;
}

.bonus-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(138, 103, 255, 0.2);
}

.bonus-row:last-child {
  border-bottom: none;
}

.bonus-row span:first-child {
  color: #c9a870;
}

.bonus-row span:last-child {
  color: #daa520;
  font-weight: bold;
}

.inventory-section h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#inventory-weight {
  font-size: 0.9em;
  color: #c9a870;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 500px;
  overflow-y: auto;
  padding: 10px;
  border: 2px solid #8a67ff;
  background: rgba(10, 5, 20, 0.3);
  border-radius: 4px;
}

.inventory-item {
  border: 2px solid #8a67ff;
  padding: 10px;
  background: rgba(20, 10, 35, 0.5);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  min-height: 100px;
  border-radius: 4px;
}

.inventory-item:hover {
  border-color: #daa520;
  background: rgba(90, 58, 138, 0.3);
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
  transform: translateY(-2px);
}

.inventory-item.consumable {
  border-color: #ff0;
}

.inventory-item.consumable:hover {
  border-color: #ff0;
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.4);
}

.inventory-item-name {
  font-weight: bold;
  color: #daa520;
  margin-bottom: 5px;
  font-size: 0.95em;
}

.inventory-item-type {
  font-size: 0.75em;
  color: #c9a870;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.inventory-item-stats {
  font-size: 0.8em;
  color: #c9a870;
  margin-top: auto;
}

.inventory-item-quantity {
  position: absolute;
  top: 5px;
  right: 5px;
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: bold;
}

.inventory-item {
  position: relative;
}

.item-tier-starter { border-left: 3px solid #888; }
.item-tier-common { border-left: 3px solid #8a67ff; }
.item-tier-uncommon { border-left: 3px solid #daa520; }
.item-tier-rare { border-left: 3px solid #c983ff; }

.inventory-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.inventory-actions button {
  padding: 12px 30px;
  font-family: inherit;
  font-size: 1em;
  background: linear-gradient(135deg, #3d2463, #5a3a8a);
  color: #f4e4c1;
  border: 2px solid #8a67ff;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 4px;
  font-weight: 600;
}

.inventory-actions button:hover {
  background: linear-gradient(135deg, #daa520, #f4c430);
  color: #1a0f2e;
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
  border-color: #daa520;
  transform: translateY(-2px);
}

/* Item tooltip */
.item-tooltip {
  position: absolute;
  background: rgba(20, 10, 35, 0.98);
  border: 2px solid #daa520;
  padding: 10px;
  z-index: 10000;
  max-width: 300px;
  pointer-events: none;
  box-shadow: 0 0 25px rgba(218, 165, 32, 0.5);
  border-radius: 4px;
}

.item-tooltip-name {
  font-weight: bold;
  color: #f4e4c1;
  font-size: 1.1em;
  margin-bottom: 5px;
}

.item-tooltip-description {
  color: #c9a870;
  font-size: 0.9em;
  margin: 5px 0;
}

.item-tooltip-stats {
  color: #e8d4a0;
  font-size: 0.85em;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(138, 103, 255, 0.3);
}

@media (max-width: 1000px) {
  .inventory-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .inventory-container {
    width: 95vw;
    padding: 15px;
  }
}

/* Combat Visualization */
.combat-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 99vw;
  height: 98vh;
  padding: 8px;
  background: rgba(20, 10, 35, 0.98);
  border: 3px solid #8a67ff;
  box-shadow: 0 0 30px rgba(138, 103, 255, 0.5);
  overflow: hidden;
}

.combat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 2px solid #8a67ff;
  flex-shrink: 0;
  gap: 10px;
}

.combat-header h2 {
  margin: 0;
  text-shadow: 0 0 15px #daa520;
  font-size: 1.4em;
}

.turn-indicator {
  font-size: 1em;
  color: #daa520;
  font-weight: bold;
}

/* Formations - Horizontal layout on single line */
.combat-formations {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: rgba(20, 10, 35, 0.6);
  border: 2px solid rgba(138, 103, 255, 0.3);
  border-radius: 8px;
  flex-shrink: 0;
  height: auto;
  overflow-x: auto;
  overflow-y: hidden;
}

.formation-side {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.formation-divider {
  width: 2px;
  height: 60px;
  background: rgba(138, 103, 255, 0.5);
  flex-shrink: 0;
}

.clones-container {
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(20, 10, 35, 0.6);
  border: 1px dashed #8a67ff;
  border-radius: 4px;
  min-height: 20px;
  flex-wrap: wrap;
  align-content: flex-start;
}

.clone-portrait {
  opacity: 0.8;
  border-color: #aa0 !important;
}

.formation-line {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.formation-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-label {
  min-width: 35px;
  padding: 3px 4px;
  background: rgba(138, 103, 255, 0.1);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  font-size: 0.7em;
  color: #e8d4a0;
  text-align: center;
  font-weight: bold;
  flex-shrink: 0;
  white-space: nowrap;
}

.front-row .row-label {
  background: rgba(255, 107, 0, 0.2);
  border-color: #ff6b00;
  color: #ff6b00;
}

.back-row .row-label {
  background: rgba(0, 153, 255, 0.2);
  border-color: #0099ff;
  color: #0099ff;
}

.combat-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 4px;
  background: rgba(20, 10, 35, 0.5);
  border: 1px solid #8a67ff;
  border-radius: 4px;
  min-height: auto;
  flex: 1;
}

.combat-row-front {
  border-color: #ff6b00;
}

.combat-row-back {
  border-color: #0099ff;
}

/* Combat Main Area - Takes remaining space */
.combat-main {
  display: grid;
  grid-template-columns: 40% 60%;
  gap: 10px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.combat-log-section {
  display: flex;
  flex-direction: column;
  border: 2px solid #8a67ff;
  border-radius: 6px;
  background: rgba(20, 10, 35, 0.8);
  overflow: hidden;
  min-height: 0;
}

.log-header {
  padding: 4px 8px;
  background: rgba(138, 103, 255, 0.15);
  border-bottom: 1px solid #8a67ff;
  font-weight: bold;
  color: #e8d4a0;
  font-size: 0.8em;
}

.combat-log {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  font-size: 0.7em;
  line-height: 1.3;
  color: #e8d4a0;
}

.combat-log p {
  margin: 1px 0;
  padding: 0;
  word-wrap: break-word;
}

.action-selection-section {
  display: flex;
  flex-direction: column;
  border: 2px solid #8a67ff;
  border-radius: 6px;
  background: rgba(20, 10, 35, 0.8);
  overflow: hidden;
  min-height: 0;
}

.action-header {
  padding: 4px 8px;
  background: rgba(138, 103, 255, 0.15);
  border-bottom: 1px solid #8a67ff;
  font-weight: bold;
  color: #e8d4a0;
  font-size: 0.8em;
}

.character-actions-panel {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: auto;
  gap: 10px;
  height: 100%;
}

.action-phase-info {
  padding: 4px 6px;
  background: rgba(138, 103, 255, 0.1);
  border-top: 1px solid rgba(138, 103, 255, 0.3);
  font-size: 0.7em;
  color: #e8d4a0;
  text-align: center;
  font-style: italic;
  flex-shrink: 0;
}

/* Character Action Card */
.combat-character-action {
  display: flex;
  flex-direction: column;
  padding: 12px;
  border: 1px solid #8a67ff;
  background: rgba(20, 10, 35, 0.7);
  border-radius: 3px;
  max-height: 280px;
}

.combat-character-action.completed {
  background: rgba(138, 103, 255, 0.2);
  opacity: 0.7;
}

.combat-character-action.disabled {
  opacity: 0.4;
  border-color: #333;
}

.combat-character-header {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 6px;
}

.combat-portrait-container {
  position: relative;
  display: inline-block;
  width: fit-content;
  transition: all 0.3s ease;
}

/* Targeting mode styles */
.combat-portrait-container.targetable {
  cursor: pointer;
  animation: targetable-pulse-portrait 1.5s ease-in-out infinite;
}

.combat-portrait-container.targetable:hover .combat-char-portrait {
  border-color: #00ddff;
  box-shadow: 0 0 15px rgba(0, 221, 255, 0.7);
  transform: scale(1.05);
}

/* Visual confirmation when target is selected */
.combat-portrait-container.target-confirmed .combat-char-portrait {
  border-color: #8a67ff;
  box-shadow: 0 0 20px rgba(138, 103, 255, 0.9);
  animation: target-confirm 0.5s ease;
}

@keyframes targetable-pulse-portrait {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.3);
  }
}

@keyframes target-confirm {
  0% {
    box-shadow: 0 0 5px rgba(138, 103, 255, 0.5);
  }
  50% {
    box-shadow: 0 0 30px rgba(138, 103, 255, 1);
    transform: scale(1.1);
  }
  100% {
    box-shadow: 0 0 10px rgba(138, 103, 255, 0.7);
  }
}

.combat-char-portrait {
  width: 60px;
  height: 60px;
  border: 1px solid #8a67ff;
  object-fit: contain;
  background: #000;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  border-radius: 2px;
  display: block;
}

/* Status effect icons on portraits */
.portrait-status-icons {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  pointer-events: none;
  z-index: 5;
}

.status-icon {
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #8a67ff;
  border-radius: 2px;
  display: none; /* Hidden - using action-card-status-icon instead */
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: help;
  pointer-events: auto;
  position: relative;
}

.status-icon.buff {
  border-color: #4af;
  color: #4af;
}

.status-icon.debuff {
  border-color: #f44;
  color: #f44;
}

/* Tooltip for status icons */
.status-icon-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 180px;
  max-width: 250px;
  font-size: 11px;
  line-height: 1.4;
  color: #e8d4a0;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
}

.status-icon:hover .status-icon-tooltip {
  opacity: 1;
  visibility: visible;
}

.status-icon-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #4af;
}

.status-icon-tooltip.debuff .tooltip-title {
  color: #f44;
}

.status-icon-tooltip .tooltip-effect {
  margin-left: 4px;
  color: #8f8;
}

/* Action card status effects container (horizontal layout) */
.action-card-status-effects {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  min-height: 22px;
}

.action-card-status-icon {
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #8a67ff;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: help;
  pointer-events: auto;
  position: relative;
}

.action-card-status-icon.buff {
  border-color: #4af;
  color: #4af;
}

.action-card-status-icon.debuff {
  border-color: #f44;
  color: #f44;
}

/* Tooltip for action card status icons */
.action-card-status-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  right: auto;
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid #8a67ff;
  border-radius: 3px;
  padding: 6px 8px;
  min-width: 180px;
  max-width: 250px;
  font-size: 11px;
  line-height: 1.4;
  color: #e8d4a0;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10000;
}

.action-card-status-icon:hover .action-card-status-tooltip {
  opacity: 1;
  visibility: visible;
}

.action-card-status-tooltip .tooltip-title {
  font-weight: bold;
  margin-bottom: 4px;
  color: #4af;
}

.action-card-status-tooltip.debuff .tooltip-title {
  color: #f44;
}

.action-card-status-tooltip .tooltip-effect {
  margin-left: 4px;
  color: #8f8;
}

/* Susanoo fire effect animation */
.susanoo-active {
  position: relative;
  animation: susanoo-pulse 2s ease-in-out infinite;
}

.susanoo-active::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border: 2px solid transparent;
  border-radius: 3px;
  pointer-events: none;
  animation: susanoo-fire 1.5s ease-in-out infinite;
  z-index: 1;
}

.susanoo-active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 
    0 0 8px rgba(138, 43, 226, 0.6),
    0 0 15px rgba(138, 43, 226, 0.4),
    inset 0 0 8px rgba(138, 43, 226, 0.3);
  animation: susanoo-glow 2s ease-in-out infinite;
  z-index: 0;
}

@keyframes susanoo-fire {
  0%, 100% {
    border-color: rgba(138, 43, 226, 0.8);
    filter: brightness(1);
  }
  25% {
    border-color: rgba(75, 0, 130, 0.9);
    filter: brightness(1.2);
  }
  50% {
    border-color: rgba(138, 43, 226, 0.7);
    filter: brightness(0.9);
  }
  75% {
    border-color: rgba(148, 0, 211, 0.85);
    filter: brightness(1.1);
  }
}

@keyframes susanoo-glow {
  0%, 100% {
    box-shadow: 
      0 0 8px rgba(138, 43, 226, 0.6),
      0 0 15px rgba(138, 43, 226, 0.4),
      inset 0 0 8px rgba(138, 43, 226, 0.3);
  }
  50% {
    box-shadow: 
      0 0 12px rgba(138, 43, 226, 0.8),
      0 0 20px rgba(138, 43, 226, 0.5),
      inset 0 0 12px rgba(138, 43, 226, 0.4);
  }
}

@keyframes susanoo-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.combat-portrait-health-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 0, 0, 0.25);
  transition: height 0.3s ease;
  border-bottom: 1px solid #8a67ff;
  border-left: 1px solid #8a67ff;
  border-right: 1px solid #8a67ff;
  border-radius: 0 0 1px 1px;
}

.combat-character-info {
  flex: 1;
  min-width: 0;
}

.combat-char-name {
  font-weight: bold;
  font-size: 0.85em;
  color: #e8d4a0;
  margin: 0;
}

.combat-char-stats {
  font-size: 0.75em;
  line-height: 1.2;
  margin: 0 0 6px 0;
  color: #0c0;
}

.combat-char-status {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.status-icon {
  font-size: 0.65em;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-bottom: 6px;
}

.action-buttons button {
  padding: 6px 4px;
  font-size: 0.75em;
  background: rgba(138, 103, 255, 0.1);
  border: 1px solid #8a67ff;
  color: #e8d4a0;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
}

.action-buttons button:hover:not(:disabled) {
  background: rgba(138, 103, 255, 0.25);
  box-shadow: 0 0 8px rgba(138, 103, 255, 0.5);
}

.action-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auto Controls Footer (Bottom-Right of Character Card) */
.combat-auto-controls-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  background: rgba(138, 103, 255, 0.05);
  border-top: 1px solid rgba(138, 103, 255, 0.2);
  font-size: 0.7em;
  margin-top: auto;
}

.combat-auto-controls-footer input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #8a67ff;
}

.combat-auto-controls-footer label {
  cursor: pointer;
  color: #e8d4a0;
  white-space: nowrap;
  margin: 0;
}

/* Bulk Action Buttons */
.bulk-action-btn {
  padding: 6px 12px;
  font-size: 0.85em;
  background: rgba(138, 103, 255, 0.15);
  border: 1px solid #8a67ff;
  color: #e8d4a0;
  cursor: pointer;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
  white-space: nowrap;
}

.bulk-action-btn:hover {
  background: rgba(138, 103, 255, 0.3);
  box-shadow: 0 0 12px rgba(138, 103, 255, 0.6);
  text-shadow: 0 0 8px #daa520;
}

.bulk-action-btn:active {
  background: rgba(138, 103, 255, 0.4);
  transform: scale(0.98);
}

/* Combat Footer */
.combat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-top: 2px solid #8a67ff;
  background: rgba(20, 10, 35, 0.6);
  flex-shrink: 0;
  gap: 10px;
}

.combat-options {
  display: flex;
  gap: 15px;
  flex: 1;
}

.combat-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.combat-option input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #8a67ff;
}

.combat-option label {
  cursor: pointer;
  color: #e8d4a0;
  font-weight: bold;
  font-size: 0.85em;
}

#submit-turn-button {
  padding: 8px 20px;
  font-size: 0.85em;
  font-weight: bold;
  background: rgba(138, 103, 255, 0.2);
  border: 2px solid #8a67ff;
  color: #f4e4c1;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  min-width: 120px;
}

#submit-turn-button:hover:not(:disabled) {
  background: rgba(138, 103, 255, 0.35);
  box-shadow: 0 0 15px rgba(138, 103, 255, 0.7);
  transform: scale(1.05);
}

#submit-turn-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.combat-row {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: flex-start;
  padding: 10px;
  background: rgba(20, 10, 35, 0.5);
  border: 2px solid #8a67ff;
  border-radius: 6px;
  min-height: auto;
  flex: 1;
}

.combat-row-front {
  border-color: #ff6b00;
  background: rgba(255, 107, 0, 0.1);
}

.combat-row-back {
  border-color: #0099ff;
  background: rgba(0, 153, 255, 0.1);
}

.combat-portrait {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid #8a67ff;
  border-radius: 3px;
  background: rgba(20, 10, 35, 0.8);
  min-width: 55px;
  transition: all 0.3s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.combat-portrait:hover {
  box-shadow: 0 0 10px #8a67ff;
  transform: scale(1.05);
}

.portrait-image {
  width: 40px;
  height: 40px;
  background-size: cover;
  background-position: center;
  border: 1px solid #8a67ff;
  border-radius: 3px;
}

.portrait-name {
  font-size: 0.65em;
  color: #e8d4a0;
  text-align: center;
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portrait-hp {
  font-size: 0.65em;
  color: #e8d4a0;
  margin-top: 2px;
}

.hp-bar {
  width: 60px;
  height: 8px;
  background: #000;
  border: 1px solid #8a67ff;
  overflow: hidden;
  border-radius: 2px;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00cc00);
  width: 100%;
  transition: width 0.3s ease;
}

/* Combat Portrait States */
.combat-portrait.highlight-attacker {
  box-shadow: 0 0 30px #fff, inset 0 0 20px rgba(255, 255, 255, 0.5);
  transform: scale(1.15) translateY(-5px);
  border-color: #fff;
  background: rgba(50, 50, 50, 0.9);
  animation: pulse-attacker 0.6s ease-out;
}

.combat-portrait.highlight-target {
  box-shadow: 0 0 30px #f00, inset 0 0 20px rgba(255, 0, 0, 0.5);
  transform: scale(1.15);
  border-color: #f00;
  background: rgba(50, 0, 0, 0.9);
  animation: pulse-target 0.6s ease-out;
}

.combat-portrait.dead {
  opacity: 0.5;
  filter: grayscale(100%) brightness(0.6);
  pointer-events: none;
  border-color: #666;
}

.combat-portrait.dead::after {
  content: '✦ DEAD ✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #f00;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 10px #f00;
}

/* Targeting Mode Styles */
body.targeting-mode {
  cursor: crosshair;
}

body.targeting-mode * {
  cursor: crosshair;
}

.combat-portrait.targetable {
  animation: targetable-pulse 1.5s ease-in-out infinite;
  border-color: #0ff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  cursor: crosshair !important;
}

.combat-portrait.targetable:hover {
  box-shadow: 0 0 25px #0ff;
  border-color: #0ff;
  transform: scale(1.15);
}

@keyframes targetable-pulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
  }
}

.targeting-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 255, 0.9);
  color: #000;
  padding: 10px 20px;
  border: 2px solid #0ff;
  border-radius: 5px;
  font-weight: bold;
  font-size: 1.1em;
  z-index: 10000;
  animation: targeting-indicator-pulse 1s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
}

@keyframes targeting-indicator-pulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.05);
  }
}

/* Damage Indicator */
.damage-indicator {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: #f00;
  font-weight: bold;
  font-size: 1.8em;
  text-shadow: 0 0 10px #f00, 0 0 20px rgba(255, 0, 0, 0.5);
  pointer-events: none;
  z-index: 10;
  animation: float-up 5s ease-out forwards;
}

.damage-indicator.critical {
  color: #ffff00;
  font-size: 2.2em;
  text-shadow: 0 0 15px #ffff00, 0 0 25px rgba(255, 255, 0, 0.7);
}

.damage-indicator.heal {
  color: #daa520;
  text-shadow: 0 0 10px #daa520, 0 0 20px rgba(218, 165, 32, 0.5);
}

/* Animations */
@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px);
  }
}

@keyframes pulse-attacker {
  0% {
    box-shadow: 0 0 10px #fff;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px #fff;
    transform: scale(1.2);
  }
  100% {
    box-shadow: 0 0 30px #fff;
    transform: scale(1.15) translateY(-5px);
  }
}

@keyframes pulse-target {
  0% {
    box-shadow: 0 0 10px #f00;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px #f00;
    transform: scale(1.2);
  }
  100% {
    box-shadow: 0 0 30px #f00;
    transform: scale(1.15);
  }
}

/* Auto-attack and Auto-target Checkboxes */
.combat-options {
  display: flex;
  gap: 15px;
  justify-content: center;
  padding: 15px;
  background: rgba(20, 10, 35, 0.8);
  border: 2px solid #8a67ff;
  border-radius: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.combat-option {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e8d4a0;
}

.combat-option input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #8a67ff;
}

.combat-option label {
  cursor: pointer;
  user-select: none;
}

.combat-option input[type="checkbox"]:checked + label {
  color: #ff0;
  text-shadow: 0 0 10px #ff0;
}

/* Chakra Bar Styling */
.chakra-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 0, 0.2);
  border: 1px solid #ffff00;
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}

.chakra-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffff00, #ffcc00);
  transition: width 0.3s ease;
}

.chakra-text {
  font-size: 0.65em;
  color: #ffff00;
  margin-top: 2px;
  display: block;
}

.portrait-chakra {
  margin-top: 2px;
  text-align: center;
}

/* Laptop/Medium screens (tablets, small laptops) */
@media (max-width: 1366px) {
  .combat-char-portrait {
    width: 36px;
    height: 52px;
  }
  
  .combat-character-action {
    min-height: 130px;
    padding: 8px;
  }
  
  .character-actions-panel {
    gap: 6px;
  }
}

/* Mobile Combat Layout */
@media (max-width: 768px) {
  .combat-main {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1.5fr;
  }
  
  .character-actions-panel {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px;
  }
  
  .combat-character-action {
    min-height: 120px;
    padding: 8px;
    gap: 4px;
  }
  
  .combat-char-portrait {
    width: 32px;
    height: 48px;
  }
  
  .combat-formations {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 5px;
  }
  
  .formation-divider {
    display: none;
  }
}
/* Grudges List Styling */
.grudges-list {
  padding: 10px;
  background: rgba(0, 10, 0, 0.5);
  border: 1px solid #f00;
  border-radius: 3px;
  max-height: 300px;
  overflow-y: auto;
}

.grudge-item {
  margin-bottom: 8px;
}

.grudge-item:hover {
  background: rgba(255, 0, 0, 0.1);
}

/* ==================== */
/* World Map Styles */
/* ==================== */

.world-map-container {
  width: 90%;
  max-width: 1400px;
  height: 90%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 5, 20, 0.95);
  border: 3px solid #d4af37;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

#world-map h2 {
  color: #d4af37;
  font-size: 2.5em;
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

#world-map p {
  color: #e8d4a0;
  text-align: center;
  font-size: 1.2em;
  margin-bottom: 25px;
  font-style: italic;
}

.location-image-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 25px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  overflow: hidden;
}

.location-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.image-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(212, 175, 55, 0.8);
  color: #0a0612;
  border: none;
  padding: 15px 20px;
  font-size: 2em;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.3s;
  z-index: 10;
}

.image-nav-btn:hover {
  background: rgba(212, 175, 55, 1);
  transform: translateY(-50%) scale(1.1);
}

.image-nav-btn:first-of-type {
  left: 10px;
}

.image-nav-btn:last-of-type {
  right: 10px;
}

.image-counter {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.8);
  color: #d4af37;
  padding: 8px 15px;
  border-radius: 5px;
  font-size: 1em;
  font-weight: bold;
}

.location-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.location-actions button {
  padding: 12px 25px;
  font-size: 1.1em;
  background: rgba(80, 50, 120, 0.9);
  color: #d4af37;
  border: 2px solid #d4af37;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
}

.location-actions button:hover {
  background: rgba(120, 80, 180, 1);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.location-actions .primary-button {
  background: rgba(180, 80, 20, 0.9);
  border-color: #ff6600;
  color: #ffe6cc;
}

.location-actions .primary-button:hover {
  background: rgba(220, 100, 30, 1);
  box-shadow: 0 4px 15px rgba(255, 102, 0, 0.5);
}

.location-actions .underway-button {
  background: rgba(100, 70, 40, 0.9);
  border-color: #8b7355;
  color: #d4af37;
}

.location-actions .underway-button:hover {
  background: rgba(140, 100, 60, 1);
  box-shadow: 0 4px 15px rgba(139, 115, 85, 0.5);
}

.location-navigation {
  padding: 15px;
  background: rgba(20, 10, 40, 0.7);
  border-radius: 8px;
  border: 2px solid #663399;
}

.location-navigation h3 {
  color: #d4af37;
  margin-bottom: 10px;
  font-size: 1.3em;
}

.location-btn {
  margin: 5px;
  padding: 10px 20px;
  background: rgba(60, 40, 100, 0.8);
  color: #e8d4a0;
  border: 2px solid #663399;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1em;
}

.location-btn:hover {
  background: rgba(80, 60, 130, 1);
  border-color: #8a67ff;
  transform: scale(1.05);
}

.location-btn.active {
  background: rgba(212, 175, 55, 0.3);
  border-color: #d4af37;
  color: #d4af37;
  font-weight: bold;
}

/* Remove character button */
.remove-char-btn {
  background: rgba(180, 20, 20, 0.7);
  color: #fff;
  border: 1px solid #ff3333;
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  font-size: 0.75em;
  font-weight: bold;
  transition: all 0.2s;
  width: 18px;
  height: 18px;
  min-width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  flex-shrink: 0;
}

.remove-char-btn:hover {
  background: rgba(220, 30, 30, 1);
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(255, 51, 51, 0.5);
}

/* Modal for party restore */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: linear-gradient(135deg, #1a0f2e 0%, #2d1b4e 100%);
  padding: 35px;
  border-radius: 15px;
  border: 3px solid #d4af37;
  max-width: 500px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9);
  color: #e8d4a0;
}

.modal-content h2 {
  color: #d4af37;
  margin-bottom: 20px;
  font-size: 1.8em;
  text-align: center;
}

.modal-content p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.modal-content ul {
  margin: 15px 0;
  padding-left: 30px;
}

.modal-content li {
  margin: 8px 0;
  color: #e8d4a0;
}

.modal-content button {
  padding: 12px 25px;
  font-size: 1.1em;
  background: rgba(80, 50, 120, 0.9);
  color: #d4af37;
  border: 2px solid #d4af37;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
}

.modal-content button:hover {
  background: rgba(120, 80, 180, 1);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}
