html, body { overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.title-art { width: 100%; max-width: 288px; height: auto; image-rendering: pixelated; align-self: center; }
.title-buttons { display: flex; flex-direction: column; gap: 10px; }
.title-note { margin: 0; color: var(--muted); font-size: 13px; }

.console {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0e0b16;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.stage {
  position: relative;
  flex: none;
  width: min(100%, 640px, calc((100dvh - 236px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 240 / 208));
  aspect-ratio: 240 / 208;
  container-type: inline-size;
  overflow: hidden;
  background: #000;
}
.stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.stage #view3d { image-rendering: auto; }

.stage-nav { position: absolute; top: 3cqw; right: 3cqw; display: flex; gap: 6px; z-index: 3; }
.stage-btn { width: 34px; height: 34px; display: grid; place-items: center; font-size: 16px; font-weight: 800; color: #fff; text-decoration: none; background: rgba(22, 19, 31, .78); border-radius: 50%; }

.fade { position: absolute; inset: 0; background: #0e0b16; opacity: 0; pointer-events: none; transition: opacity .22s linear; }
.fade.on { opacity: 1; }

.place {
  position: absolute;
  top: 3cqw;
  left: 3cqw;
  max-width: calc(100% - 6cqw - 84px);
  padding: 1.2cqw 3cqw;
  font-size: clamp(12px, 3.6cqw, 20px);
  font-weight: 800;
  background: rgba(22, 19, 31, .86);
  border-left: 4px solid var(--sun);
}

.tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 0 1.2cqw;
  font-size: clamp(9px, 2.7cqw, 15px);
  font-weight: 800;
  white-space: nowrap;
  color: #fff6e6;
  background: rgba(22, 19, 31, .78);
  border-radius: 3px;
}

.invite {
  position: fixed;
  z-index: 40;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  right: max(10px, env(safe-area-inset-right));
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  font-weight: 800;
  background: var(--panel);
  border: 2px solid var(--sun);
  border-radius: 8px;
}
.invite span { flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
.invite .btn { flex: 1; }

.dialog {
  position: absolute;
  left: 2cqw;
  right: 2cqw;
  bottom: 2cqw;
  min-height: 17cqw;
  padding: 2.4cqw 3.4cqw;
  background: #fff6e6;
  color: #231a2c;
  border: 3px solid #231a2c;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #e2b873;
}
.dialog p { margin: 0; font-size: clamp(14px, 4.2cqw, 23px); font-weight: 600; line-height: 1.32; }
#dialogMore {
  position: absolute;
  right: 3cqw;
  bottom: 1.6cqw;
  width: 0;
  height: 0;
  border: 1.5cqw solid transparent;
  border-top-color: var(--hot);
  border-bottom-width: 0;
  animation: bob .7s ease-in-out infinite alternate;
}
@keyframes bob { to { transform: translateY(1cqw); } }

.hud {
  position: absolute;
  width: 44cqw;
  padding: 1.2cqw 2.2cqw 1.4cqw;
  color: #231a2c;
  background: #fff6e6;
  border: 2px solid #231a2c;
  border-radius: 5px;
}
.hud.foe { top: 3.5cqw; left: 3cqw; }
.hud.me { top: 50cqw; right: 3cqw; }
.hud-top, .hud-bottom { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.hud-name { font-size: clamp(12px, 3.8cqw, 21px); font-weight: 900; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-lv { font-size: clamp(10px, 3cqw, 17px); font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-num { font-size: clamp(10px, 3cqw, 17px); font-weight: 800; font-variant-numeric: tabular-nums; margin-left: auto; }
.hud-st { font-size: clamp(9px, 2.5cqw, 14px); font-weight: 900; color: #fff; padding: 0 1cqw; border-radius: 3px; }
.hud-st:empty { display: none; }
.hud-bottom { min-height: 1.1em; }
.hud.foe .hud-bottom { min-height: 0; }

.bar { height: 1.9cqw; min-height: 6px; margin-top: .6cqw; background: #3b3144; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: #4cc265; transition: width .42s ease-out, background-color .2s; }
.bar i.mid { background: #e9b52c; }
.bar i.low { background: #e0483a; }
.bar.xp { height: 1.1cqw; min-height: 3px; }
.bar.xp i { background: #4d9de0; }

.deck { flex: 1; width: 100%; max-width: 640px; min-height: 0; display: flex; padding: 10px 14px; }

.pad { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.dpad {
  position: relative;
  justify-self: start;
  width: min(162px, 42vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #2b2439 58%, #231e31 59%);
  touch-action: none;
}
.dpad::before, .dpad::after { content: ""; position: absolute; background: #41385a; border-radius: 8px; }
.dpad::before { left: 34%; right: 34%; top: 8%; bottom: 8%; }
.dpad::after { top: 34%; bottom: 34%; left: 8%; right: 8%; }
.arrow { position: absolute; z-index: 1; width: 0; height: 0; border: 8px solid transparent; opacity: .75; pointer-events: none; }
.arrow.up { top: 13%; left: calc(50% - 8px); border-bottom-color: var(--ink); border-top-width: 0; }
.arrow.down { bottom: 13%; left: calc(50% - 8px); border-top-color: var(--ink); border-bottom-width: 0; }
.arrow.left { left: 13%; top: calc(50% - 8px); border-right-color: var(--ink); border-left-width: 0; }
.arrow.right { right: 13%; top: calc(50% - 8px); border-left-color: var(--ink); border-right-width: 0; }
.dpad[data-dir="up"] .arrow.up, .dpad[data-dir="down"] .arrow.down, .dpad[data-dir="left"] .arrow.left, .dpad[data-dir="right"] .arrow.right { opacity: 1; filter: drop-shadow(0 0 4px var(--sun)); }

.centre { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pill {
  min-width: 72px;
  min-height: 34px;
  padding: 2px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.actions-ab { position: relative; justify-self: end; width: min(136px, 34vw); aspect-ratio: 1.1; }
.round {
  position: absolute;
  width: 56%;
  aspect-ratio: 1;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  color: #1d0f0a;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: none;
}
.round.a { right: 0; top: 0; background: var(--hot); }
.round.b { left: 0; bottom: 0; background: var(--sun); }
.round:active { transform: scale(.94); }

.battle-menu { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(64px, 84px); gap: 8px; align-content: center; }
.battle-menu button {
  min-height: 52px;
  padding: 4px 10px;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 8px;
  cursor: pointer;
}
.battle-menu button:active { transform: translateY(2px); }
.battle-menu button:focus-visible, .sheet button:focus-visible, .pill:focus-visible { outline: 3px solid var(--sun); outline-offset: 1px; }
.battle-menu .fight { background: var(--hot); border-color: #b63b1f; color: #1d0f0a; }
.battle-menu .move { display: flex; flex-direction: column; justify-content: center; font-size: 16px; line-height: 1.15; text-align: left; border-color: var(--type); border-left-width: 8px; }
.battle-menu .move small { font-size: 12px; font-weight: 700; font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.battle-menu .move:disabled { opacity: .45; }
.battle-menu .wide { grid-column: 1 / -1; min-height: 40px; font-size: 14px; font-style: normal; }

.sheet { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--night); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 2px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 20px; font-weight: 900; font-style: italic; color: var(--ink); text-transform: none; letter-spacing: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 12px 16px 24px; width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
button.row:active { transform: translateY(1px); }
.row:disabled { opacity: .5; cursor: default; }
.row.lead { border-color: var(--sun); }
.row img { flex: none; width: 56px; height: 56px; image-rendering: pixelated; }
.row img.unknown { filter: brightness(0) opacity(.55); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 800; }
.row-title small { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .cabar { flex: none; min-height: 40px; padding: 0 10px; }
input { -webkit-user-select: text; user-select: text; }
.name-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.sheet-body { color-scheme: dark; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head img { flex: none; width: 88px; height: 99px; image-rendering: pixelated; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 6px; }
.profile-head div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.profile-name { font-size: 24px; font-weight: 900; font-style: italic; overflow-wrap: anywhere; }
.profile-title { color: var(--sun); font-weight: 800; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat { display: flex; flex-direction: column; padding: 8px 10px; background: var(--panel); border-radius: 8px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.team-strip { display: flex; flex-wrap: wrap; gap: 4px; }
.team-strip img { width: 52px; height: 52px; image-rendering: pixelated; background: var(--panel); border-radius: 8px; }
.look-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.look { padding: 6px; background: var(--panel); border: 2px solid var(--line); border-radius: 8px; cursor: pointer; }
.look.on { border-color: var(--sun); }
.look img { display: block; width: 100%; aspect-ratio: 16 / 18; image-rendering: pixelated; }
.row-sub { color: var(--muted); font-size: 13px; line-height: 1.3; }
.row .bar { height: 7px; margin-top: 0; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { padding: 1px 7px; font-size: 11px; font-weight: 900; font-style: normal; color: #fff; border-radius: 4px; }
.section-label { margin: 8px 0 0; }
.money { color: var(--sun); font-weight: 900; font-variant-numeric: tabular-nums; }
.starter-grid { display: flex; flex-direction: column; gap: 8px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-actions .btn { flex: 1 1 120px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-mark { flex: 1 1 90px; padding: 10px 6px; text-align: center; font-size: 13px; font-weight: 800; color: var(--muted); background: var(--panel); border: 2px dashed var(--line); border-radius: 8px; }
.badge-mark.on { color: #1d0f0a; background: var(--sun); border: 2px solid var(--sun); }

@media (orientation: landscape) and (max-height: 560px) {
  .console { flex-direction: row; justify-content: center; }
  .stage { width: auto; height: 100%; }
  .deck { max-width: none; align-items: center; }
  .pad { height: 100%; }
  .dpad { width: min(150px, 38dvh + 20px); }
}

@media (prefers-reduced-motion: reduce) {
  #dialogMore { animation: none; }
  .bar i, .fade { transition-duration: .01s; }
}

.emote-btn { position: absolute; z-index: 3; top: calc(3cqw + 40px); right: 2.5cqw; width: 44px; height: 44px; padding: 0; font-size: 24px; line-height: 1; background: rgba(22, 19, 31, .78); border: 2px solid var(--line); border-radius: 50%; cursor: pointer; }
.emote-btn[hidden], .emote-pick[hidden], .emote[hidden], .chat-bubble[hidden] { display: none; }
.rchat-btn { top: calc(3cqw + 90px); }
.mini-map { position: absolute; z-index: 3; left: 2.5cqw; bottom: 3cqw; width: clamp(76px, 26cqw, 132px); aspect-ratio: 1; padding: 0; background: #1d4f78; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.mini-map[hidden] { display: none; }
.mini-map canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.rchat-badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; font-size: 11px; line-height: 18px; color: #fff; background: #d9263f; border-radius: 9px; }
.rchat-badge[hidden], .rchat[hidden], .rchat-note[hidden] { display: none; }
.rchat { position: absolute; z-index: 4; left: 2.5cqw; right: calc(2.5cqw + 52px); bottom: 2.5cqw; height: min(44%, 300px); display: flex; flex-direction: column; gap: 4px; padding: 6px; color: var(--ink); background: rgba(22, 19, 31, .9); border: 2px solid var(--line); border-radius: 12px; }
.rchat-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--sun); }
.rchat-head button { width: 34px; height: 30px; padding: 0; font-size: 16px; color: var(--ink); background: none; border: 0; cursor: pointer; }
.rchat-log { flex: 1; min-height: 0; margin: 0; padding: 0 2px; overflow-y: auto; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 13px; line-height: 1.3; }
.rchat-log li { overflow-wrap: anywhere; }
.rchat-log li.mine b { color: var(--sun); }
.rchat-log time { margin-right: 5px; font-size: 10px; color: var(--muted); }
.rchat-log b { margin-right: 4px; color: #8fd3ff; }
.rchat-log small { margin-right: 5px; padding: 0 4px; font-size: 10px; color: #16131f; background: #c9c2d9; border-radius: 4px; }
.rchat-note { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.rchat-form { display: flex; gap: 4px; }
.rchat-form input { flex: 1; min-width: 0; height: 36px; padding: 0 8px; font-size: 16px; }
.rchat-form button { flex: none; width: 40px; height: 36px; padding: 0; font-size: 18px; color: #1d0f0a; background: var(--sun); border: 0; border-radius: 9px; cursor: pointer; }
.chat-bubble { position: absolute; max-width: 36cqw; transform: translate(5cqw, -10%); }
.chat-bubble.kiri { transform: translate(calc(-100% - 5cqw), -10%); }
.chat-bubble span { display: block; position: relative; padding: .8cqw 1.8cqw; font-size: clamp(12px, 3.4cqw, 18px); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; color: #231e31; background: #fff6e6; border-radius: 10px; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.chat-bubble span::before { content: ''; position: absolute; top: 40%; left: -5px; border: 5px solid transparent; border-left: 0; border-right-color: #fff6e6; }
.chat-bubble.kiri span::before { left: auto; right: -5px; border: 5px solid transparent; border-right: 0; border-left-color: #fff6e6; }
.emote-pick { position: absolute; z-index: 4; top: calc(3cqw + 140px); right: 2.5cqw; display: grid; grid-template-columns: repeat(6, 44px); gap: 4px; padding: 6px; background: rgba(22, 19, 31, .92); border: 2px solid var(--line); border-radius: 10px; }
.emote-pick button { width: 44px; height: 44px; padding: 0; font-size: 24px; line-height: 1; background: var(--panel); border: 0; border-radius: 8px; cursor: pointer; }
.emote-pick button:active { transform: scale(.92); }
.emote { position: absolute; transform: translate(-50%, calc(-100% - 4cqw)); }
.emote span { display: block; padding: 1cqw 1.6cqw; font-size: clamp(20px, 6.5cqw, 34px); line-height: 1.1; background: #fff6e6; border-radius: 12px; box-shadow: 0 2px 0 rgba(0, 0, 0, .35); animation: emote-pop .22s ease-out; }
@keyframes emote-pop { from { transform: scale(.3) translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }

.peta-board { position: relative; flex: none; overflow: hidden; border: 2px solid var(--line); border-radius: 8px; background: #3b8fc6; }
.peta-canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.peta-area { position: absolute; display: flex; align-items: flex-start; justify-content: center; padding: 2px; font: inherit; background: none; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.peta-area.on { background: rgba(255, 255, 255, .12); border-color: var(--sun); }
.peta-area span { padding: 1px 5px; font-size: clamp(9px, 2.7vw, 13px); font-weight: 800; line-height: 1.15; color: #fff6e6; background: rgba(22, 19, 31, .82); border-radius: 3px; }
.peta-area span:empty { display: none; }
.peta-you { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--sun); border: 2px solid #16131f; border-radius: 50%; pointer-events: none; animation: peta-pulse 1.3s ease-out infinite; }
@keyframes peta-pulse { from { box-shadow: 0 0 0 0 rgba(255, 214, 90, .85); } to { box-shadow: 0 0 0 14px rgba(255, 214, 90, 0); } }
.peta-goal .row-title { font-weight: 800; line-height: 1.25; }
.peta-goal { cursor: default; border-color: var(--sun); }
.peta-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; }
.peta-legend span { display: inline-flex; align-items: center; gap: 5px; }
.peta-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.peta-legend .you::before { background: var(--sun); }
.peta-legend .peer::before { background: #4fc3ff; }
.peta-peers { position: absolute; inset: 0; pointer-events: none; }
.peta-peer { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: #4fc3ff; border: 2px solid #16131f; border-radius: 50%; }
.peta-peer span { position: absolute; left: 50%; bottom: 9px; transform: translateX(-50%); padding: 0 3px; font-size: 9px; font-weight: 800; line-height: 1.3; white-space: nowrap; color: #fff6e6; background: rgba(22, 19, 31, .78); border-radius: 3px; }
.peta-peer-note { margin: 0; }
.peta-legend .star::before { content: "★"; width: auto; height: auto; color: var(--sun); }
.peta-legend .fog::before { background: #334250; border-radius: 2px; }
.peta-detail { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--panel); border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  .peta-you, .emote span { animation: none; }
}

.npc-tag { color: var(--sun); }
.friend-tag { color: #9fe8a8; }
.mission-btn { position: absolute; z-index: 3; left: 50%; bottom: 3cqw; transform: translateX(-50%); min-height: 44px; padding: 0 18px; font: inherit; font-size: clamp(14px, 4.2cqw, 20px); font-weight: 900; white-space: nowrap; color: #16131f; background: var(--sun); border: 2px solid #16131f; border-radius: 10px; cursor: pointer; }

.menu-hero { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; }
.menu-hero > img { flex: none; width: 56px; height: 63px; image-rendering: pixelated; }
.menu-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu-who b { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }
.menu-who small, .menu-badges small { color: var(--muted); font-size: 12px; font-weight: 700; }
.menu-badges { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.menu-medals { display: flex; gap: 3px; }
.menu-medal { width: 26px; height: 26px; display: grid; place-items: center; font-size: 13px; background: var(--night); border: 1px dashed var(--line); border-radius: 50%; }
.menu-medal.on { font-size: 16px; background: rgba(255, 194, 61, .18); border: 1px solid var(--sun); }
.menu-goal, .menu-tile { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; text-align: left; color: var(--ink); cursor: pointer; }
.menu-goal { padding: 10px 12px; background: rgba(255, 194, 61, .1); border: 2px solid var(--sun); border-radius: 12px; }
.menu-goal .menu-icon { background: var(--sun); }
.menu-goal small { color: var(--sun); font-size: 12px; font-weight: 800; }
.menu-goal b { font-size: 14px; font-weight: 800; line-height: 1.3; }
.menu-goal:active, .menu-tile:active { transform: translateY(1px); }
.menu-section { display: flex; flex-direction: column; gap: 6px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.menu-tile { min-width: 0; min-height: 64px; padding: 8px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: 12px; }
/* Ikon barang dalam Beg */
.menu-icon.item-icon { width: 44px; height: 44px; font-size: 24px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.menu-icon { flex: none; width: 38px; height: 38px; display: grid; place-items: center; font-size: 20px; line-height: 1; background: var(--tile, var(--line)); border-radius: 10px; }
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.menu-tile b { font-size: 15px; font-weight: 800; line-height: 1.15; }
.menu-tile small { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.2; }
.menu-leave { justify-content: center; margin-top: 8px; }
body:has(.menu-hero) .sembang-butang, body:has(.menu-hero) .mw { display: none; }
.sheet button.menu-goal:focus-visible, .sheet button.menu-tile:focus-visible { outline: 3px solid var(--sun); outline-offset: 1px; }

.acc-preview { position: relative; flex: none; width: 56px; height: 56px; }
.acc-preview i { position: absolute; width: 9px; height: 9px; background: var(--fx); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: acc-twinkle 1.3s ease-in-out infinite; }
.acc-preview i:nth-of-type(1) { left: 4px; top: 6px; }
.acc-preview i:nth-of-type(2) { right: 3px; top: 16px; animation-delay: .35s; }
.acc-preview i:nth-of-type(3) { left: 9px; bottom: 10px; animation-delay: .7s; }
.acc-preview i:nth-of-type(4) { right: 8px; bottom: 4px; animation-delay: 1s; }
@keyframes acc-twinkle { 0%, 100% { transform: scale(.1); opacity: 0; } 50% { transform: scale(1.3); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .acc-preview i { animation: none; } }

/* Ajar berjalan: sorotan langkah tutorial */

/* Nombor kerosakan dalam pertarungan */
.dmg { position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, -50%); pointer-events: none; animation: dmg-naik 1.1s ease-out forwards; }
.dmg b { font-size: clamp(18px, 6.5cqw, 34px); font-weight: 900; line-height: 1; color: #fff; -webkit-text-stroke: 1.5px #2a0d12; paint-order: stroke fill; text-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.dmg small { margin-top: 2px; padding: 0 5px; font-size: clamp(10px, 3cqw, 15px); font-weight: 900; white-space: nowrap; color: #2a0d12; background: #ffd23d; border-radius: 4px; }
.dmg.kuat b { font-size: clamp(22px, 8.5cqw, 44px); color: #ffd23d; }
.dmg.lemah b { color: #c9c2d9; }
.dmg.lemah small { color: #fff; background: #6b6280; }
.dmg.lain b { color: #ffab5e; }
.dmg.pulih b { color: #7ef0a0; -webkit-text-stroke-color: #0c2a17; }
@keyframes dmg-naik {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  30% { transform: translate(-50%, -70%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .dmg { animation-duration: 1.1s; animation-name: dmg-pudar; } }
@keyframes dmg-pudar { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* Buang makhluk dari geng */
.buang { margin-top: 18px; display: grid; gap: 8px; }
.buang-btn { width: 100%; background: transparent; border-color: #d0483c; color: #ff8a7f; }
.buang-amaran { color: #ffb4ab; margin: 0; }
.buang-row { display: flex; gap: 8px; }
.buang-row .btn { flex: 1 1 0; }
.buang-pasti { background: #d0483c; border-color: #d0483c; color: #fff; font-weight: 800; }

/* Babak perpisahan dalam dunia dan notis dalam Sembang Rimba */
.chat-bubble.pisah-chat { max-width: 46cqw; }
.chat-bubble.pisah-chat span { background: #fff3b8; }
.chat-bubble.pisah-chat span::before { border-right-color: #fff3b8; }
.chat-bubble.pisah-chat.kiri span::before { border-right-color: transparent; border-left-color: #fff3b8; }
.rchat-log li.lepas { color: #ffd98a; font-style: italic; }
.rchat-log li.hadiah { color: #9fe8b0; font-weight: 700; }
.sewa-baki { color: #ffd98a; font-weight: 700; }

/* Butang Daftar di profil pemain untuk pelawat */
.daftar-blok { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.daftar-blok .hint { margin: 0; }
.daftar-blok a.btn { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }

/* Tip makhluk keletihan */
.tip-letih { position: absolute; z-index: 5; top: calc(3cqw + 44px); left: 2.5cqw; right: calc(2.5cqw + 52px); display: flex; gap: 6px; align-items: flex-start; padding: 8px 10px; color: #231e31; background: #fff6e6; border: 3px solid #ff8a5b; border-radius: 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); font-size: 13px; line-height: 1.35; animation: tip-masuk .35s ease-out; }
.tip-letih[hidden] { display: none; }
.tip-letih-teks { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tip-letih-teks b { font-size: 14px; color: #b3361b; }
.tip-letih-tutup { flex: none; width: 28px; height: 28px; padding: 0; font-size: 14px; color: #6b6280; background: none; border: 0; cursor: pointer; }
@keyframes tip-masuk { from { transform: translateY(-10px); opacity: 0; } }

/* Animasi rawatan */
.rawat-show { position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(40, 120, 90, .92), rgba(10, 30, 40, .96) 70%); animation: rawat-masuk .35s ease-out; cursor: pointer; }
.rawat-show.tutup { opacity: 0; transition: opacity .3s; }
.rawat-glow { position: absolute; left: 50%; top: 45%; width: 70%; aspect-ratio: 1; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(170, 255, 200, .55), transparent 65%); animation: rawat-denyut 1.2s ease-in-out infinite; }
.rawat-show.siap .rawat-glow { background: radial-gradient(circle, rgba(255, 245, 170, .75), transparent 65%); }
.rawat-rings i { position: absolute; left: 50%; top: 45%; width: 30%; aspect-ratio: 1; border: 3px solid rgba(160, 255, 200, .8); border-radius: 50%; transform: translate(-50%, -50%) scale(.2); opacity: 0; animation: rawat-cincin 1.4s ease-out infinite; }
.rawat-sparks i { position: absolute; bottom: -20px; color: #b9ffcf; font-style: normal; font-weight: 900; text-shadow: 0 0 6px #6dff9c; animation: rawat-naik linear infinite; }
.rawat-sparks i.star { color: #fff3a0; text-shadow: 0 0 6px #ffd23d; }
.rawat-sparks i:not(.plus):not(.star) { width: 6px; height: 6px; background: #b9ffcf; border-radius: 50%; box-shadow: 0 0 8px #6dff9c; }
.rawat-team { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 92%; }
.rawat-mon { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; background: rgba(255, 255, 255, .1); border: 2px solid rgba(255, 255, 255, .25); border-radius: 12px; animation: rawat-muncul .45s ease-out backwards; }
.rawat-mon img { width: 56px; height: 56px; image-rendering: pixelated; transition: filter .4s, transform .4s; }
.rawat-mon.pengsan img { filter: grayscale(1) brightness(.6); transform: rotate(-8deg); }
.rawat-mon.segar { border-color: #8dffb0; box-shadow: 0 0 14px rgba(120, 255, 160, .8); }
.rawat-mon.segar img { filter: none; transform: none; animation: rawat-lompat .5s ease-out; }
.rawat-bar { width: 56px; height: 7px; overflow: hidden; background: rgba(0, 0, 0, .45); border-radius: 4px; }
.rawat-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4fd36b, #b6ff8a); transition: width .6s ease-out; }
.rawat-title { position: relative; padding: 0 12px; font-size: 18px; font-weight: 900; color: #eafff0; text-align: center; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); }
.rawat-title.siap { color: #fff3a0; animation: rawat-lompat .5s ease-out; }
@keyframes rawat-masuk { from { opacity: 0; } }
@keyframes rawat-denyut { 50% { transform: translate(-50%, -50%) scale(1.15); opacity: .7; } }
@keyframes rawat-cincin { 0% { transform: translate(-50%, -50%) scale(.2); opacity: .9; } 100% { transform: translate(-50%, -50%) scale(3); opacity: 0; } }
@keyframes rawat-naik { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-420px) scale(1.1); opacity: 0; } }
@keyframes rawat-muncul { from { transform: translateY(14px) scale(.7); opacity: 0; } }
@keyframes rawat-lompat { 40% { transform: translateY(-10px) scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .rawat-show, .rawat-glow, .rawat-rings i, .rawat-sparks i, .rawat-mon, .rawat-mon.segar img, .rawat-title.siap, .tip-letih { animation: none; }
  .rawat-sparks, .rawat-rings { display: none; }
}

/* ---- Naga Agung terbang melintasi langit ---- */
.naga-terbang { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.naga-lintas { position: absolute; left: 0; top: 0; will-change: transform; }
.naga-lintas img { position: relative; width: 100%; height: 100%; image-rendering: pixelated; filter: drop-shadow(0 0 10px #ffd23d) drop-shadow(0 0 22px #ffb43d); animation: naga-kepak 0.5s ease-in-out infinite alternate; }
.naga-cahaya { position: absolute; inset: -35%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 240, 170, 0.75) 0%, rgba(255, 200, 70, 0.35) 40%, rgba(255, 150, 40, 0) 70%); mix-blend-mode: screen; animation: naga-denyut 0.6s ease-in-out infinite alternate; }
.naga-cahaya::before { content: ''; position: absolute; inset: 10%; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 236, 150, 0.35) 0deg 6deg, transparent 6deg 45deg); animation: naga-sinar 3s linear infinite; }
.naga-bayang { position: absolute; left: 0; top: 0; height: 14px; border-radius: 50%; background: rgba(0, 0, 0, 0.22); filter: blur(3px); will-change: transform; }
.naga-percik { position: absolute; width: 5px; height: 5px; margin: -2px; border-radius: 50%; background: #ffe680; box-shadow: 0 0 8px 3px #ffc23d; color: #fff6b0; font-style: normal; font-size: 14px; line-height: 5px; text-shadow: 0 0 6px #ffd23d; animation: naga-percik 1.1s ease-out forwards; }
.naga-percik.pelangi { background: #fff; animation-name: naga-percik, naga-pelangi; animation-duration: 1.1s, 0.4s; animation-iteration-count: 1, infinite; }
/* Api naga: kon api dari mulut (kiri atas gambar), muncul semasa .hembus */
.naga-api { position: absolute; right: 95%; top: 25%; width: 160%; height: 42%; transform-origin: 100% 50%; transform: scaleX(0); opacity: 0; transition: transform .35s ease-out, opacity .25s; pointer-events: none; }
.naga-lintas.hembus .naga-api { transform: scaleX(1); opacity: 1; }
.naga-api i { position: absolute; top: 0; right: 0; height: 100%; clip-path: polygon(0 0, 100% 38%, 100% 62%, 0 100%); border-radius: 50%; animation: api-kelip .12s ease-in-out infinite alternate; }
.naga-api .api-luar { width: 100%; background: radial-gradient(ellipse at 100% 50%, rgba(255, 120, 30, .95) 0%, rgba(230, 50, 20, .8) 45%, rgba(160, 20, 10, 0) 75%); filter: blur(2px); }
.naga-api .api-tengah { width: 82%; top: 15%; height: 70%; background: radial-gradient(ellipse at 100% 50%, #fff3a0 0%, #ffb52e 40%, rgba(255, 110, 20, 0) 75%); animation-duration: .09s; }
.naga-api .api-teras { width: 45%; top: 32%; height: 36%; background: radial-gradient(ellipse at 100% 50%, #ffffff 0%, #fff6c8 45%, rgba(255, 230, 120, 0) 80%); animation-duration: .07s; }
.naga-terbang::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 25%, rgba(255, 140, 40, .28), rgba(255, 80, 20, 0) 70%); opacity: 0; transition: opacity .4s; }
.naga-terbang.panas::after { opacity: 1; }
.naga-bara { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #ffd04a; box-shadow: 0 0 8px 3px #ff6a1a; animation: naga-bara .9s ease-out forwards; }
@keyframes api-kelip { from { transform: scaleY(.88) scaleX(.96); opacity: .85; } to { transform: scaleY(1.08) scaleX(1.03); opacity: 1; } }
@keyframes naga-bara { from { opacity: 1; transform: translate(0, 0) scale(1.2); } to { opacity: 0; transform: translate(var(--hanyut), var(--naik)) scale(.2); } }
@media (prefers-reduced-motion: reduce) { .naga-api i { animation: none; } }
/* Ribut sebelum naga: mendung, kilat dan petir */
.naga-mendung { position: absolute; inset: 0; opacity: 0; background:
  radial-gradient(ellipse 30% 14% at 15% 6%, rgba(60, 64, 78, .95), rgba(60, 64, 78, 0) 70%),
  radial-gradient(ellipse 34% 16% at 48% 3%, rgba(48, 52, 66, .95), rgba(48, 52, 66, 0) 70%),
  radial-gradient(ellipse 30% 14% at 84% 7%, rgba(56, 60, 74, .95), rgba(56, 60, 74, 0) 70%),
  linear-gradient(rgba(20, 24, 40, .62), rgba(20, 24, 40, .38)); animation: naga-awan 6s ease-in-out infinite alternate; }
.naga-kilat { position: absolute; inset: 0; background: rgba(235, 240, 255, .85); opacity: 0; }
.naga-kilat.nyala { animation: naga-kilat .45s ease-out; }
.kilat-panah { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; animation: naga-kilat .42s ease-out forwards; }
.kilat-panah polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.kilat-panah .kilat-cahaya { stroke: rgba(170, 200, 255, .8); stroke-width: 9; filter: blur(3px); }
.kilat-panah .kilat-teras { stroke: #ffffff; stroke-width: 3; }
@keyframes naga-kilat { 0% { opacity: 1; } 15% { opacity: .2; } 30% { opacity: .9; } 100% { opacity: 0; } }
@keyframes naga-awan { from { background-position: 0 0; } to { background-position: 18px 0; } }
@media (prefers-reduced-motion: reduce) { .naga-mendung { animation: none; } .naga-kilat.nyala, .kilat-panah { animation-duration: .8s; } }
@keyframes naga-kepak { from { transform: translateY(-3%) scaleY(1); } to { transform: translateY(3%) scaleY(0.94); } }
@keyframes naga-denyut { from { opacity: 0.7; transform: scale(0.92); } to { opacity: 1; transform: scale(1.08); } }
@keyframes naga-sinar { to { transform: rotate(360deg); } }
@keyframes naga-percik { from { opacity: 1; transform: translateY(0) scale(1.3); } to { opacity: 0; transform: translateY(var(--jatuh)) scale(0.2); } }
@keyframes naga-pelangi { 0% { box-shadow: 0 0 8px 3px #ff4d4d; } 25% { box-shadow: 0 0 8px 3px #ffc23d; } 50% { box-shadow: 0 0 8px 3px #4fd98a; } 75% { box-shadow: 0 0 8px 3px #4fa8ff; } 100% { box-shadow: 0 0 8px 3px #e05cff; } }
@media (prefers-reduced-motion: reduce) {
  .naga-lintas img, .naga-cahaya, .naga-cahaya::before { animation: none; }
}

/* ---- Kilat skrin semasa hentaman pertarungan ---- */
.tempur-kilat { position: absolute; inset: 0; pointer-events: none; z-index: 5; mix-blend-mode: screen; animation: tempur-kilat 240ms ease-out forwards; }
@keyframes tempur-kilat { from { opacity: 1; } to { opacity: 0; } }

/* Label pemilik Naga Agung: emas berkilau */
.tag.naga-tag { color: #3a2400; background: linear-gradient(90deg, #ffd23d, #fff6b0, #ffb43d); box-shadow: 0 0 6px rgba(255, 200, 60, .9); animation: naga-tag 1.6s ease-in-out infinite alternate; }
@keyframes naga-tag { from { box-shadow: 0 0 4px rgba(255, 200, 60, .6); } to { box-shadow: 0 0 10px rgba(255, 220, 90, 1); } }
@media (prefers-reduced-motion: reduce) { .tag.naga-tag { animation: none; } }

/* Baki masa makhluk berdurasi; .atas = di atas label pemilik, .hampir = kurang seminit */
.tag.masa-tag { color: #dff8ff; background: rgba(16, 40, 70, .85); border: 1px solid rgba(140, 220, 255, .7); font-variant-numeric: tabular-nums; }
.tag.masa-tag.atas { transform: translate(-50%, -215%); }
.tag.masa-tag.hampir { color: #fff0f0; background: rgba(150, 30, 40, .9); border-color: #ff9a9a; animation: masa-hampir 0.8s ease-in-out infinite alternate; }
@keyframes masa-hampir { from { opacity: 1; } to { opacity: 0.6; } }

/* ---- Portal perpisahan: makhluk berjalan masuk dan hilang dengan kelip-kelip ---- */
.portal { position: absolute; width: 0; height: 0; pointer-events: none; }
.portal-cincin, .portal-teras { position: absolute; left: 0; top: 0; border-radius: 50%; transform: translate(-50%, -50%) scaleY(0.42); }
.portal-cincin { width: 15cqw; height: 15cqw; border: 0.9cqw solid #a85cff; box-shadow: 0 0 12px 4px #a85cff, inset 0 0 12px 4px #6be0ff; background: conic-gradient(from 0deg, rgba(107, 224, 255, .55), rgba(168, 92, 255, .2), rgba(255, 92, 168, .55), rgba(107, 224, 255, .55)); animation: portal-buka 0.6s ease-out, portal-pusing 1.2s linear infinite; }
.portal-cincin.dua { width: 10cqw; height: 10cqw; border-color: #6be0ff; animation: portal-buka 0.6s ease-out, portal-pusing 0.8s linear infinite reverse; }
.portal-teras { width: 6cqw; height: 6cqw; background: radial-gradient(circle, #ffffff 0%, #e0b0ff 45%, rgba(168, 92, 255, 0) 75%); animation: portal-denyut 0.5s ease-in-out infinite alternate; }
.portal.kilat .portal-teras { animation: portal-kilat 0.6s ease-out forwards; }
.portal.tutup .portal-cincin, .portal.tutup .portal-teras { animation: portal-tutup 1.2s ease-in forwards; }
.kelip-bintang { position: absolute; left: 0; top: 0; font-style: normal; font-size: clamp(12px, 4.2cqw, 24px); text-shadow: 0 0 6px currentColor, 0 0 12px currentColor, 0 0 2px #241a30; transform: translate(-50%, -50%); animation: kelip-bintang 1.3s ease-out forwards; opacity: 0; }
@keyframes portal-buka { from { transform: translate(-50%, -50%) scale(0); } }
@keyframes portal-pusing { from { transform: translate(-50%, -50%) scaleY(0.42) rotate(0deg); } to { transform: translate(-50%, -50%) scaleY(0.42) rotate(360deg); } }
@keyframes portal-denyut { from { opacity: .6; } to { opacity: 1; } }
@keyframes portal-kilat { 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 40% { transform: translate(-50%, -50%) scale(4); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(5); opacity: 0; } }
@keyframes portal-tutup { to { transform: translate(-50%, -50%) scale(0) rotate(270deg); opacity: 0; } }
@keyframes kelip-bintang {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  15% { opacity: 1; }
  30% { opacity: .2; }
  45% { opacity: 1; transform: translate(calc(-50% + var(--dx) * .5), calc(-50% + var(--dy) * .5)) scale(1.2); }
  60% { opacity: .3; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.4); }
}
@media (prefers-reduced-motion: reduce) { .portal-cincin, .portal-teras, .kelip-bintang { animation: none; } }

/* Darjat makhluk: Common → Immortal */
.chip.darjat { text-shadow: 0 1px 0 rgba(0,0,0,.35); letter-spacing: .02em; }
.chip.darjat.dj-mythic { box-shadow: 0 0 6px rgba(255,61,110,.7); }
.chip.darjat.dj-immortal { color: #10202a; text-shadow: none; background: linear-gradient(90deg,#ff7ad9,#ffe066,#5ff2ff,#a6ff8a,#ff7ad9) !important; background-size: 200% 100% !important; animation: dj-kilau 2.4s linear infinite; box-shadow: 0 0 8px rgba(95,242,255,.8); }
@keyframes dj-kilau { to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .chip.darjat.dj-immortal { animation: none; } }
.hud-dj { margin: 0 4px 0 auto; font-size: clamp(9px, 2.6cqw, 12px); align-self: center; flex: none; }
.darjat-info { margin: 6px 0; }
.darjat-tangga { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.darjat-tangga .chip.belum { opacity: .35; filter: grayscale(.6); }
.darjat-tangga .chip.kini { outline: 2px solid #fff; outline-offset: 1px; }

/* Babak perpisahan: naik darjat hingga Immortal */
.emote.darjat-naik span { color: #fff; font-size: clamp(14px, 4.4cqw, 22px); font-weight: 900; letter-spacing: .03em; text-shadow: 0 1px 2px rgba(0,0,0,.5); background: var(--dj); box-shadow: 0 0 10px var(--dj), 0 2px 0 rgba(0,0,0,.35); }
.emote.darjat-naik.akhir span { color: #10202a; text-shadow: none; background: linear-gradient(90deg,#ff7ad9,#ffe066,#5ff2ff,#a6ff8a,#ff7ad9); background-size: 200% 100%; animation: emote-pop .22s ease-out, dj-kilau 1.6s linear infinite; box-shadow: 0 0 14px rgba(95,242,255,.9); }
@media (prefers-reduced-motion: reduce) { .emote.darjat-naik.akhir span { animation: none; } }

/* Pemburu Makhluk: tangkal dibaling melengkung */
.tangkal-terbang { position: absolute; z-index: 2; pointer-events: none; font-size: clamp(14px, 4cqw, 22px); line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.tangkal-terbang[hidden] { display: none; }

/* Misi Pemula: butang Beg bercahaya bila HP makhluk liar rendah. */
.battle-menu button.tip-glow { animation: tipGlow 0.9s ease-in-out infinite; border-color: #ffd23d; }
@keyframes tipGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 61, 0.9); } 50% { box-shadow: 0 0 0 5px rgba(255, 210, 61, 0); } }
@media (prefers-reduced-motion: reduce) { .battle-menu button.tip-glow { animation: none; outline: 3px solid #ffd23d; } }

/* Misi Pemula: petunjuk arah ke semak. */
.arah-semak { position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: .4cqw; transform: translate(-50%, -100%); pointer-events: none; }
.arah-semak .arah-label { padding: .4cqw 1.6cqw; border-radius: 99px; background: #ffd23d; color: #231a2c; border: 2px solid #231a2c; font-size: clamp(10px, 3cqw, 16px); font-weight: 900; white-space: nowrap; }
.arah-semak .arah-panah { color: #ffd23d; font-size: clamp(18px, 6cqw, 34px); line-height: 1; -webkit-text-stroke: 2px #231a2c; paint-order: stroke fill; }
.arah-semak.atas { flex-direction: column; animation: arahLantun .8s ease-in-out infinite; }
.arah-semak.atas .arah-panah { transform: rotate(90deg); order: 2; }
.arah-semak.tepi { transform: translate(-50%, -50%); }
.arah-semak.tepi .arah-panah { animation: arahDenyut .8s ease-in-out infinite; }
.arah-semak.dalam { transform: translate(-50%, -100%); }
.arah-semak.dalam .arah-panah { display: none; }
.arah-semak.dalam .arah-label { white-space: normal; max-width: 60cqw; text-align: center; }
@keyframes arahLantun { 0%, 100% { margin-top: 0; } 50% { margin-top: -2.4cqw; } }
@keyframes arahDenyut { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .arah-semak.atas, .arah-semak.tepi .arah-panah { animation: none; } }

/* ---- Papan Juara di Kampung Seri Rimba ---- */
.juara-list, .juara-saya { display: flex; flex-direction: column; gap: 6px; }
.juara-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--panel); border: 2px solid transparent; border-radius: 10px; }
.juara-row.mine { border-color: #f6c945; }
.juara-row.top1 { background: linear-gradient(90deg, rgba(255, 210, 61, .28), var(--panel) 70%); }
.juara-row.top2 { background: linear-gradient(90deg, rgba(200, 210, 225, .28), var(--panel) 70%); }
.juara-row.top3 { background: linear-gradient(90deg, rgba(205, 127, 50, .28), var(--panel) 70%); }
.juara-rank { flex: none; width: 34px; text-align: center; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.juara-look { flex: none; width: 48px; height: 54px; image-rendering: pixelated; background: rgba(0, 0, 0, .15); border-radius: 8px; padding: 3px; box-sizing: border-box; }
.juara-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.juara-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.juara-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.juara-chips .chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: rgba(0, 0, 0, .22); white-space: nowrap; }
.juara-chips .desa { color: #9fe3b4; }
.juara-chips .makhluk { color: #ffd98a; }

/* ---- Skrin tajuk: hutan senja beranimasi, logo bercahaya, kad simpanan ---- */
.rimba-title { background: #100b1c; }
.rimba-title .title-sky { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; z-index: 0; pointer-events: none; }
.rimba-title::after { content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(10, 6, 22, 0) 30%, rgba(10, 6, 22, .55) 100%); }
.rimba-title .panel { position: relative; z-index: 1; gap: 12px; }
.rimba-title .back { color: #e8dcff; text-shadow: 0 1px 3px #000; }
.rimba-title .title-art { max-width: 300px; filter: drop-shadow(0 0 14px rgba(255, 200, 90, .35)); margin-bottom: -6px; }
.title-kicker { margin: -4px 0 0; padding: 0 36px; text-align: center; white-space: nowrap; color: #ffd75a; font-size: clamp(9px, 2.8vw, 11px); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; text-shadow: 0 0 10px rgba(255, 200, 80, .6); }
.rimba-title .logo {
  text-align: center; font-size: clamp(56px, 18vw, 84px); letter-spacing: .02em;
  background: linear-gradient(100deg, #fff4c8 0%, #ffd75a 30%, #fff9e6 45%, #ffb84a 60%, #ffd75a 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #7a3a12) drop-shadow(0 0 18px rgba(255, 190, 70, .45));
  animation: tajukKilau 5s ease-in-out infinite;
}
.rimba-title .logo span {
  margin-left: 0; background: linear-gradient(180deg, #b6ff9c, #3fcf6e 55%, #1f8a4a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #0d3b22) drop-shadow(0 0 16px rgba(90, 255, 140, .45));
}
@keyframes tajukKilau { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0 0; } }
.rimba-title .tagline { text-align: center; color: #e9e0ff; text-shadow: 0 1px 4px #000; line-height: 1.4; }
.rimba-title .field > span { color: #ffd75a; }
.rimba-title input { background: rgba(20, 14, 38, .78); border-color: rgba(255, 215, 90, .45); backdrop-filter: blur(4px); }
.rimba-title .btn { background: rgba(30, 22, 52, .78); border-color: rgba(200, 180, 255, .3); color: #fff; backdrop-filter: blur(4px); }
.rimba-title .btn.primary.tajuk-mula {
  min-height: 58px; font-size: 20px; letter-spacing: .03em; color: #2a1600; border: 0;
  background: linear-gradient(180deg, #ffe27a, #ffb52e 55%, #f08a1c);
  box-shadow: 0 4px 0 #a5520c, 0 0 0 2px rgba(255, 240, 180, .6) inset, 0 0 24px rgba(255, 180, 60, .55);
  animation: tajukDenyut 2.2s ease-in-out infinite;
}
.rimba-title .btn.primary.tajuk-mula:active { transform: translateY(3px); box-shadow: 0 1px 0 #a5520c, 0 0 18px rgba(255, 180, 60, .5); }
.rimba-title .btn.bahaya { background: #c8382a; border-color: #ff6a50; }
@keyframes tajukDenyut { 0%, 100% { box-shadow: 0 4px 0 #a5520c, 0 0 0 2px rgba(255, 240, 180, .6) inset, 0 0 16px rgba(255, 180, 60, .35); } 50% { box-shadow: 0 4px 0 #a5520c, 0 0 0 2px rgba(255, 240, 180, .6) inset, 0 0 34px rgba(255, 190, 70, .8); } }
.tajuk-baris { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tajuk-baris .btn { padding: 0 8px; font-size: 15px; white-space: nowrap; }
.tajuk-kad {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(60, 38, 100, .82), rgba(22, 16, 40, .86)); border: 2px solid rgba(255, 215, 90, .55);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .45), 0 0 18px rgba(255, 200, 80, .18); backdrop-filter: blur(6px);
}
.tajuk-rupa { flex: none; width: 58px; height: 66px; image-rendering: pixelated; border-radius: 12px; padding: 4px; box-sizing: border-box; background: radial-gradient(circle at 50% 40%, rgba(255, 215, 90, .35), rgba(0, 0, 0, .25)); }
.tajuk-kad-teks { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tajuk-kad-teks b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tajuk-kad-teks small { color: #cfc4ea; font-size: 12px; }
.tajuk-cip, .tajuk-ciri { display: flex; flex-wrap: wrap; gap: 5px; }
.tajuk-cip span, .tajuk-ciri span { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgba(0, 0, 0, .32); color: #ffe9a8; white-space: nowrap; }
.tajuk-ciri { justify-content: center; }
.tajuk-ciri span { background: rgba(30, 20, 56, .7); border: 1px solid rgba(255, 215, 90, .35); }
@media (prefers-reduced-motion: reduce) { .rimba-title .logo, .rimba-title .btn.primary.tajuk-mula { animation: none; } }

/* ---- Cerita: prolog sinematik, kad tajuk bab dan Kisah ---- */
.sinema { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 22px 54px; text-align: center;
  background: radial-gradient(ellipse at 50% 35%, #3a2350 0%, #160f26 60%, #08060e 100%); color: #fff4dc; animation: sinemaMasuk .5s ease-out; transition: background .6s; }
.sinema.gelap { background: radial-gradient(ellipse at 50% 40%, #4a1410 0%, #12080a 55%, #000 100%); }
.sinema.keluar { animation: sinemaKeluar .45s ease-in forwards; }
.sinema-ikon { font-size: 54px; line-height: 1; filter: drop-shadow(0 0 18px rgba(255, 190, 90, .55)); }
.sinema-teks { margin: 0; max-width: 330px; font-size: 16px; line-height: 1.55; font-weight: 600; text-shadow: 0 2px 6px #000; }
.sinema .masuk { animation: sinemaNaik .7s ease-out both; }
.sinema-teks.masuk { animation-delay: .12s; }
.sinema-hint { position: absolute; bottom: 16px; left: 0; right: 0; color: rgba(255, 240, 210, .55); font-size: 12px; animation: sinemaKelip 1.6s ease-in-out infinite; }
.sinema-langkau { position: absolute; top: 10px; right: 10px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .35); color: #fff; border-radius: 99px; padding: 6px 12px; font: 700 12px system-ui, sans-serif; cursor: pointer; }
@keyframes sinemaMasuk { from { opacity: 0; } }
@keyframes sinemaKeluar { to { opacity: 0; } }
@keyframes sinemaNaik { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes sinemaKelip { 50% { opacity: .25; } }
.kad-bab { position: absolute; left: 0; right: 0; top: 50%; z-index: 59; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; text-align: center; pointer-events: none;
  background: linear-gradient(90deg, rgba(10, 6, 20, 0), rgba(10, 6, 20, .88) 18%, rgba(10, 6, 20, .88) 82%, rgba(10, 6, 20, 0)); animation: kadBabMasuk .6s cubic-bezier(.2, 1.3, .4, 1) both; }
.kad-bab.keluar { animation: kadBabKeluar .4s ease-in forwards; }
.kad-bab-atas { color: #ffd75a; font-size: 13px; font-weight: 800; letter-spacing: .32em; }
.kad-bab-tajuk { color: #fff; font-size: clamp(22px, 7vw, 30px); font-weight: 900; line-height: 1.1; text-shadow: 0 0 18px rgba(255, 200, 90, .6), 0 3px 0 #000; }
.kad-bab-garis { width: 0; height: 2px; background: linear-gradient(90deg, transparent, #ffd75a, transparent); animation: kadBabGaris .9s .25s ease-out forwards; }
.kad-bab-bawah { color: #d9cdf5; font-size: 13px; font-weight: 600; }
.kad-bab.tamat .kad-bab-atas { color: #8dff9a; }
.kad-bab.tamat .kad-bab-bawah { color: #ffe9a8; font-size: 14px; }
@keyframes kadBabMasuk { from { opacity: 0; transform: translateY(-50%) scaleY(.2); } }
@keyframes kadBabKeluar { to { opacity: 0; transform: translateY(-50%) scaleY(.3); } }
@keyframes kadBabGaris { to { width: min(260px, 70%); } }
.kisah-senarai { display: flex; flex-direction: column; gap: 5px; }
.kisah-bab { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--panel); }
.kisah-bab.kini { border: 2px solid #ffd75a; }
.kisah-bab.kunci { opacity: .5; }
.kisah-no { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 215, 90, .18); color: #ffd75a; font-weight: 800; font-size: 13px; }
.kisah-bab small { color: var(--muted); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .sinema, .sinema .masuk, .kad-bab, .kad-bab-garis, .sinema-hint { animation: none; } .kad-bab-garis { width: min(260px, 70%); } }

/* ---- Butang zoom dunia (penjuru kiri atas skrin game) ---- */
.zoom-ctl { position: absolute; top: 84px; left: 3cqw; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.zoom-label { position: absolute; left: 42px; top: 24px; white-space: nowrap; }
.zoom-ctl .stage-btn { border: 0; padding: 0; cursor: pointer; font: 800 20px/1 system-ui, sans-serif; touch-action: manipulation; }
.zoom-ctl .stage-btn:active:not(:disabled) { transform: scale(.9); }
.zoom-ctl .stage-btn:disabled { opacity: .35; cursor: default; }
.zoom-label { padding: 4px 8px; border-radius: 99px; background: rgba(22, 19, 31, .78); color: #ffd75a; font: 800 12px system-ui, sans-serif; }
/* Pasar Rimba: jual makhluk di Papan Juara */
.jual { margin-top: 18px; display: grid; gap: 8px; }
.jual-btn { width: 100%; background: transparent; border-color: #f6c945; color: #ffd98a; }
.jual-form { display: grid; gap: 8px; }
.jual-form .hint { margin: 0; }
.jual-harga { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.jual-harga input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 18px; padding: 8px 10px; border-radius: 10px; border: 2px solid #f6c945; background: rgba(0, 0, 0, .25); color: inherit; font-variant-numeric: tabular-nums; }
.jual-ralat { color: #ffb4ab; min-height: 0; }
.jual-ralat:empty { display: none; }
.jual-harga-tag { color: var(--sun); font-weight: 800; }
button.juara-row { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.juara-row.ada-jual { border-color: rgba(246, 201, 69, .55); }
.juara-row.ada-jual.mine { border-color: #f6c945; }
.juara-chips .jual { color: #1b1300; background: #f6c945; font-weight: 800; }
/* Profil pemain dari Papan Juara: grid makhluk Geng + Kandang */
.koleksi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.koleksi-petak { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: var(--panel); border: 2px solid var(--dj, var(--line)); border-radius: 10px; min-width: 0; text-align: center; }
.koleksi-petak img { width: 56px; height: 56px; image-rendering: pixelated; }
.koleksi-petak b { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.koleksi-petak small { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }
.koleksi-petak .chip { font-size: 10px; padding: 1px 6px; }
/* Rakan di Profil: lihat makhluk rakan */
.rakan-makhluk { display: grid; gap: 6px; margin-top: 8px; }
.rakan-makhluk .hint { margin: 0; }
.rakan-makhluk-btn { width: 100%; margin-top: 10px; }
