:root {
  color-scheme: dark;
  --red: #d71920;
  --red-dark: #8f1118;
  --white: #fff7ed;
  --ink: #171312;
  --coal: #120d0c;
  --gold: #f7c948;
  --teal: #2dd4bf;
  --muted: rgba(255, 247, 237, 0.72);
  --line: rgba(255, 247, 237, 0.2);
  --panel: rgba(23, 19, 18, 0.72);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(247, 201, 72, 0.2), transparent 32rem),
    linear-gradient(145deg, #26080a 0%, #110e0d 46%, #221414 100%);
  color: var(--white);
  overflow-x: hidden;
}

#merdeka-gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgba(18, 13, 12, 0.65);
  backdrop-filter: blur(18px);
}

.brand,
nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border: 2px solid var(--white);
  background: linear-gradient(var(--red) 0 50%, var(--white) 50%);
  color: var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

nav a {
  min-width: 4.75rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
}

nav a[aria-current="page"],
nav a:hover {
  border-color: var(--line);
  color: var(--white);
  background: rgba(255, 247, 237, 0.08);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  min-height: calc(100vh - 4.7rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 25rem);
  align-items: end;
  gap: 2rem;
  padding: 8vh 0 10vh;
}

.hero-copy {
  max-width: 48rem;
}

.eyebrow {
  margin: 0 0 0.85rem;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.7rem;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.55rem;
  font-size: 1.1rem;
}

.hero p,
.games-hero p {
  max-width: 42rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.05rem;
  border-radius: 0.5rem;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary {
  background: var(--gold);
  color: var(--ink);
}

.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 247, 237, 0.1);
  color: var(--white);
}

.hero-panel,
.feature,
.game-card,
.play-area {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.hero-panel {
  padding: 1.25rem;
}

.panel-label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
}

.countdown {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--teal);
  font-weight: 900;
  font-size: 1.25rem;
}

.section {
  padding: 4rem 0 6rem;
}

.section-heading {
  margin-bottom: 1.5rem;
}

.feature-grid,
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.feature {
  min-height: 14rem;
  padding: 1.2rem;
}

.feature span {
  display: inline-flex;
  margin-bottom: 2rem;
  color: var(--gold);
  font-weight: 900;
}

.feature p,
.game-card p {
  color: var(--muted);
  line-height: 1.55;
}

.games-hero {
  padding: 4rem 0 2rem;
}

.game-grid {
  padding-bottom: 4rem;
}

.game-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 25rem;
  padding: 1rem;
  gap: 1rem;
}

.game-art {
  min-height: 12rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background-size: cover;
  background-position: center;
}

.sack-art {
  background:
    linear-gradient(90deg, rgba(255, 247, 237, 0.16) 1px, transparent 1px) 0 0 / 32px 32px,
    radial-gradient(circle at 70% 35%, var(--gold), transparent 5rem),
    linear-gradient(135deg, var(--red), #36110f 55%, #1f1714);
}

.flag-art {
  background:
    repeating-conic-gradient(from 0deg, var(--red) 0 12deg, var(--white) 12deg 24deg),
    radial-gradient(circle, transparent 0 38%, rgba(18, 13, 12, 0.76) 39%);
}

.quiz-art {
  background:
    linear-gradient(var(--red) 0 50%, var(--white) 50%),
    radial-gradient(circle at 30% 30%, var(--teal), transparent 4rem);
  background-blend-mode: multiply;
}

.game-modal {
  width: min(760px, calc(100% - 1rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #160f0e;
  color: var(--white);
  box-shadow: 0 2rem 8rem rgba(0, 0, 0, 0.45);
}

.game-modal::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 247, 237, 0.08);
  color: var(--white);
  font-size: 1.25rem;
}

.play-area {
  min-height: 24rem;
  padding: 1rem;
}

.game-canvas {
  display: block;
  width: 100%;
  max-width: 680px;
  aspect-ratio: 16 / 9;
  margin: 0 auto 1rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #201514;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
}

.hud strong {
  color: var(--white);
}

.quiz-options {
  display: grid;
  gap: 0.75rem;
}

.quiz-options button {
  justify-content: start;
  width: 100%;
}

.closed {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.closed-box {
  width: min(38rem, 100%);
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 820px) {
  .hero,
  .feature-grid,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: center;
    padding: 3rem 0 4rem;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  nav {
    width: 100%;
  }

  nav a {
    flex: 1;
  }

  .games-hero h1 {
    max-width: 9ch;
    font-size: clamp(2.2rem, 12vw, 2.85rem);
    line-height: 1;
  }

  .games-hero p {
    font-size: 1rem;
  }
}
