:root {
  --gold: #a67c00;
  --gold2: #d4a017;
  --gold3: #5c4300;
  --ink: #2a1c05;
  --muted: #6b5420;
  --card: #fff8dc;
  --line: rgba(166, 124, 0, 0.4);
  --ok: #2db34a;
  --btn: linear-gradient(180deg, #ffe9a8 0%, #e0a820 55%, #b8860b 100%);
  --btn2: linear-gradient(180deg, #fff3c4 0%, #f0c75e 50%, #c9971a 100%);
  --radius: 12px;
  --gap: 6px;
  --shell: 1040px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "Noto Sans Khmer", "Leelawadee UI", "Segoe UI", sans-serif;
  background: url("./tm95-bg.jpg?v=31") 50% 0% / cover no-repeat fixed;
  background-color: #e8c45a;
}
a { color: var(--gold); text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
i { font-style: normal; }

/* very light veil — do not cover carved theme */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 252, 235, 0.18) 0%, transparent 28%, transparent 58%, rgba(255, 244, 200, 0.16) 100%);
}

/* floating sparkles & coins */
.fx {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #fff8dc 0%, #ffd76a 35%, transparent 70%);
  border-radius: 50%;
  opacity: 0.75;
  animation: twinkle 3.6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(255, 220, 120, 0.8));
}
.spark::after {
  content: "";
  position: absolute;
  inset: -4px;
  background:
    linear-gradient(#ffefb0, #ffefb0) center / 2px 100% no-repeat,
    linear-gradient(#ffefb0, #ffefb0) center / 100% 2px no-repeat;
  opacity: 0.85;
}
.s1 { left: 8%; top: 18%; animation-delay: 0s; }
.s2 { left: 18%; top: 72%; animation-delay: 0.8s; width: 7px; height: 7px; }
.s3 { right: 10%; top: 22%; animation-delay: 1.2s; }
.s4 { right: 16%; top: 68%; animation-delay: 1.8s; width: 8px; height: 8px; }
.s5 { left: 46%; top: 8%; animation-delay: 0.4s; width: 6px; height: 6px; }
.s6 { left: 52%; bottom: 12%; animation-delay: 2.2s; width: 7px; height: 7px; }

.coin {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff3c4 0%, #f0c75e 40%, #b8860b 78%, #7a5a08 100%);
  box-shadow:
    inset 0 0 0 2px rgba(166, 124, 0, 0.45),
    0 6px 12px rgba(90, 55, 0, 0.28);
  opacity: 0.72;
  animation: floatCoin 9s ease-in-out infinite;
}
.coin::before {
  content: "$";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #5c4300;
  font-family: Georgia, serif;
}
.c1 { left: 4%; top: 30%; animation-delay: 0s; }
.c2 { left: 11%; top: 58%; width: 20px; height: 20px; animation-delay: 1.4s; }
.c3 { right: 5%; top: 34%; animation-delay: 0.6s; }
.c4 { right: 12%; top: 55%; width: 22px; height: 22px; animation-delay: 2s; }
.c5 { left: 22%; bottom: 8%; width: 18px; height: 18px; animation-delay: 2.8s; }

@keyframes twinkle {
  0%, 100% { transform: scale(0.7); opacity: 0.35; }
  50% { transform: scale(1.15); opacity: 0.95; }
}
@keyframes floatCoin {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-18px) rotate(18deg); }
}

.shell {
  position: relative;
  z-index: 5;
  width: min(var(--shell), calc(100% - 24px));
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  padding: 8px 0 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
}

.hero-space {
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: none;
}

.main {
  position: relative;
  z-index: 2;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  flex: 0 0 auto;
}

.block {
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.welcome {
  margin: 0;
  padding: 8px 12px;
  text-align: center;
  color: var(--gold3);
  font-size: clamp(12px, 1.5vw, 14px);
  line-height: 1.4;
  background: rgba(255, 248, 220, 0.55);
  flex: 0 0 auto;
  border: 0;
  border-radius: 12px;
}

.menu-box {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  background: transparent;
  overflow: visible;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
}
.menu {
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(166, 124, 0, 0.35);
  border-radius: 16px;
  min-height: 78px;
  padding: 16px 12px;
  color: #1a1408;
  font-weight: 700;
  font-size: clamp(13px, 1.45vw, 15px);
  font-family: inherit;
  background: var(--btn2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 4px 10px rgba(120, 80, 10, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  line-height: 1.25;
  overflow: visible;
  isolation: isolate;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    color 0.22s ease,
    filter 0.22s ease;
}
.menu::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 229, 255, 0.15) 30%,
    rgba(255, 80, 180, 0.55) 48%,
    rgba(120, 255, 180, 0.5) 58%,
    rgba(0, 229, 255, 0.15) 70%,
    transparent 100%
  );
  transform: skewX(-18deg) translateX(0);
  opacity: 0;
  transition: transform 0.55s ease, opacity 0.2s ease;
  pointer-events: none;
  z-index: 0;
}
.menu::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0 rgba(0, 229, 255, 0);
  transition: box-shadow 0.22s ease;
  pointer-events: none;
  z-index: 0;
}
.menu > img,
.menu > span {
  position: relative;
  z-index: 1;
}
.menu:hover,
.menu:focus-visible {
  transform: translateY(-4px) scale(1.03);
  color: #0a3d4a;
  border-color: rgba(0, 210, 255, 0.9);
  filter: brightness(1.06) saturate(1.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(255, 70, 170, 0.4),
    0 10px 24px rgba(0, 160, 200, 0.35),
    0 0 30px rgba(0, 229, 255, 0.55),
    0 0 18px rgba(255, 80, 180, 0.35);
  outline: none;
}
.menu:hover::before,
.menu:focus-visible::before {
  opacity: 1;
  transform: skewX(-18deg) translateX(320%);
}
.menu:hover::after,
.menu:focus-visible::after {
  box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.35);
}
.menu:active {
  transform: translateY(-1px) scale(0.99);
  filter: brightness(1.02);
}
.menu img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  filter: brightness(0.2) sepia(1) hue-rotate(5deg) saturate(4);
  transition: transform 0.22s ease, filter 0.22s ease;
}
.menu:hover img,
.menu:focus-visible img {
  transform: scale(1.15) rotate(-6deg);
  filter: brightness(0.9) sepia(0.4) hue-rotate(140deg) saturate(4);
}
.menu > span { min-width: 0; }

/* each button a different hover accent */
#menu01:hover,
#menu01:focus-visible {
  border-color: rgba(0, 210, 255, 0.95);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(0, 229, 255, 0.45),
    0 10px 24px rgba(0, 160, 200, 0.4),
    0 0 28px rgba(0, 229, 255, 0.6);
}
#menu02:hover,
#menu02:focus-visible {
  border-color: rgba(255, 70, 170, 0.95);
  color: #5a1040;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(255, 80, 180, 0.45),
    0 10px 24px rgba(200, 40, 120, 0.35),
    0 0 28px rgba(255, 80, 180, 0.55);
}
#menu03:hover,
#menu03:focus-visible {
  border-color: rgba(80, 255, 160, 0.95);
  color: #0d4a2e;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(80, 255, 160, 0.45),
    0 10px 24px rgba(20, 160, 90, 0.35),
    0 0 28px rgba(80, 255, 160, 0.55);
}
#menu04:hover,
#menu04:focus-visible {
  border-color: rgba(170, 120, 255, 0.95);
  color: #2a1858;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 2px rgba(170, 120, 255, 0.45),
    0 10px 24px rgba(100, 60, 200, 0.35),
    0 0 28px rgba(170, 120, 255, 0.55);
}

.pop {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(420px, 78vw);
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffaf0;
  color: var(--ink);
  box-shadow: 0 14px 32px rgba(120, 80, 10, 0.25);
  z-index: 40;
  text-align: left;
  font-weight: 400;
}
.pop-wide { width: min(520px, 86vw); }
#menu01 .pop { left: 0; transform: none; }
#menu04 .pop { left: auto; right: 0; transform: none; }
.menu:hover .pop,
.menu.active .pop { display: block; }
.pop h3 {
  margin: 0 0 10px;
  color: var(--gold3);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.45;
}
.web-row {
  display: grid;
  grid-template-columns: 64px 18px minmax(0, 1fr) 56px;
  gap: 4px;
  align-items: stretch;
  margin-bottom: 7px;
}
.ms, .site, .enter {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ms {
  border: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
  gap: 4px;
  font-size: 12px;
  color: var(--gold3);
  background: #fff8dc;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.arrow {
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.site {
  border: 1px solid var(--line);
  padding: 0 6px;
  font-size: 11px;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #fff;
}
.enter {
  border-radius: 0 8px 8px 0;
  color: #1a1408;
  font-weight: 700;
  background: var(--btn);
  font-size: 13px;
}
.enter:hover { filter: brightness(1.08); }
.link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.link-grid a {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  color: #1a1408;
  font-weight: 700;
  background: var(--btn);
  font-size: 13px;
}

.jackpot {
  padding: 10px 12px 12px;
  text-align: center;
  flex: 0 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 248, 220, 0.55);
}
.jackpot-label {
  color: var(--gold3);
  font-size: 13px;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
  font-weight: 700;
}
.jackpot-num {
  margin-top: 8px;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 800;
  color: #5c4300;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.winners {
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  background: #fffaf0;
  height: min(16vh, 130px);
  max-height: 130px;
  overflow: hidden;
  flex: 0 0 auto;
}
.marquee {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  animation: rise 48s linear infinite;
}
.winners:hover .marquee { animation-play-state: paused; }
@keyframes rise {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 6px;
  border-radius: 10px;
  background: rgba(240, 199, 94, 0.12);
}
.item img {
  width: 36px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.meta { min-width: 0; flex: 1; }
.meta .t {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta .d { font-size: 11px; color: var(--muted); }
.meta .a {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}
.meta .a b { color: var(--gold); }

.footer {
  width: 100%;
  margin: 0;
  text-align: center;
  color: #5c4300;
  font-size: 12px;
  padding: 2px 0 0;
  flex: 0 0 auto;
  text-shadow: 0 1px 0 rgba(255, 248, 220, 0.6);
}
.home-btn {
  display: none;
  width: 100%;
  margin: 0;
  text-align: center;
  padding: 14px 16px;
  border-radius: 999px;
  color: #1a1408;
  font-weight: 800;
  background: var(--btn2);
  border: 1px solid var(--line);
}

@media (max-height: 820px) {
  .winners { height: min(14vh, 110px); max-height: 110px; }
  .jackpot-num { font-size: clamp(18px, 3.2vw, 26px); }
  .menu { min-height: 68px; }
}
@media (max-height: 700px) {
  .winners { height: 88px; max-height: 88px; }
  .menu { min-height: 60px; padding: 10px 8px; }
}
@media (max-width: 1100px) {
  :root { --shell: 920px; }
  .menu { font-size: 13px; min-height: 70px; padding: 12px 8px; }
}
@media (max-width: 920px) {
  .coin, .spark { opacity: 0.45; }
  :root { --shell: 100%; }
}
@media (max-width: 820px) {
  html, body {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    background-color: #e8c45a;
    background-image: none;
  }
  .stage {
    display: block;
    background:
      linear-gradient(180deg, rgba(255, 252, 235, 0.12) 0%, transparent 28%, transparent 58%, rgba(255, 244, 200, 0.2) 100%),
      url("./tm95-bg.jpg?v=31") 50% 0% / cover no-repeat;
    background-color: #e8c45a;
  }
  .fx { display: block; opacity: 0.75; }
  .shell {
    width: min(640px, calc(100% - 12px));
    height: 100dvh;
    max-height: 100dvh;
    padding: 6px 0 10px;
    justify-content: flex-end;
  }
  .hero-space {
    display: block;
    flex: 1 1 auto;
    min-height: 40dvh;
  }
  .main {
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 8px;
  }
  .menu-box {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .menu {
    min-height: 62px;
    font-size: clamp(10px, 2.8vw, 12px);
    padding: 8px 4px;
    flex-direction: column;
    gap: 4px;
  }
  .menu img { width: 16px; height: 16px; }
  .pop {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    width: min(92vw, 420px);
    margin-top: 0;
    display: none;
    z-index: 50;
  }
  #menu01 .pop { left: 0; transform: none; }
  #menu04 .pop { left: auto; right: 0; transform: none; }
  .menu:hover .pop { display: none; }
  .menu.active .pop { display: block; }
  .menu.active {
    transform: translateY(-3px) scale(1.02);
  }
  .jackpot {
    padding: 10px 12px 12px;
    background: rgba(255, 248, 220, 0.55);
  }
  .jackpot-label { font-size: 13px; }
  .jackpot-num {
    margin-top: 8px;
    font-size: clamp(20px, 5.5vw, 30px);
  }
  .winners {
    margin-top: 6px;
    height: min(15dvh, 120px);
    max-height: 120px;
  }
  .home-btn { display: none; }
  .row { grid-template-columns: 1fr 1fr; }
  .footer { font-size: 12px; }
}
@media (max-width: 820px) and (max-height: 700px) {
  .hero-space { min-height: 34dvh; }
  .winners { height: 88px; max-height: 88px; }
  .menu { min-height: 52px; padding: 6px 3px; }
  .jackpot { padding: 8px 10px; }
}
@media (hover: hover) and (pointer: fine) {
  .menu:hover .pop { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { animation-duration: 80s; }
  .spark, .coin { animation: none; }
}
