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

body {
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ========== LOGIN SCREEN ========== */
#login-screen {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.splash-bg {
  position: absolute;
  inset: 0;
  background: #0a0200 url('/assets/download/splash2.png') center top / contain no-repeat;
  image-rendering: pixelated;
  z-index: 0;
}

.splash-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.7) 100%);
}

.login-container {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 32px 28px;
  border: 2px solid #8b4513;
  border-bottom: none;
  background: rgba(20, 8, 4, 0.92);
  border-radius: 6px 6px 0 0;
  min-width: 340px;
  max-width: 380px;
  margin-bottom: 0;
  box-shadow: 0 -4px 30px rgba(255, 80, 0, 0.25), inset 0 1px 0 rgba(255, 120, 40, 0.15);
}

.tab-buttons {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  padding: 9px;
  background: #1a0a04;
  border: 1px solid #5a2a0a;
  color: #886644;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.tab-btn.active {
  background: #2a1208;
  color: #ff8833;
  border-bottom-color: #ff6600;
}

.tab-btn:hover {
  background: #2a1208;
  color: #ffaa55;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.auth-form.active {
  display: flex;
}

.auth-form input {
  padding: 10px 12px;
  background: #120804;
  border: 1px solid #5a2a0a;
  color: #e8d0b0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  border-radius: 2px;
}

.auth-form input:focus {
  outline: none;
  border-color: #ff6600;
  box-shadow: 0 0 6px rgba(255, 102, 0, 0.3);
}

.auth-form input::placeholder {
  color: #665544;
}

.btn-primary {
  padding: 12px;
  background: linear-gradient(180deg, #8b3a00 0%, #6b2200 100%);
  border: 2px solid #aa5500;
  color: #ffd700;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
  border-radius: 3px;
  letter-spacing: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,180,80,0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #aa4800 0%, #882e00 100%);
  border-color: #cc6600;
  box-shadow: 0 2px 12px rgba(255, 100, 0, 0.4), inset 0 1px 0 rgba(255,180,80,0.3);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.error-message {
  color: #ff4444;
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

.status-message {
  color: #66ff66;
  font-size: 12px;
  margin-top: 2px;
  min-height: 18px;
}

/* ========== LOADING SCREEN ========== */
#loading-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: #0a0a0a;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.loading-container {
  text-align: center;
}

.loading-bar {
  width: 300px;
  height: 8px;
  background: #1a1a2e;
  border: 1px solid #4a4a6a;
  margin-top: 20px;
  border-radius: 2px;
}

.loading-fill {
  width: 0%;
  height: 100%;
  background: #ffd700;
  transition: width 0.3s;
}

#loading-text {
  color: #8888aa;
  margin-top: 16px;
}

/* ========== GAME CANVAS ========== */
#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

/* ========== HUD ========== */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#hud > * {
  pointer-events: auto;
}

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px;
}

.hp-bar {
  width: 150px;
  height: 6px;
  background: #1a1a1a;
  margin-top: 4px;
  border-radius: 2px;
}

.hp-fill {
  height: 100%;
  background: #44ff44;
  border-radius: 2px;
  transition: width 0.3s;
}

#hud-info {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 14px;
  border: 1px solid #4a4a6a;
  border-radius: 2px;
  display: flex;
  gap: 16px;
  font-size: 13px;
}

#map-name { color: #ffd700; }
#player-level { color: #88aaff; }
#player-money { color: #ffcc44; }

#online-count {
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 14px;
  border: 1px solid #4a4a6a;
  border-radius: 2px;
  font-size: 13px;
  color: #88ff88;
}

/* ========== MINIMAP ========== */
#minimap-container {
  position: fixed;
  bottom: 12px;
  right: 12px;
  border: 2px solid #4a4a6a;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 2px;
}

#minimap {
  display: block;
}

/* ========== CHAT ========== */
#chat-container {
  position: fixed;
  bottom: 12px;
  left: 12px;
  width: 350px;
}

#chat-messages {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 13px;
  scrollbar-width: thin;
  scrollbar-color: #4a4a6a transparent;
}

#chat-messages:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #4a4a6a;
}

.chat-msg {
  margin-bottom: 3px;
  word-wrap: break-word;
}

.chat-msg .username {
  color: #ffd700;
  font-weight: bold;
}

.chat-msg .text {
  color: #ccc;
}

.chat-msg.system {
  color: #88aaff;
  font-style: italic;
}

#chat-input {
  width: 100%;
  padding: 8px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid #ffd700;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  margin-top: 4px;
  border-radius: 2px;
}

#chat-input:focus {
  outline: none;
}

/* ========== HUD BUTTONS ========== */
#hud-buttons {
  display: flex;
  gap: 6px;
}

.hud-btn {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #4a4a6a;
  color: #ffd700;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 1px;
  transition: all 0.15s;
}

.hud-btn:hover {
  background: rgba(60, 60, 100, 0.8);
  border-color: #ffd700;
}

/* ========== GAME PANELS ========== */
.game-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  background: rgba(10, 10, 30, 0.95);
  border: 2px solid #4a4a6a;
  border-radius: 4px;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #4a4a6a;
}

.panel-title {
  color: #ffd700;
  font-size: 18px;
  letter-spacing: 2px;
}

.panel-close {
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  font-family: 'Courier New', monospace;
}

.panel-close:hover {
  color: #ff4444;
}

.panel-body {
  padding: 16px;
  overflow-y: auto;
  max-height: 60vh;
}

/* Party monsters */
.party-monster {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(30, 30, 60, 0.6);
  border: 1px solid #3a3a5a;
  border-radius: 3px;
}

.party-monster-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  border: 1px solid #4a4a6a;
  border-radius: 2px;
  background: #0a0a1a;
}

.party-monster-info {
  flex: 1;
}

.party-monster-name {
  color: #ffd700;
  font-size: 14px;
}

.party-monster-details {
  color: #888;
  font-size: 12px;
  margin-top: 2px;
}

.party-monster-hp-bar {
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  margin-top: 4px;
  border-radius: 2px;
}

.party-monster-hp-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.party-monster-exp-bar {
  width: 100%;
  height: 4px;
  background: #1a1a1a;
  margin-top: 3px;
  border-radius: 2px;
}

.party-monster-exp-fill {
  height: 100%;
  border-radius: 2px;
  background: #4488ff;
  transition: width 0.3s;
}

.party-leader {
  border-color: #ffd700;
}

.party-leader-tag {
  color: #0a0a1a;
  background: #ffd700;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  letter-spacing: 1px;
  font-weight: bold;
  vertical-align: middle;
}

.party-reorder {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: auto;
  padding-left: 8px;
}

.party-order-btn {
  width: 28px;
  height: 28px;
  background: #2a2a4e;
  border: 1px solid #4a4a6a;
  color: #ffd700;
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: 'Courier New', monospace;
}

.party-order-btn:hover {
  background: #4a4a6e;
  border-color: #ffd700;
}

.party-empty {
  color: #555;
  font-size: 13px;
  padding: 10px;
  text-align: center;
}

/* Inventory items */
.inv-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: rgba(30, 30, 60, 0.6);
  border: 1px solid #3a3a5a;
  border-radius: 3px;
}

.inv-item-name {
  color: #e0e0e0;
  font-size: 13px;
}

.inv-item-qty {
  color: #ffd700;
  font-size: 13px;
}

.inv-empty {
  color: #555;
  font-size: 13px;
  padding: 10px;
  text-align: center;
}

/* Settings */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  color: #ccc;
  font-size: 13px;
}

.setting-row input[type="range"] {
  width: 120px;
  accent-color: #ffd700;
}

.setting-row select {
  background: #1a1a2e;
  border: 1px solid #4a4a6a;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 2px;
}

.setting-row input[type="checkbox"] {
  accent-color: #ffd700;
  width: 16px;
  height: 16px;
}

.setting-hint {
  color: #666;
  font-size: 12px;
}

.setting-divider {
  border: none;
  border-top: 1px solid #3a3a5a;
  margin: 8px 0;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: #4a2020;
  border: 1px solid #6a3030;
  color: #ff6666;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  border-radius: 2px;
  margin-top: 4px;
}

.btn-logout:hover {
  background: #6a3030;
}

/* FPS counter */
#fps-counter {
  position: fixed;
  top: 52px;
  right: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #88ff88;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
  z-index: 10;
  pointer-events: none;
}

/* ========== INTERACTION HINT ========== */
#interaction-hint, #encounter-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  padding: 8px 20px;
  font-size: 14px;
  border-radius: 2px;
  pointer-events: none;
}

#interaction-hint {
  bottom: 50%;
  color: #ffd700;
  border: 1px solid #ffd700;
}

#encounter-hint {
  bottom: calc(50% - 40px);
  color: #ff6644;
  border: 1px solid #ff6644;
}

/* ========== BATTLE SCREEN ========== */
#battle-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: #1a1a2e;
}

#battle-canvas {
  width: 100%;
  height: 55%;
  display: block;
  background: linear-gradient(180deg, #2a3a5e 0%, #1a2a3e 40%, #3a5a3a 40%, #2a4a2a 100%);
}

#battle-ui {
  height: 45%;
  background: #0a0a1e;
  border-top: 2px solid #4a4a6a;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

#battle-info-wild, #battle-info-player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  font-size: 14px;
}

#battle-info-wild {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  z-index: 101;
}

#battle-info-player {
  position: fixed;
  top: auto;
  bottom: 48%;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  z-index: 101;
}

#battle-info-wild .hp-bar, #battle-info-player .hp-bar {
  width: 120px;
}

#wild-name, #player-mon-name { color: #ffd700; }
#wild-level, #player-mon-level { color: #88aaff; }
#wild-hp-text, #player-mon-hp-text { color: #aaa; font-size: 12px; }

#battle-log {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  font-size: 14px;
  color: #ccc;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #2a2a4a;
  margin: 8px 0;
  border-radius: 2px;
}

#battle-log .log-entry {
  margin-bottom: 4px;
}

#battle-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.battle-btn {
  padding: 14px;
  background: #2a2a4e;
  border: 2px solid #4a4a6a;
  color: #ffd700;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 2px;
}

.battle-btn:hover {
  background: #4a4a6e;
  border-color: #ffd700;
}

#moves-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.move-btn {
  padding: 10px;
  background: #2a2a4e;
  border: 2px solid #4a4a6a;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  border-radius: 2px;
}

.move-btn:hover {
  border-color: #ffd700;
  background: #3a3a5e;
}

.move-btn .move-name { color: #ffd700; }
.move-btn .move-info { color: #888; font-size: 11px; margin-top: 2px; }

.move-btn.type-fire    { border-left: 4px solid #ff6644; }
.move-btn.type-water   { border-left: 4px solid #4488ff; }
.move-btn.type-earth   { border-left: 4px solid #88aa44; }
.move-btn.type-wind    { border-left: 4px solid #88ddaa; }
.move-btn.type-dark    { border-left: 4px solid #8844aa; }
.move-btn.type-light   { border-left: 4px solid #ffdd44; }
.move-btn.type-normal  { border-left: 4px solid #888888; }

/* ========== DIALOG BOX ========== */
#dialog-box {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  max-width: 90vw;
  background: rgba(10, 10, 30, 0.95);
  border: 2px solid #ffd700;
  padding: 20px;
  z-index: 50;
  border-radius: 4px;
}

#dialog-name {
  color: #ffd700;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
}

#dialog-text {
  color: #e0e0e0;
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 12px;
}

#dialog-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialog-option {
  padding: 8px 14px;
  background: #2a2a4e;
  border: 1px solid #4a4a6a;
  color: #e0e0e0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  cursor: pointer;
  border-radius: 2px;
}

.dialog-option:hover {
  background: #4a4a6e;
  border-color: #ffd700;
  color: #ffd700;
}

#dialog-continue {
  text-align: right;
  color: #888;
  font-size: 12px;
  margin-top: 8px;
}

/* ========== TRANSITION OVERLAY ========== */
#transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.4s;
}

#transition-overlay.active {
  opacity: 1;
}

/* ========== RECONNECTION OVERLAY ========== */
#reconnect-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
}

.reconnect-content {
  text-align: center;
  padding: 40px 60px;
  background: rgba(10, 10, 30, 0.95);
  border: 2px solid #ffd700;
  border-radius: 4px;
}

.reconnect-icon {
  font-size: 48px;
  color: #ffd700;
  margin-bottom: 12px;
}

#reconnect-title {
  font-size: 24px;
  color: #ff6666;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

#reconnect-text {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 20px;
}

.reconnect-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #333;
  border-top: 3px solid #ffd700;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== PING DISPLAY ========== */
#ping-display {
  position: fixed;
  top: 52px;
  left: 16px;
  background: rgba(0, 0, 0, 0.7);
  color: #88ff88;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 2px;
  z-index: 10;
  pointer-events: none;
}

/* ========== CROSSHAIR ========== */
.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
}
