/* Lobi bergaya kartun 1930-an (sesi 7), khusus versi grafis baru. Aktif bila js/art-lobby.js sudah
   memasang gambar (--lobby-*) dan kelas #menu.hose; sebelum itu lobi lama (css/style.css) yang tampil.
   --beat = satu ketukan gerak objek lobi (papan judul, penari, tangan, tombol PLAY). Semula 0,395 dtk
   (±152 BPM); atas permintaan pemilik diperlambat 50% menjadi 0,79 dtk. */
:root { --beat: .79s; }

/* ---------- Papan judul ---------- */
#menu.hose .marquee {
  width: min(460px, 54vw, calc((100vh - 150px) * 1.94)); aspect-ratio: 1150 / 592; padding: 0;
  /* dvh = tinggi yang benar-benar terlihat. Di HP, 100vh = tinggi tanpa bilah alamat browser,
     jadi lobi terlalu besar dan bagian bawahnya terpotong. vh di atas = cadangan browser lama. */
  width: min(460px, 54vw, calc((100dvh - 150px) * 1.94));
  border: 0; border-radius: 0; background: none; box-shadow: none;
  isolation: isolate; container-type: inline-size; overflow: visible;
  animation: hose-bob calc(var(--beat) * 2) ease-in-out infinite;
}
/* Sinar matahari krem-emas di belakang papan, berputar pelan. */
#menu.hose .marquee::before {
  content: ""; position: absolute; inset: -70% -40%; z-index: -2; border: 0; border-radius: 0;
  background: repeating-conic-gradient(rgba(255, 226, 160, .34) 0 8deg, rgba(255, 226, 160, 0) 8deg 16deg);
  -webkit-mask: radial-gradient(closest-side, #000 25%, transparent 100%);
  mask: radial-gradient(closest-side, #000 25%, transparent 100%);
  animation: hose-spin 70s linear infinite;
}
#menu.hose .marquee::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--lobby-plaque) center / 100% 100% no-repeat;
}
#menu.hose #logo {
  position: absolute; left: 50%; top: 11%; height: 50%; width: auto; margin: 0;
  transform: translateX(-50%); animation: none;
}
#menu.hose .marquee h1 {
  position: absolute; left: 24%; right: 24%; top: 68.5%; height: 15%; margin: 0; padding: 0 0 0 .4em;
  display: flex; align-items: center; justify-content: center;
  font-size: 4.6cqw; font-weight: 700; letter-spacing: .4em; color: var(--cream); line-height: 1;
  text-shadow: 0 .08em 0 rgba(42, 31, 23, .55); white-space: nowrap;
}
#menu.hose .marquee p { display: none; }

/* Penari: dua di kiri dan dua di kanan papan, berdiri sejajar dasar papan. */
#menu.hose .dancers {
  position: absolute; bottom: -4%; display: flex; align-items: flex-end; gap: 0;
  pointer-events: none;
}
#menu.hose .dancers.l { right: 98%; }
#menu.hose .dancers.r { left: 98%; }
#menu.hose .dancer { position: relative; display: block; width: clamp(44px, 18cqw, 92px); aspect-ratio: 1 / 1.12; }
#menu.hose .dancer img {
  position: absolute; left: 50%; bottom: 0; width: 100%; height: auto; transform: translateX(-50%);
  animation: hose-frame calc(var(--beat) * 2) steps(1) infinite;
}
#menu.hose .dancer img.b { animation-delay: calc(var(--beat) * -1); }
/* Penari kanan dicerminkan dan seirama dengan penari kiri, jadi pose kiri-kanan simetris
   (tangan yang melambai selalu di sisi luar). */
#menu.hose .dancers.r .dancer { transform: scaleX(-1); }

/* ---------- Tombol ---------- */
#menu.hose .btn.play {
  position: relative; width: clamp(150px, 27vw, 250px); aspect-ratio: 600 / 250; min-height: 0; padding: 0 0 .1em .3em;
  border: 0; border-radius: 0; box-shadow: none; background: var(--lobby-plate-gold) center / 100% 100% no-repeat;
  /* Huruf mengikuti lebar pelat (15%), supaya PLAY tidak keluar dari pelat saat pelat mengecil. */
  font-size: clamp(22px, 4.05vw, 37.5px); font-weight: 700; letter-spacing: .3em; color: var(--ink);
  text-shadow: 0 2px 0 rgba(255, 246, 220, .55);
  animation: hose-squash calc(var(--beat) * 2) ease-in-out infinite; transform-origin: 50% 100%;
}
#menu.hose .btn.play:active { animation: none; transform: scale(.93, .88); }
/* Tangan bersarung menunjuk ke PLAY, menyodok tiap ketukan. */
#menu.hose .btn.play::before {
  content: ""; position: absolute; right: 100%; top: 50%; width: 32%; aspect-ratio: 180 / 162; margin-right: 2%;
  background: var(--lobby-hand) center / contain no-repeat; transform: translateY(-50%);
  animation: hose-poke var(--beat) ease-in-out infinite;
}
#menu.hose .toggle,
#menu.hose .lobby-corner .btn,
#menu.hose .mode-btn {
  border: 0; border-radius: 0; box-shadow: none; background: var(--lobby-plate-pill) center / 100% 100% no-repeat;
  color: var(--ink);
}
#menu.hose .toggle { min-height: 0; height: 50px; gap: 8px; padding: 0 22px 2px 20px; }
#menu.hose .toggle img { display: none; }
#menu.hose .toggle::before {
  content: ""; width: 34px; height: 26px; background: var(--lobby-snd-on) center / contain no-repeat;
}
#menu.hose .toggle.off::before { background-image: var(--lobby-snd-off); }
#menu.hose .toggle b {
  min-width: 2.6em; padding: 0; border: 0; border-radius: 0; background: none; color: #4f7a3a; font-weight: 700;
}
#menu.hose .toggle.off b { background: none; color: var(--brick); }
#menu.hose .toggle:active, #menu.hose .lobby-corner .btn:active, #menu.hose .mode-btn:active { transform: scale(.94); box-shadow: none; }
#menu.hose .lobby-corner .btn { min-height: 0; height: 44px; padding: 0 20px 2px; }
#menu.hose .mode-btn { min-height: 0; height: 36px; padding: 0 14px 2px; }
#menu.hose .mode-btn.on { filter: sepia(.6) saturate(2.2) hue-rotate(-12deg); box-shadow: none; }

/* ---------- Pemilih mode awal (khusus pemilik) ----------
   Dulu label "MULAI DARI" 10 px cokelat di atas rak kayu gelap, jadi nyaris tak terbaca. Sekarang
   seluruh grup menjadi satu pita kertas krem bergaris tinta: label merah bata berhuruf renggang,
   tombol piring enamel dibuat lebih ringkas supaya pita tidak lebih lebar dari tombol PLAY. */
#menu.hose .mode-pick {
  align-items: center; justify-content: center; gap: 7px;
  padding: 6px 12px 7px 15px; border-radius: 999px;
  background: linear-gradient(180deg, #f7e8cb 0%, #e8cfa2 100%);
  border: 3px solid var(--ink);
  box-shadow: inset 0 -4px 0 rgba(42, 31, 23, .12), 0 4px 0 rgba(42, 31, 23, .4);
}
#menu.hose .mode-lab {
  margin: 0 3px 0 0; padding: 0 11px 0 0;
  font-size: 11px; font-weight: 700; letter-spacing: .17em; line-height: 1;
  color: var(--brick); opacity: 1; text-shadow: none;
  border-right: 2px dashed rgba(42, 31, 23, .3);
}
#menu.hose .mode-pick .mode-btn { height: 30px; padding: 0 12px 1px; font-size: 11.5px; letter-spacing: 1.1px; }
#menu.hose .mode-pick .mode-btn:active { transform: translateY(2px) scale(.97); }
/* Layar sempit: label selebar pita di baris atas, ketiga tombol sebaris di bawahnya. */
@media (max-width: 460px) {
  #menu.hose .mode-pick { row-gap: 7px; padding: 8px 14px 9px; border-radius: 24px; }
  #menu.hose .mode-lab { flex: 0 0 100%; margin: 0; padding: 0 0 6px; border-right: 0; border-bottom: 2px dashed rgba(42, 31, 23, .28); }
  #menu.hose .mode-pick .mode-btn { height: 32px; }
}
#menu.hose #btn-settings {
  position: relative; width: 52px; height: 52px; border: 0; box-shadow: none;
  background: var(--lobby-plate-round) center / contain no-repeat;
}
#menu.hose #btn-settings img { display: none; }
#menu.hose #btn-fs {
  width: 52px; height: 52px; border: 0; box-shadow: none; color: var(--ink);
  background: var(--lobby-plate-round) center / contain no-repeat;
}
#menu.hose #btn-fs svg { width: 22px; height: 22px; }
#menu.hose #btn-settings::after {
  content: ""; position: absolute; inset: 22%; background: var(--lobby-gear) center / contain no-repeat;
  transition: transform .4s;
}
#menu.hose #btn-settings:hover::after, #menu.hose #btn-settings:active::after { transform: rotate(90deg); }

/* ---------- Papan HIGH SCORE ---------- */
#menu.hose .board {
  position: relative; border: 0; border-radius: 0; box-shadow: none; padding: 40px 26px 22px;
  background: var(--lobby-board) center / 100% 100% no-repeat; color: var(--ink);
}
#menu.hose .board h2 {
  position: absolute; left: -6%; right: -6%; top: -14px; height: 44px; margin: 0; padding-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  background: var(--lobby-ribbon) center / 100% 100% no-repeat;
  color: var(--cream); font-size: 17px; font-weight: 700; letter-spacing: 5px; text-shadow: 0 2px 0 rgba(42, 31, 23, .5);
}
#menu.hose .board li:nth-child(odd) { background: rgba(255, 244, 222, .28); }
#menu.hose .board .rk { color: var(--ink); opacity: .7; }
#menu.hose .board .sc { color: var(--brick); font-weight: 700; }
#menu.hose li.top1 .rk, #menu.hose li.top1 .sc { color: #a8741d; }
#menu.hose li.top2 .rk, #menu.hose li.top2 .sc { color: #6d6760; }
#menu.hose li.top3 .rk, #menu.hose li.top3 .sc { color: #9b5530; }
#menu.hose #board-note { color: var(--ink); }

/* ---------- Efek film: tepi gelap, butir film, kedip halus ---------- */
#menu.hose::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(20, 10, 4, 0) 55%, rgba(20, 10, 4, .5) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .14 0 0 0 0 .08 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .9; animation: hose-grain .5s steps(1) infinite, hose-flicker 3.2s steps(1) infinite;
}

/* ---------- Iris (transisi PLAY) ---------- */
#iris {
  --r: 200vmax; position: fixed; inset: 0; z-index: 45; display: none; background: #140c07;
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent var(--r), #000 calc(var(--r) + 1px));
  mask: radial-gradient(circle at 50% 50%, transparent var(--r), #000 calc(var(--r) + 1px));
}
#iris.on { display: block; }

@keyframes hose-spin { to { transform: rotate(360deg); } }
@keyframes hose-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes hose-frame { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes hose-squash {
  0%, 50%, 100% { transform: scale(1, 1); }
  12% { transform: scale(1.06, .92); }
  25% { transform: scale(.97, 1.05); }
  62% { transform: scale(1.04, .95); }
  75% { transform: scale(.99, 1.02); }
}
@keyframes hose-poke { 0%, 100% { transform: translate(0, -50%); } 40% { transform: translate(18%, -50%); } }
@keyframes hose-grain {
  0% { background-position: 0 0, 0 0; } 25% { background-position: 0 0, -40px 30px; }
  50% { background-position: 0 0, 30px -50px; } 75% { background-position: 0 0, -20px -20px; }
}
@keyframes hose-flicker { 0%, 100% { opacity: .9; } 47% { opacity: .78; } 49% { opacity: .95; } 83% { opacity: .84; } }

@media (prefers-reduced-motion: reduce) {
  #menu.hose .marquee, #menu.hose .marquee::before, #menu.hose .btn.play, #menu.hose .btn.play::before, #menu.hose::after { animation: none; }
}

/* Lanskap pendek (HP diputar, terutama tanpa layar penuh): SUARA menjadi tombol ikon bulat di pojok
   kiri bawah (sejajar tombol pojok kanan), jadi kolom tengah hanya papan judul + PLAY (+ pemilih
   mode pemilik). Ukuran papan dihitung dari tinggi layar yang terlihat (--mq), dan PLAY selalu
   setengah lebar papan, supaya proporsinya sama di layar setinggi apa pun. */
@media (max-height: 480px) {
  #menu.hose { --mq: min(420px, 46vw, calc((100vh - 112px) * 1.94)); --mq: min(420px, 46vw, calc((100dvh - 112px) * 1.94)); }
  #menu.hose:has(#mode-pick:not(.hidden)) { --mq: min(420px, 46vw, calc((100vh - 160px) * 1.94)); --mq: min(420px, 46vw, calc((100dvh - 160px) * 1.94)); }
  #menu.hose .marquee { width: var(--mq); }
  #menu.hose .btn.play { width: calc(var(--mq) * .5); font-size: calc(var(--mq) * .075); }
  #menu.hose .toggle {
    position: fixed; left: calc(env(safe-area-inset-left) + 12px); bottom: calc(env(safe-area-inset-bottom) + 12px);
    width: 44px; height: 44px; padding: 0; gap: 0; font-size: 0; justify-content: center;
    background: var(--lobby-plate-round) center / contain no-repeat;
  }
  #menu.hose .toggle span, #menu.hose .toggle b { display: none; }
  #menu.hose .toggle::before { width: 24px; height: 19px; }
  #fs-hint { left: calc(env(safe-area-inset-left) + 66px); }
  #menu.hose .lobby-corner .btn { height: 38px; }
  #menu.hose #btn-settings, #menu.hose #btn-fs { width: 44px; height: 44px; }
  #menu.hose .lobby-main { gap: 8px; }
  /* Pemilih mode dibuat ringkas supaya tidak menambah tumpahan di layar pendek. */
  #menu.hose .mode-pick { gap: 6px; padding: 4px 10px 5px 13px; }
  #menu.hose .mode-lab { font-size: 10px; padding-right: 9px; }
  #menu.hose .mode-pick .mode-btn { height: 26px; padding: 0 10px 1px; font-size: 10.5px; }
}
/* Tegak: papan judul lebih lebar, penari lebih kecil. */
@media (max-aspect-ratio: 1/1) {
  #menu.hose .marquee { width: min(460px, 60vw); }
  #menu.hose .dancer { width: clamp(30px, 16cqw, 70px); }
  #menu.hose .btn.play { width: clamp(150px, 46vw, 250px); font-size: clamp(22.5px, 6.9vw, 37.5px); }
}
