* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #0a0a0a;
  --bg-darker: #050505;
  --bg-panel: rgba(20, 20, 20, 0.95);
  --text: #e8e8e8;
  --text-dim: #888;
  --danger: #d32f2f;
  --warning: #f57c00;
  --success: #388e3c;
  --primary: #1976d2;
  --health: #e53935;
  --hunger: #ff6f00;
  --thirst: #0288d1;
  --stamina: #7b1fa2;
  --border: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-darker);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

/* AUTH SCREEN */
.auth-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.auth-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a0000 0%, #000000 50%, #001a00 100%);
  opacity: 0.8;
}

.auth-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.3) 2px, rgba(0,0,0,.3) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,.3) 2px, rgba(0,0,0,.3) 4px);
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0% { transform: translateY(0); }
  100% { transform: translateY(100px); }
}

.auth-container {
  position: relative;
  z-index: 2;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid var(--danger);
  padding: 3rem;
  width: 450px;
  box-shadow: 0 0 50px rgba(211, 47, 47, 0.5), inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.auth-logo h1 {
  font-size: 2.5rem;
  color: var(--danger);
  text-shadow: 0 0 20px rgba(211, 47, 47, 0.8), 0 0 40px rgba(211, 47, 47, 0.4);
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.tagline {
  font-style: italic;
  color: var(--text-dim);
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.blood-drip {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--danger), transparent);
  margin-top: 1rem;
  box-shadow: 0 0 10px var(--danger);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-form h2 {
  color: var(--text);
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.3rem;
}

.input-group {
  margin-bottom: 1.2rem;
}

.input-group input {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.3s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--danger);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 15px rgba(211, 47, 47, 0.3);
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--danger) 0%, #b71c1c 100%);
  border: none;
  color: white;
  font-weight: bold;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 5px 15px rgba(211, 47, 47, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(211, 47, 47, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
}

.starter-info {
  background: rgba(56, 142, 60, 0.1);
  border: 1px solid var(--success);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
}

.starter-info h4 {
  color: var(--success);
  margin-bottom: 0.5rem;
}

.starter-info ul {
  list-style: none;
  padding-left: 0;
}

.starter-info li {
  color: var(--text);
  padding: 0.3rem 0;
  font-size: 0.95rem;
}

.toggle {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.toggle a {
  color: var(--danger);
  cursor: pointer;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s;
}

.toggle a:hover {
  color: #ff5252;
  text-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

/* GAME SCREEN */
.game-screen {
  display: none;
  width: 100vw;
  height: 100vh;
  flex-direction: column;
  background: var(--bg-darker);
}

.game-screen.active {
  display: flex;
}

/* TOP HUD */
.top-hud {
  background: var(--bg-panel);
  border-bottom: 2px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.player-info h2 {
  color: var(--text);
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.location, .days {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.vital-stats {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  justify-content: center;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stat-item .icon {
  font-size: 1.5rem;
}

.stat-bar-container {
  width: 150px;
  height: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.stat-bar {
  height: 100%;
  transition: width 0.5s ease;
  position: relative;
}

.stat-item.health .stat-bar {
  background: linear-gradient(90deg, var(--health), #ff5252);
  box-shadow: 0 0 10px var(--health);
}

.stat-item.hunger .stat-bar {
  background: linear-gradient(90deg, var(--hunger), #ffb74d);
  box-shadow: 0 0 10px var(--hunger);
}

.stat-item.thirst .stat-bar {
  background: linear-gradient(90deg, var(--thirst), #4fc3f7);
  box-shadow: 0 0 10px var(--thirst);
}

.stat-item.stamina .stat-bar {
  background: linear-gradient(90deg, var(--stamina), #ba68c8);
  box-shadow: 0 0 10px var(--stamina);
}

.stat-item .value {
  color: var(--text);
  font-weight: bold;
  min-width: 35px;
  text-align: right;
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kills {
  color: var(--danger);
  font-weight: bold;
  font-size: 1.1rem;
}

.btn-menu, .btn-logout {
  padding: 0.6rem 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-menu:hover, .btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--danger);
  transform: translateY(-2px);
}

/* GAME CONTAINER */
.game-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* GAME WORLD */
.game-world {
  flex: 1;
  position: relative;
  background: #1a1a1a;
  overflow: hidden;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

.world-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.minimap {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 200px;
  height: 200px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--border);
  pointer-events: auto;
}

.tile-info {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid var(--border);
  padding: 1rem;
  min-width: 250px;
  color: var(--text);
  font-size: 0.9rem;
}

/* RIGHT PANEL */
.right-panel {
  width: 350px;
  background: var(--bg-panel);
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.panel-section {
  padding: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.panel-section h3 {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1.2rem;
  border-bottom: 2px solid var(--danger);
  padding-bottom: 0.5rem;
}

/* INVENTORY */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inv-slot {
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.inv-slot:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
  transform: scale(1.05);
}

.inv-slot .item-icon {
  font-size: 2rem;
}

.inv-slot .item-qty {
  position: absolute;
  bottom: 2px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.7rem;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: bold;
}

.inv-slot.empty {
  opacity: 0.3;
}

.inventory-weight {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
}

/* EQUIPMENT */
.equipment-slots {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.equip-slot {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
}

.equip-slot:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--success);
}

.slot-label {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.slot-content {
  color: var(--text);
  font-weight: bold;
}

/* ACTIONS */
.action-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.action-btn {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.3), rgba(25, 118, 210, 0.1));
  border: 2px solid var(--primary);
  color: var(--text);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
  font-size: 0.95rem;
}

.action-btn:hover {
  background: linear-gradient(135deg, rgba(25, 118, 210, 0.5), rgba(25, 118, 210, 0.2));
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(25, 118, 210, 0.4);
}

.action-btn:active {
  transform: translateY(0);
}

/* CONTROLS PANEL */
.controls-panel {
  background: var(--bg-panel);
  border-top: 2px solid var(--border);
  padding: 1rem;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.movement-controls {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  gap: 5px;
}

.move-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--border);
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: bold;
}

.move-btn:hover:not(.center) {
  background: rgba(255, 255, 255, 0.2);
  border-color: var(--primary);
  transform: scale(1.1);
}

.move-btn:active:not(.center) {
  transform: scale(0.95);
}

.move-btn.center {
  background: rgba(211, 47, 47, 0.3);
  border-color: var(--danger);
  cursor: default;
}

/* GAME LOG */
.game-log {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border);
  padding: 1rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.log-entry {
  padding: 0.3rem 0;
  border-left: 3px solid var(--text-dim);
  padding-left: 0.5rem;
  margin-bottom: 0.3rem;
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.log-entry.success {
  border-color: var(--success);
  color: var(--success);
}

.log-entry.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.log-entry.warning {
  border-color: var(--warning);
  color: var(--warning);
}

.log-entry.info {
  border-color: var(--primary);
  color: var(--primary);
}

/* MODALS */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-panel);
  border: 3px solid var(--border);
  padding: 2rem;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  color: var(--danger);
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s;
}

.modal-close:hover {
  transform: scale(1.2);
  text-shadow: 0 0 10px var(--danger);
}

/* SCROLLBAR */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar-thumb {
  background: var(--danger);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #ff5252;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
  .right-panel {
    width: 300px;
  }
  
  .vital-stats {
    gap: 1rem;
  }
  
  .stat-bar-container {
    width: 120px;
  }
}
