:root {
  --ink: #fff8e8;
  --panel: rgba(22, 32, 24, 0.78);
  --panel-solid: #1b2a1f;
  --line: rgba(255, 240, 200, 0.18);
  --gold: #f2c14e;
  --red: #e5534b;
  --green: #5cc46a;
  --blue: #4aa3df;
  --font: 'Nunito', system-ui, sans-serif;
  --title: 'Lilita One', 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #16231a; color: var(--ink); font-family: var(--font); touch-action: none; user-select: none; -webkit-user-select: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font-family: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* label nama & gelembung obrolan di atas kepala */
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); text-align: center; white-space: nowrap; will-change: transform; }
.tag .nm { display: inline-block; font-weight: 800; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); }
.tag.me .nm { background: rgba(40, 110, 60, 0.75); }
.tag.npc .nm { background: rgba(150, 110, 30, 0.85); }
.tag.home .nm { background: rgba(60, 90, 140, 0.7); }
.tag .mk { display: block; font-family: var(--title); font-size: 22px; color: var(--gold); text-shadow: 0 2px 0 #000; animation: bob 1s ease-in-out infinite; }
.tag .bub { display: block; max-width: 180px; white-space: normal; margin: 0 auto 4px; padding: 5px 9px; border-radius: 12px; background: #fff8e8; color: #222; font-size: 12px; font-weight: 600; box-shadow: 0 2px 0 rgba(0,0,0,.3); }
@keyframes bob { 50% { transform: translateY(-4px); } }

#flash { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle, transparent 40%, rgba(200, 0, 0, 0.55)); opacity: 0; transition: opacity 0.35s; }

/* HUD atas: kiri = status + Tas/Obrol/Teman/Suara · tengah = jam/koin/misi · kanan = peta/kamera + peta mini */
.lcol { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: calc(env(safe-area-inset-left) + 8px); display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.lbar { display: flex; gap: 7px; pointer-events: auto; }
.rb { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 17px; line-height: 1; pointer-events: auto; touch-action: none; padding: 0; }
.rb small { font-size: 8.5px; font-weight: 800; margin-top: 2px; }
.rb.zm { font-size: 20px; font-weight: 800; }
.rb:active, .rb.on { transform: scale(0.94); background: rgba(60, 110, 160, 0.92); border-color: #9fd0ff; }
.rb em { position: absolute; top: -3px; right: -3px; font-style: normal; font-size: 10px; font-weight: 800; background: var(--red); border-radius: 8px; padding: 0 5px; }
.rb.talking { box-shadow: 0 0 0 3px #6aff8a; }
.cmid { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.midrow { display: flex; gap: 5px; align-items: center; pointer-events: auto; }
.midrow > * { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.rcol { position: fixed; top: calc(env(safe-area-inset-top) + 8px); right: calc(env(safe-area-inset-right) + 8px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.rcam { display: flex; gap: 6px; }
.rcam .rb { width: 38px; height: 38px; font-size: 15px; }
#mini { width: 110px; height: 110px; border-radius: 50%; border: 2px solid rgba(255, 240, 200, 0.45); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); pointer-events: auto; }
#mapsheet { position: fixed; inset: 0; background: rgba(10, 14, 10, 0.55); display: flex; align-items: center; justify-content: center; z-index: 20; }
#mapsheet[hidden] { display: none; }
.mapcard { position: relative; display: flex; gap: 12px; padding: 10px 12px; max-width: 96vw; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
#bigmap { width: min(80vh, 60vw, 420px); height: min(80vh, 60vw, 420px); border-radius: 10px; border: 1px solid rgba(255, 240, 200, 0.3); }
.mapinfo { width: 230px; font-size: 12px; line-height: 1.5; }
.mapinfo .mt { display: block; font-family: var(--title); font-weight: 400; font-size: 20px; color: var(--gold); }
.mapinfo #map-pct { color: #ffe2a0; }
.mapinfo .lg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin: 0 3px 0 6px; vertical-align: -1px; }
.mapinfo .lg i:first-child { margin-left: 0; }
.mapinfo p { margin: 8px 0; padding: 7px 9px; background: rgba(0, 0, 0, 0.3); border-radius: 9px; }
.mapinfo small { opacity: 0.8; }
#map-close { position: absolute; right: 8px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); font-size: 14px; }
.tag.land.sale .nm { background: rgba(200, 50, 40, 0.85); }
.stats { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 7px 9px; width: min(46vw, 210px); }
.who { display: flex; gap: 6px; align-items: center; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.who b { font-family: var(--title); font-weight: 400; font-size: 15px; letter-spacing: 0.5px; }
#sick { background: #7a2a2a; padding: 0 6px; border-radius: 6px; font-size: 11px; animation: pulse 1s infinite; }
#safe { background: #2a6a3a; padding: 0 6px; border-radius: 6px; font-size: 11px; }
@keyframes pulse { 50% { opacity: 0.55; } }
.bar { display: flex; align-items: center; gap: 5px; margin: 3px 0; }
.bar i { font-style: normal; font-size: 12px; width: 16px; text-align: center; }
.bar b { flex: 1; height: 9px; border-radius: 5px; background: rgba(0, 0, 0, 0.45); overflow: hidden; }
.bar s { display: block; height: 100%; width: 50%; border-radius: 5px; transition: width 0.3s; }
.hp s { background: linear-gradient(#ff7a6e, #d9423a); }
.food s { background: linear-gradient(#ffd27a, #e09a2a); }
.water s { background: linear-gradient(#8fd6ff, #3a8fd8); }
.sta s { background: linear-gradient(#c9f27a, #6ab03a); }
.bar.low s { animation: pulse 0.6s infinite; }
#desa { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; font-size: 11px; font-weight: 600; opacity: 0.9; }
.dia { border: 1px solid #6ac8ff !important; }
.dia em { font-style: normal; color: #6ac8ff; }

#mission { max-width: min(36vw, 320px); text-align: center; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 6px 10px; font-size: 12px; pointer-events: none; }
#mission .tier { display: inline-block; font-size: 10px; font-weight: 800; background: var(--green); color: #102010; border-radius: 5px; padding: 0 5px; margin-right: 4px; }
#mission .ok { color: var(--green); font-weight: 800; }

#toasts { position: fixed; top: 34%; left: 50%; transform: translateX(-50%); width: min(90vw, 420px); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 7px 12px; font-size: 13px; font-weight: 700; text-align: center; animation: tin 0.25s ease-out; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.toast.good { border-color: var(--green); }
.toast.bad { border-color: var(--red); background: #3a1a1a; }
.toast.out { opacity: 0; transition: opacity 0.4s; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

#chatlog { position: fixed; left: 8px; bottom: calc(env(safe-area-inset-bottom) + 160px); width: min(58vw, 280px); font-size: 12px; pointer-events: none; display: flex; flex-direction: column; gap: 2px; }
#chatlog div { background: rgba(0, 0, 0, 0.35); border-radius: 6px; padding: 2px 7px; transition: opacity 1s; }
#chatlog b { color: var(--gold); }

/* joystick */
#stickzone { position: fixed; left: 0; bottom: 0; width: 55vw; height: 62vh; }
#stick { position: fixed; left: 86px; bottom: calc(env(safe-area-inset-bottom) + 96px); width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.22); pointer-events: none; transform: translate(-50%, 50%); }
#stick.on { transform: translate(-50%, -50%); background: rgba(255, 255, 255, 0.14); }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; transform: translate(-50%, -50%); background: rgba(255, 248, 232, 0.55); border: 2px solid rgba(255, 255, 255, 0.7); }

/* tombol kanan */
.pad { position: fixed; right: calc(env(safe-area-inset-right) + 12px); bottom: calc(env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.pad .row { display: flex; gap: 10px; align-items: flex-end; }
.pad button { border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: none; }
.pad button small { font-size: 10px; font-weight: 800; margin-top: 3px; }
.pad button:active, .pad button.on { transform: scale(0.94); background: rgba(80, 130, 70, 0.85); }
.sm { width: 50px; height: 50px; font-size: 20px; }
.mid { width: 68px; height: 68px; font-size: 26px; background: rgba(120, 40, 30, 0.8) !important; }
.big { width: 92px; height: 92px; font-size: 32px; background: rgba(170, 120, 30, 0.9) !important; border-color: #ffe2a0 !important; }
.big.idle { opacity: 0.55; background: var(--panel) !important; border-color: rgba(255, 255, 255, 0.35) !important; }
.big small { max-width: 84px; text-align: center; white-space: normal; }

.sm.build { background: rgba(60, 110, 160, 0.9) !important; border-color: #9fd0ff !important; }
#buildbar { position: fixed; right: calc(env(safe-area-inset-right) + 12px); bottom: calc(env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#buildbar .row { display: flex; gap: 10px; align-items: flex-end; }
#buildbar button { border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; touch-action: none; }
#buildbar button small { font-size: 10px; font-weight: 800; margin-top: 3px; }
#buildbar button:active { transform: scale(0.94); }
#buildbar .big { background: rgba(50, 140, 70, 0.92) !important; border-color: #b8f0b0 !important; }
#buildbar .mid { background: rgba(60, 110, 160, 0.9) !important; }
#bb-name { background: var(--panel-solid); border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; font-size: 12px; font-weight: 800; max-width: 80vw; }
.tag.land .nm { background: rgba(90, 70, 30, 0.6); font-size: 10px; }
.tag.land.me .nm { background: rgba(60, 120, 50, 0.8); }

/* lembar bawah (tas, rumah, dialog) */
#sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100vw, 520px); max-height: 62vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 12px 14px calc(env(safe-area-inset-bottom) + 14px); animation: up 0.2s ease-out; touch-action: pan-y; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sheet-head b { font-family: var(--title); font-weight: 400; font-size: 20px; letter-spacing: 0.5px; }
#sheet-x { background: none; border: 0; font-size: 20px; padding: 4px 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.item { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 700; }
.item .ic { font-size: 26px; display: block; }
.item .n { color: var(--gold); }
.empty { opacity: 0.7; font-size: 13px; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.opt .ic { font-size: 24px; }
.opt small { display: block; font-weight: 600; opacity: 0.75; font-size: 12px; }
.opt:disabled, .opt.off { opacity: 0.45; }
#sheet-body > b { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--gold); }
.tag.work .nm { background: rgba(200, 130, 20, 0.9); color: #1a1000; }
.tag.warn .nm { background: rgba(190, 50, 40, 0.88); animation: bob 1s ease-in-out infinite; }
.tag.me .mk, .tag.npc .mk { font-size: 18px; }
.say { display: flex; gap: 10px; align-items: flex-start; }
.say .face { font-size: 34px; }
.say p { margin: 0; font-size: 14px; line-height: 1.45; background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 10px 12px; }
.mbox { margin: 10px 0; padding: 10px 12px; border: 1px dashed var(--gold); border-radius: 12px; font-size: 13px; }
.mbox b { color: var(--gold); }
.cta { width: 100%; padding: 13px; border: 0; border-radius: 12px; background: var(--gold); color: #2a1a00; font-family: var(--title); font-size: 18px; letter-spacing: 0.5px; }

#chatbox { position: fixed; left: 8px; right: 8px; bottom: calc(env(safe-area-inset-bottom) + 8px); display: flex; gap: 6px; }
#chatbox input { flex: 1; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--ink); }
#chatbox button { padding: 0 16px; border-radius: 12px; border: 0; background: var(--gold); color: #2a1a00; font-weight: 800; }

#dead { position: fixed; inset: 0; background: rgba(40, 0, 0, 0.78); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#dead h1 { font-family: var(--title); font-weight: 400; font-size: 44px; color: #ff6a5e; margin: 0 0 8px; letter-spacing: 1px; }
#dead .note { opacity: 0.75; font-size: 13px; }
#dead button { margin-top: 14px; padding: 14px 22px; border: 0; border-radius: 14px; background: var(--gold); color: #2a1a00; font-family: var(--title); font-size: 18px; }

/* layar masuk */
#join { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(rgba(10, 20, 12, 0.35), rgba(10, 20, 12, 0.85)); overflow: auto; touch-action: pan-y; }
.card { width: min(100%, 400px); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 20px; padding: 20px 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.logo { font-family: var(--title); text-align: center; font-size: 30px; line-height: 0.95; color: #fff; letter-spacing: 2px; }
.logo span { display: block; font-size: 46px; color: var(--gold); text-shadow: 0 4px 0 #6a3a10; }
.sub { text-align: center; font-size: 13px; opacity: 0.85; margin: 8px 0 14px; }
.field { display: block; font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.field input { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--ink); }
.pick { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.pick > span { width: 56px; font-size: 12px; font-weight: 800; }
.pick > div { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.pick button { border: 2px solid transparent; border-radius: 10px; background: rgba(255, 255, 255, 0.08); padding: 6px 9px; font-size: 12px; font-weight: 800; }
.pick button.sw { width: 32px; height: 32px; padding: 0; }
.pick button.sel { border-color: var(--gold); }
#btn-join { width: 100%; margin-top: 12px; padding: 14px; border: 0; border-radius: 14px; background: var(--gold); color: #2a1a00; font-family: var(--title); font-size: 22px; letter-spacing: 1px; }
#joinmsg { text-align: center; font-size: 13px; min-height: 1em; color: #ffb0a0; }
.tip { font-size: 11px; opacity: 0.65; text-align: center; margin: 0; }

.chip { pointer-events: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 5px 11px; font-size: 12px; font-weight: 800; }
.chip.on { background: rgba(60, 110, 160, 0.92); border-color: #9fd0ff; }
.camchips { display: flex; gap: 5px; justify-content: flex-end; pointer-events: auto; }
.chip.zm { width: 30px; padding: 5px 0; font-size: 16px; line-height: 1; }
.chip:active { transform: scale(0.94); }
.tag.npc.rich .nm { background: linear-gradient(#e8b84a, #b0802a); color: #2a1a00; }

/* transisi masuk lahan: kilasan iris + papan nama yang turun dari atas */
#warp { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 55%, transparent 0 30%, rgba(255, 246, 220, 0.0) 31%, rgba(20, 30, 20, 0.75) 75%); }
#warp.go { animation: warp 1.1s ease-in-out; }
@keyframes warp { 0% { opacity: 0; transform: scale(1.3); } 35% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.15); } }
#banner { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); transform: translate(-50%, -140%); opacity: 0; pointer-events: none;
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 9px 20px 10px 14px; border-radius: 16px; background: linear-gradient(#fff6dc, #f2dfb0); color: #3a2410; border: 3px solid #b07a30;
  box-shadow: 0 6px 0 #7a4f1a, 0 12px 30px rgba(0, 0, 0, 0.35); transition: transform 0.45s cubic-bezier(.2, 1.4, .4, 1), opacity 0.3s; }
#banner.show { transform: translate(-50%, 0); opacity: 1; }
#banner i { grid-row: span 2; font-style: normal; font-size: 30px; }
#banner b { font-family: var(--title); font-weight: 400; font-size: 21px; letter-spacing: 0.5px; white-space: nowrap; }
#banner small { font-size: 12px; font-weight: 800; opacity: 0.75; white-space: nowrap; }

/* game dimainkan mendatar: minta putar HP bila tegak */
#rotate { display: none; position: fixed; inset: 0; z-index: 50; background: #16231a; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px; }
#rotate div { font-size: 56px; animation: tilt 1.6s ease-in-out infinite; }
#rotate b { font-family: var(--title); font-weight: 400; font-size: 24px; color: var(--gold); }
#rotate small { opacity: 0.75; }
@keyframes tilt { 50% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

@media (orientation: landscape) and (max-height: 500px) {
  #mission { max-width: 34vw; font-size: 11px; padding: 4px 8px; }
  .rb { width: 40px; height: 40px; font-size: 15px; }
  .rcam .rb { width: 34px; height: 34px; font-size: 14px; }
  #mini { width: 96px; height: 96px; }
  #banner { top: calc(env(safe-area-inset-top) + 54px); }
  #chatlog { bottom: 12px; left: 50%; transform: translateX(-50%); width: 34vw; }
  .stats { width: 180px; padding: 5px 8px; }
  .bar { margin: 2px 0; }
  .sm { width: 46px; height: 46px; font-size: 18px; }
  .mid { width: 62px; height: 62px; font-size: 24px; }
  .big { width: 82px; height: 82px; font-size: 28px; }
  #stick { left: calc(env(safe-area-inset-left) + 92px); bottom: 70px; }
  #stickzone { width: 45vw; height: 75vh; }
  #sheet { max-height: 82vh; width: min(100vw, 560px); }
  .card { width: min(100%, 760px); display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; padding: 14px 18px; }
  .card .logo, .card .sub, .card #btn-join, .card #joinmsg, .card .tip { grid-column: 1 / -1; }
  .card .field { grid-column: 1 / -1; }
  .card #btn-tut { grid-column: 1 / -1; }
  .logo span { font-size: 36px; }
  .card.tcard { display: block; width: min(100%, 620px); }
}

/* ── tombol tambahan, panduan, tutorial, rumah, suara ── */
.ghost { width: 100%; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.06); color: var(--ink); font: inherit; font-weight: 800; font-size: 14px; }
.credit { font-size: 10px; margin-top: 6px; }
#fr-badge { font-style: normal; display: inline-block; min-width: 16px; margin-left: 4px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; }
.chip.live { background: rgba(50, 140, 70, 0.92); border-color: #b8f0b0; }
.chip.muted { background: rgba(140, 50, 40, 0.9); border-color: #ffb0a0; }
.chip.talking { box-shadow: 0 0 0 2px #b8f0b0, 0 0 12px #5cc46a; }
#pausechip { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); background: rgba(60, 110, 160, 0.92); border: 1px solid #9fd0ff; border-radius: 12px; padding: 5px 12px; font-size: 12px; font-weight: 800; pointer-events: none; animation: pulse 1.6s infinite; }
#roomchip { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 800; }
#btn-hit { position: relative; }
#dur { position: absolute; left: 12%; right: 12%; bottom: 7px; height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.55); overflow: hidden; }
#dur s { display: block; height: 100%; width: 100%; background: #5cc46a; transition: width 0.3s; }
#dur.warn s { background: #f2c14e; }
#dur.bad s { background: #e5534b; animation: pulse 0.6s infinite; }
#guide { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.45); z-index: 30; }
.gcard { width: min(100%, 420px); max-height: 88vh; overflow: auto; background: var(--panel-solid); border: 2px solid var(--gold); border-radius: 18px; padding: 14px 16px; text-align: center; animation: gpop 0.3s ease-out; }
.gcard .gic { font-size: 40px; line-height: 1; }
.gcard > b { display: block; font-family: var(--title); font-weight: 400; font-size: 21px; color: var(--gold); margin: 4px 0 6px; }
.gcard ol { text-align: left; margin: 0 0 12px; padding-left: 22px; font-size: 13.5px; line-height: 1.45; }
.gcard li { margin: 3px 0; }
@keyframes gpop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
#tut { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(8, 14, 10, 0.86); z-index: 40; }
.tcard { max-height: 94vh; overflow: auto; }
.tstep { text-align: center; font-size: 12px; font-weight: 800; opacity: 0.7; margin-bottom: 4px; }
#t-body h2 { font-family: var(--title); font-weight: 400; color: var(--gold); text-align: center; font-size: 24px; margin: 2px 0 8px; }
#t-body .tbig { font-size: 44px; text-align: center; line-height: 1; }
#t-body ul { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.5; }
#t-body li { margin: 3px 0; }
.tskip { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 12px; margin: 10px 0 6px; opacity: 0.85; }
.trow { display: flex; gap: 8px; }
.trow .ghost { margin-top: 0; flex: 1; }
.trow .cta { flex: 2; }
.tag .mic { display: inline-block; margin-right: 3px; font-size: 11px; }
.tag .mic.on { filter: drop-shadow(0 0 4px #5cc46a); }
.fr-row { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.fr-row .nm { flex: 1; font-weight: 800; }
.fr-row .st { font-size: 11px; opacity: 0.75; font-weight: 600; display: block; }
.fr-row button { border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.08); color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; padding: 5px 9px; }
.fr-row button.go { background: var(--green); color: #0a2010; border-color: transparent; }
.lockbox { border: 1px dashed var(--red); border-radius: 12px; padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.lockbox .ok { color: var(--green); }
.lockbox .no { color: #ffb0a0; }

/* ── KTW Desa Sukamati: gerbang warga Pak Kades, loket, kartu, mode tamu ── */
#gate, #ktp, #ktpview { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 14px; background: linear-gradient(rgba(10, 20, 12, 0.4), rgba(10, 20, 12, 0.88)); overflow: auto; touch-action: pan-y; }
#gate[hidden], #ktp[hidden], #ktpview[hidden], #join[hidden] { display: none; }
.card.gatecard, .card.kcard { display: block !important; width: min(100%, 460px); max-height: calc(100vh - 28px); overflow: auto; background: #fbf5e6; color: #2a2418; border: 0; padding: 18px 18px 16px; }
.gatecard h2 { font-family: var(--title); font-weight: 400; font-size: 25px; margin: 10px 0 6px; color: #23402c; line-height: 1.1; }
.gatecard p, .kcard p { font-size: 14px; line-height: 1.45; margin: 6px 0; }
.chip-kades { display: inline-block; background: #2f7a55; color: #fff; font-weight: 800; font-size: 13px; padding: 4px 12px; border-radius: 20px; }
.follow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.follow a { display: flex; flex-direction: column; align-items: center; gap: 1px; text-decoration: none; color: #fff; font-weight: 800; font-size: 13px; padding: 8px 4px; border-radius: 12px; }
.follow a small { font-size: 10px; font-weight: 600; opacity: 0.9; }
.f-ig { background: linear-gradient(135deg, #f58529, #dd2a7b 55%, #8134af); }
.f-tt { background: #111; box-shadow: inset 2px 0 0 #25f4ee, inset -2px 0 0 #fe2c55; }
.f-yt { background: #e62117; }
.follow.mini { margin: 0; grid-template-columns: repeat(3, auto); }
.follow.mini a { padding: 5px 9px; font-size: 11px; flex-direction: row; gap: 4px; }
.follow.mini a small { display: none; }
.wcount { text-align: center; font-size: 14px; margin: 6px 0 10px; color: #5a4a2a; }
.wcount b { font-family: var(--title); font-weight: 400; font-size: 22px; color: #1f7a72; }
.gatecard .cta, .kcard .cta { background: #1f7a72; color: #fff; display: block; text-align: center; text-decoration: none; }
.gatecard #g-login { width: 100%; margin-top: 8px; padding: 11px; border-radius: 12px; border: 2px solid #1f7a72; background: #fff; color: #1f7a72; font: inherit; font-weight: 800; font-size: 15px; }
.gatecard .ghost, .kcard .ghost { color: #2a2418; background: #f1e8d2; border-color: #e2d4b0; }
.legal { text-align: center; font-size: 11px !important; opacity: 0.7; margin-top: 10px !important; }
.legal a { color: inherit; }
.kerr { color: #b23a20; font-weight: 800; font-size: 13px !important; min-height: 1em; }
.kerr a { color: #1f7a72; }
.khead { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; }
.khead > span { font-size: 26px; }
.khead div { flex: 1; line-height: 1.15; }
.khead b { display: block; font-size: 15px; }
.khead small { font-size: 12px; opacity: 0.65; }
.khead .chip { background: #f1e8d2; color: #2a2418; border-color: #e2d4b0; }
.kcard h3 { font-size: 18px; margin: 10px 0 4px; }
.ks { font-size: 13px !important; color: #6a5a3a; }
.ks a { color: #1f7a72; font-weight: 800; }
.kq { display: flex; justify-content: space-between; background: #1f7a72; color: #fff; border-radius: 12px; padding: 8px 16px; position: relative; }
.kq small { display: block; font-size: 9px; letter-spacing: 1px; opacity: 0.8; }
.kq b { font-family: ui-monospace, Consolas, monospace; font-size: 22px; letter-spacing: 1px; }
.kq .r { text-align: right; }
.ksteps { display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; padding: 0; margin: 10px 0 4px; text-align: center; }
.ksteps i { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: 12px; background: #ece2c8; color: #8a7a5a; }
.ksteps span { display: block; font-size: 10px; font-weight: 800; color: #8a7a5a; margin-top: 3px; line-height: 1.2; }
.ksteps .on i { background: #e8a92a; color: #fff; }
.ksteps .done i { background: #2f7a55; color: #fff; }
.ksteps .on span { color: #2a2418; }
.plats { display: flex; gap: 6px; margin: 8px 0; }
.plats button { flex: 1; padding: 8px 4px; border-radius: 10px; border: 2px solid #e2d4b0; background: #fff; color: #2a2418; font: inherit; font-weight: 800; font-size: 13px; }
.plats button.sel { border-color: #1f7a72; background: #e2f2ef; }
.kf { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #6a5a3a; margin: 8px 0; }
.kf input { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 17px; padding: 11px 12px; border-radius: 12px; border: 1px solid #e2d4b0; background: #f4ecd8; color: #2a2418; letter-spacing: 0; user-select: text; -webkit-user-select: text; }
.kchk { display: flex; gap: 8px; font-size: 12px; line-height: 1.35; margin: 8px 0; color: #4a3a22; }
.kchk input { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.krow { display: flex; gap: 8px; margin-top: 6px; }
.krow > * { flex: 1; margin-top: 0 !important; }
.krow .cta { flex: 1.4; font-size: 16px; padding: 12px; }
.kreq { margin-top: 12px; border: 1px dashed #d8c69a; border-radius: 12px; padding: 8px 12px; font-size: 12px; }
.kreq ol { margin: 4px 0 0; padding-left: 18px; line-height: 1.45; }
.kcode { display: flex; align-items: center; gap: 10px; justify-content: center; background: #fff; border: 2px dashed #1f7a72; border-radius: 14px; padding: 12px; margin: 10px 0; }
.kcode b { font-family: ui-monospace, Consolas, monospace; font-size: 32px; letter-spacing: 2px; color: #1f5a54; user-select: all; -webkit-user-select: all; }
.kcode button { padding: 7px 10px; border-radius: 10px; border: 1px solid #e2d4b0; background: #f1e8d2; font: inherit; font-weight: 800; font-size: 13px; color: #2a2418; }
.kbtn { margin: 6px 0; padding: 12px !important; font-size: 17px !important; border-radius: 12px; }
.kwait { display: flex; align-items: center; gap: 10px; background: #fff4d8; border-radius: 12px; padding: 10px 12px; margin: 10px 0 4px; font-size: 13px; font-weight: 800; color: #6a4a10; }
.kwait a { color: #1f7a72; }
.spin { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 3px solid #f0d79a; border-top-color: #e8a92a; animation: kspin 0.9s linear infinite; }
@keyframes kspin { to { transform: rotate(360deg); } }

/* kartu KTW Desa Sukamati */
.ktpcard { position: relative; margin: 10px 0; border-radius: 16px; overflow: hidden; color: #fff; background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.14), transparent 40%), repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 6px, transparent 6px 14px), linear-gradient(135deg, #1f6a5a, #2b8a6a 55%, #1d5a4a); border: 3px solid #e8b84a; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); font-size: 12px; }
.kc-top { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: rgba(0, 0, 0, 0.18); }
.kc-logo { font-size: 24px; }
.kc-top b { display: block; font-family: var(--title); font-weight: 400; font-size: 17px; letter-spacing: 1px; }
.kc-top small { font-size: 9px; letter-spacing: 1.5px; color: #f2d27a; }
.kc-top em { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 800; background: #f2c14e; color: #3a2400; border-radius: 10px; padding: 3px 8px; }
.kc-main { display: flex; gap: 12px; padding: 10px 12px 4px; }
.kc-photo { width: 82px; flex: none; background: #f6efdc; border-radius: 10px; padding: 8px 4px 4px; text-align: center; }
.kc-photo span { display: inline-flex; width: 56px; height: 56px; border-radius: 50%; background: #8a5ac8; color: #fff; align-items: center; justify-content: center; font-family: var(--title); font-size: 28px; }
.kc-photo small { display: block; color: #6a5a3a; font-size: 8px; font-weight: 800; margin-top: 4px; }
.kc-main dl { margin: 0; flex: 1; min-width: 0; }
.kc-main dt { font-size: 8px; letter-spacing: 1px; color: #f2d27a; font-weight: 800; margin-top: 3px; }
.kc-main dd { margin: 0; font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kc-main dd.kc-name { font-family: var(--title); font-weight: 400; font-size: 19px; }
.kc-foot { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 12px 9px; font-size: 9px; opacity: 0.95; }
.kc-stamp { width: 54px; height: 54px; border: 2px solid rgba(255, 110, 90, 0.85); border-radius: 50%; color: rgba(255, 140, 120, 0.95); display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 8px; line-height: 1.1; transform: rotate(-14deg); }
.kvwrap { width: min(100%, 440px); }
#ktpstrip { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; background: rgba(242, 193, 78, 0.12); border: 1px solid rgba(242, 193, 78, 0.5); border-radius: 12px; padding: 7px 10px; margin-bottom: 10px; font-size: 13px; }
#ktpstrip[hidden] { display: none; }
#ktpstrip b { flex: 1; }
#ktpstrip button { background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); border-radius: 10px; padding: 4px 9px; font: inherit; font-size: 12px; font-weight: 800; color: var(--ink); }

/* mode tamu: hanya melihat-lihat */
#guestbar { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; width: min(96vw, 820px); background: rgba(251, 245, 230, 0.96); color: #2a2418; border-radius: 16px; padding: 8px 10px; pointer-events: auto; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); z-index: 5; }
#guestbar[hidden] { display: none; }
.gb-txt { flex: 1; font-size: 12px; line-height: 1.3; }
#guestbar .cta { width: auto; padding: 8px 12px; font-size: 14px; background: #1f7a72; color: #fff; white-space: nowrap; }
#guestbar .chip { background: #f1e8d2; color: #2a2418; border-color: #e2d4b0; }
body.guest .lcol, body.guest .pad, body.guest #mission, body.guest .coin, body.guest #btn-dia, body.guest #btn-cam, body.guest #buildbar, body.guest #chatlog { display: none !important; }
@media (orientation: landscape) and (max-height: 500px) {
  .card.gatecard, .card.kcard { width: min(100%, 560px); padding: 12px 16px; }
  .gatecard h2 { font-size: 21px; margin: 6px 0 4px; }
  .gb-txt { font-size: 11px; }
}

/* ── v3: label gedung umum (bisa diketuk), iuran warga ─────────────────── */
.tag.bld { pointer-events: auto; cursor: pointer; }
.tag.bld .nm { font-size: 12px; padding: 4px 11px; border-radius: 999px; background: rgba(28, 34, 46, 0.88); border: 1.5px solid rgba(255, 240, 200, 0.55); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.tag.bld.gold .nm { background: linear-gradient(180deg, #f6d06a, #d9a22a); color: #2a1a00; border-color: #fff3c0; }
.tag.bld.near .nm { background: #2f8a4a; border-color: #b8ffcc; animation: bob 1s ease-in-out infinite; }
.tag.bld.gold.near .nm { background: linear-gradient(180deg, #ffe08a, #e8b03a); }
.tag.bld:active .nm { transform: scale(0.94); }
.btn-saweria { display: block; text-align: center; margin: 12px 0 4px; padding: 14px; border-radius: 12px; background: #f2c14e; color: #2a1a00; font-family: var(--title); font-size: 18px; text-decoration: none; box-shadow: 0 3px 0 #9a6a10; }
.btn-saweria:active { transform: translateY(2px); box-shadow: 0 1px 0 #9a6a10; }
.iubar { height: 10px; margin: 8px 0 4px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.iubar i { display: block; height: 100%; background: linear-gradient(90deg, #f2c14e, #ffe08a); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: inherit; font-weight: 800; }
.tabs button.on { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
.iulist { list-style: none; margin: 0 0 10px; padding: 0; }
.iulist li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px; }
.iulist .rk { width: 22px; text-align: center; font-weight: 800; opacity: 0.7; }
.iulist .nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iulist .am { font-weight: 800; color: var(--gold); }

/* jendela iuran di tengah layar (di atas banner ajakan KTW tamu) */
#sheet.center { top: 50%; bottom: auto; transform: translate(-50%, -50%); width: min(94vw, 520px); max-height: min(84vh, 720px); border: 1px solid var(--line); border-radius: 18px; padding-bottom: 16px; z-index: 8; animation: pop 0.18s ease-out; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* clan */
.ctag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--cc, #d84a4a); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.clform { display: flex; flex-direction: column; gap: 7px; margin: 6px 0 12px; }
.clform input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: var(--ink); font: inherit; font-size: 14px; }
.clcols { display: flex; flex-wrap: wrap; gap: 8px; }
.clcol { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); cursor: pointer; }
.clcol.on { border-color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.cllog { max-height: 160px; overflow-y: auto; font-size: 12px; margin: 4px 0 10px; }
.cllog div { padding: 4px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.cllog small { opacity: 0.6; margin-right: 4px; }

/* bendera clan */
.cfl { height: 11px; vertical-align: -1px; margin-right: 3px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5); }
.tag .nm .ctag { font-size: 10px; padding: 0 5px; letter-spacing: 0.5px; }
.cflab { font-weight: 900; font-size: 11.5px; color: var(--gold); margin: 6px 0 0; letter-spacing: 0.3px; }
.cfcnt { font-size: 11.5px; opacity: 0.8; margin-top: -3px; }
.cfcnt.bad { color: var(--red); opacity: 1; font-weight: 800; }
.cflogos { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.cflogo { aspect-ratio: 1; padding: 3px; border-radius: 9px; background: rgba(255, 255, 255, 0.07); border: 1.5px solid var(--line); }
.cflogo img { width: 100%; display: block; pointer-events: none; }
.cflogo.on { border-color: #fff; box-shadow: 0 0 0 3px var(--gold); background: rgba(242, 193, 78, 0.2); }
.clform .tabs { margin: 0; }
.clform .tabs button:disabled { opacity: 0.3; }
.cfpv { display: flex; gap: 8px; align-items: flex-end; }
.cfpv img { border-radius: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); }
#cf-big { width: 64%; } #cf-small { width: 28%; }
.clbanner { display: block; width: 100%; max-width: 330px; margin: 0 auto 8px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
