:root {
  --header: #102D4D;
  --header-deep: #0a2340;
  --accent: #1e6bb8;
  --accent-soft: #3a8fd4;
  --join: #e11d48;
  --join-hover: #be123c;
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1e293b;
  --muted: #64748b;
  --site: min(1100px, 100%);
  --layout: min(1580px, 100%);
  --content: 1100px;
  --side: 460px;
  --pad: clamp(14px, 3vw, 24px);
  --font: "Noto Sans Thai", "Manrope", "Segoe UI", sans-serif;
  --display: "Sora", "Manrope", sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  min-height: 100vh;
  padding-bottom: 72px;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; }

.wrap {
  margin: 0 auto;
  max-width: var(--site);
  padding: 0 var(--pad);
  width: 100%;
}

/* Header */
.site-header {
  background: var(--header);
  box-shadow: 0 4px 18px rgba(16, 45, 77, 0.28);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto;
  max-width: var(--layout);
  min-height: 68px;
  padding: 10px var(--pad);
  width: 100%;
}

.brand {
  align-items: center;
  display: inline-flex;
  flex-shrink: 0;
  margin-left: 0;
}

.brand-logo {
  height: 48px;
  object-fit: contain;
  object-position: left center;
  width: 48px;
}

.header-nav {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 4px;
  justify-content: center;
}

.header-nav a {
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 12px;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav a.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.auth-btns {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}

.btn {
  align-items: center;
  border: 0;
  border-radius: 10px;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  justify-content: center;
  letter-spacing: 0.01em;
  line-height: 1;
  min-height: 44px;
  padding: 0 28px;
  transition: transform 0.15s, background 0.2s, filter 0.2s;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }

.btn-login {
  background: #ffffff;
  color: var(--header);
}

.btn-login:hover { filter: brightness(0.96); }

.btn-join {
  background: #e91e43;
  color: #ffffff;
  min-width: 118px;
}

.btn-join:hover { background: #d01238; }

.menu-toggle {
  background: transparent;
  border: 0;
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.menu-toggle span {
  background: #ffffff;
  border-radius: 2px;
  display: block;
  height: 2px;
  width: 22px;
}

/* Unified main width — banner, buttons, sports, content */
.site-main {
  margin: 0 auto;
  max-width: var(--layout);
  padding: 0 var(--pad);
  width: 100%;
}

/* Banner */
.banner {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.banner-inner {
  margin: 0;
  max-width: none;
  overflow: hidden;
  padding: 0;
  width: 100%;
}

.banner a,
.banner img {
  border-radius: 0;
  display: block;
  width: 100%;
}

.banner img {
  height: auto;
  max-height: none;
  object-fit: cover;
}

/* Main layout — auth, cats, article + side banner aligned */
.page-with-side {
  align-items: start;
  box-sizing: border-box;
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) var(--side);
  margin: 0;
  max-width: none;
  padding: 0;
  width: 100%;
}

.auth-strip {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-row: 1;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  max-width: none;
  padding: 12px 0 8px;
  width: 100%;
}

.auth-strip .btn {
  min-height: 46px;
  width: 100%;
}

.auth-strip .btn-login {
  background: var(--header);
  color: #ffffff;
}

.cats {
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: repeat(6, 1fr);
  margin: 0 0 8px;
  max-width: none;
  padding: 0;
  width: 100%;
}

.page-with-side .section {
  grid-column: 1;
  grid-row: 3;
  margin: 0;
  max-width: none;
  min-width: 0;
  padding: 28px 0 40px;
  width: 100%;
}

.side-banner {
  align-self: start;
  background: #f1f5f9;
  border: 1px dashed var(--border);
  grid-column: 2;
  grid-row: 3;
  position: sticky;
  top: 84px;
  width: 460px;
}

.side-banner a {
  display: block;
  overflow: hidden;
  width: 460px;
}

.side-banner img {
  background: #ffffff;
  display: block;
  height: 1200px;
  max-width: none !important;
  object-fit: cover;
  width: 460px !important;
}

/* Categories */
.cat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.cat-card:hover {
  border-color: rgba(16, 45, 77, 0.35);
  box-shadow: 0 8px 24px rgba(16, 45, 77, 0.1);
  transform: translateY(-2px);
}

.cat-card img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}

.cat-card span {
  color: var(--header);
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 12px 12px;
  text-align: center;
}

/* Article */
.section {
  margin: 0 auto;
  max-width: var(--site);
  padding: 28px var(--pad) 40px;
  width: 100%;
}

.article h1,
.article h2,
.article h3 {
  color: var(--header);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.3;
}

.article h1 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  margin-bottom: 16px;
  text-align: center;
}

.article h2 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  margin: 28px 0 12px;
}

.article h3 {
  font-size: 1.02rem;
  margin: 20px 0 8px;
}

.article p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 12px;
}

.article a.brand-link,
.article a.brand-link strong {
  color: var(--header);
  font-weight: 800;
  text-decoration: none;
}

.article a.brand-link:hover,
.article a.brand-link:hover strong {
  color: var(--header-deep);
  text-decoration: underline;
}

.article a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.article a:hover {
  color: var(--header);
  text-decoration: underline;
}

.article a strong {
  color: var(--header);
  font-weight: 800;
}

.article ul {
  color: var(--muted);
  margin: 0 0 14px 18px;
}

.article li {
  list-style: disc;
  margin-bottom: 6px;
}

/* Footer */
.site-footer {
  background: var(--header);
  color: rgba(255, 255, 255, 0.85);
  margin-top: 20px;
  padding: 28px 0 24px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  margin: 0 auto 16px;
  max-width: var(--site);
  padding: 0 var(--pad);
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
  font-weight: 600;
}

.footer-nav a:hover { color: #ffffff; }

.footer-copy {
  font-size: 0.82rem;
  opacity: 0.75;
  padding: 0 var(--pad);
  text-align: center;
}

.footer-copy strong { color: #ffffff; }

/* Sticky bar */
.sticky-cta {
  background: var(--header);
  bottom: 0;
  box-shadow: 0 -6px 20px rgba(16, 45, 77, 0.25);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  left: 0;
  position: fixed;
  right: 0;
  z-index: 90;
}

.sticky-cta a {
  align-items: center;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 2px;
  justify-content: center;
  min-height: 60px;
  padding: 6px 4px;
  text-align: center;
}

.sticky-cta a:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.sticky-cta .ico {
  font-size: 1.1rem;
  line-height: 1;
}

/* Sub pages */
.sub-page {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 24px auto;
  max-width: var(--site);
  padding: clamp(20px, 3vw, 32px);
  width: calc(100% - 2 * var(--pad));
}

.sub-page h1 {
  color: var(--header);
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  margin-bottom: 14px;
  text-align: center;
}

.sub-page h2 {
  color: var(--header);
  font-family: var(--display);
  font-size: 1.1rem;
  margin: 22px 0 10px;
}

.sub-page p,
.sub-page li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 10px;
}

.sub-page ul { margin-left: 18px; }
.sub-page li { list-style: disc; }

.sub-page a {
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 900px) {
  .header-nav {
    background: var(--header-deep);
    display: none;
    flex-direction: column;
    left: 0;
    padding: 10px 12px 14px;
    position: absolute;
    right: 0;
    top: 68px;
  }

  .header-nav.open { display: flex; }

  .menu-toggle { display: flex; }

  .auth-btns { display: none; }

  .header-inner {
    min-height: 56px;
    padding: 8px var(--pad);
  }

  .page-with-side {
    grid-template-columns: 1fr;
  }

  .site-main {
    max-width: var(--site);
  }

  .auth-strip,
  .cats,
  .page-with-side .section,
  .side-banner {
    grid-column: 1;
    grid-row: auto;
  }

  .auth-strip {
    gap: 8px;
    padding: 10px 0 6px;
  }

  .auth-strip .btn {
    font-size: 14px;
    min-height: 44px;
    padding: 0 16px;
  }

  .cats {
    gap: 10px;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 4px;
  }

  .cat-card span {
    font-size: 0.82rem;
    padding: 8px 6px 10px;
  }

  .page-with-side .section {
    padding-bottom: 24px;
    padding-top: 16px;
  }

  .side-banner {
    justify-self: center;
    position: static;
    width: 100%;
  }

  .side-banner a,
  .side-banner img {
    height: auto;
    max-width: 100% !important;
    width: min(460px, 100%) !important;
  }
}

@media (max-width: 640px) {
  .cats {
    grid-template-columns: repeat(2, 1fr);
  }

  .article h1 {
    font-size: 1.2rem;
  }

  .section {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 560px) {
  .auth-strip .btn {
    font-size: 13px;
    min-height: 42px;
  }

  .brand-logo {
    height: 40px;
    width: 40px;
  }

  .sticky-cta a {
    font-size: 0.62rem;
    min-height: 56px;
    padding: 4px 2px;
  }

  .sticky-cta .ico { font-size: 1rem; }

  .cat-card span {
    font-size: 0.78rem;
    padding: 7px 4px 9px;
  }
}
