/* ============================================================
   TerraCraft – Style Sheet
   ============================================================ */

:root {
  --accent-color: #ff2a2a;
  --accent-glow: rgba(255, 42, 42, 0.45);
  --accent-glow-strong: rgba(255, 42, 42, 0.75);
  --accent-hover: #ef4444;
  --accent-light: #fca5a5;
  --accent-dark: #991b1b;
  --accent-darker: #450a0a;
  --border-color: rgba(220, 38, 38, 0.4);
  --border-color-subtle: rgba(220, 38, 38, 0.2);
  --bg-tint: rgba(220, 38, 38, 0.08);
  --bg-tint-hover: rgba(239, 68, 68, 0.16);
  --iris-gradient: radial-gradient(circle at 40% 40%, #b91c1c 0%, #7f1d1d 40%, #450a0a 100%);
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #080b12;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: #e0e6f0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* ---- Game Container ---- */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  cursor: crosshair;
}

#ui-layer,
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

#inventory-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(4px);
  z-index: 300;
}

#inventory-modal.hidden {
  display: none;
}

.inventory-window {
  width: min(1040px, 96vw);
  max-height: 96vh;
  overflow: hidden;
  background: rgba(14, 8, 16, 0.95);
  border: 2px solid var(--border-color, rgba(220, 38, 38, 0.4));
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(10, 5, 12, 0.9), 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px var(--accent-glow, rgba(220, 38, 38, 0.15));
}

.inventory-header,
.inventory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(10, 6, 12, 0.98);
  border-bottom: 2px solid var(--border-color-subtle, rgba(220, 38, 38, 0.3));
}

.inventory-header h2,
.inventory-main-panel h3,
.equipment-panel h3,
.character-stats-panel h3,
.crafting-panel h3 {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-light, #fca5a5);
  font-size: 10px;
  letter-spacing: 0.5px;
}

.inventory-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-color, #ef4444);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-shadow: 0 0 8px var(--accent-glow, rgba(239, 68, 68, 0.4));
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.1fr);
  align-items: stretch;
  gap: 14px;
  padding: 10px;
}

.inventory-main-panel {
  min-width: 0;
  min-height: 0;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
}

.loadout-row {
  display: grid;
  grid-template-columns: 120px 84px minmax(130px, 1fr);
  gap: 10px;
  min-height: 200px;
}

.player-preview {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.35));
  background: rgba(10, 6, 12, 0.9);
  border-radius: 6px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 0 10px var(--accent-glow, rgba(220, 38, 38, 0.08));
}

.player-preview::before,
.player-preview::after {
  content: "";
  position: absolute;
  background: var(--border-color-subtle, rgba(220, 38, 38, 0.2));
}

.player-preview::before { width: 100%; height: 2px; top: 14%; left: 0; }
.player-preview::after { width: 100%; height: 2px; bottom: 16%; left: 0; }

.pixel-player { position: absolute; left: 50%; transform: translateX(-50%); }
.pixel-player-head { top: 16%; width: 68px; height: 62px; background: #f0b96f; border: 8px solid #aeb3b3; box-shadow: 0 -8px 0 #858b8c; }
.pixel-player-head::before,
.pixel-player-head::after { content: ""; position: absolute; top: 20px; width: 10px; height: 15px; background: #17120e; }
.pixel-player-head::before { left: 10px; }
.pixel-player-head::after { right: 10px; }
.pixel-player-head span { position: absolute; width: 24px; height: 6px; left: 14px; bottom: 6px; background: #bc7840; }
.pixel-player-body { top: 44%; width: 110px; height: 68px; background: #315bd2; box-shadow: 0 0 0 3px #274fbf; }
.pixel-player-legs { bottom: 7%; width: 56px; height: 62px; background: #273c4b; border-left: 22px solid #304b5e; border-right: 22px solid #304b5e; }

.equipment-panel {
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.35));
  background: rgba(10, 6, 12, 0.9);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.equipment-panel h3 { margin: 0 0 10px; color: var(--accent-light, #fca5a5); font-size: 8px; text-align: center; }

/* Character Stats Panel */
.character-stats-panel {
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.35));
  background: rgba(10, 6, 12, 0.9);
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 12px var(--accent-glow, rgba(220, 38, 38, 0.06));
}

.character-stats-panel h3 {
  margin: 0 0 8px;
  color: var(--accent-light, #fca5a5);
  font-size: 8px;
  text-align: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  flex: 1;
}

.stat-card {
  background: var(--bg-tint, rgba(220, 38, 38, 0.07));
  border: 1px solid var(--border-color-subtle, rgba(220, 38, 38, 0.22));
  border-radius: 4px;
  padding: 5px 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.stat-card:hover {
  background: var(--bg-tint-hover, rgba(220, 38, 38, 0.14));
  border-color: var(--border-color, rgba(239, 68, 68, 0.45));
}

.stat-card.full-width {
  grid-column: span 2;
}

.stat-icon {
  font-size: 10px;
  line-height: 1;
}

.stat-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #a88;
  letter-spacing: 0.5px;
}

.stat-value {
  margin-left: auto;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #fff;
  text-shadow: 0 0 6px var(--accent-glow, rgba(239, 68, 68, 0.4));
}

.stat-value.small-text {
  font-size: 7px;
  max-width: 105px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-heading { margin: 10px 0 7px; }

.crafting-panel {
  min-width: 0;
  height: 100%;
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.35));
  background: rgba(10, 6, 12, 0.9);
  border-radius: 6px;
  padding: 9px;
}

.crafting-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.crafting-panel-header h3 { margin-top: 4px; color: var(--accent-light, #fca5a5); }
.panel-status { color: var(--accent-color, #ef4444); font: 7px 'Press Start 2P', monospace; }

.category-filter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.35));
  background: rgba(10, 6, 12, 0.9);
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 9px;
}

.category-filter-button {
  min-width: 0;
  height: 54px;
  border: 1px solid var(--border-color-subtle, rgba(220, 38, 38, 0.2));
  background: rgba(22, 10, 16, 0.8);
  color: #a88;
  border-radius: 4px;
  cursor: pointer;
  font: 18px 'Press Start 2P', monospace;
  transition: all 0.2s ease;
}
.category-filter-button span { display: block; margin-top: 5px; font-size: 6px; }
.category-filter-button.active {
  border: 2px solid var(--accent-color, #ef4444);
  color: #fff;
  background: var(--bg-tint-hover, rgba(220, 38, 38, 0.2));
  box-shadow: 0 0 12px var(--accent-glow, rgba(239, 68, 68, 0.3));
}

.main-inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 52px);
  gap: 6px;
  padding: 8px;
  margin-bottom: 12px;
  min-width: 0;
}

.inventory-hotbar-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 52px);
  gap: 6px;
  margin-top: auto;
  padding: 6px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  background: rgba(10, 6, 12, 0.9);
  border: 1px solid var(--accent-color);
  border-radius: 6px;
}

.main-inventory-grid .inventory-slot,
.inventory-hotbar-grid .inventory-slot {
  width: 100%;
  min-width: 0;
  height: auto;
}

.inventory-slot,
.equipment-slot {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 10, 16, 0.8);
  border: 1px solid var(--accent-glow);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s ease;
}

.inventory-slot:hover,
.inventory-slot.selected,
.equipment-slot:hover,
.equipment-slot.selected {
  border: 2px solid var(--accent-color);
  background: var(--accent-glow);
  box-shadow: 0 0 10px var(--accent-glow);
}

.slot-icon { line-height: 1; }
.slot-count {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: #fff;
  font: bold 10px 'Press Start 2P', monospace;
  text-shadow: 1px 1px #000;
}

.equipment-slots {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 6px;
  padding: 4px;
  margin-bottom: 0;
}

.equipment-slots .equipment-slot {
  width: 52px;
  height: 44px;
  align-self: center;
  flex: 0 0 auto;
}

.equipment-placeholder {
  color: #886670;
  max-width: 100%;
  font-size: 8px;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.3;
  padding: 0 2px;
}

.inventory-recipes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(510px, calc(96vh - 250px));
  overflow-y: auto;
}

.inventory-recipe {
  min-height: 106px;
  padding: 12px 12px 12px 66px;
  position: relative;
  background: rgba(10, 6, 12, 0.9);
  border: 0;
  border-top: 1px solid var(--border-color-subtle, rgba(220, 38, 38, 0.3));
  border-radius: 4px;
}

.recipe-preview-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #F1F5F9;
  font: 9px 'Press Start 2P', monospace;
}

.recipe-costs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  color: #a88;
  font-size: 9px;
}

.recipe-preview-line > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-costs .owned { color: #4ade80; }
.recipe-costs .missing { color: #f87171; }

.inventory-recipe::before {
  content: "✦";
  position: absolute;
  left: 14px;
  top: 29px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-color, rgba(220, 38, 38, 0.4));
  border-radius: 50%;
  color: var(--accent-color, #ef4444);
  font-size: 24px;
  box-shadow: 0 0 10px var(--accent-glow, rgba(220, 38, 38, 0.2));
}

.craft-btn-small {
  padding: 7px 9px;
  border: 1px solid var(--accent-color, #ef4444);
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent-dark, #b91c1c) 0%, var(--accent-color, #dc2626) 100%);
  color: #fff;
  cursor: pointer;
  font: bold 9px 'Press Start 2P', monospace;
  box-shadow: 0 0 8px var(--accent-glow, rgba(220, 38, 38, 0.25));
  transition: all 0.2s ease;
}

.craft-btn-small:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-color, #dc2626) 0%, var(--accent-hover, #ef4444) 100%);
  box-shadow: 0 0 14px var(--accent-glow-strong, rgba(239, 68, 68, 0.4));
}

.craft-btn-small:disabled { opacity: 0.35; cursor: not-allowed; border-color: var(--border-color-subtle, rgba(220, 38, 38, 0.2)); color: #888; }

.inventory-footer {
  justify-content: center;
  border-top: 1px solid var(--border-color-subtle, rgba(220, 38, 38, 0.3));
  border-bottom: 0;
  color: #a88;
  font-size: 10px;
  text-align: center;
}

@media (max-width: 700px) {
  .inventory-layout { grid-template-columns: 1fr; overflow-y: auto; max-height: calc(96vh - 54px); }
  .crafting-panel { min-height: 440px; }
  .inventory-recipes { max-height: 420px; }
  .inventory-window { max-height: 90vh; }
  .inventory-footer { line-height: 1.5; }
}

/* ---- Controls Hint Overlay ---- */
#controls-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(8, 12, 24, 0.92);
  backdrop-filter: blur(10px);
  z-index: 100;
  text-align: center;
  gap: 14px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#controls-hint.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#controls-hint h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 28px;
  color: #ffd369;
  margin-bottom: 8px;
  text-shadow: 0 0 24px rgba(255,211,105,0.45);
}

#controls-hint h3 {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #90a4c8;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.hint-columns {
  display: flex;
  gap: 40px;
  margin-bottom: 6px;
}

.hint-col {
  text-align: left;
  background: rgba(255,255,255,0.03);
  padding: 16px 22px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}

#controls-hint p {
  font-size: 13px;
  line-height: 2;
  color: #b0bdd4;
}

#controls-hint kbd {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #fff;
  min-width: 24px;
  text-align: center;
}

.hint-items {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #a0b0cc;
  margin-top: 4px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}

.hint-fade {
  margin-top: 14px;
  font-size: 12px !important;
  color: #607090 !important;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ============================================================
   Crafting Modal System
   ============================================================ */

#crafting-modal {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 7, 15, 0.75);
  backdrop-filter: blur(8px);
  z-index: 50;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#crafting-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#chest-modal,
#furnace-modal,
#victory-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 7, 15, 0.78);
  backdrop-filter: blur(8px);
  z-index: 200;
}

#chest-modal.hidden,
#furnace-modal.hidden,
#victory-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.storage-window,
.furnace-window,
.victory-window {
  width: min(430px, 90vw);
  padding: 22px;
  background: #151a26;
  border: 2px solid #d18a42;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.8);
  text-align: center;
}

.furnace-window {
  border-color: #ff7043;
}

.furnace-recipes {
  display: grid;
  gap: 8px;
}

.furnace-recipe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 112, 67, 0.08);
  border: 1px solid #704338;
  border-radius: 5px;
  color: #f8fafc;
  font-size: 11px;
}

.furnace-recipe button {
  padding: 7px 9px;
  border: 0;
  border-radius: 4px;
  background: #ff7043;
  color: #1b0d08;
  cursor: pointer;
  font: bold 9px 'Press Start 2P', monospace;
}

.furnace-recipe button:disabled { opacity: 0.35; cursor: not-allowed; }

.furnace-status {
  min-height: 18px;
  margin-top: 14px;
  color: #ffcc80;
  font-size: 11px;
  text-align: center;
}

.storage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.storage-header h2,
.victory-window h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #ffd369;
}

.storage-help,
.victory-window p {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 16px;
}

.storage-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.storage-section-title {
  margin: 18px 0 8px;
  color: #ffd369;
  font: 10px 'Press Start 2P', monospace;
  text-align: left;
}

.storage-inventory-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.storage-hotbar-slots {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.storage-inventory-slots .inventory-slot,
.storage-hotbar-slots .inventory-slot {
  min-height: 52px;
  font-size: 23px;
}

.storage-slot {
  position: relative;
  min-height: 58px;
  background: rgba(255,255,255,0.08);
  border: 1px solid #4a5568;
  border-radius: 6px;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

.storage-slot:hover {
  border-color: #ffd369;
  background: rgba(255,211,105,0.16);
}

.storage-slot small {
  position: absolute;
  right: 5px;
  bottom: 3px;
  color: #fff;
  font: bold 10px 'Press Start 2P', monospace;
}

.victory-icon {
  font-size: 44px;
  margin-bottom: 10px;
}

.victory-window h2 {
  color: #ffd369;
  margin-bottom: 14px;
}

.crafting-window {
  width: 620px;
  max-width: 90vw;
  background: #151a26;
  border: 2px solid #2d3748;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.8), 0 0 20px rgba(255,211,105,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.crafting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #1c2333;
  border-bottom: 2px solid #2d3748;
}

.crafting-header h2 {
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  color: #ffd369;
  letter-spacing: 0.5px;
}

.close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.close-btn:hover {
  color: #ff5252;
  background: rgba(255,82,82,0.1);
}

.crafting-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 18px;
  gap: 18px;
  min-height: 280px;
}

.recipes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 6px;
}

.recipes-list::-webkit-scrollbar {
  width: 6px;
}
.recipes-list::-webkit-scrollbar-thumb {
  background: #2d3748;
  border-radius: 3px;
}

.recipe-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #1c2333;
  border: 1px solid #2d3748;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.recipe-item:hover {
  background: #252e42;
  border-color: #4a5568;
  transform: translateY(-1px);
}

.recipe-item.active {
  background: rgba(255,211,105,0.12);
  border-color: #ffd369;
}

.recipe-item.can-craft {
  border-left: 4px solid #48bb78;
}

.recipe-icon {
  width: 32px;
  height: 32px;
  overflow: hidden;
  display: flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  max-width: 32px;
  max-height: 32px;
}

.craft-icon-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  image-rendering: pixelated;
}

.recipe-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recipe-title {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.recipe-count {
  font-size: 11px;
  color: #94a3b8;
}

.recipe-preview {
  background: #1c2333;
  border: 1px solid #2d3748;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-between;
}

.preview-icon {
  font-size: 38px;
  margin-bottom: 8px;
  background: rgba(0,0,0,0.25);
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recipe-preview h3 {
  font-size: 15px;
  color: #ffd369;
  margin-bottom: 4px;
}

.recipe-preview p {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
  margin-bottom: 12px;
}

.preview-reqs {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  text-align: left;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 6px;
}

.req-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
}

.req-row.met {
  color: #48bb78;
}

.req-row.unmet {
  color: #f56565;
}

.craft-btn {
  width: 100%;
  padding: 10px 0;
  background: #e2b714;
  color: #0b0e17;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.craft-btn:hover:not(:disabled) {
  background: #ffd369;
  box-shadow: 0 0 12px rgba(255,211,105,0.4);
  transform: translateY(-1px);
}

.craft-btn:disabled {
  background: #334155;
  color: #64748b;
  cursor: not-allowed;
  opacity: 0.7;
}

.crafting-footer {
  padding: 10px 20px;
  background: #111622;
  border-top: 1px solid #232d3f;
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

.crafting-footer kbd {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #cbd5e1;
}

/* ============================================================
   Settings Modal & Theme System
   ============================================================ */

#settings-modal {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 7, 15, 0.88);
  backdrop-filter: blur(10px);
  z-index: 550;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#settings-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.settings-box {
  width: min(540px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  background: rgba(10, 8, 16, 0.94);
  border: 1px solid var(--border-color, rgba(220, 38, 38, 0.4));
  border-radius: 16px;
  box-shadow: 0 0 50px var(--accent-glow, rgba(220, 38, 38, 0.2)), inset 0 0 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: menuBoxFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.settings-header .menu-title {
  font-size: 20px;
  color: var(--accent-color, #ef4444);
  text-shadow: 0 0 10px var(--accent-glow-strong, rgba(239, 68, 68, 0.6)), 0 0 30px var(--accent-glow, rgba(200, 30, 30, 0.35));
}

.settings-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.settings-section-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--accent-light, #fca5a5);
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

.theme-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.theme-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-color);
  transform: translateX(4px);
  box-shadow: 0 0 12px var(--accent-glow, rgba(0,0,0,0.3));
}

.theme-card.active {
  background: var(--bg-tint, rgba(220, 38, 38, 0.12));
  border: 2px solid var(--accent-color, #ef4444);
  box-shadow: 0 0 18px var(--accent-glow, rgba(239, 68, 68, 0.35));
}

.theme-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 10px currentColor;
  flex-shrink: 0;
}

.theme-name {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #f1f5f9;
}

.theme-tag {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
  margin-left: 6px;
}

.theme-active-indicator {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: var(--accent-color, #ef4444);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease;
}

.theme-card.active .theme-active-indicator {
  opacity: 1;
  transform: scale(1);
}

/* Theme Live Preview Box */
.theme-preview-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed var(--border-color, rgba(220, 38, 38, 0.3));
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-preview-title {
  font-size: 9px;
  color: #94a3b8;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.theme-preview-elements {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.theme-preview-hp {
  flex: 1;
  height: 14px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.theme-preview-hp-fill {
  width: 75%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dark, #991b1b), var(--accent-color, #ef4444));
  box-shadow: 0 0 8px var(--accent-glow);
}

.theme-preview-badge {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--accent-color);
  background: var(--bg-tint);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  text-shadow: 0 0 6px var(--accent-glow);
}

