/* ============================================
   MMOCHECK — Design tokens
   ============================================ */
:root {
  --green-deep:    #123D2C;
  --green-primary: #1B6E4C;
  --green-mid:     #2E8B57;
  --green-soft:    #E4F0E9;
  --blue-accent:   #1E3A8A;
  --blue-soft:     #E9EDF9;
  --bg:            #F7F9F7;
  --paper:         #FFFFFF;
  --ink:           #182019;
  --ink-muted:     #5B6B63;
  --line:          #DCE5DE;
  --shadow-card:   0 18px 40px -20px rgba(18, 61, 44, 0.35);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--blue-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Page frame — 2 quảng cáo rail + nội dung giữa
   ============================================ */
.page-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr);
  align-items: start;
  gap: 0;
}

.rail {
  position: sticky;
  top: 96px;
  display: none;
  height: 600px;
  margin: 32px 24px;
  border: 1px dashed #B9CBBF;
  border-radius: 4px;
  background: repeating-linear-gradient(
    135deg,
    rgba(27, 110, 76, 0.05),
    rgba(27, 110, 76, 0.05) 10px,
    transparent 10px,
    transparent 20px
  );
  color: #7C8F84;
  font-size: 12px;
  letter-spacing: 0.04em;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.rail span { writing-mode: vertical-rl; text-orientation: mixed; }

@media (min-width: 1024px) {
  .rail { display: flex; }
}

.main-col {
  min-width: 0;
  width: 100%;
}

/* ============================================
   Header
   ============================================ */
.site-header {
  background: var(--green-deep);
  color: #F4F8F5;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand img { height: 40px; width: auto; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
  color: #FFFFFF;
}

.main-nav {
  display: none;
  gap: 4px;
  margin-left: 8px;
}

@media (min-width: 800px) {
  .main-nav { display: flex; }
}

.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  color: rgba(244, 248, 245, 0.82);
  transition: background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.header-spacer { flex: 1; }

.account-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.account-link:hover { background: rgba(255, 255, 255, 0.22); }

.account-link svg { width: 19px; height: 19px; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  margin-left: -6px;
}

@media (min-width: 800px) {
  .nav-toggle { display: none; }
}

.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--green-deep);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-nav.open { display: flex; }

@media (min-width: 800px) {
  .mobile-nav { display: none !important; }
}

.mobile-nav a {
  padding: 13px 24px;
  font-size: 15px;
  color: rgba(244, 248, 245, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================
   Marquee thông báo
   ============================================ */
.announce {
  background: var(--green-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  overflow: hidden;
}

.announce svg {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  color: var(--green-primary);
}

.announce-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.announce-track span {
  display: inline-block;
  padding-left: 100%;
  color: var(--green-primary);
  font-size: 13.5px;
  font-weight: 500;
  animation: marquee 14s linear infinite;
}

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ============================================
   Hero / nội dung chính
   ============================================ */
.hero {
  padding: 44px 24px 8px;
  text-align: center;
}

.hero p {
  max-width: 46ch;
  margin: 0 auto;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.hero p strong { color: var(--ink); font-weight: 600; }

/* ============================================
   Card carousel — hiệu ứng xếp chồng
   ============================================ */
.carousel-section {
  padding: 28px 16px 8px;
}

.score-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 22px;
}

.score-value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--blue-accent);
  transition: opacity 0.2s ease;
}

.score-max {
  font-size: 15px;
  color: var(--ink-muted);
}

.score-label {
  display: block;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: -14px;
  margin-bottom: 26px;
}

.stack {
  position: relative;
  height: 300px;
  max-width: 340px;
  margin: 0 auto;
}

.stack-card {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.38s cubic-bezier(.22,.61,.36,1), opacity 0.38s ease, filter 0.38s ease;
}

.stack-card .thumb {
  flex: 1;
  background: linear-gradient(135deg, #E4F0E9, #DCE9E1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7C8F84;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.02em;
}

.stack-card .thumb-caption {
  padding: 12px 16px 16px;
  font-size: 13px;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
}

.stack-card[data-pos="current"] {
  transform: translateX(0) scale(1) rotate(0deg);
  opacity: 1;
  z-index: 3;
  filter: none;
}

.stack-card[data-pos="next"] {
  transform: translateX(34px) scale(0.92) rotate(3deg);
  opacity: 0.55;
  z-index: 2;
  filter: saturate(0.85);
}

.stack-card[data-pos="prev"] {
  transform: translateX(-34px) scale(0.92) rotate(-3deg);
  opacity: 0.55;
  z-index: 2;
  filter: saturate(0.85);
}

.stack-card[data-pos="hidden"] {
  transform: translateX(0) scale(0.85);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.stack-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 20px;
}

.stack-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-primary);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.stack-btn:hover { background: var(--green-soft); }
.stack-btn:active { transform: scale(0.94); }
.stack-btn svg { width: 18px; height: 18px; }

.stack-dots {
  display: flex;
  gap: 7px;
}

.stack-dots button {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  padding: 0;
  cursor: pointer;
}

.stack-dots button[aria-current="true"] {
  background: var(--green-primary);
  width: 18px;
  border-radius: 4px;
}

.detail-cta {
  display: flex;
  justify-content: center;
  margin: 30px 0 6px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--green-primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover { background: var(--green-mid); }

/* ============================================
   Khối thông tin khác (placeholder)
   ============================================ */
.info-block {
  margin: 44px 16px 24px;
  padding: 30px 20px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #A7B5AD;
  font-size: 13.5px;
}

/* Banner quảng cáo ngang dưới cùng */
.ad-strip {
  margin: 0 16px 40px;
  padding: 18px;
  border: 1px dashed #B9CBBF;
  border-radius: 10px;
  background: repeating-linear-gradient(
    135deg,
    rgba(27, 110, 76, 0.04),
    rgba(27, 110, 76, 0.04) 10px,
    transparent 10px,
    transparent 20px
  );
  text-align: center;
  color: #7C8F84;
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

/* ============================================
   Footer (placeholder, tối giản)
   ============================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 24px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 12.5px;
}

/* ============================================
   Trang placeholder (Mẹo, Cộng đồng, Tài khoản...)
   ============================================ */
.placeholder-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 100px 24px;
  text-align: center;
}

.placeholder-page h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 10px;
}

.placeholder-page p {
  color: var(--ink-muted);
  font-size: 14.5px;
}

.placeholder-page a {
  display: inline-block;
  margin-top: 22px;
  font-size: 13.5px;
  color: var(--green-primary);
  font-weight: 600;
}

/* ============================================
   Trang MMO List — ô tìm kiếm
   ============================================ */
.list-hero {
  padding: 36px 20px 8px;
}

.search-bar {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.search-bar input {
  border: none;
  outline: none;
  flex: 1;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: transparent;
}

/* ============================================
   Khối category (Khảo sát/nhiệm vụ, Game/App...)
   ============================================ */
.category-block {
  padding: 30px 20px 6px;
}

.category-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 16px;
  padding-left: 4px;
}

.category-empty {
  padding: 30px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
  color: #A7B5AD;
  font-size: 13.5px;
}

/* ============================================
   Carousel trượt ngang — luôn hiện 3 thẻ
   ============================================ */
.hcarousel {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hcarousel-track {
  flex: 1;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.mmo-card {
  flex: 1 1 0;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mmo-card .thumb-btn {
  border: none;
  padding: 0;
  cursor: zoom-in;
  display: block;
  width: 100%;
}

.mmo-card .thumb {
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #E4F0E9, #DCE9E1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7C8F84;
  font-family: var(--font-display);
  font-size: 15px;
}

.mmo-card .card-foot {
  padding: 10px 12px 14px;
  text-align: center;
}

.mmo-card .card-score {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--blue-accent);
  font-size: 15px;
}

.mmo-card .card-score-max {
  color: var(--ink-muted);
  font-size: 12px;
}

.hcarousel .stack-btn { flex-shrink: 0; }

/* ============================================
   Modal phóng to — trung tính đen trắng
   ============================================ */
.mmo-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.6);
  padding: 20px;
}

.mmo-modal.open { display: flex; }

.mmo-modal-panel {
  width: 100%;
  max-width: 880px;
  height: 80vh;
  max-height: 780px;
  background: #FFFFFF;
  color: #111111;
  border-radius: 16px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 70px -25px rgba(0,0,0,0.55);
  animation: modalPop 0.22s ease;
}

@keyframes modalPop {
  from { transform: scale(0.94); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.mmo-modal-close {
  position: sticky;
  top: 14px;
  left: 100%;
  transform: translateX(-14px);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #DDDDDD;
  background: #FFFFFF;
  color: #111111;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.mmo-modal-body {
  padding: 4px 32px 40px;
  margin-top: -22px;
}

.mmo-modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 18px;
}

.mmo-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.mmo-gallery div {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background: #EFEFEF;
  border: 1px dashed #CFCFCF;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9A9A9A;
  font-size: 12px;
}

.mmo-info-placeholder {
  padding: 26px 20px;
  border: 1px dashed #D8D8D8;
  border-radius: 12px;
  text-align: center;
  color: #9A9A9A;
  font-size: 13.5px;
  margin-bottom: 26px;
}

.mmo-join-row {
  display: flex;
  justify-content: center;
}

.btn-join {
  padding: 12px 34px;
  border-radius: 999px;
  background: #111111;
  color: #FFFFFF;
  font-size: 14.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.btn-join:hover { background: #333333; }

@media (max-width: 560px) {
  .mmo-gallery { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   User badge (tên + UID) hiện cạnh icon tài khoản
   khi đã đăng nhập
   ============================================ */
.user-badge {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  margin-right: 2px;
}

.user-badge.visible { display: flex; }

.user-badge-uid {
  font-size: 10.5px;
  color: rgba(244, 248, 245, 0.5);
}

.user-badge-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #FFFFFF;
}

.account-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ============================================
   Trang Tài khoản — khung chung + chuyển view
   ============================================ */
.account-page {
  max-width: 440px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.account-view { display: none; }
.account-view.active { display: block; }

.account-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
}

.account-card h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 22px;
  text-align: center;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 14.5px;
  outline: none;
}

.field input:focus {
  border-color: var(--green-primary);
}

.pw-field {
  position: relative;
}

.pw-field input { padding-right: 42px; }

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 4px;
}

.pw-toggle svg { width: 18px; height: 18px; }
.pw-toggle .icon-off { display: none; }
.pw-toggle.is-visible .icon-on { display: none; }
.pw-toggle.is-visible .icon-off { display: block; }

.form-error {
  display: none;
  color: #C0392B;
  font-size: 12.5px;
  margin: -6px 0 14px;
}

.btn-block {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--green-primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.btn-block:hover { background: var(--green-mid); }

.account-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--ink-muted);
}

.account-switch button {
  background: none;
  border: none;
  color: var(--green-primary);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

/* Màn hình chọn Đăng ký / Đăng nhập */
.choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-buttons button {
  padding: 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}

.choice-buttons button.primary {
  background: var(--green-primary);
  color: #fff;
  border: none;
}

.choice-buttons button.primary:hover { background: var(--green-mid); }

/* OTP + resend + turnstile */
.otp-hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 16px;
  text-align: center;
}

.otp-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.otp-row input { flex: 1; }

.otp-resend-btn {
  flex-shrink: 0;
  min-width: 76px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--green-soft);
  color: var(--green-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.otp-resend-btn:disabled {
  cursor: default;
  color: var(--ink-muted);
  background: var(--bg);
}

.turnstile-wrap { margin-bottom: 18px; display: flex; justify-content: center; }

/* ============================================
   Trang Profile
   ============================================ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.profile-avatar-wrap { position: relative; flex-shrink: 0; }

.profile-avatar-img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
}

.profile-avatar-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--green-primary);
  border: 2px solid var(--paper);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-avatar-btn svg { width: 13px; height: 13px; }
.profile-avatar-input { display: none; }

.profile-uid {
  font-size: 11.5px;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 2px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-name-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.profile-name-input {
  display: none;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 15px;
  max-width: 160px;
}

[data-action="edit-name"],
[data-action="save-name"] {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--green-primary);
  padding: 2px;
  display: inline-flex;
}

[data-action="save-name"] { display: none; }
[data-action="edit-name"] svg,
[data-action="save-name"] svg { width: 15px; height: 15px; }

.name-error {
  display: none;
  color: #C0392B;
  font-size: 12px;
  margin: 4px 0 0;
}

.profile-rows {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--line);
}

.profile-row .label { color: var(--ink-muted); }
.profile-row .value { font-weight: 500; }

.profile-stats {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.profile-stat-box {
  flex: 1;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.profile-stat-box .stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 6px;
}

.profile-stat-box .stat-value {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--blue-accent);
}

.logout-row {
  text-align: center;
  margin-top: 26px;
}

.logout-row button {
  background: none;
  border: none;
  color: #C0392B;
  font-size: 13.5px;
  cursor: pointer;
}
