*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --topbar-h: 68px;
  --radius: 16px;
  --high: #2ee59d;
  --mid: #ffc53d;
  --low: #ff6b6b;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 120px);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 15% -120px, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(800px 420px at 90% -80px, color-mix(in srgb, var(--accent2) 14%, transparent), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.btn,
.pct,
.badge,
.stats strong {
  font-family: var(--font-heading);
}

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

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

svg {
  fill: currentColor;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
}

:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}

/* Tombol */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: transform .15s, filter .15s, background-color .15s, border-color .15s;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:active {
  transform: scale(.97);
}

.btn-primary {
  color: var(--accentText);
  background: linear-gradient(135deg, var(--ctaFrom, var(--accent2)), var(--ctaTo, var(--accent)));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
}

.btn-primary:hover {
  filter: brightness(1.08) saturate(1.1);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.btn-ghost:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: var(--surface2);
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--topbar-h);
}

.brand img {
  height: 42px;
  width: auto;
  transition: transform .2s;
}

.brand:hover img {
  transform: scale(1.03) rotate(-1deg);
}

.topbar-cta {
  display: flex;
  gap: 8px;
}

/* Hero */
.hero {
  padding: 44px 16px 28px;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5.6vw, 56px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.01em;
  background: linear-gradient(180deg, #fff 30%, color-mix(in srgb, var(--accent2) 60%, white));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-wrap: balance;
}

.hero-note {
  margin: 10px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.status,
.stats {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  font-size: 13px;
  color: var(--muted);
}

.status strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.status-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--high);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--high) 60%, transparent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.stats {
  gap: 14px;
}

.stats strong {
  color: var(--accent2);
  font-size: 15px;
  font-weight: 600;
}

/* Tab & pencarian, menempel di bawah header saat di-scroll */
.controls {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  padding: 10px 0 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  min-width: 108px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  scroll-snap-align: start;
  transition: border-color .15s, background-color .15s, transform .15s, box-shadow .15s;
}

.tab img {
  height: 24px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  opacity: .72;
  filter: saturate(.75);
  transition: opacity .15s, filter .15s;
}

/* Logo Pragmatic punya mahkota tinggi sehingga teksnya tampak kecil */
.tab[data-provider="pragmatic"] img {
  height: 34px;
}

/* Tab tanpa logo gambar: tampilkan nama provider sebagai teks */
.tab-label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .3px;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s;
}
.tab:hover .tab-label,
.tab[aria-selected="true"] .tab-label {
  color: var(--text);
}

.tab:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.tab:hover img,
.tab[aria-selected="true"] img {
  opacity: 1;
  filter: none;
}

.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  box-shadow: 0 0 0 1px var(--accent), 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: var(--muted);
  pointer-events: none;
}

.search input,
.sort select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}

.search input {
  padding: 0 14px 0 44px;
}

.search input::placeholder {
  color: var(--muted);
}

.search input:focus,
.sort select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.sort {
  flex: 0 0 auto;
}

.sort select {
  width: auto;
  padding: 0 38px 0 14px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23b9a6d6'%3E%3Cpath d='M12 15.4 6.3 9.7l1.4-1.4 4.3 4.3 4.3-4.3 1.4 1.4Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

.sort select option {
  background: var(--surface);
  color: var(--text);
}

/* Bagian provider */
.result-info {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.provider {
  padding-top: 22px;
}

.provider-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.provider-head img {
  height: 22px;
  width: auto;
}

.provider-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
}

.provider-count {
  margin-left: auto;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

/* Grid game */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 14px;
}

.card {
  --c: #8a7aa6;
  --t: var(--muted);
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface2), var(--surface) 55%);
  overflow: hidden;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}

.card[data-tier="high"] { --c: linear-gradient(90deg, #12b76a, var(--high)); --t: var(--high); }
.card[data-tier="mid"] { --c: linear-gradient(90deg, #f79009, var(--mid)); --t: var(--mid); }
.card[data-tier="low"] { --c: linear-gradient(90deg, #d92d20, var(--low)); --t: var(--low); }

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4), 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 1;
  margin: 6px 6px 0;
  border-radius: calc(var(--radius) - 6px);
  overflow: hidden;
  background: var(--surface2);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s;
}

.card:hover .thumb img {
  transform: scale(1.06);
}

.play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .65));
  opacity: 0;
  transition: opacity .2s;
}

.play span {
  padding: 8px 24px;
  border-radius: 999px;
  color: var(--accentText);
  background: linear-gradient(135deg, var(--ctaFrom, var(--accent2)), var(--ctaTo, var(--accent)));
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .06em;
  transform: translateY(6px);
  transition: transform .2s;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
}

.thumb:hover .play,
.thumb:focus-visible .play {
  opacity: 1;
}

.thumb:hover .play span,
.thumb:focus-visible .play span {
  transform: none;
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9a1f, #ff2d55);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  box-shadow: 0 4px 12px rgba(255, 45, 85, .45);
}

.badge svg {
  width: 12px;
  height: 12px;
}

.info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px 12px;
}

.info h3 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.rate {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meter {
  --v: 0%;
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 60%, var(--surface2));
  overflow: hidden;
}

.meter::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--v);
  border-radius: inherit;
  background: var(--c);
  box-shadow: 0 0 10px color-mix(in srgb, var(--t) 60%, transparent);
  transition: width .9s cubic-bezier(.2, .8, .2, 1);
}

.pct {
  flex: 0 0 auto;
  min-width: 3ch;
  text-align: right;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--t);
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 56px 0;
  text-align: center;
  color: var(--muted);
}

.empty p {
  margin: 0;
}

.empty-title {
  margin-bottom: 6px !important;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
}

/* Footer */
.footer {
  margin-top: 56px;
  padding: 36px 0 40px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-logo {
  height: 36px;
  width: auto;
}

.footer-links {
  display: flex;
  gap: 20px;
  font-weight: 600;
  font-size: 14px;
}

.footer-links a {
  color: var(--muted);
  transition: color .15s;
}

.footer-links a:hover {
  color: var(--text);
}

.disclaimer {
  max-width: 620px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.age {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
}

.copy {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  opacity: .7;
}

/* Tombol kembali ke atas */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
  backdrop-filter: blur(8px);
  transition: transform .15s, border-color .15s;
}

.to-top:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.to-top svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 58px;
    --radius: 12px;
  }

  html {
    scroll-padding-top: calc(var(--topbar-h) + 110px);
  }

  /* Logo lebar (mis. KOKO55) diperkecil supaya tidak menabrak tombol Login/Daftar */
  .brand img {
    height: auto;
    max-height: 32px;
    max-width: calc(100vw - 220px);
  }

  /* Di HP: Login & Daftar tetap di header (kecil), live chat pindah ke footer */
  .btn-chat {
    display: none;
  }

  .topbar-cta {
    gap: 6px;
  }

  .topbar-cta .btn {
    height: 34px;
    padding: 0 14px;
    font-size: 14px;
  }

  .topbar-cta .btn-primary {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, .35);
  }

  .hero {
    padding: 26px 16px 18px;
  }

  .hero-note {
    font-size: 13px;
  }

  .hero-meta {
    margin-top: 16px;
    gap: 8px;
  }

  .status,
  .stats {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .controls {
    padding: 8px 0 10px;
  }

  .tab {
    height: 40px;
    min-width: 88px;
    padding: 0 12px;
    border-radius: 10px;
  }

  .tab img {
    height: 20px;
    max-width: 92px;
  }

  .tab[data-provider="pragmatic"] img {
    height: 28px;
  }

  .tabs {
    gap: 6px;
    padding-bottom: 6px;
  }

  .search input,
  .sort select {
    height: 42px;
    font-size: 14px;
  }

  .search input {
    padding-left: 40px;
  }

  .search svg {
    left: 13px;
  }

  .sort select {
    max-width: 128px;
    padding-right: 32px;
    background-position: right 8px center;
  }

  .provider {
    padding-top: 16px;
  }

  .provider-head h2 {
    font-size: 18px;
  }

  .games {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .thumb {
    margin: 4px 4px 0;
  }

  .info {
    padding: 6px 7px 9px;
    gap: 7px;
  }

  .info h3 {
    font-size: 11.5px;
  }

  .rate {
    gap: 5px;
  }

  .meter {
    height: 5px;
  }

  .pct {
    font-size: 13px;
  }

  .badge {
    top: 8px;
    left: 8px;
    padding: 2px 6px 2px 5px;
    font-size: 9.5px;
  }

  .badge svg {
    width: 9px;
    height: 9px;
  }

  .to-top {
    right: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }

}

@media (hover: none) {
  .card:hover {
    transform: none;
  }

  .card:hover .thumb img {
    transform: none;
  }
}

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