:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --accent: #4fc3f7;
  --text: #eaf2fb;
  --muted: #8b9bb4;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at 50% 0%, #1a2740, var(--bg));
  color: var(--text);
  min-height: 100vh;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid #223252;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  color: var(--accent);
}

.auth-card p.subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #2a3a5c;
  background: #0e1626;
  color: var(--text);
  font-size: 1rem;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

button.btn-primary {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #04141f;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

button.btn-primary:hover { filter: brightness(1.08); }

.error-box {
  background: rgba(255,107,107,0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.hint-box {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #223252;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* --- HUD trong game --- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(180deg, rgba(11,18,32,0.85), transparent);
  z-index: 10;
  font-size: 0.9rem;
}

#hud .hud-left { display: flex; align-items: center; gap: 0.75rem; }
#hud .hud-title { color: var(--accent); font-weight: 700; letter-spacing: 0.5px; }
#hud a, #hud button {
  color: var(--text);
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
}
#hud a:hover, #hud button:hover { background: rgba(255,255,255,0.16); }

#crosshair-hint {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.78rem;
  background: rgba(11,18,32,0.6);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  z-index: 10;
}

canvas { display: block; }

/* --- Start overlay (yêu cầu click để khóa chuột) --- */
#start-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,18,32,0.55);
  z-index: 20;
  cursor: pointer;
}
#start-overlay .start-box {
  text-align: center;
  background: var(--panel);
  border: 1px solid #223252;
  border-radius: 14px;
  padding: 2rem 2.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
#start-overlay .start-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
#start-overlay p { margin: 0.25rem 0; }
#start-overlay .start-sub { color: var(--muted); font-size: 0.82rem; margin-top: 0.75rem; }
#start-overlay kbd {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.78rem;
}

/* --- Menu overlay (Ba lô / Cài đặt) --- */
#menu-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11,18,32,0.65);
  z-index: 30;
}
.menu-panel {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid #223252;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.menu-header h2 { margin: 0; font-size: 1.15rem; }
.menu-header button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
}
.menu-header button:hover { color: var(--text); }

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.inv-slot {
  aspect-ratio: 1;
  background: #0e1626;
  border: 1px solid #2a3a5c;
  border-radius: 8px;
}
.menu-hint {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.settings-list { margin-bottom: 1.25rem; }
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid #223252;
  font-size: 0.9rem;
}
.settings-row a { color: var(--accent); text-decoration: none; }

.menu-panel .btn-primary { margin-bottom: 0.6rem; }
.btn-danger {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid rgba(255,107,107,0.4);
  border-radius: 8px;
  background: rgba(255,107,107,0.08);
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(255,107,107,0.16); }

.hidden { display: none !important; }

/* --- Admin --- */
.admin-wrap { max-width: 960px; margin: 2rem auto; padding: 0 1rem; }
.admin-wrap table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-wrap th, .admin-wrap td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #223252;
  font-size: 0.88rem;
}
.admin-wrap th { color: var(--muted); font-weight: 600; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-admin { background: rgba(79,195,247,0.15); color: var(--accent); }
.badge-player { background: rgba(255,255,255,0.08); color: var(--muted); }
.badge-ok { background: rgba(87,214,148,0.15); color: #57d694; }
.badge-fail { background: rgba(255,107,107,0.15); color: var(--danger); }
