/* Tata letak (lihat DESIGN.md): bilah atas lengket, deret kontrol, kisi kartu persegi dirata tengah.
   Halaman main memberi sisa tinggi layar untuk bingkai game, dengan bilah tipis di bawahnya. */
:root {
  --bg: #FBF8F1;
  --card: #FFFFFF;
  --ink: #0F2A4A;
  --ink-soft: #4B5D75;
  --on-ink: #FFFFFF;
  --line: #D8D1C2;
  --line-strong: #7A8699;
  --thumb: #EFE8D8;
  --gold: #C2A158;
  --shadow: rgba(15, 42, 74, .18);
  --hover: rgba(15, 42, 74, .07);
  --backdrop: rgba(15, 42, 74, .42);
  --stage: #0F2A4A;
  --stage-ink: #F2ECDF;
  --sans: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --dot: "DotGothic16", "Courier New", monospace;
  --head-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1B2F;
    --card: #13263F;
    --ink: #F2ECDF;
    --ink-soft: #AEBBCD;
    --on-ink: #0C1B2F;
    --line: #2B4061;
    --line-strong: #7088A8;
    --thumb: #1B3150;
    --gold: #D4B46A;
    --shadow: rgba(0, 0, 0, .45);
    --hover: rgba(242, 236, 223, .08);
    --backdrop: rgba(0, 0, 0, .55);
    --stage: #06111F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1B2F;
  --card: #13263F;
  --ink: #F2ECDF;
  --ink-soft: #AEBBCD;
  --on-ink: #0C1B2F;
  --line: #2B4061;
  --line-strong: #7088A8;
  --thumb: #1B3150;
  --gold: #D4B46A;
  --shadow: rgba(0, 0, 0, .45);
  --hover: rgba(242, 236, 223, .08);
  --backdrop: rgba(0, 0, 0, .55);
  --stage: #06111F;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: 12px; top: -80px; z-index: 2000;
  padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--on-ink);
  font-weight: 700; text-decoration: none;
}
.skip:focus { top: 10px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Bilah atas */
.site-head {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  height: var(--head-h);
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}
.menu-btn, .side-close {
  width: 44px; height: 44px; flex: none;
  display: grid; place-content: center; gap: 5px;
  background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.menu-btn { justify-self: start; }
.menu-btn span { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: var(--ink); }
.menu-btn:hover, .side-close:hover { background: var(--hover); }
.side-close svg { width: 22px; height: 22px; }

.head-logo {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px;
  font-weight: 700; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none;
}
.head-logo img { width: 34px; height: 34px; }
.head-title {
  min-width: 0; margin: 0;
  font-family: var(--dot); font-size: 22px; font-weight: 400; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.pick { position: relative; }
.pick select {
  appearance: none; -webkit-appearance: none;
  height: 44px; padding: 0 24px 0 8px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--ink-soft); font-size: 13px; letter-spacing: .02em; cursor: pointer;
}
.pick select:hover { background: var(--hover); }
.pick select option { color: initial; }
.pick::after {
  content: ""; position: absolute; right: 9px; top: 50%; pointer-events: none;
  border: 4.5px solid transparent; border-top: 5.5px solid var(--ink-soft); border-bottom: 0;
  transform: translateY(-50%);
}
.lang { justify-self: end; }

@media (max-width: 479px) {
  .site-head { grid-template-columns: auto 1fr auto; }
  .head-logo { justify-self: center; font-size: 16px; gap: 8px; }
  .head-logo img { width: 30px; height: 30px; }
  .head-title { font-size: 18px; text-align: center; }
}

/* Laci menu */
.side-backdrop { position: fixed; inset: 0; z-index: 1000; background: var(--backdrop); }
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1001;
  width: min(300px, 86vw);
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
  padding: calc(10px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: var(--bg); border-right: 2px solid var(--ink);
  transform: translateX(-100%); visibility: hidden;
  transition: transform .2s ease, visibility 0s linear .2s;
}
.side.open { transform: none; visibility: visible; transition: transform .2s ease; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 10px; }
.side-brand { margin: 0; font-weight: 700; font-size: 16px; }
.side-head { margin: 0 0 6px; padding: 0 10px; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.side-nav { list-style: none; margin: 0; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.side-nav a {
  display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 8px 10px;
  border-radius: 10px; font-weight: 700; font-size: 15px; text-decoration: none;
}
.side-nav a:hover, .side-nav a[aria-current="page"] { background: var(--hover); }
.side-nav .host { margin-left: auto; font-family: var(--dot); font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.side-ic { width: 22px; height: 22px; flex: none; }

.theme { margin: 0; padding: 0 0 4px; border: 0; min-width: 0; }
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0 10px; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden;
}
.seg label { position: relative; }
.seg label + label { border-left: 2px solid var(--ink); }
.seg input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 44px; padding: 0 4px; font-size: 13px; font-weight: 700; }
.seg input:checked + span { background: var(--ink); color: var(--on-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: -7px; }
.seg input:checked:focus-visible + span { outline-color: var(--on-ink); }
.side-copy { margin: auto 0 0; padding: 0 10px; font-size: 12px; color: var(--ink-soft); }

/* Beranda */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.home-hero { padding: 30px 0 22px; text-align: center; }
.tagline {
  max-width: 28em; margin: 0 auto;
  font-size: clamp(18px, 2.6vw, 22px); font-weight: 700; line-height: 1.4; text-wrap: balance;
}
.controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 12px; margin: 0 0 26px;
}
.search { position: relative; flex: 1 1 100%; max-width: 420px; margin: 0; }
.search svg {
  position: absolute; left: 14px; top: 50%; width: 17px; height: 17px;
  transform: translateY(-50%); color: var(--ink-soft); pointer-events: none;
}
.search input {
  width: 100%; height: 46px; padding: 8px 14px 8px 40px;
  background: var(--card); border: 1.5px solid var(--line-strong); border-radius: 999px;
  font-size: 16px;
}
.search input::placeholder { color: var(--ink-soft); opacity: 1; }
.search input:focus-visible { outline-offset: 1px; }
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tab {
  min-height: 44px; padding: 8px 16px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .08s, background-color .12s, color .12s;
}
.tab:hover { transform: translateY(-1px); }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.tab[aria-pressed="true"]:focus-visible { outline-offset: 3px; }
.tally { display: flex; align-items: center; gap: 4px; }
.count { font-family: var(--dot); font-size: 14px; white-space: nowrap; }
@media (min-width: 760px) {
  .search { flex: 0 1 300px; }
}

.grid { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: 16px; margin: 0; padding: 0; list-style: none; }
.grid > li { width: calc((100% - 80px) / 6); }
@media (max-width: 999px) { .grid > li { width: calc((100% - 64px) / 5); } }
@media (max-width: 819px) { .grid > li { width: calc((100% - 48px) / 4); } }
@media (max-width: 639px) { .grid > li { width: calc((100% - 32px) / 3); } }
@media (max-width: 480px) {
  .grid { gap: 12px; }
  .grid > li { width: calc((100% - 12px) / 2); }
}

.card-link { display: block; color: inherit; text-decoration: none; border-radius: 10px; }
.card-link:focus-visible { outline-offset: 5px; }
.card {
  position: relative; overflow: hidden;
  background: var(--card); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.card-link:hover .card, .card-link:focus-visible .card {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--gold);
}
.thumb { aspect-ratio: 1 / 1; overflow: hidden; background: var(--thumb); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.noimg {
  display: grid; place-items: center; width: 100%; height: 100%; padding: 0 10px;
  font-family: var(--dot); font-size: 22px; line-height: 1.2; text-align: center; color: var(--ink-soft);
}
.meta { padding: 8px 10px 10px; }
.meta .title { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.35; }
.meta .tags, .meta .year {
  margin: 0; max-height: 0; overflow: hidden; opacity: 0;
  font-family: var(--dot); font-size: 12px; line-height: 1.5; color: var(--ink-soft);
  transition: max-height .15s, opacity .12s, margin-top .15s;
}
.card-link:hover .tags, .card-link:focus-visible .tags,
.card-link:hover .year, .card-link:focus-visible .year { max-height: 3em; margin-top: 3px; opacity: 1; }
@media (hover: none) {
  .meta .tags, .meta .year { max-height: 3em; margin-top: 3px; opacity: 1; }
}

.empty { display: grid; justify-items: center; gap: 12px; padding: 36px 16px 8px; text-align: center; }
.empty img { width: 52px; height: 52px; }
.empty p { margin: 0; max-width: 30em; }

.grid-note { max-width: 46em; margin: 40px auto 48px; text-align: center; font-size: 13px; color: var(--ink-soft); }
.grid-note a { color: var(--ink); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: var(--card); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn-ink { background: var(--ink); color: var(--on-ink); }
.btn-ink:hover { background: var(--ink); opacity: .9; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Halaman main */
.play { display: flex; flex-direction: column; height: calc(100dvh - var(--head-h)); }
.stage { position: relative; flex: 1; min-height: 0; background: var(--stage); }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.stage-state {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  padding: 24px; text-align: center;
  background: var(--stage); color: var(--stage-ink);
}
.stage-state p { margin: 0; max-width: 28em; }
.stage-state .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.stage :focus-visible { outline-color: var(--stage-ink); }
.stage .btn { background: transparent; color: var(--stage-ink); border-color: var(--stage-ink); }
.stage .btn-ink { background: var(--stage-ink); color: #0F2A4A; }
.sun { width: 64px; height: 64px; }
.sun .disc { animation: rise 1.4s ease-in-out infinite alternate; }
@keyframes rise { from { transform: translateY(14px); } to { transform: translateY(-4px); } }

.play-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--bg); border-top: 2px solid var(--ink);
}
.play-desc {
  flex: 1; min-width: 0; margin: 0;
  font-size: 13px; color: var(--ink-soft); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 719px) { .play-desc { display: none; } }

/* Halaman teks: Tentang dan tidak ditemukan */
.page { max-width: 640px; margin: 0 auto; padding: 40px 16px 64px; }
.page h1 { margin: 0 0 16px; font-size: clamp(26px, 4.4vw, 34px); line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
.page p { margin: 0 0 14px; }
.page .mark { width: 56px; height: 56px; margin-bottom: 18px; }
.link-list { list-style: none; margin: 26px 0 0; padding: 0; border-top: 1px solid var(--line); }
.link-list li { border-bottom: 1px solid var(--line); }
.link-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 10px 6px; text-decoration: none; font-weight: 700;
}
.link-list a:hover { background: var(--hover); }
.link-list .host { font-family: var(--dot); font-weight: 400; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; text-align: right; }

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