/* AMMO-8 Color Palette */
:root {
  --ammo-0: #040c06;  /* Darkest - background */
  --ammo-1: #112318;  /* Dark */
  --ammo-2: #1e3a29;  /* Dark green */
  --ammo-3: #305d42;  /* Medium green */
  --ammo-4: #4d8061;  /* Medium */
  --ammo-5: #89a257;  /* Yellow-green */
  --ammo-6: #bedc7f;  /* Bright lime - primary text */
  --ammo-7: #eeffcc;  /* Cream - highlights */

  --hp-color: #ff6b6b;
  --mp-color: #4ecdc4;
  --gold-color: #ffd700;
}

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

body {
  background: var(--ammo-0);
  color: var(--ammo-6);
  font-family: 'Courier New', monospace;
  font-size: 16px;
  line-height: 1.4;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

#game-container {
  width: 900px;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--ammo-1);
  border: 3px solid var(--ammo-3);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 0 30px rgba(78, 205, 196, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Screen Management */
.screen {
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Screen Shake Animations */
@keyframes shake-small {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2px, 1px); }
  20% { transform: translate(2px, -1px); }
  30% { transform: translate(-2px, -1px); }
  40% { transform: translate(2px, 1px); }
  50% { transform: translate(-2px, 1px); }
  60% { transform: translate(2px, -1px); }
  70% { transform: translate(-2px, -1px); }
  80% { transform: translate(2px, 1px); }
  90% { transform: translate(-1px, 0); }
}

@keyframes shake-large {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-5px, 3px) rotate(-1deg); }
  20% { transform: translate(5px, -4px) rotate(1deg); }
  30% { transform: translate(-6px, -3px) rotate(-1deg); }
  40% { transform: translate(6px, 4px) rotate(1deg); }
  50% { transform: translate(-5px, 3px) rotate(-1deg); }
  60% { transform: translate(5px, -4px) rotate(1deg); }
  70% { transform: translate(-4px, -3px) rotate(-1deg); }
  80% { transform: translate(4px, 3px) rotate(1deg); }
  90% { transform: translate(-2px, 1px) rotate(0deg); }
}

.shake-small {
  animation: shake-small 0.3s ease-in-out;
}

.shake-large {
  animation: shake-large 0.5s ease-in-out;
}

/* Damage Flash */
@keyframes damage-flash {
  0% { background: var(--ammo-2); }
  50% { background: rgba(255, 107, 107, 0.3); }
  100% { background: var(--ammo-2); }
}

.damage-flash {
  animation: damage-flash 0.3s ease-in-out;
}

/* Main Menu */
.title-card {
  text-align: center;
  margin-bottom: 40px;
}

.title-card h1 {
  font-size: 3em;
  color: var(--ammo-7);
  margin-bottom: 10px;
  text-shadow: 0 0 10px var(--ammo-5);
}

.subtitle {
  font-size: 1.2em;
  color: var(--ammo-5);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 400px;
  margin: 0 auto;
}

.menu-btn {
  background: var(--ammo-2);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 20px;
  font-size: 1.3em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.menu-btn:hover:not(:disabled) {
  background: var(--ammo-3);
  border-color: var(--ammo-5);
  transform: translateY(-2px);
}

.menu-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Class Selection */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.class-card {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.class-card:hover {
  border-color: var(--ammo-5);
  transform: scale(1.05);
}

.class-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.class-icon {
  font-size: 3em;
  margin-bottom: 10px;
}

.class-name {
  font-size: 1.2em;
  color: var(--ammo-7);
  margin-bottom: 5px;
}

.class-description {
  font-size: 0.9em;
  color: var(--ammo-5);
}

/* Prep Room */
.prep-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--ammo-3);
}

.wave-counter {
  font-size: 1.5em;
  color: var(--ammo-7);
}

.character-summary {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 30px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.stat-row:last-child {
  margin-bottom: 0;
}

.label {
  color: var(--ammo-4);
  min-width: 40px;
}

.ml-4 {
  margin-left: 40px;
}

.bar {
  flex: 1;
  height: 24px;
  background: var(--ammo-1);
  border: 1px solid var(--ammo-3);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  transition: width 0.3s;
}

.hp-bar {
  background: var(--hp-color);
}

.mp-bar {
  background: var(--mp-color);
}

.enemy-hp-bar {
  background: var(--ammo-5);
}

.bar-text {
  position: relative;
  z-index: 1;
  font-size: 0.9em;
  font-weight: bold;
  color: var(--ammo-7);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.prep-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.action-btn {
  background: var(--ammo-2);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 30px 20px;
  font-size: 1.2em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
  text-align: center;
}

.action-btn:hover {
  background: var(--ammo-3);
  border-color: var(--ammo-5);
  transform: translateY(-2px);
}

.btn-subtitle {
  display: block;
  font-size: 0.7em;
  color: var(--ammo-5);
  margin-top: 5px;
}

.fight-btn {
  grid-column: span 2;
  background: var(--ammo-3);
  border-color: var(--ammo-5);
  font-size: 1.5em;
}

.fight-btn:hover {
  background: var(--ammo-4);
  border-color: var(--ammo-6);
}

/* Combat Screen */
.combat-header {
  text-align: center;
  margin-bottom: 10px;
}

.wave-info {
  font-size: 1.2em;
  color: var(--ammo-7);
}

.combat-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.enemy-display, .player-display {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 6px;
  border-radius: 5px;
  text-align: center;
}

.enemy-icon, .player-icon {
  font-size: 1.8em;
  margin-bottom: 2px;
}

.combat-log {
  background: var(--ammo-1);
  border: 2px solid var(--ammo-3);
  padding: 10px;
  border-radius: 5px;
  height: 110px;
  overflow-y: auto;
  font-size: 0.9em;
}

.log-entry {
  margin-bottom: 3px;
  color: var(--ammo-5);
}

.log-entry.damage {
  color: var(--hp-color);
}

.log-entry.heal {
  color: var(--mp-color);
}

.log-entry.important {
  color: var(--ammo-7);
  font-weight: bold;
}

.combat-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 5px;
}

.combat-btn {
  background: var(--ammo-2);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 8px 12px;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.combat-btn:hover:not(:disabled) {
  background: var(--ammo-3);
  border-color: var(--ammo-5);
  transform: scale(1.02);
}

.combat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Vendor */
.vendor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--ammo-3);
}

.vendor-gold {
  font-size: 1.3em;
  color: var(--gold-color);
}

.vendor-categories {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.category-btn {
  flex: 1;
  background: var(--ammo-2);
  color: var(--ammo-5);
  border: 2px solid var(--ammo-3);
  padding: 12px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.category-btn:hover {
  border-color: var(--ammo-4);
}

.category-btn.active {
  background: var(--ammo-3);
  border-color: var(--ammo-5);
  color: var(--ammo-6);
}

.vendor-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  max-height: calc(100vh - 350px);
  min-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

/* Custom scrollbar for vendor items */
.vendor-items::-webkit-scrollbar {
  width: 8px;
}

.vendor-items::-webkit-scrollbar-track {
  background: var(--ammo-2);
  border-radius: 4px;
}

.vendor-items::-webkit-scrollbar-thumb {
  background: var(--ammo-4);
  border-radius: 4px;
}

.vendor-items::-webkit-scrollbar-thumb:hover {
  background: var(--ammo-5);
}

.vendor-item-row {
  position: relative;
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 12px 15px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.vendor-item-row:hover {
  border-color: var(--ammo-5);
  background: var(--ammo-3);
  transform: translateX(5px);
}

.vendor-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.vendor-item-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.item-icon {
  font-size: 1.5em;
}

.item-name {
  font-size: 1.1em;
  color: var(--ammo-7);
  font-weight: bold;
}

.item-price {
  font-size: 1em;
  color: var(--gold-color);
  min-width: 80px;
  text-align: right;
}

/* Vendor tooltip modal - simple centered display */
.vendor-tooltip {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  pointer-events: none;
}

.vendor-tooltip.active {
  display: block;
}

.tooltip-content {
  background: var(--ammo-0);
  border: 4px solid var(--ammo-6);
  border-radius: 8px;
  padding: 20px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}

.tooltip-name {
  font-size: 1.2em;
  color: var(--ammo-7);
  font-weight: bold;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--ammo-4);
  padding-bottom: 8px;
}

.tooltip-description {
  font-size: 0.95em;
  color: var(--ammo-6);
  margin-bottom: 10px;
  line-height: 1.4;
}

.tooltip-price {
  font-size: 0.9em;
  color: var(--gold-color);
}

.buy-btn {
  background: var(--ammo-3);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 10px;
  font-size: 1em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
}

.buy-btn:hover:not(:disabled) {
  background: var(--ammo-4);
  border-color: var(--ammo-5);
}

.buy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Event Encounters */
.event-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
  overflow-y: auto;
  max-height: calc(100vh - 40px);
}

/* Custom scrollbar for event container */
.event-container::-webkit-scrollbar {
  width: 8px;
}

.event-container::-webkit-scrollbar-track {
  background: var(--ammo-2);
  border-radius: 4px;
}

.event-container::-webkit-scrollbar-thumb {
  background: var(--ammo-4);
  border-radius: 4px;
}

.event-container::-webkit-scrollbar-thumb:hover {
  background: var(--ammo-5);
}

.event-card {
  background: linear-gradient(135deg, var(--ammo-2) 0%, var(--ammo-3) 100%);
  border: 3px solid var(--ammo-4);
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.event-icon {
  font-size: 5em;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.event-name {
  font-size: 2em;
  color: var(--ammo-6);
  margin: 0 0 20px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.event-description {
  font-size: 1.2em;
  color: var(--ammo-5);
  line-height: 1.6;
  margin: 0 0 20px 0;
}

.event-rarity {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9em;
  letter-spacing: 1px;
}

.rarity-common {
  background: var(--ammo-3);
  color: var(--ammo-5);
  border: 2px solid var(--ammo-4);
}

.rarity-uncommon {
  background: #2d5016;
  color: #a8ff60;
  border: 2px solid #a8ff60;
}

.rarity-rare {
  background: #16325c;
  color: #5eb3ff;
  border: 2px solid #5eb3ff;
}

.rarity-legendary {
  background: #5c2d16;
  color: #ffae42;
  border: 2px solid #ffae42;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.event-choice-btn {
  background: var(--ammo-3);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 20px 25px;
  font-size: 1.1em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.event-choice-btn:hover:not(:disabled) {
  background: var(--ammo-4);
  border-color: var(--ammo-5);
  transform: translateX(5px);
}

.event-choice-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-choice-btn.disabled {
  opacity: 0.5;
}

.choice-text {
  flex: 1;
}

.choice-cost {
  color: var(--gold-color);
  font-weight: bold;
  margin-left: 15px;
}

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

.modal-content {
  background: var(--ammo-2);
  border: 3px solid var(--ammo-5);
  border-radius: 10px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
  color: var(--ammo-6);
  margin: 0 0 15px 0;
}

.event-result-text {
  font-size: 1.1em;
  line-height: 1.6;
  margin: 20px 0;
}

/* Character Sheet */
.character-details {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 20px;
  overflow-y: auto;
  flex: 1;
  max-height: calc(90vh - 200px); /* Leave room for header and back button */
}

.back-btn, .continue-btn {
  background: var(--ammo-3);
  color: var(--ammo-6);
  border: 2px solid var(--ammo-4);
  padding: 15px 30px;
  font-size: 1.1em;
  font-family: inherit;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s;
  display: block;
  margin: 20px auto;
}

.back-btn:hover, .continue-btn:hover {
  background: var(--ammo-4);
  border-color: var(--ammo-5);
}

/* Modal back button - prevent shrinking in flex container */
.item-menu-content .back-btn {
  flex-shrink: 0;
  margin-top: auto;
}

/* Victory/Game Over */
#victory h2, #game-over h2 {
  text-align: center;
  font-size: 2.5em;
  margin-bottom: 30px;
  color: var(--ammo-7);
}

#victory-rewards, #game-over-stats {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 20px;
  text-align: center;
}

/* Scrollbar Styling */
.combat-log::-webkit-scrollbar {
  width: 8px;
}

.combat-log::-webkit-scrollbar-track {
  background: var(--ammo-0);
}

.combat-log::-webkit-scrollbar-thumb {
  background: var(--ammo-3);
  border-radius: 4px;
}

.combat-log::-webkit-scrollbar-thumb:hover {
  background: var(--ammo-4);
}

/* Responsive */
/* Save Slot Styles */
.save-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.save-slot-card {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 20px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.save-slot-card:hover {
  border-color: var(--ammo-5);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(190, 220, 127, 0.3);
}

.save-slot-name {
  font-size: 1.1em;
  color: var(--ammo-7);
  font-weight: bold;
  margin-bottom: 10px;
}

.save-slot-empty {
  color: var(--ammo-4);
  font-style: italic;
  text-align: center;
  margin: auto 0;
}

.save-slot-info {
  color: var(--ammo-6);
  line-height: 1.6;
}

.save-slot-info > div {
  margin-bottom: 5px;
}

.save-slot-date {
  color: var(--ammo-4);
  font-size: 0.85em;
  margin-top: 5px;
}

.delete-save-btn {
  background: var(--ammo-3);
  color: var(--hp-color);
  border: 1px solid var(--hp-color);
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  transition: all 0.2s;
  margin-top: 10px;
  align-self: flex-start;
}

.delete-save-btn:hover {
  background: var(--hp-color);
  color: var(--ammo-0);
  transform: scale(1.05);
}

/* === Small Equipment Buttons === */
.small-btn {
  padding: 2px 8px;
  font-size: 0.85em;
  border: 2px solid var(--ammo-3);
  background: var(--ammo-1);
  color: var(--ammo-7);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Courier New', monospace;
  font-weight: bold;
}

.small-btn:hover {
  border-color: var(--ammo-5);
  background: var(--ammo-2);
  transform: translateY(-2px);
}

.equip-btn {
  margin-right: 5px;
  border-color: var(--ammo-4);
  color: var(--ammo-6);
}

.equip-btn:hover {
  border-color: var(--ammo-5);
  background: var(--ammo-3);
  box-shadow: 0 2px 8px rgba(190, 220, 127, 0.3);
}

.sell-btn {
  border-color: var(--gold-color);
  color: var(--gold-color);
}

.sell-btn:hover {
  border-color: var(--gold-color);
  background: rgba(255, 215, 0, 0.1);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.unequip-btn {
  border-color: var(--ammo-4);
  color: var(--ammo-5);
}

.unequip-btn:hover {
  border-color: var(--ammo-6);
  background: var(--ammo-2);
  box-shadow: 0 2px 8px rgba(190, 220, 127, 0.2);
}

/* === Item Menu Overlay === */
.item-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.item-menu-overlay.active {
  display: flex;
}

.item-menu-content {
  background: var(--ammo-1);
  border: 3px solid var(--ammo-4);
  border-radius: 10px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.item-menu-content h3 {
  color: var(--ammo-7);
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.5em;
  flex-shrink: 0;
}

.combat-items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  overflow-y: auto;
  max-height: 50vh;
  flex: 1;
  min-height: 0;
}

.combat-item-card {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 15px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.combat-item-card:hover {
  border-color: var(--ammo-5);
  transform: translateX(5px);
}

.combat-item-info {
  flex: 1;
}

.combat-item-name {
  font-weight: bold;
  color: var(--ammo-7);
  margin-bottom: 5px;
}

.combat-item-description {
  font-size: 0.9em;
  color: var(--ammo-5);
}

.combat-item-count {
  color: var(--ammo-6);
  margin-right: 15px;
  font-weight: bold;
}

.use-item-btn {
  padding: 8px 16px;
  background: var(--ammo-3);
  border: 2px solid var(--ammo-4);
  color: var(--ammo-7);
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  transition: all 0.2s;
}

.use-item-btn:hover {
  background: var(--ammo-4);
  border-color: var(--ammo-5);
  transform: scale(1.05);
}

.use-item-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Ability List */
.ability-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 10px;
  flex: 1;
  min-height: 0;
  margin-bottom: 20px;
}

/* Custom scrollbar for ability list */
.ability-list::-webkit-scrollbar {
  width: 8px;
}

.ability-list::-webkit-scrollbar-track {
  background: var(--ammo-2);
  border-radius: 4px;
}

.ability-list::-webkit-scrollbar-thumb {
  background: var(--ammo-4);
  border-radius: 4px;
}

.ability-list::-webkit-scrollbar-thumb:hover {
  background: var(--ammo-5);
}

.ability-card {
  background: var(--ammo-2);
  border: 2px solid var(--ammo-3);
  padding: 15px;
  border-radius: 5px;
  transition: all 0.2s;
}

.ability-card:hover:not(.disabled) {
  border-color: var(--magic-color);
  transform: translateX(5px);
}

.ability-card.disabled {
  opacity: 0.5;
  border-color: var(--ammo-3);
}

.ability-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.ability-name {
  font-weight: bold;
  color: var(--ammo-7);
  font-size: 1.1em;
}

.ability-cost {
  color: var(--magic-color);
  font-weight: bold;
  font-size: 0.9em;
}

.ability-description {
  font-size: 0.9em;
  color: var(--ammo-5);
  margin-bottom: 8px;
}

.ability-cooldown-info {
  font-size: 0.85em;
  color: var(--ammo-4);
  margin-bottom: 8px;
}

.use-ability-btn {
  width: 100%;
  padding: 8px 16px;
  background: var(--ammo-3);
  border: 2px solid var(--magic-color);
  color: var(--ammo-7);
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  transition: all 0.2s;
}

.use-ability-btn:hover:not(:disabled) {
  background: var(--magic-color);
  color: var(--ammo-1);
  transform: scale(1.02);
}

.use-ability-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  border-color: var(--ammo-4);
}

@media (max-width: 600px) {
  /* Fix scrolling on mobile */
  body {
    align-items: flex-start; /* Don't vertically center on mobile */
    padding: 10px; /* Reduce padding on mobile */
  }

  #game-container {
    max-height: none; /* Remove height constraint */
    overflow-y: auto; /* Allow vertical scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  }

  .screen {
    overflow-y: auto; /* Allow screens to scroll internally */
    -webkit-overflow-scrolling: touch;
  }

  .prep-actions {
    grid-template-columns: 1fr;
  }

  .fight-btn {
    grid-column: span 1;
  }

  .combat-actions {
    grid-template-columns: 1fr;
  }

  /* Vendor category tabs - horizontal scrolling */
  .vendor-categories {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap; /* Prevent wrapping */
    padding-bottom: 5px; /* Space for scrollbar */
  }

  .category-btn {
    flex-shrink: 0; /* Prevent buttons from shrinking */
    min-width: 130px; /* Ensure buttons are readable */
    white-space: nowrap; /* Prevent text wrapping in buttons */
  }

  /* Vendor item rows - better mobile layout */
  .vendor-item-row {
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 10px;
  }

  .vendor-item-info {
    flex: 1 1 auto;
    min-width: 0; /* Allow text truncation */
  }

  .vendor-item-actions {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
  }

  .item-price {
    white-space: nowrap; /* Keep price on one line */
  }

  /* Buy button - prevent text overflow */
  .buy-btn {
    padding: 8px 12px;
    font-size: 0.9em;
    white-space: nowrap; /* Prevent text wrapping */
    min-width: 90px; /* Ensure button is wide enough for "Can't Afford" */
  }
}

/* ===== ALPHA NOTICE ===== */
.alpha-notice {
  color: var(--ammo-5);
  font-size: 11px;
  font-weight: 500;
  margin-top: 30px;
  padding: 0;
  opacity: 0.7;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ===== HOW TO PLAY MODAL ===== */
.how-to-play-content {
  color: var(--ammo-6);
  line-height: 1.6;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 10px;
}

.how-to-play-content h3 {
  color: var(--ammo-7);
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 18px;
  border-bottom: 2px solid var(--ammo-4);
  padding-bottom: 5px;
}

.how-to-play-content h3:first-child {
  margin-top: 0;
}

.gameplay-loop {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 15px 0;
}

.loop-step {
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(77, 128, 97, 0.2);
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--ammo-5);
}

.loop-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.loop-step strong {
  color: var(--ammo-8);
  font-size: 16px;
  display: block;
  margin-bottom: 4px;
}

.loop-step p {
  margin: 0;
  color: var(--ammo-6);
  font-size: 14px;
}

.loop-arrow {
  text-align: center;
  color: var(--ammo-5);
  font-size: 24px;
  margin: 5px 0;
  font-weight: bold;
}

.controls-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

.controls-list li {
  padding: 8px 12px;
  margin: 6px 0;
  background: rgba(48, 93, 66, 0.3);
  border-radius: 6px;
  border-left: 3px solid var(--ammo-5);
}

.controls-list strong {
  color: var(--ammo-7);
}

/* Scrollbar styling for How to Play */
.how-to-play-content::-webkit-scrollbar {
  width: 8px;
}

.how-to-play-content::-webkit-scrollbar-track {
  background: var(--ammo-2);
  border-radius: 4px;
}

.how-to-play-content::-webkit-scrollbar-thumb {
  background: var(--ammo-5);
  border-radius: 4px;
}

.how-to-play-content::-webkit-scrollbar-thumb:hover {
  background: var(--ammo-6);
}
