:root {
  --home-container: 1480px;
  --home-gutter: clamp(18px, 3vw, 48px);
  --home-space-section: clamp(24px, 3vw, 40px);
  --home-radius-lg: 20px;
  --home-radius-md: 13px;
  --home-surface: rgba(18, 42, 91, 0.64);
  --home-surface-soft: rgba(42, 35, 94, 0.54);
  --home-border: rgba(190, 211, 255, 0.22);
  --home-gold: #f8d43b;
  --home-purple: #9d6cff;
  --home-focus: #c4b5fd;
  --home-motion: 220ms ease-out;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

html {
  font-size: 20px;
}

body {
  line-height: 1.6;
}

.game-header .header-inner {
  display: grid;
  width: min(1440px, calc(100% - 32px));
  min-height: 88px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 1.5vw, 24px);
  padding-block: 10px;
}

.game-header .header-logo {
  justify-self: start;
}

.game-header .header-logo img {
  width: auto;
  height: 64px;
  max-width: 160px;
}

.game-header .nav-links {
  width: max-content;
  max-width: 100%;
  justify-self: center;
  gap: 8px;
}

.game-header .nav-links a {
  min-height: 50px;
  padding: 12px 15px;
  font-size: 0.92rem;
}

.game-header .header-actions > .btn-game,
.game-header .user-panel {
  min-height: 52px;
}

.game-header .header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-self: end;
  justify-content: flex-end;
  gap: 10px;
  margin-left: 0;
}

.game-header .user-panel {
  width: auto;
  min-width: 130px;
  max-width: 180px;
}

.game-header .user-panel-meta {
  min-width: 0;
  overflow: hidden;
}

.game-header .user-panel :is(.user-name, .user-balance) {
  overflow: hidden;
  max-width: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .hamburger {
  display: none;
}

.home-hero {
  position: relative;
  width: min(var(--home-container), calc(100% - (2 * var(--home-gutter))));
  height: clamp(520px, 42vw, 720px);
  min-height: 0 !important;
  margin: clamp(28px, 3vw, 44px) auto 0;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid rgba(248, 212, 59, 0.38);
  border-radius: var(--home-radius-lg);
  background-color: #0b214d;
  background-image: url("/public/images/hinh-nen-7-vien-ngoc-rong-9.webp") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: cover !important;
  box-shadow: 0 24px 70px rgba(2, 8, 28, 0.3), 0 0 34px rgba(96, 165, 250, 0.16);
}

.home-hero::before,
.home-hero::after {
  pointer-events: none;
}

.home-hero::before { content: "" !important; display: block !important; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(0,20,55,.04), rgba(0,15,45,.1) 55%, rgba(0,5,24,.48)); }
.home-hero::after { content: none !important; display: none !important; }
.home-hero-content { position: absolute; z-index: 1; top: 10%; left: 50%; display: flex; width: min(720px, calc(100% - 40px)); flex-direction: column; align-items: center; transform: translateX(-50%); text-align: center; }
.home-hero-logo { width: clamp(210px, 24vw, 350px); height: auto; max-height: 190px; object-fit: contain; filter: drop-shadow(0 5px 8px rgba(0,0,0,.5)) drop-shadow(0 0 13px rgba(255,180,0,.42)); }
.home-hero-welcome { margin: clamp(8px, 1.4vw, 18px) 0 0; color: #fff; font-size: clamp(.9rem, 1.35vw, 1.12rem); font-weight: 600; line-height: 1.55; text-shadow: 0 2px 5px rgba(0,0,0,.9), 0 0 16px rgba(0,0,0,.55); }
.home-hero-welcome strong { color: #ffd54a; font-weight: 800; }
/* The account actions remain available in the header and mobile navigation;
   suppress only the duplicated guest CTA group inside the homepage hero. */
.home-hero-actions { display: none; }
.home-hero-button { display: inline-flex; min-width: 142px; min-height: 46px; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; border: 2px solid #ff4b32; border-radius: 999px; color: #fff; background: rgba(7,18,44,.58); box-shadow: 0 8px 22px rgba(0,0,0,.26); font-weight: 800; text-decoration: none; transition: transform var(--home-motion), filter var(--home-motion); }
.home-hero-button--login { background: linear-gradient(135deg, #ff5a36, #df241f); }
.home-hero-button:hover { color: #fff; filter: brightness(1.08); transform: translateY(-2px); }
.home-hero-button:focus-visible { outline: 3px solid #fde68a; outline-offset: 3px; }
.server-announcement { position: absolute; z-index: 2; right: clamp(12px,2vw,28px); bottom: clamp(12px,2vw,24px); left: clamp(12px,2vw,28px); display: flex; min-height: 52px; overflow: hidden; border: 1px solid rgba(255,184,77,.48); border-radius: 12px; background: rgba(4,15,41,.66); box-shadow: 0 8px 24px rgba(0,0,0,.25), inset 0 1px rgba(255,255,255,.08); color: #fff; }
.announcement-label { z-index: 1; display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 0 18px; color: #fff6d8; background: linear-gradient(135deg, rgba(234,88,12,.94), rgba(190,24,24,.94)); font-size: .82rem; font-weight: 900; letter-spacing: .04em; }
.announcement-viewport { display: flex; min-width: 0; flex: 1; align-items: center; overflow: hidden; }
.announcement-track { width: max-content; padding-left: 100%; white-space: nowrap; will-change: transform; animation: forestAnnouncementScroll 24s linear infinite; }
.announcement-track span { display: inline-block; padding-right: 40px; font-size: .88rem; font-weight: 700; text-shadow: 0 1px 3px #000; }
.server-announcement:hover .announcement-track { animation-play-state: paused; }
@keyframes forestAnnouncementScroll { to { transform: translateX(-100%); } }

.portal-main {
  padding: 0 0 clamp(40px, 5vw, 64px) !important;
}

.portal-main > section {
  margin-top: var(--home-space-section);
}

.portal-main > :is(.download-section, .news-section, .slider-section, .guide-section, .community-section) {
  padding-block: clamp(42px, 5vw, 68px) !important;
}

.portal-main > .quick-access-section {
  margin-top: clamp(16px, 2.5vw, 28px);
  margin-bottom: clamp(44px, 5vw, 64px);
}

body.girlkun-bg .portal-main > .download-section {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding: clamp(56px, 6vw, 72px) 0 clamp(64px, 7vw, 88px) !important;
  overflow: visible;
  border-block: 1px solid rgba(190, 211, 255, 0.12);
  background: linear-gradient(180deg, rgba(18, 42, 91, 0.34), rgba(16, 25, 66, 0.48)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.portal-main .site-container {
  width: min(var(--home-container), calc(100% - (2 * var(--home-gutter))));
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}

.quick-access-card {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 3.5vw, 48px);
  border: 1px solid var(--home-border);
  border-radius: var(--home-radius-lg);
  background:
    radial-gradient(circle at 8% 0%, rgba(248, 212, 59, 0.12), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(124, 58, 237, 0.17), transparent 32%),
    linear-gradient(145deg, var(--home-surface), var(--home-surface-soft));
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
  box-shadow: 0 18px 48px rgba(2, 8, 28, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.quick-access-heading {
  margin-bottom: 28px;
  text-align: center;
}

.quick-access-heading p,
.quick-access-heading h1 {
  margin: 0;
}

.quick-access-heading p {
  color: #c4b5fd;
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quick-access-heading h1 {
  margin-top: 4px;
  color: var(--home-gold);
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  line-height: 1.2;
  text-transform: uppercase;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.quick-access-action {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 15px 18px;
  border: 1px solid rgba(196, 181, 253, 0.3);
  border-radius: var(--home-radius-md);
  color: #f8fafc;
  background: linear-gradient(180deg, rgba(73, 83, 154, 0.58), rgba(28, 48, 104, 0.68));
  -webkit-backdrop-filter: blur(12px) saturate(130%);
  backdrop-filter: blur(12px) saturate(130%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 7px 18px rgba(2, 8, 28, 0.18);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform var(--home-motion), border-color var(--home-motion), box-shadow var(--home-motion), filter var(--home-motion);
}

.quick-access-action i {
  flex: 0 0 auto;
  color: #c4b5fd;
  font-size: 1.16rem;
}

.quick-access-action span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-access-action:hover {
  transform: translateY(-2px);
  border-color: rgba(196, 181, 253, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 11px 24px rgba(0, 0, 0, 0.32);
  filter: brightness(1.07);
}

.quick-access-action:active,
.btn-game:active {
  transform: translateY(1px) scale(0.985);
}

.quick-access-action:focus-visible,
.btn-game:focus-visible {
  outline: 3px solid var(--home-focus);
  outline-offset: 3px;
}

.download-section .section-title {
  position: relative;
  z-index: 2;
  margin: 0 auto clamp(30px, 3vw, 40px);
  padding: 0;
  text-align: center;
}

.download-section .section-title :is(h2, p, .title-line) {
  position: relative;
  z-index: 2;
}

.download-section .download-grid {
  position: relative;
  z-index: 2;
  width: min(1180px, 100%);
  max-width: 1180px;
  margin: 0 auto;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
  align-items: stretch;
}

.download-card {
  display: flex;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 3vw, 40px) !important;
}

.portal-main .section-title {
  margin-bottom: clamp(26px, 3vw, 38px);
}

.portal-main .section-title h2 {
  font-size: clamp(1.9rem, 2.8vw, 2.65rem);
}

.portal-main .section-title p {
  max-width: 760px;
  margin-inline: auto;
  font-size: 1rem;
  line-height: 1.65;
}

.portal-main .download-card h3,
.portal-main .social-card h3,
.portal-main .feature-game-card figcaption {
  font-size: 1.25rem;
}

.portal-main .download-card > p,
.portal-main .social-card p,
.portal-main .manga-news-list,
.portal-main .manga-news-tab {
  font-size: 0.98rem;
}

.download-card .card-icon {
  flex: 0 0 auto;
}

.download-card h3 {
  min-height: 1.4em;
}

.download-card > p {
  min-height: 3.25em;
  margin-bottom: 20px;
}

.download-btns {
  display: grid;
  width: 100%;
  gap: 10px;
  margin-top: auto;
}

.download-btns .btn-game {
  width: 100%;
  min-height: 56px;
  margin: 0;
  border-width: 1px;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  touch-action: manipulation;
}

.portal-main .btn-game {
  padding: 13px 20px;
  font-size: 0.98rem;
}

.portal-main .download-card .card-icon,
.portal-main .social-card .social-icon {
  width: 68px;
  height: 68px;
  font-size: 2rem;
}

.portal-main .manga-news-list li {
  min-height: 52px;
  padding-block: 12px;
}

.portal-main .manga-news-tab {
  min-height: 48px;
  padding: 11px 17px;
}

.btn-game-purple {
  border-color: #6d28d9 !important;
  color: #fff !important;
  background: linear-gradient(135deg, #6d28d9, #8b5cf6 55%, #a78bfa) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 0 #5420aa, 0 9px 24px rgba(139, 92, 246, 0.38) !important;
  text-shadow: 0 1px 2px rgba(26, 10, 61, 0.85);
}

.btn-game-purple:hover {
  filter: brightness(1.08);
}

.download-card.ios::before {
  background: linear-gradient(90deg, #6d28d9, #a78bfa) !important;
}

.download-card.ios .card-icon {
  color: #bca8ff;
  background: rgba(124, 58, 237, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
}

@media (max-width: 1500px) {
  .game-header .header-inner {
    gap: 10px;
  }

  .game-header .nav-links {
    gap: 2px;
  }

  .game-header .nav-links a {
    padding-inline: 9px;
    font-size: 0.76rem;
  }
}

@media (max-width: 1100px) {
  .game-header .nav-links {
    display: none;
  }

  .game-header .hamburger {
    display: inline-flex;
  }
}

@media (max-width: 1024px) {
  html {
    font-size: 18px;
  }

  .game-header .header-inner {
    min-height: 76px;
  }

  .game-header .header-logo img {
    height: 54px;
  }

  .home-hero {
    height: clamp(430px, 52vw, 560px);
  }

  .quick-access-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 768px) {
  html {
    font-size: 17px;
  }

  .game-header .header-inner {
    min-height: 70px;
  }

  .game-header .header-logo img {
    height: 48px;
    max-width: 125px;
  }

  .home-hero {
    width: calc(100% - 32px);
    height: clamp(340px, 60vw, 480px);
    margin-top: 16px;
    border-radius: 16px;
  }

  .home-hero-content { top: 7%; width: min(620px, calc(100% - 28px)); }
  .home-hero-logo { width: clamp(150px, 34vw, 230px); max-height: 118px; }
  .home-hero-welcome { font-size: clamp(.76rem, 2.3vw, .92rem); line-height: 1.4; }
  .home-hero-actions { gap: 9px; margin-top: 10px; }
  .home-hero-button { min-width: 120px; min-height: 40px; padding: 7px 15px; font-size: .82rem; }
  .server-announcement { min-height: 44px; }
  .announcement-label { padding-inline: 12px; font-size: .7rem; }
  .announcement-track span { font-size: .76rem; }

  .portal-main > section {
    margin-top: clamp(28px, 5vw, 40px);
  }

  .portal-main > .quick-access-section {
    margin-bottom: 40px;
  }

  body.girlkun-bg .portal-main > .download-section {
    margin-top: 0;
    padding: 48px 0 64px !important;
  }

  .download-section .section-title {
    margin-bottom: 28px;
  }

  .download-section .download-grid {
    width: min(480px, 100%);
    grid-template-columns: 1fr;
  }

  .quick-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .download-card > p {
    min-height: 0;
  }
}

@media (max-width: 430px) {
  :root {
    --home-gutter: 12px;
    --home-space-section: 24px;
  }

  html {
    font-size: 16px;
  }

  .game-header .header-inner {
    width: calc(100% - 20px);
    gap: 8px;
  }

  .game-header .header-logo img {
    max-width: 100px;
  }

  .game-header .user-panel {
    min-width: 0;
    max-width: 145px;
    padding-inline: 7px;
  }

  .home-hero {
    width: calc(100% - 24px);
    height: clamp(330px, 95vw, 390px);
    background-position: 46% center !important;
    border-radius: 14px;
  }

  .home-hero-content { top: 5%; }
  .home-hero-actions { flex-wrap: wrap; }
  .announcement-label span { display: none; }

  .quick-access-card {
    padding: 24px 16px;
    border-radius: 16px;
  }

  .quick-access-grid {
    gap: 10px;
  }

  .quick-access-action {
    min-height: 56px;
    gap: 7px;
    padding: 10px 8px;
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  .home-hero {
    height: 350px;
  }

  .quick-access-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .game-header .user-panel {
    width: 48px;
    min-width: 48px;
    max-width: 48px;
    padding: 6px;
  }

  .game-header .user-panel-meta,
  .game-header .user-panel > .fa-chevron-down {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quick-access-action,
  .download-btns .btn-game {
    transition: none;
  }

  .announcement-track { padding-left: 16px; animation: none; }
}
