:root {
  --bg: #f7f3e8;
  --bg-alt: #fffdf7;
  --text: #1f2428;
  --brand: #1261a0;
  --brand-2: #ff5c35;
  --accent: #1d8f6e;
  --card: #ffffff;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans Thai", Tahoma, sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(16, 28, 40, 0.45), rgba(16, 28, 40, 0.45)),
    url("/assets/images/background.webp") center / cover no-repeat fixed,
    var(--bg);
  line-height: 1.6;
}

body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

a {
  color: var(--brand);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 241, 232, 0.98);
  border-bottom: 1px solid #cfc7b6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
}

.header-inner,
.container,
.footer-inner {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 0;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.logo img {
  width: 180px;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
}

nav a {
  text-decoration: none;
  font-weight: 600;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
}

nav a:hover,
nav a[aria-current="page"] {
  background: #e7f1fb;
}

main {
  padding: 1.2rem 0 2.8rem;
}

.breadcrumbs {
  font-size: 0.92rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #d6cfbf;
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  color: #253546;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.breadcrumbs li::after {
  content: ">";
  margin-left: 0.4rem;
  color: #5c6670;
}

.breadcrumbs li:last-child::after {
  content: "";
}

.breadcrumbs a {
  color: #0f4f84;
  font-weight: 600;
}

.hero,
.panel,
.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.hero h1 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.banner {
  margin-top: 1rem;
  position: relative;
  overflow: hidden;
}

.video-feature {
  margin-top: 1rem;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-credit {
  margin: 0.65rem 0 0;
  font-weight: 700;
  color: #3b4754;
}

.cta-art {
  margin-top: 1rem;
  background:
    linear-gradient(120deg, rgba(7, 35, 65, 0.9), rgba(29, 143, 110, 0.85)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 18px, rgba(255, 255, 255, 0) 18px 36px);
  color: #fff;
}

.cta-art-inner {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.35rem;
}

.cta-kicker {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #dffaf2;
}

.cta-art h2 {
  margin: 0;
}

.cta-art p {
  margin: 0;
}

.play-now-btn {
  margin-top: 0.5rem;
  display: inline-block;
  width: fit-content;
  padding: 0.56rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, #ff7a3f, #ff4f52);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.banner-track {
  display: flex;
  transition: transform 0.45s ease;
}

.banner-item {
  min-width: 100%;
  padding: 1rem;
  border-radius: 12px;
  background: linear-gradient(120deg, #22456f, #1d8f6e);
  color: #fff;
}

.banner-controls {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.banner-controls button {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 0;
  background: #b8c0c8;
}

.banner-controls button.active {
  background: var(--brand-2);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.card h2,
.card h3 {
  margin-top: 0.5rem;
}

.share-rail {
  position: fixed;
  right: 24px;
  top: 35%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.share-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.share-btn img {
  width: 28px;
  height: 28px;
}

.game-wrap {
  display: grid;
  gap: 1rem;
}

.game-ui {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.8rem;
  justify-items: center;
}

.game-ui > .panel {
  width: min(100%, 840px);
  margin-inline: auto;
  text-align: center;
}

canvas#tetris {
  width: min(100%, 840px);
  border-radius: 12px;
  border: 3px solid #253546;
  background: #000;
  image-rendering: pixelated;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.game-controls button {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
}

.site-footer {
  border-top: 1px solid #ddd;
  background: var(--bg-alt);
}

.footer-inner {
  padding: 1rem 0;
  text-align: center;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.footer-links a {
  text-decoration: none;
}

.footer-copyright {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: #5c6670;
}

/* Guides page readability polish (scoped to /guides only) */
body.guide-page .guide-content {
  --guide-muted-bg: #f6f9fc;
  --guide-border: #d7dee8;
  --guide-header-bg: #eaf2fb;
  --guide-row-alt: #fbfdff;
}

body.guide-page .guide-content h1 {
  margin: 0 0 1rem;
  line-height: 1.25;
}

body.guide-page .guide-content h2 {
  margin: 2.35rem 0 0.75rem;
  padding-top: 0.9rem;
  font-size: 1.45rem;
  line-height: 1.3;
  border-top: 1px solid #dbe4ef;
  color: #17324d;
}

body.guide-page .guide-content h1 + h2 {
  margin-top: 1.25rem;
  padding-top: 0;
  border-top: 0;
}

body.guide-page .guide-content h3 {
  margin: 1.25rem 0 0.55rem;
  font-size: 1.12rem;
  line-height: 1.35;
}

body.guide-page .guide-content h4 {
  margin: 1rem 0 0.4rem;
  font-size: 1.02rem;
  line-height: 1.35;
  color: #213041;
}

body.guide-page .guide-content p {
  margin: 0.5rem 0 0.9rem;
}

body.guide-page .guide-content p + ul,
body.guide-page .guide-content p + ol {
  margin-top: -0.15rem;
}

body.guide-page .guide-content ul,
body.guide-page .guide-content ol {
  margin: 0.25rem 0 1rem;
  padding-left: 1.35rem;
}

body.guide-page .guide-content li {
  margin: 0.2rem 0;
  padding-left: 0.15rem;
}

body.guide-page .guide-content li::marker {
  color: var(--accent);
  font-weight: 700;
}

body.guide-page .guide-content .guide-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0.7rem 0 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(13, 35, 57, 0.05);
}

body.guide-page .guide-content table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

body.guide-page .guide-content th,
body.guide-page .guide-content td {
  padding: 0.62rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--guide-border);
}

body.guide-page .guide-content th {
  background: var(--guide-header-bg);
  color: #1f3042;
  font-weight: 700;
}

body.guide-page .guide-content tbody tr:nth-child(even) {
  background: var(--guide-row-alt);
}

body.guide-page .guide-content tbody tr:hover {
  background: var(--guide-muted-bg);
}

body.guide-page .guide-content tbody tr:last-child td {
  border-bottom: 0;
}

body.guide-page .guide-content .guide-video-panel {
  margin-top: 1.4rem;
  padding: 0.8rem;
  background: linear-gradient(180deg, #f8fbff, #edf4fb);
  border: 1px solid #d8e4f1;
}

body.guide-page .guide-content .guide-video-panel .video-embed {
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(13, 35, 57, 0.18);
}

@media (max-width: 820px) {
  .share-rail {
    position: fixed;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 8px;
    top: auto;
    flex-direction: row;
    background: rgba(21, 30, 41, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.25rem 0.3rem;
  }

  .header-inner {
    flex-direction: column;
    gap: 0.6rem;
  }

  body.guide-page .guide-content {
    padding: 1rem;
  }

  body.guide-page .guide-content h2 {
    font-size: 1.24rem;
    margin-top: 1.9rem;
    padding-top: 0.7rem;
  }

  body.guide-page .guide-content h1 + h2 {
    margin-top: 1rem;
    padding-top: 0;
  }

  body.guide-page .guide-content h3 {
    font-size: 1.03rem;
  }

  body.guide-page .guide-content th,
  body.guide-page .guide-content td {
    padding: 0.55rem 0.65rem;
    font-size: 0.95rem;
  }

  body.guide-page .guide-content table {
    min-width: 440px;
  }
}
