/* ---------------------------CUSTOM STYLING---------------------------- */

/* Dino Font by Devfolio */

@font-face {
  font-family: 'OnchainDino';
  src: url('extra/OnchainDino-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

.trex-game {
  max-width: 600px;
  width: 100%;
  position: relative;
  /* mốc định vị cho nút Bắt đầu/Chơi lại bên trong */
  /* Chuyển động mượt khi phóng to / thu nhỏ (bấm F vào/ra arcade). */
  transition: transform 0.4s ease, margin 0.4s ease;
}

.trex-game .runner-container {
  transition: all 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: OnchainDino;
  text-transform: uppercase;
  color: rgb(122, 122, 122);
}

.container {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 32px;
}

.header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.game-intro {
  font-size: 15px;
  color: rgb(100, 100, 100);
  text-align: center;
  max-width: 520px;
  margin: 4px 0 0;
}

.game-instruction {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  color: rgb(110, 110, 110);
  text-align: center;
  margin: 8px 0 0;
}

/* Tiêu đề trang chủ: font sạch (hỗ trợ tiếng Việt), 2 màu */
.game-title {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgb(55, 55, 55);
}

.game-title .hl {
  color: #27ae60;
}

a {
  font-size: 16px;
  color: rgb(122, 122, 122);
}

a:active {
  scale: 0.95;
}

/* ------------------- Đăng nhập + Bảng xếp hạng (thêm mới) ------------------- */

.account-box,
.leaderboard-box {
  width: 100%;
  max-width: 600px;
  align-self: center; /* canh giữa khi nằm trong .page (flex stretch) */
  /* Font thường dễ đọc cho nội dung; chỉ tiêu đề mới dùng font pixel OnchainDino */
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  color: rgb(122, 122, 122);
}

/* --- Auth --- */
.auth-title {
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(122, 122, 122, 0.4);
  border-radius: 8px;
  padding: 20px;
}

.auth-fields {
  display: flex;
  gap: 12px;
}

.auth-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid rgba(122, 122, 122, 0.5);
  border-radius: 6px;
  color: inherit;
  font-family: inherit;
  font-size: 14px;
}

.auth-input:focus {
  outline: none;
  border-color: rgb(122, 122, 122);
}

.auth-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.auth-btn {
  padding: 8px 20px;
  border: 1px solid rgb(122, 122, 122);
  border-radius: 6px;
  background: rgb(122, 122, 122);
  color: #111;
  font-family: inherit;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.auth-btn:hover {
  opacity: 0.85;
}

.auth-btn:active {
  scale: 0.96;
}

.auth-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-btn-ghost {
  background: transparent;
  color: rgb(122, 122, 122);
}

.auth-msg {
  margin: 0;
  min-height: 16px;
  text-align: center;
  font-size: 13px;
}

.auth-msg-error {
  color: #d66;
}

.auth-switch {
  margin: 0;
  text-align: center;
  font-size: 13px;
}

.auth-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: #e8b04b;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.auth-link:hover {
  opacity: 0.85;
}

.auth-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-show {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.auth-show input {
  width: auto;
  cursor: pointer;
}

.auth-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid rgba(122, 122, 122, 0.4);
  border-radius: 8px;
  padding: 14px 20px;
}

.auth-hello {
  font-size: 14px;
}

.auth-logout {
  padding: 6px 16px;
  font-size: 12px;
}

/* --- Leaderboard --- */
.lb-title {
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
  text-align: center;
}

.lb-empty {
  text-align: center;
  font-size: 13px;
  opacity: 0.8;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lb-table th,
.lb-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(122, 122, 122, 0.25);
}

.lb-table th {
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.7;
}

.lb-rank {
  width: 40px;
  text-align: center;
}

.lb-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lb-me {
  color: #e8b04b;
  font-weight: bold;
}

/* Dòng hiển thị hạng của bạn khi ở ngoài Top 10 */
.lb-me-row td {
  border-top: 2px dashed rgba(232, 176, 75, 0.5);
}

/* Mobile */
@media screen and (max-width: 600px) {
  .auth-fields {
    flex-direction: column;
  }
}

/* Chế độ toàn màn hình (bấm F): phóng to game và đưa cả trang vào giữa màn hình.
   Tiêu đề, khung đăng nhập và bảng xếp hạng VẪN hiển thị, không bị đè. */
body.arcade-mode {
  overflow-x: hidden;
}

body.arcade-mode .container {
  min-height: 100vh;
  justify-content: center;
}

body.arcade-mode .trex-game {
  transform: scale(2.5);
  transform-origin: center;
  /* Chừa khoảng trống cho phần game phóng to (cao thêm ~180px) để không đè
     lên tiêu đề ở trên và khung đăng nhập/bảng xếp hạng ở dưới. */
  margin: 95px 0;
}

/* Màn hình nhỏ: giảm mức phóng to để game không tràn ngang. */
@media screen and (max-width: 900px) {
  body.arcade-mode .trex-game {
    transform: scale(1.25);
    margin: 30px 0;
  }
}

/* --- Nút điều khiển mobile (mặc định ẩn; chỉ hiện trên thiết bị cảm ứng/màn nhỏ) --- */
.mobile-controls {
  display: none;
  width: 100%;
  max-width: 600px;
}

@media (pointer: coarse),
(max-width: 768px) {
  .mobile-controls {
    display: block;
  }
}

/* Hai nút lớn có nhãn: cúi (xanh dương) & nhảy (xanh lá) */
.mc-move {
  display: flex;
  gap: 16px;
}

.mc-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 10px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: #f2f2f2;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* chống cuộn/zoom khi đang giữ nút */
  transition: transform 0.06s, filter 0.12s;
}

.mc-btn svg {
  display: block;
}

.mc-label {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #333;
}

.mc-sub {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-size: 12px;
  color: #999;
}

/* Cúi = xanh dương */
.mc-duck {
  background: #eaf4fe;
  border-color: #cfe4fb;
  color: #2f80ed;
}

/* Nhảy = xanh lá */
.mc-jump {
  background: #e9f9ee;
  border-color: #c9ecd4;
  color: #27ae60;
}

.mc-btn:active {
  transform: scale(0.97);
  filter: brightness(0.96);
}

.mc-start {
  background: #e8b04b;
}

/* Nút Bắt đầu / Chơi lại — nhỏ, không màu, nằm đè bên trong khung game */
.game-action-btn {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 3px 12px;
  border: 1px solid #535353;
  border-radius: 4px;
  background: transparent;
  color: #535353;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  touch-action: manipulation;
}

.game-action-btn:hover {
  background: rgba(83, 83, 83, 0.08);
}

.game-action-btn:active {
  transform: translateX(-50%) scale(0.96);
}

/* ===================== NAV + LOGO + NỘI DUNG (SEO) ===================== */

html {
  scroll-behavior: smooth;
}

/* Cuộn tới mục không bị nav che */
[id] {
  scroll-margin-top: 80px;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(122, 122, 122, 0.2);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: OnchainDino;
  text-transform: uppercase;
  font-size: 18px;
  color: rgb(90, 90, 90);
  text-decoration: none;
}

.logo-name {
  font-family: OnchainDino;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  font-size: 14px;
  color: rgb(100, 100, 100);
  text-decoration: none;
}

.nav-menu a:hover {
  color: #111;
  text-decoration: underline;
}

/* Nội dung chính */
.site-content {
  max-width: 760px;
  margin: 48px auto 0;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.content-section h2 {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 20px;
  color: rgb(80, 80, 80);
  margin: 0 0 14px;
  text-align: center;
}

.content-section p {
  font-size: 15px;
  line-height: 1.7;
  color: rgb(90, 90, 90);
  margin: 0 0 12px;
}

.howto-list {
  font-size: 15px;
  line-height: 1.9;
  color: rgb(90, 90, 90);
  padding-left: 20px;
}

kbd {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-weight: 700;
  background: rgba(122, 122, 122, 0.14);
  border: 1px solid rgba(122, 122, 122, 0.35);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 13px;
  color: #444;
}

/* Phần thưởng / CTA */
.cta-section {
  border: 1px solid rgba(232, 176, 75, 0.6);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
  background: rgba(232, 176, 75, 0.06);
}

/* Khung nội dung trang chủ (admin soạn) */
.home-article {
  border: 1px solid rgba(122, 122, 122, 0.25);
  border-radius: 12px;
  padding: 24px 28px;
  background: #fafafa;
}

.home-article h2 {
  margin-top: 0;
}

.prize-grid {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0 12px;
}

.prize-card {
  min-width: 130px;
  padding: 16px 20px;
  border: 1px solid rgba(232, 176, 75, 0.5);
  border-radius: 10px;
  background: #fff;
}

.prize-rank {
  font-size: 15px;
  color: rgb(90, 90, 90);
  margin-bottom: 6px;
}

.prize-amount {
  font-family: OnchainDino;
  font-size: 22px;
  color: #d1901f;
}

.cta-note {
  font-size: 13px !important;
  opacity: 0.85;
}

.cta-note a {
  color: #d1901f;
  font-weight: 600;
}

/* Footer */
.site-footer {
  margin-top: 56px;
  padding: 28px 20px;
  border-top: 1px solid rgba(122, 122, 122, 0.2);
  text-align: center;
  font-size: 13px;
  color: rgb(122, 122, 122);
}

/* Nút hamburger (ẩn trên desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: rgb(90, 90, 90);
  cursor: pointer;
  padding: 4px 8px;
}

/* Mobile: hiện hamburger, menu xổ xuống khi mở */
@media (max-width: 640px) {
  .site-nav {
    padding: 10px 16px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-menu {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
  }

  .site-nav.open .nav-menu {
    display: flex;
  }

  .nav-menu li {
    width: 100%;
  }

  .nav-menu a {
    display: block;
    padding: 11px 8px;
    font-size: 15px;
    border-radius: 6px;
  }

  .nav-menu a:hover {
    background: rgba(122, 122, 122, 0.1);
  }
}

/* Menu: link trang hiện tại */
.nav-menu a[aria-current='page'] {
  color: #111;
  font-weight: 700;
}

/* ===================== TRANG CON + HỒ SƠ ===================== */

.page {
  max-width: 760px;
  margin: 40px auto 0;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.page-title {
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 26px;
  color: rgb(80, 80, 80);
  text-align: center;
  margin: 8px 0 0;
}

.page-back {
  text-align: center;
}

.page-back a {
  color: rgb(100, 100, 100);
}

/* Link "xem đầy đủ" dưới bảng xếp hạng ở trang chủ */
.lb-viewall {
  display: inline-block;
  margin-top: 4px;
  font-size: 14px;
  color: #d1901f;
  font-weight: 600;
  text-decoration: none;
}

.lb-viewall:hover {
  text-decoration: underline;
}

/* Thẻ hồ sơ người dùng */
.profile-card {
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  border: 1px solid rgba(122, 122, 122, 0.3);
  border-radius: 14px;
  padding: 32px 24px;
  color: rgb(90, 90, 90);
}

.profile-avatar {
  font-size: 56px;
  line-height: 1;
}

.profile-name {
  font-family: OnchainDino;
  text-transform: uppercase;
  font-size: 22px;
  color: rgb(90, 90, 90);
  margin: 12px 0 24px;
  word-break: break-word;
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

.stat {
  min-width: 80px;
}

.stat-num {
  font-family: OnchainDino;
  font-size: 26px;
  color: #d1901f;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  color: rgb(122, 122, 122);
  margin-top: 4px;
}

.profile-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.profile-actions .auth-btn {
  text-decoration: none;
}

/* Bọc nội dung trang con để giãn cách đều */
.page-root {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===================== TRANG QUẢN TRỊ ===================== */

.admin-msg {
  text-align: center;
  color: rgb(90, 90, 90);
}

.admin-msg .auth-btn {
  text-decoration: none;
  display: inline-block;
  margin-top: 8px;
}

.admin-hello {
  font-size: 14px;
  color: rgb(90, 90, 90);
  text-align: center;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid rgba(122, 122, 122, 0.3);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 28px;
}

.admin-form h2 {
  font-family: OnchainDino;
  text-transform: uppercase;
  font-size: 18px;
  color: rgb(90, 90, 90);
  margin: 0;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: rgb(90, 90, 90);
}

.admin-form label small {
  color: rgb(140, 140, 140);
  font-weight: normal;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid rgba(122, 122, 122, 0.5);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  color: rgb(60, 60, 60);
  background: #fff;
  resize: vertical;
}

.admin-form input:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: rgb(122, 122, 122);
}

.admin-prizes {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-prize {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-actions .auth-btn {
  align-self: flex-start;
}

.admin-status {
  font-size: 13px;
}

.admin-status.ok {
  color: #2e9e4f;
}

.admin-status.err {
  color: #d66;
}

@media screen and (max-width: 600px) {
  .admin-prizes {
    flex-direction: column;
  }
}

/* ===================== CÀI ĐẶT WEBSITE ===================== */

.set-imgbox {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.set-preview {
  width: 96px;
  height: 96px;
  border: 1px solid rgba(122, 122, 122, 0.4);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  overflow: hidden;
}

.set-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.set-empty {
  font-size: 12px;
  color: rgb(150, 150, 150);
}

.set-imgactions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.set-uploadbtn {
  cursor: pointer;
  text-decoration: none;
}

.set-link {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.set-link input {
  flex: 1;
  min-width: 0;
}

.set-mini {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid rgba(122, 122, 122, 0.5);
  border-radius: 6px;
  background: #fff;
  color: rgb(90, 90, 90);
  cursor: pointer;
  font-size: 13px;
}

.set-mini:hover {
  background: rgba(122, 122, 122, 0.1);
}

.set-del {
  color: #d66;
  border-color: rgba(214, 102, 102, 0.5);
}

#add-link {
  align-self: flex-start;
}

/* Logo ảnh (khi admin đặt logo) + footer động */
.logo-img {
  height: 28px;
  display: block;
}

.footer-intro {
  margin: 6px 0;
}

.footer-links {
  margin-top: 8px;
}

.footer-links a {
  color: rgb(122, 122, 122);
  font-size: 13px;
  margin: 0 2px;
}

/* ===================== KHUNG QUẢN TRỊ (SIDEBAR) ===================== */

.admin-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  flex: none;
}

.admin-navbtn {
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: rgb(90, 90, 90);
}

.admin-navbtn:hover {
  background: rgba(122, 122, 122, 0.1);
}

.admin-navbtn.active {
  background: rgba(232, 176, 75, 0.18);
  color: #111;
  font-weight: 700;
}

.admin-content {
  flex: 1;
  min-width: 0;
}

/* Danh sách trang tùy biến trong admin */
.page-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(122, 122, 122, 0.25);
  border-radius: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.page-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-slug {
  color: #2f80ed;
  font-size: 13px;
  text-decoration: none;
}

.page-tag {
  font-size: 11px;
  background: rgba(214, 102, 102, 0.15);
  color: #c0392b;
  padding: 2px 8px;
  border-radius: 10px;
}

.page-row-actions {
  display: flex;
  gap: 8px;
}

.page-row-actions .auth-btn {
  padding: 6px 14px;
  font-size: 12px;
}

@media (max-width: 700px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
}