:root {
  color-scheme: light;
  --ink: #111214;
  --ink-soft: #2d3135;
  --muted: #757b83;
  --paper: #f6f4ee;
  --panel: #ffffff;
  --line: #e1ded6;
  --line-strong: #cfc9bd;
  --gold: #f5c400;
  --gold-soft: #fff4b8;
  --teal: #164c49;
  --coral: #c85c3e;
  --shadow: 0 24px 70px rgba(18, 18, 20, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", "Segoe UI", "Noto Sans Thai", Tahoma, sans-serif;
  line-height: 1.55;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.app-header {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(245, 196, 0, 0.18), rgba(245, 196, 0, 0) 34%),
    linear-gradient(180deg, #0c0d0e, #161719);
}

.topbar,
.hero,
main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 82px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.brand-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  letter-spacing: 0;
}

.brand-lockup strong {
  font-size: 1.05rem;
  line-height: 1;
}

.brand-lockup small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.78rem;
  font-weight: 700;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  align-items: center;
  gap: 44px;
  min-height: 430px;
  padding: 36px 0 76px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(3rem, 8vw, 7rem);
  line-height: 0.88;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 2.8vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.26;
  letter-spacing: 0;
}

.hero-text {
  max-width: 620px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: clamp(1rem, 2vw, 1.18rem);
  font-weight: 650;
}

.hero-visual {
  display: grid;
  place-items: center;
  min-height: 300px;
}

.hero-visual img {
  width: min(320px, 72vw);
  filter: drop-shadow(0 32px 40px rgba(0, 0, 0, 0.36));
  animation: logoFloat 6s ease-in-out infinite;
}

main {
  padding: 36px 0 64px;
}

.recommend-section {
  margin-top: -70px;
}

.menu-shell {
  margin-top: 30px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section-note {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.carousel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.carousel-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(18, 18, 20, 0.08);
  font-size: 1.6rem;
  line-height: 1;
}

.carousel-button:disabled {
  cursor: default;
  opacity: 0.36;
}

.recommend-carousel {
  position: relative;
  overflow: hidden;
}

.recommend-carousel::before,
.recommend-carousel::after {
  position: absolute;
  top: 0;
  bottom: 10px;
  z-index: 2;
  width: 84px;
  content: "";
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.recommend-carousel::before {
  left: 0;
  background: linear-gradient(90deg, var(--paper), rgba(246, 244, 238, 0));
}

.recommend-carousel::after {
  right: 0;
  background: linear-gradient(270deg, var(--paper), rgba(246, 244, 238, 0));
}

.recommend-carousel.can-scroll-left::before,
.recommend-carousel.can-scroll-right::after {
  opacity: 1;
}

.recommend-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 372px);
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 14px;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.recommend-track::-webkit-scrollbar {
  display: none;
}

.recommend-card {
  position: relative;
  min-height: 284px;
  overflow: hidden;
  border-radius: 8px;
  background: #191a1c;
  box-shadow: var(--shadow);
  isolation: isolate;
  scroll-snap-align: start;
}

.recommend-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.96) contrast(1.04);
  transform: scale(1.02);
  z-index: -2;
}

.recommend-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(12, 13, 14, 0.04), rgba(12, 13, 14, 0.88)),
    linear-gradient(90deg, rgba(12, 13, 14, 0.5), rgba(12, 13, 14, 0));
  z-index: -1;
}

.recommend-content {
  display: flex;
  min-height: 284px;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: 22px;
  color: #fff;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge,
.floor-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.1;
}

.badge {
  color: #141414;
  background: var(--gold);
}

.floor-pill {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.recommend-content h3 {
  font-size: 1.45rem;
}

.recommend-meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 780;
}

.menu-shell {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 60px rgba(18, 18, 20, 0.08);
  backdrop-filter: blur(14px);
}

.menu-heading {
  margin-bottom: 18px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(280px, 1.1fr);
  gap: 14px;
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.floor-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  min-height: 50px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #efede7;
}

.floor-tab {
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.floor-tab.is-active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 22px rgba(17, 18, 20, 0.2);
}

.search-box,
.player-filter {
  display: grid;
  gap: 7px;
}

.player-filter {
  grid-column: 1 / -1;
}

.search-box span,
.player-filter > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.search-box input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.player-chip {
  min-width: 48px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: #fff;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(18, 18, 20, 0.04);
}

.player-chip.is-active {
  border-color: var(--gold);
  color: #141414;
  background: var(--gold);
  box-shadow: 0 12px 26px rgba(245, 196, 0, 0.28);
}

.search-box input:focus,
.floor-tab:focus-visible,
.player-chip:focus-visible,
.carousel-button:focus-visible,
.card-action:focus-visible,
.dialog-close:focus-visible,
.nav-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(245, 196, 0, 0.28);
}

.game-sections {
  display: grid;
  gap: 28px;
  margin-top: 24px;
}

.floor-section {
  display: grid;
  gap: 14px;
}

.floor-section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.floor-section-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 850;
  text-align: right;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 16px;
}

.game-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(225, 222, 214, 0.88);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(18, 18, 20, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.game-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 24px 58px rgba(18, 18, 20, 0.12);
  transform: translateY(-3px);
}

.game-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #dedbd1;
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 240ms ease;
}

.game-card:hover .game-cover img {
  transform: scale(1.035);
}

.game-cover .floor-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 18, 20, 0.72);
  font-size: 0.74rem;
  font-weight: 900;
}

.game-body {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.game-title-line {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.game-title-line h3 {
  font-size: 1.08rem;
}

.type-tag {
  flex: 0 0 auto;
  max-width: 124px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--teal);
  background: rgba(22, 76, 73, 0.1);
  font-size: 0.74rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.game-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fact {
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(225, 222, 214, 0.72);
  border-radius: 8px;
  background: #f8f7f3;
}

.fact small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.fact strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
  line-height: 1.25;
}

.skill-text {
  margin: 0;
  color: var(--teal);
  font-weight: 900;
}

.description {
  display: -webkit-box;
  min-height: 4.7em;
  margin: 0;
  overflow: hidden;
  color: #51565c;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.card-action {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #141414;
  background: var(--gold);
  font-weight: 900;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  text-align: center;
  font-weight: 800;
}

.game-dialog {
  width: min(860px, calc(100% - 32px));
  max-height: min(780px, calc(100% - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.36);
}

.game-dialog[open] {
  animation: dialogIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.game-dialog.is-closing {
  animation: dialogOut 160ms ease both;
}

.game-dialog::backdrop {
  background: rgba(10, 10, 11, 0.68);
}

.game-dialog[open]::backdrop {
  animation: backdropIn 220ms ease both;
}

.game-dialog.is-closing::backdrop {
  animation: backdropOut 160ms ease both;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 18, 20, 0.72);
  font-size: 1.45rem;
  line-height: 1;
}

.dialog-hero {
  position: relative;
  min-height: 310px;
  color: #fff;
  background: #161719;
}

.dialog-hero img {
  width: 100%;
  height: 340px;
  object-fit: cover;
  display: block;
  filter: brightness(0.78) saturate(1.02);
}

.dialog-hero-text {
  position: absolute;
  inset: auto 0 0;
  padding: 24px;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 11, 0.92));
}

.dialog-hero-text h2 {
  max-width: calc(100% - 54px);
  margin-top: 10px;
}

.dialog-body {
  display: grid;
  gap: 16px;
  padding: 22px 24px 26px;
  background: #fff;
}

.dialog-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.dialog-body p {
  margin: 0;
}

.loading {
  padding: 26px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialogOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdropOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

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

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    min-height: 0;
    padding-bottom: 96px;
  }

  .hero-visual {
    min-height: 180px;
  }

  .hero-visual img {
    width: min(220px, 62vw);
  }

  .section-heading,
  .floor-section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .carousel-actions {
    justify-content: flex-start;
  }

  .section-note,
  .floor-section-header p {
    text-align: left;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .hero,
  main {
    width: min(100% - 20px, 1180px);
  }

  .topbar {
    min-height: 74px;
  }

  .nav-link {
    display: none;
  }

  h1 {
    font-size: clamp(2.65rem, 18vw, 4.4rem);
  }

  .recommend-track {
    grid-auto-columns: minmax(238px, 84vw);
  }

  .recommend-carousel::before,
  .recommend-carousel::after {
    width: 46px;
  }

  .menu-shell {
    padding: 14px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .dialog-facts,
  .game-facts {
    grid-template-columns: 1fr;
  }
}
