/* KGame – portal styles (root-level, no folders) */
:root {
  --ink: #0c2438;
  --ink-soft: #355066;
  --muted: #5a7388;
  --paper: #f3f7fb;
  --surface: #ffffff;
  --line: #d5e3ef;
  --brand: #1490d0;
  --brand-deep: #0b6fa8;
  --teal: #0d9b9b;
  --teal-deep: #087878;
  --sand: #e7f1f8;
  --nav: rgba(8, 32, 52, 0.92);
  --nav-solid: #082034;
  --ok: #1f8a5b;
  --warn: #c47a12;
  --radius: 14px;
  --shadow: 0 12px 36px rgba(12, 36, 56, 0.1);
  --max: 1120px;
  --header-h: 68px;
  --font-display: "Sora", "Be Vietnam Pro", sans-serif;
  --font-body: "Be Vietnam Pro", "Sora", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(20, 144, 208, 0.14), transparent 60%),
    radial-gradient(900px 420px at 90% 0%, rgba(13, 155, 155, 0.12), transparent 55%),
    linear-gradient(180deg, #eef5fa 0%, var(--paper) 38%, #eaf3f8 100%);
  line-height: 1.65;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--teal-deep);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  margin: 0 0 0.6em;
  color: var(--ink);
}

p {
  margin: 0 0 1em;
  color: var(--ink-soft);
}

ul,
ol {
  color: var(--ink-soft);
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 10000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Fixed header */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 1000;
  background: var(--nav);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  max-width: min(150px, 40vw);
  max-height: calc(var(--header-h) - 20px);
  overflow: hidden;
  text-decoration: none;
}

.brand-link img {
  height: 34px;
  width: auto;
  max-width: 100%;
  max-height: 34px;
  object-fit: contain;
  object-position: left center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 0.35rem;
}

.nav-desktop a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.nav-desktop a:hover,
.nav-desktop a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.header-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1.15rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--teal));
  color: #fff;
  box-shadow: 0 8px 20px rgba(20, 144, 208, 0.28);
}

.btn-primary:hover {
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--brand-deep);
  border: 1px solid var(--brand);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--nav-solid);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem 1.1rem;
  z-index: 999;
  animation: slideDown 0.22s ease;
}

.nav-mobile.open {
  display: block;
}

.nav-mobile a {
  display: block;
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 500;
}

.nav-mobile .mobile-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  padding-top: var(--header-h);
}

/* Hero */
.hero {
  position: relative;
  min-height: min(88vh, 720px);
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #fff;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 24, 40, 0.82) 0%, rgba(6, 24, 40, 0.55) 48%, rgba(6, 24, 40, 0.28) 100%),
    linear-gradient(180deg, rgba(6, 24, 40, 0.2) 0%, rgba(6, 24, 40, 0.75) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 4.5rem 0 3.5rem;
  max-width: 640px;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.55rem;
  color: #fff;
}

.hero h1 {
  color: #fff;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.05rem;
  max-width: 36rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

/* Sections */
.section {
  padding: 4rem 0;
}

.section-head {
  margin-bottom: 1.8rem;
  max-width: 40rem;
}

.section-head h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
}

.section-head p {
  margin: 0;
}

.section-alt {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(231, 241, 248, 0.8));
  border-block: 1px solid var(--line);
}

.prose {
  max-width: 720px;
}

.prose h2 {
  margin-top: 1.8rem;
}

.prose a.ext {
  font-weight: 600;
}

/* Category grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}

.cat-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  min-height: 160px;
  text-decoration: none;
  color: #fff;
  isolation: isolate;
  transform: translateZ(0);
  transition: transform 0.25s ease;
}

.cat-item:hover {
  transform: translateY(-3px);
}

.cat-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.cat-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 25%, rgba(6, 24, 40, 0.88) 100%);
  z-index: -1;
}

.cat-item span {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  right: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
}

/* Article cards */
.card-grid {
  display: grid;
  gap: 1.1rem;
}

.article-card {
  display: grid;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s;
}

.article-card:hover {
  transform: translateY(-3px);
}

.article-card .thumb {
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 10;
  background: var(--sand);
}

.article-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.article-card:hover .thumb img {
  transform: scale(1.04);
}

.article-card .meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.article-card h3 {
  font-size: 1.08rem;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.article-card p {
  margin: 0;
  font-size: 0.95rem;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 0.75rem;
  max-width: 780px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.2rem 1rem;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-display);
  padding: 0.95rem 0;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--brand);
  font-weight: 700;
}

.faq-item[open] summary::after {
  content: "–";
}

.faq-item p {
  margin-top: 0;
  padding-bottom: 0.95rem;
}

/* Page hero (inner) */
.page-hero {
  padding: 2.6rem 0 1.4rem;
  background:
    linear-gradient(120deg, rgba(20, 144, 208, 0.12), rgba(13, 155, 155, 0.08)),
    linear-gradient(180deg, #dff0f8, transparent);
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--brand-deep);
}

.page-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.45rem;
}

.page-hero .lead {
  max-width: 42rem;
  margin: 0;
}

/* Article layout */
.article-layout {
  display: grid;
  gap: 2rem;
  padding: 2.4rem 0 3.5rem;
}

.article-cover {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--sand);
  margin-bottom: 1.4rem;
}

.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-list {
  display: grid;
  gap: 0.9rem;
}

.related-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
  align-items: center;
}

.related-item img {
  width: 88px;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
}

.related-item h3 {
  font-size: 0.95rem;
  margin: 0;
}

/* About / legal */
.feature-row {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-block {
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
}

.feature-block h3 {
  margin-bottom: 0.4rem;
}

.split-visual {
  display: grid;
  gap: 1.5rem;
  align-items: center;
}

.split-visual img {
  border-radius: var(--radius);
  width: 100%;
}

/* Error pages */
.error-page {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  text-align: center;
  padding: 3rem 1rem;
}

.error-page .code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
  background: var(--nav-solid);
  color: rgba(255, 255, 255, 0.82);
  padding: 3rem 0 1.6rem;
  margin-top: 2rem;
}

.footer-grid {
  display: grid;
  gap: 1.6rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
}

.site-footer h3 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 0.7rem;
}

.footer-links {
  display: grid;
  gap: 0.45rem;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.55);
}

.footer-brand img {
  height: 34px;
  width: auto;
  margin-bottom: 0.7rem;
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s ease, transform 0.55s ease;
  }

  .reveal.in {
    opacity: 1;
    transform: none;
  }

  .hero-content {
    animation: heroIn 0.7s ease both;
  }
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Responsive */
@media (min-width: 640px) {
  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .menu-toggle {
    display: none;
  }

  .nav-desktop,
  .header-actions {
    display: flex;
  }

  .nav-mobile {
    display: none !important;
  }

  .cat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .article-layout {
    grid-template-columns: 1fr 300px;
  }

  .split-visual {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .feature-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .feature-block {
    border-top: 0;
    padding: 0;
  }
}

@media (max-width: 899px) {
  .header-actions {
    display: none;
  }
}
