/* ============================================================
   ROARBIT — halaman game
   ============================================================ */
html, body.game { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.game { touch-action: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
.night { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 1.4s;
  background: linear-gradient(180deg, #1a1440 0%, #2b1a55 50%, #160c26 100%); }
.night.on { opacity: .92; }

/* --- bar atas --- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 16px 10px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.logo { font-size: 24px; color: var(--ink); text-decoration: none; text-shadow: 0 2px 0 rgba(255, 245, 232, .6); display: flex; align-items: center; gap: 8px; }
.logo-img { width: 40px; height: auto; filter: drop-shadow(0 2px 6px rgba(36,16,47,.35)); }
.night.on ~ .topbar .logo { color: var(--cream); text-shadow: none; }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; padding: 9px 14px 8px; border-radius: 999px;
  background: rgba(36, 16, 47, .82); color: var(--cream); font: 700 13px/1 var(--body); box-shadow: var(--shadow); }
.pill b { color: var(--sun); font-weight: 800; }
.pill svg { width: 15px; height: 15px; color: var(--sun); }
.pill.preview { background: rgba(255, 245, 232, .9); color: var(--ink); }
.pill.preview svg { color: var(--coral); }

/* --- kartu monster --- */
.moncard { position: fixed; z-index: 15; left: 16px; top: 72px; width: 312px; padding: 16px 16px 12px; }
.mc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.mc-name { font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 6px; line-height: 1.05; }
.mini { border: 0; background: rgba(36, 16, 47, .08); border-radius: 8px; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; flex: none; }
.mini svg { width: 14px; height: 14px; }
.mc-sub { font-size: 13px; color: var(--plum-3); font-weight: 600; margin-top: 4px; }
.mc-chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.grow { margin: 14px 0 10px; }
.grow-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--plum); margin-bottom: 6px; letter-spacing: .02em; }
.grow-row b { color: var(--coral-d); }
.bar { height: 10px; border-radius: 99px; background: rgba(36, 16, 47, .1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--coral), var(--sun)); transition: width .6s; }
.stats { display: grid; gap: 8px; }
.stat { display: grid; grid-template-columns: 28px 64px 1fr 34px; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.stat .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.stat .ic svg { width: 16px; height: 16px; }
.stat .bar { height: 12px; }
.stat .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--plum-3); font-size: 12px; }
.stat.low .num { color: var(--coral-d); }
.stat.low .ic { animation: nudge 1s infinite; }
@keyframes nudge { 50% { transform: scale(1.12); } }
.ic.fuel { background: #ff8a3d; } .ic.joy { background: #ff4f7a; } .ic.clean { background: #31b7ff; } .ic.energy { background: #f4b400; }
.stat .bar i.fuel { background: #ff8a3d; } .stat .bar i.joy { background: #ff4f7a; } .stat .bar i.clean { background: #31b7ff; } .stat .bar i.energy { background: #f4b400; }
.mc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; }
.mood { font-weight: 700; color: var(--plum); }
.linkbtn { border: 0; background: none; color: var(--plum-3); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 4px; }
.adultbox { margin: 12px 0 2px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(255, 209, 102, .35), rgba(255, 106, 77, .18)); font-size: 13px; }
.adultbox b { font-family: var(--display); font-size: 18px; display: block; color: var(--ink); }

/* --- gelembung pikiran & teks melayang --- */
.bubble { position: fixed; z-index: 12; transform: translate(-50%, -100%); background: var(--cream); border-radius: 18px; padding: 8px 10px;
  box-shadow: var(--shadow); pointer-events: none; animation: bob 1.6s ease-in-out infinite; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; background: var(--cream); transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.bubble svg { width: 26px; height: 26px; position: relative; z-index: 1; }
@keyframes bob { 50% { margin-top: -6px; } }
.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 13; overflow: hidden; }
.floater { position: absolute; transform: translate(-50%, -50%); animation: floatUp 1.4s ease-out forwards; font-family: var(--display); color: #fff; text-shadow: 0 2px 6px rgba(36, 16, 47, .5); }
.floater svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 4px rgba(36, 16, 47, .4)); }
@keyframes floatUp { 0% { opacity: 0; margin-top: 10px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -90px; } }

/* --- dok bawah: aksi + roster --- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; padding: 0 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.dock > * { pointer-events: auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.actions .btn { min-width: 108px; padding: 15px 16px 13px; font-size: 15px; }
.actions .btn .k { font: 700 10px/1 var(--body); opacity: .75; letter-spacing: .06em; display: block; margin-top: 4px; }
.actions .btn.feed { --bg: #ff8a3d; --bd: #c35c17; }
.actions .btn.play { --bg: #ff4f7a; --bd: #b92a52; }
.actions .btn.clean { --bg: #31b7ff; --bd: #1478b4; }
.actions .btn.sleep { --bg: #5a3a8c; --bd: #2f1a55; }
.actions .btn.wake { --bg: var(--sun); --bd: var(--sun-d); --fg: var(--ink); }
.hatch { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.hatch .btn { font-size: 20px; padding: 20px 34px 17px; position: relative; overflow: hidden; }
.hatch .btn .fill { position: absolute; left: 0; bottom: 0; top: 0; width: 0; background: rgba(255, 255, 255, .35); }
.hatch .btn span { position: relative; }
.hatch .note { font-size: 13px; font-weight: 700; color: var(--ink); background: rgba(255, 245, 232, .85); padding: 6px 12px; border-radius: 99px; }
.incubate { font-family: var(--display); font-size: 22px; color: var(--ink); background: var(--cream); padding: 12px 18px 10px; border-radius: 14px; box-shadow: var(--shadow); text-align: center; }
/* den terkunci sebelum connect wallet */
.gate { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-start; padding: 80px 6vw 40px; pointer-events: none; }
.gate[hidden] { display: none; }
.gate-card { pointer-events: auto; max-width: 420px; background: var(--cream); color: var(--ink); border-radius: 22px; padding: 26px 28px 22px; box-shadow: var(--shadow); }
.gate-k { font: 800 12px/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: #e0561c; }
.gate-card h2 { font-family: var(--display); font-size: 34px; line-height: 1.05; margin: 10px 0 12px; }
.gate-card p { font: 600 15px/1.5 var(--body); margin: 0 0 18px; color: var(--plum-3); }
.gate-card p b { color: var(--ink); }
.gate-card .btn { width: 100%; justify-content: center; }
.gate-card small { display: block; text-align: center; margin-top: 10px; font: 700 12px var(--body); color: var(--plum-3); }
body.gated #card, body.gated .dock, body.gated #bubble, body.gated #earnPill { display: none !important; }
@media (max-width: 700px) { .gate { align-items: flex-end; justify-content: center; padding: 0 16px 28px; } .gate-card h2 { font-size: 28px; } }
.incubate small { display: block; font: 700 12px/1.3 var(--body); color: var(--plum-3); margin-top: 4px; }
.incubate .ibar { display: block; width: 220px; height: 8px; margin: 8px auto 2px; border-radius: 99px; background: rgba(60, 30, 80, .15); overflow: hidden; }
.incubate .ibar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffb347, #ff6a1f); transition: width .9s linear; }

.roster { display: flex; gap: 10px; }
.slot { width: 92px; height: 104px; border-radius: 16px; border: 0; padding: 6px; cursor: pointer; position: relative;
  background: rgba(255, 245, 232, .92); box-shadow: 0 4px 0 rgba(36, 16, 47, .18), var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; transition: transform .15s; }
.slot:hover { transform: translateY(-3px); }
.slot.on { outline: 3px solid var(--coral); outline-offset: 2px; }
.slot img { width: 74px; height: 66px; object-fit: contain; }
.slot .sn { font: 800 11px/1.1 var(--body); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .ss { font: 700 9px/1 var(--body); color: var(--plum-3); letter-spacing: .06em; text-transform: uppercase; }
.slot .dot { position: absolute; top: 7px; right: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 2px var(--cream); }
.slot .dot.mid { background: var(--sun); } .slot .dot.bad { background: var(--coral); animation: nudge 1s infinite; }
.slot .orbicon { width: 54px; height: 60px; margin-bottom: 6px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 35% 30%, #fff 0, #b8b3c4 18%, #5a5466 70%); position: relative; }
.slot .orbicon::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 12px var(--g, #ff6a2b), 0 0 14px var(--g, #ff6a2b); opacity: .8; }
.slot.empty { background: rgba(255, 245, 232, .5); border: 2px dashed rgba(36, 16, 47, .25); box-shadow: none; justify-content: center; text-align: center; }
.slot.empty .ss { font-size: 10px; line-height: 1.3; }
.slot.claim { background: var(--sun); animation: glowpulse 1.4s infinite; }
@keyframes glowpulse { 50% { box-shadow: 0 0 0 6px rgba(255, 209, 102, .4), var(--shadow); } }

/* --- mode gosok --- */
.scrub { position: fixed; z-index: 17; left: 50%; bottom: 150px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--cream); padding: 10px 12px 10px 10px; border-radius: 99px; font-weight: 700; box-shadow: var(--shadow); }
.scrub .ring svg { width: 36px; height: 36px; transform: rotate(-90deg); }
.scrub circle { fill: none; stroke-width: 5; }
.scrub .bg { stroke: rgba(255, 255, 255, .15); }
.scrub .fg { stroke: #31b7ff; stroke-linecap: round; stroke-dasharray: 107; stroke-dashoffset: 107; transition: stroke-dashoffset .1s; }
body.scrubbing #scene { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Crect x='6' y='10' width='28' height='20' rx='7' fill='%2331b7ff' stroke='%23fff' stroke-width='3'/%3E%3C/svg%3E") 20 20, pointer; }

/* --- modal --- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(36, 16, 47, .45); backdrop-filter: blur(3px); }
.modal[hidden] { display: none; }
.reveal { width: min(420px, 100%); padding: 26px 22px 22px; text-align: center; animation: popin .45s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes popin { from { transform: scale(.6); opacity: 0; } }
.rv-kicker { font: 800 12px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--coral-d); }
.rv-title { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1; margin: 10px 0 12px; }
.rv-chips { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.rv-text { color: var(--plum); line-height: 1.5; margin: 14px 0 18px; }
.sheet { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 20px 20px; position: relative; }
.sheet h3 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.sheet p { line-height: 1.5; color: var(--plum); margin: 8px 0; }
.sheet .rows { display: grid; gap: 8px; margin: 14px 0; }
.sheet .row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(36, 16, 47, .06); font-weight: 600; font-size: 14px; }
.sheet .row b { font-variant-numeric: tabular-nums; }
.sheet .ok { color: #148a52; } .sheet .warn { color: var(--coral-d); }
.close { position: absolute; top: 12px; right: 12px; border: 0; background: rgba(36, 16, 47, .08); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.walletlist { display: grid; gap: 8px; margin-top: 14px; }
.walletlist button:not(.btn) { display: flex; align-items: center; gap: 12px; border: 0; padding: 12px 14px; border-radius: 12px; background: rgba(36, 16, 47, .06); cursor: pointer; font-weight: 700; font-size: 15px; text-align: left; }
.walletlist img { width: 28px; height: 28px; border-radius: 7px; }
.namefield { display: flex; gap: 8px; margin-top: 12px; }
.namefield input { flex: 1; font: 700 16px var(--body); padding: 12px; border-radius: 12px; border: 2px solid rgba(36, 16, 47, .15); background: #fff; color: var(--ink); min-width: 0; }

.loading { position: fixed; inset: 0; z-index: 80; display: grid; place-content: center; justify-items: center; gap: 16px; font-weight: 700; color: var(--ink);
  background: linear-gradient(180deg, #ffe0b0, #ff8a72); transition: opacity .5s; }
.loading.done { opacity: 0; pointer-events: none; }
.ld-orb { width: 64px; height: 70px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 35% 30%, #fff, #a29db0 25%, #4e4859 75%); box-shadow: 0 0 30px #ff6a2b; animation: wob 1s ease-in-out infinite; }
@keyframes wob { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

/* --- HP --- */
@media (max-width: 760px) {
  .logo { font-size: 19px; }
  .moncard { left: 10px; right: 10px; top: 60px; width: auto; padding: 10px 12px; }
  .mc-name { font-size: 17px; }
  .mc-sub { font-size: 12px; }
  .grow { margin: 8px 0 6px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .stat { grid-template-columns: 22px 1fr 28px; gap: 6px; }
  .stat .lbl { display: none; }
  .stat .ic { width: 22px; height: 22px; border-radius: 7px; }
  .stat .ic svg { width: 13px; height: 13px; }
  .mc-foot { margin-top: 6px; }
  .adultbox { margin: 8px 0 0; padding: 8px 10px; }
  .adultbox b { font-size: 15px; }
  .actions { gap: 8px; }
  .actions .btn { min-width: 0; flex: 1 1 70px; font-size: 13px; padding: 13px 8px 11px; }
  .actions .btn .k { display: none; }
  .roster { gap: 8px; }
  .slot { width: 76px; height: 84px; }
  .slot img { width: 56px; height: 44px; }
  .slot .sn { font-size: 10px; }
  .scrub { bottom: 200px; }
  .pill { padding: 8px 11px 7px; font-size: 12px; }
  .pill .lbl { display: none; }
}
@media (max-width: 380px) { .top-right .btn.sm:not(.icon) { padding: 9px 9px 7px; font-size: 11px; } }
