/* ============ RESET & BASE ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5efe6;
  --ink: #3a2e26;
  --accent: #b8860b;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ============ TRANG CHỦ (GIỮ NGUYÊN) ============ */
.page-index {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, var(--bg) 0%, #ede3d3 100%);
  color: var(--ink);
  padding: 24px;
}

.index-wrap {
  width: 100%;
  max-width: 420px;
  text-align: center;
  background: #fffaf3;
  border: 1px solid #e0d3c1;
  border-radius: 14px;
  padding: 40px 28px;
  box-shadow: 0 8px 24px rgba(58, 46, 38, 0.08);
}

.brand { font-size: 1.6rem; letter-spacing: 0.15em; font-weight: 600; margin-bottom: 8px; }
.tagline { color: #6b5b4c; font-size: 0.9rem; margin-bottom: 28px; letter-spacing: 0.05em; }

.enter-form { display: flex; flex-direction: column; gap: 10px; }
.label { text-align: left; font-size: 0.85rem; color: #6b5b4c; margin-bottom: -4px; }

.input {
  width: 100%; padding: 12px 14px; border: 1px solid #e0d3c1; border-radius: 10px;
  font-size: 1rem; background: #fff; color: var(--ink); outline: none;
}
.input:focus { border-color: #d4a94a; box-shadow: 0 0 0 3px rgba(212, 169, 74, 0.2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 18px; border-radius: 10px; border: none; font-size: 1rem;
  cursor: pointer; transition: transform 0.1s, background 0.2s; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; font-weight: 600; letter-spacing: 0.05em; }
.btn-primary:hover { background: #d4a94a; }

.footnote { margin-top: 24px; font-size: 0.78rem; color: #6b5b4c; }

/* ============ TRANG 3D TEMPLE ============ */
.page-temple-3d {
  margin: 0;
  overflow: hidden;
  background-color: #111;
  user-select: none;
}

#canvas-container {
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0; left: 0;
  z-index: 1;
  cursor: pointer;
}

.ui-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; /* Xuyên qua UI để click xuống 3D */
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 20px;
}

.room-info {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  padding: 10px 16px;
  border-radius: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}
.room-name { font-weight: bold; font-size: 0.95rem; }
.room-online { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; opacity: 0.8; }

.top-actions { display: flex; gap: 10px; pointer-events: auto; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
}

.hint-text {
  position: absolute;
  top: 15%; left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0,0,0,0.6);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  pointer-events: none;
  animation: fadeOut 4s forwards;
}
@keyframes fadeOut { 0% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; display: none; } }

.bottom-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 30px;
  pointer-events: auto;
}

.action-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
}
.action-btn:hover { background: rgba(255,255,255,0.2); }
.action-btn:active { transform: scale(0.9); }
.action-btn.active { background: rgba(212, 169, 74, 0.8); border-color: #d4a94a; }

@media (max-width: 480px) {
  .action-btn { width: 56px; height: 56px; font-size: 1.5rem; }
  .bottom-bar { gap: 14px; padding: 20px; }
}
/* Joystick cho Mobile */
#joystick-zone {
  position: absolute;
  bottom: 100px;
  left: 20px;
  width: 120px;
  height: 120px;
  pointer-events: auto;
  display: none; /* Sẽ bật bằng JS nếu là mobile */
}

#joystick-base {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  position: relative;
  backdrop-filter: blur(5px);
}

#joystick-stick {
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Khu vực xoay camera (nửa phải màn hình) */
#touch-zone-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  pointer-events: auto;
  z-index: 5;
}

@media (max-width: 768px) {
  #joystick-zone { display: block; }
  .bottom-bar { bottom: 20px; right: 20px; position: absolute; flex-direction: column; }
  .action-btn { width: 50px; height: 50px; font-size: 1.2rem; margin-bottom: 10px; }
}