* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: none;
}

#game-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#game-container canvas {
  display: block;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #0a0a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease;
}
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-content {
  text-align: center;
}
.loading-title {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 12px;
  color: #e8e0d0;
  margin-bottom: 40px;
  text-shadow: 0 0 30px rgba(200,180,140,0.3);
}
.loading-bar-bg {
  width: 320px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  margin: 0 auto 16px;
  overflow: hidden;
}
.loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8ab4d8, #c8a86e);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.loading-text {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  letter-spacing: 1px;
}

/* ===== VIGNETTE ===== */
#vignette {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 8;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.35) 100%);
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10;
}

/* ===== MINIMAP ===== */
#minimap-container {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 160px;
  height: 160px;
  display: none;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.15);
}

#minimap-canvas {
  width: 160px;
  height: 160px;
  display: block;
  image-rendering: pixelated;
}

.minimap-border {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  box-sizing: border-box;
}

/* ===== CROSSHAIR ===== */
#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.crosshair-dot {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.crosshair-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

.crosshair-top { width: 2px; height: 8px; top: -12px; left: 50%; transform: translateX(-50%); }
.crosshair-bottom { width: 2px; height: 8px; bottom: -12px; left: 50%; transform: translateX(-50%); }
.crosshair-left { width: 8px; height: 2px; left: -12px; top: 50%; transform: translateY(-50%); }
.crosshair-right { width: 8px; height: 2px; right: -12px; top: 50%; transform: translateY(-50%); }

/* Hit marker */
#crosshair.hitmarker .crosshair-line {
  background: rgba(255, 60, 60, 1);
  box-shadow: 0 0 6px rgba(255, 50, 50, 0.8);
}
#crosshair.hitmarker .crosshair-dot {
  background: rgba(255, 60, 60, 1);
  box-shadow: 0 0 6px rgba(255, 50, 50, 0.8);
  transform: translate(-50%, -50%) scale(1.5);
}
#crosshair.hitmarker .crosshair-top { transform: translateX(-50%) translateY(-3px); }
#crosshair.hitmarker .crosshair-bottom { transform: translateX(-50%) translateY(3px); }
#crosshair.hitmarker .crosshair-left { transform: translateY(-50%) translateX(-3px); }
#crosshair.hitmarker .crosshair-right { transform: translateY(-50%) translateX(3px); }

/* ===== BOW CHARGE BAR ===== */
#bow-charge-bar {
  position: absolute;
  bottom: 45%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  text-align: center;
}

.charge-bar-bg {
  width: 80px;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.charge-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffaa22, #ff4444);
  border-radius: 2px;
  transition: width 0.05s linear;
}

.charge-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  margin-top: 2px;
}

/* ===== EDITOR CROSSHAIR ===== */
#editor-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

.editor-cross-h {
  position: absolute;
  width: 20px; height: 2px;
  background: rgba(255, 255, 255, 0.6);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.editor-cross-v {
  position: absolute;
  width: 2px; height: 20px;
  background: rgba(255, 255, 255, 0.6);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* ===== TARGET INFO ===== */
#target-info {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  display: none;
}

.target-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  margin-bottom: 4px;
}

.target-hp-bar {
  width: 120px;
  height: 6px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}

.target-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #e74c3c, #f39c12);
  border-radius: 3px;
  transition: width 0.15s ease;
}

.target-hp-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  margin-top: 2px;
}

/* ===== HOTBAR / INVENTORY DISPLAY ===== */
#inventory-display {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.inv-slot {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
}

.inv-slot.inv-active {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.12), inset 0 0 8px rgba(255, 255, 255, 0.04);
}

.inv-slot-separator {
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 2px;
}

.inv-icon {
  font-size: 22px;
  line-height: 1;
}

.inv-count {
  position: absolute;
  bottom: 1px;
  right: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.inv-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 8px;
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.inv-key {
  position: absolute;
  top: 2px;
  left: 4px;
  color: rgba(255, 255, 255, 0.25);
  font-size: 9px;
  font-weight: 600;
}

/* ===== MESSAGES ===== */
#messages {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.game-message {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 6px;
  white-space: nowrap;
  transition: opacity 0.5s ease, transform 0.5s ease;
  backdrop-filter: blur(2px);
}

/* ===== EPIC LOOT OVERLAY ===== */
#epic-loot-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, rgba(255, 220, 80, 0.4) 0%, rgba(255, 180, 40, 0.15) 40%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease-in, opacity 0.8s ease-out;
  z-index: 15;
}

.epic-loot-message {
  color: #ffdd44;
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255, 200, 50, 0.8), 0 0 40px rgba(255, 150, 30, 0.5), 0 2px 6px rgba(0, 0, 0, 0.8);
  padding: 12px 30px;
  background: linear-gradient(180deg, rgba(255, 200, 50, 0.15), rgba(255, 150, 30, 0.08));
  border: 1px solid rgba(255, 220, 80, 0.3);
  border-radius: 8px;
  white-space: nowrap;
  animation: epicPulse 0.6s ease-in-out 3;
  backdrop-filter: blur(3px);
}

@keyframes epicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ===== MAIN MENU ===== */
#main-menu {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.7) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: default;
  backdrop-filter: blur(3px);
  animation: menuFadeIn 0.4s ease;
}

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

.menu-content {
  text-align: center;
  color: #fff;
  animation: menuSlideUp 0.5s ease;
}

@keyframes menuSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.menu-btn {
  width: 280px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  outline: none;
  position: relative;
  overflow: hidden;
}

.menu-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
  transition: left 0.4s ease;
}

.menu-btn:hover::after {
  left: 100%;
}

.menu-btn-play {
  background: rgba(68, 170, 102, 0.2);
  color: #88ffaa;
  border-color: rgba(68, 170, 102, 0.3);
}

.menu-btn-play:hover {
  background: rgba(68, 170, 102, 0.4);
  border-color: #88ffaa;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(68, 170, 102, 0.2);
}

.menu-btn-editor {
  background: rgba(100, 140, 220, 0.15);
  color: #aaccff;
  border-color: rgba(100, 140, 220, 0.25);
}

.menu-btn-editor:hover {
  background: rgba(100, 140, 220, 0.35);
  border-color: #aaccff;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(100, 140, 220, 0.15);
}

/* ===== START SCREEN ===== */
#start-screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  backdrop-filter: blur(2px);
}

.start-content {
  text-align: center;
  color: #fff;
}

.game-title {
  font-size: 72px;
  font-weight: 100;
  letter-spacing: 20px;
  margin-bottom: 4px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  background: linear-gradient(180deg, #ffffff, #a0c4ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-subtitle {
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 8px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 48px;
  text-transform: uppercase;
}

.game-version {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
  margin-bottom: 32px;
}

.controls-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-bottom: 48px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.control-row {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.key {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  min-width: 64px;
  text-align: center;
  flex-shrink: 0;
}

.start-prompt {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.4);
  animation: pulse 2s infinite;
  letter-spacing: 3px;
  text-transform: uppercase;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* ===== EDITOR TOOLBAR ===== */
#editor-toolbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-toolbar-left,
.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.editor-toolbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-stat {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
}

.editor-btn {
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.editor-btn:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.3); }
.editor-btn-accent { background: rgba(68, 170, 102, 0.2); color: #88ffaa; border-color: rgba(68, 170, 102, 0.3); }
.editor-btn-accent:hover { background: rgba(68, 170, 102, 0.35); border-color: #88ffaa; }
.editor-btn-back { background: rgba(220, 80, 80, 0.15); color: #ffaaaa; border-color: rgba(220, 80, 80, 0.25); }
.editor-btn-back:hover { background: rgba(220, 80, 80, 0.3); border-color: #ffaaaa; }

.editor-help {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ekey {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin-left: 6px;
}

/* ===== EDITOR ELEMENT SELECTOR ===== */
#editor-element-selector {
  position: absolute;
  left: 16px;
  top: 60px;
  display: none;
  flex-direction: column;
  gap: 4px;
  pointer-events: auto;
}

.element-type-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  transition: all 0.15s ease;
  backdrop-filter: blur(4px);
  min-width: 120px;
}

.element-type-btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); }
.element-type-btn.active { background: rgba(100, 170, 255, 0.25); border-color: rgba(100, 170, 255, 0.6); color: #aaddff; }

.etb-icon { font-size: 16px; width: 20px; text-align: center; }
.etb-label { flex: 1; text-align: left; }
.etb-key { font-size: 10px; padding: 1px 5px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 3px; color: rgba(255, 255, 255, 0.5); }

/* ===== EDITOR SETTINGS PANEL ===== */
#editor-settings-panel {
  position: absolute;
  right: 16px;
  top: 60px;
  display: none;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 16px;
  pointer-events: auto;
  min-width: 220px;
}

#editor-settings-panel h3 { color: #aaccff; font-size: 14px; font-weight: 600; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.setting-row label { color: rgba(255, 255, 255, 0.7); font-size: 12px; }

.setting-row input {
  width: 60px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
}

.setting-row input:focus { outline: none; border-color: rgba(100, 170, 255, 0.5); }

#editor-settings-panel .editor-btn { width: 100%; margin-top: 8px; }

/* ===== TOOL POSITION PANEL ===== */
#tool-position-panel {
  position: absolute;
  left: 16px;
  top: 60px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 16px;
  pointer-events: auto;
  min-width: 280px;
  z-index: 100;
}
#tool-position-panel h3 { color: #ffcc44; font-size: 14px; font-weight: 600; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 1px; }
#tool-position-panel .setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
#tool-position-panel .setting-row label { color: rgba(255, 255, 255, 0.7); font-size: 12px; min-width: 40px; }
#tool-position-panel .setting-row input[type="range"] { flex: 1; }
#tool-position-panel .setting-row span { color: #ffcc44; font-size: 11px; min-width: 40px; text-align: right; font-family: monospace; }
#tool-position-panel select { width: 100%; padding: 4px 8px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); color: #fff; border-radius: 4px; font-size: 12px; }
#tool-position-panel .editor-btn { width: 100%; margin-top: 8px; }

/* ===== EDITOR BOTTOM INFO ===== */
#editor-bottom-info {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
}

.editor-controls-help {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 14px;
  border-radius: 4px;
  backdrop-filter: blur(3px);
}

/* ===== STATUS BARS (HP + HUNGER) ===== */
#status-bars {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

#health-bar, #hunger-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-icon {
  font-size: 13px;
  width: 16px;
  text-align: center;
}

.hp-bar-bg, .hunger-bar-bg {
  width: 180px;
  height: 10px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #44cc44, #66ff66);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.hunger-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #cc8833, #ffaa44);
  border-radius: 5px;
  transition: width 0.3s ease;
}

.hp-text, .hunger-text {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  min-width: 45px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ===== DAMAGE INDICATOR ===== */
#damage-indicator {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 20;
}
.dmg-top, .dmg-bottom, .dmg-left, .dmg-right {
  position: absolute;
  opacity: 0;
  transition: opacity 0.1s ease-in, opacity 0.6s ease-out;
}
.dmg-top { top: 0; left: 10%; right: 10%; height: 80px; background: linear-gradient(to bottom, rgba(255,0,0,0.5), transparent); }
.dmg-bottom { bottom: 0; left: 10%; right: 10%; height: 80px; background: linear-gradient(to top, rgba(255,0,0,0.5), transparent); }
.dmg-left { top: 10%; bottom: 10%; left: 0; width: 80px; background: linear-gradient(to right, rgba(255,0,0,0.5), transparent); }
.dmg-right { top: 10%; bottom: 10%; right: 0; width: 80px; background: linear-gradient(to left, rgba(255,0,0,0.5), transparent); }

/* ===== CRAFTING MENU (legacy, hidden) ===== */
#crafting-menu { display: none !important; }

@keyframes panelSlideIn {
  from { opacity: 0; transform: translate(-50%, -48%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.craft-recipe {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.craft-recipe:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); }
.craft-recipe.craft-disabled { opacity: 0.35; cursor: default; }
.craft-recipe.craft-disabled:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.06); }
.craft-name { color: #fff; font-size: 13px; font-weight: 600; }
.craft-cost { color: rgba(255,255,255,0.45); font-size: 10px; margin-top: 2px; }
.craft-icon { font-size: 20px; margin-right: 10px; }
.craft-info { flex: 1; }
.craft-btn {
  padding: 5px 14px;
  background: rgba(68,170,102,0.25);
  border: 1px solid rgba(68,170,102,0.4);
  border-radius: 6px;
  color: #88ffaa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.craft-btn:hover { background: rgba(68,170,102,0.45); border-color: #88ffaa; }

/* ===== FULL INVENTORY (3-column layout) ===== */
#full-inventory {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  background: rgba(10, 10, 18, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0;
  pointer-events: auto;
  cursor: default;
  width: 880px;
  max-height: 80vh;
  z-index: 50;
  animation: panelSlideIn 0.25s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 1px rgba(255,255,255,0.1);
}

.inv-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.inv-panel-header h3 {
  color: #ccddf8;
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0;
  font-weight: 600;
}
.inv-close {
  color: rgba(255,255,255,0.3);
  font-size: 11px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}

.inv-panel-body {
  display: flex;
  padding: 20px 24px 24px;
  gap: 20px;
  max-height: calc(80vh - 60px);
  overflow-y: auto;
}

/* --- Equipment Column (left) --- */
.equip-column {
  width: 150px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.04);
}
.equip-title {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 4px;
  padding-left: 4px;
}
.equip-slot {
  width: 100%;
  height: 72px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  transition: all 0.2s;
}
.equip-slot:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.15);
}
.equip-slot-icon {
  font-size: 24px;
  opacity: 0.2;
  filter: grayscale(1);
}
.equip-slot-label {
  font-size: 9px;
  color: rgba(255,255,255,0.2);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.equip-slot.equipped {
  border-style: solid;
  border-color: rgba(100,180,255,0.3);
  background: rgba(100,180,255,0.05);
}
.equip-slot.equipped .equip-slot-icon {
  opacity: 1;
  filter: none;
}
.equip-slot.equipped .equip-slot-label {
  color: rgba(150,200,255,0.7);
}

/* --- Inventory Column (center) --- */
.inv-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.inv-column-title {
  color: rgba(255,255,255,0.35);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  padding-left: 4px;
}

#inv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.inv-grid-slot {
  height: 80px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}
.inv-grid-slot:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.inv-grid-icon { font-size: 28px; }
.inv-grid-name { color: rgba(255,255,255,0.6); font-size: 10px; margin-top: 4px; }
.inv-grid-count { position: absolute; top: 4px; right: 6px; color: #ffdd44; font-size: 14px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.inv-grid-action { position: absolute; bottom: 3px; right: 4px; color: rgba(100,255,150,0.4); font-size: 8px; font-weight: 600; }
.inv-empty-msg {
  grid-column: span 4;
  text-align: center;
  color: rgba(255,255,255,0.2);
  padding: 30px 0;
  font-size: 12px;
}

/* --- Craft Column (right) --- */
.craft-column {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  border-left: 1px solid rgba(255,255,255,0.04);
  max-height: 100%;
  overflow-y: auto;
}
.craft-column-title {
  color: #d4a844;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ===== SETTINGS OVERLAY ===== */
#settings-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: default;
  z-index: 60;
  backdrop-filter: blur(6px);
  animation: menuFadeIn 0.2s ease;
}

#settings-panel {
  background: rgba(15,15,25,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 32px 40px 28px;
  min-width: 380px;
  text-align: center;
  animation: panelSlideIn 0.25s ease;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

#settings-panel h2 {
  color: #aaccff;
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 28px;
  font-weight: 400;
}

.settings-section {
  margin-bottom: 20px;
  text-align: left;
  padding: 0 4px;
}

.settings-section label {
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-row input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #aaccff;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 6px rgba(100,150,255,0.3);
}

.slider-row span {
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  min-width: 36px;
  text-align: right;
  font-weight: 500;
}

.settings-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  align-items: center;
}

/* ===== FISHING UI ===== */
#fishing-ui {
  position: absolute;
  bottom: 45%; left: 50%; transform: translateX(-50%);
  display: none; text-align: center;
}
.fishing-text { color: rgba(255,255,255,0.7); font-size: 14px; margin-bottom: 6px; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.fishing-bar-bg { width: 120px; height: 6px; background: rgba(0,0,0,0.5); border-radius: 3px; overflow: hidden; }
.fishing-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #22aaff, #44ddff); border-radius: 3px; transition: width 0.1s linear; }

/* ===== DEATH OVERLAY ===== */
#death-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(80, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  cursor: default;
  pointer-events: auto;
}

.death-text {
  color: #ff3333;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 6px;
  text-shadow: 0 0 30px rgba(255, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.9);
}

.death-sub {
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  margin-top: 16px;
  letter-spacing: 2px;
}

/* ===== WEATHER PARTICLES ===== */
.weather-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 5; opacity: 0;
  transition: opacity 2s ease;
}

/* ===== SCROLLBAR ===== */
.inv-panel-body::-webkit-scrollbar,
.craft-column::-webkit-scrollbar {
  width: 4px;
}
.inv-panel-body::-webkit-scrollbar-track,
.craft-column::-webkit-scrollbar-track {
  background: transparent;
}
.inv-panel-body::-webkit-scrollbar-thumb,
.craft-column::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* ===== AUTH OVERLAY ===== */
#auth-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, rgba(5,5,15,0.85) 0%, rgba(0,0,0,0.95) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: default;
  z-index: 200;
  animation: menuFadeIn 0.3s ease;
}
.auth-box {
  background: rgba(15, 15, 25, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 1px rgba(255,255,255,0.1);
  animation: panelSlideIn 0.3s ease;
}
.auth-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 10px;
  color: #fff;
  margin: 0 0 4px;
  text-shadow: 0 0 40px rgba(100, 150, 255, 0.3);
}
.auth-subtitle {
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0 0 24px;
}
.auth-error {
  color: #ff5555;
  font-size: 12px;
  min-height: 18px;
  margin-bottom: 8px;
}
#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#auth-form input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
#auth-form input:focus {
  border-color: rgba(100,150,255,0.5);
  background: rgba(255,255,255,0.06);
}
#auth-form input::placeholder {
  color: rgba(255,255,255,0.25);
}
.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.auth-btn-primary {
  background: linear-gradient(135deg, #2255aa, #3377cc);
  color: #fff;
  text-transform: uppercase;
  margin-top: 4px;
}
.auth-btn-primary:hover {
  background: linear-gradient(135deg, #3366bb, #4488dd);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(50,100,200,0.3);
}
.auth-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.auth-btn-secondary {
  background: transparent;
  color: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  margin-top: 8px;
  font-size: 12px;
}
.auth-btn-secondary:hover {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.2);
}

/* Auth tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.auth-tab.active {
  background: rgba(100,150,255,0.15);
  color: #fff;
}
.auth-tab:hover:not(.active) {
  color: rgba(255,255,255,0.7);
}
.auth-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, #2255aa, #3377cc);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}
.auth-submit:hover {
  background: linear-gradient(135deg, #3366bb, #4488dd);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(50,100,200,0.3);
}
.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ===== CHAT ===== */
#chat-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 400px;
  z-index: 50;
  pointer-events: none;
}
#chat-messages {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  scrollbar-width: none;
}
#chat-messages::-webkit-scrollbar { display: none; }
.chat-message {
  font-size: 13px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  transition: opacity 1s ease;
  word-break: break-word;
}
.chat-username {
  font-weight: bold;
}
.chat-system {
  font-style: italic;
}
#chat-input-container {
  display: none;
  margin-top: 5px;
  pointer-events: auto;
}
#chat-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
}
#chat-input:focus {
  border-color: rgba(100,150,255,0.5);
}

/* ===== INVENTORY HOTBAR ===== */
#inventory-display {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.inv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}
.inv-item-icon { font-size: 16px; }
.inv-item-name { color: rgba(255,255,255,0.7); }
.inv-item-count { color: #88ff88; font-weight: bold; }
.inv-empty { color: rgba(255,255,255,0.3); font-size: 12px; }

/* Craft recipes in full inventory */
.craft-recipe {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.craft-recipe.locked { opacity: 0.5; }
.craft-recipe-icon { font-size: 24px; }
.craft-recipe-name { font-size: 13px; font-weight: 600; color: #fff; }
.craft-recipe-ingredients { font-size: 11px; color: rgba(255,255,255,0.6); }
.craft-btn {
  padding: 6px 14px;
  background: rgba(100,150,255,0.2);
  border: 1px solid rgba(100,150,255,0.3);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  margin-left: auto;
}
.craft-btn:hover:not(:disabled) {
  background: rgba(100,150,255,0.4);
}
.craft-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Game message fade */
.game-message {
  font-size: 13px;
  padding: 4px 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  transition: opacity 0.5s ease;
}

/* Inventory grid items */
.inv-grid-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.inv-grid-empty { opacity: 0.3; }
.inv-grid-icon { font-size: 24px; margin-bottom: 4px; }
.inv-grid-name { font-size: 11px; color: rgba(255,255,255,0.7); }
.inv-grid-count { font-size: 13px; font-weight: bold; color: #88ff88; }
