/* Varnix — gaya HUD & layar. Semua HTML dibuat oleh client Rust (crates/client/src/ui.rs). */
:root {
  --panel: rgba(30, 21, 38, 0.8);
  --panel-2: rgba(48, 34, 58, 0.92);
  --line: rgba(255, 196, 220, 0.2);
  --text: #fff6fa;
  --muted: #cdbccb;
  --pink: #ff7aa8;
  --pink-2: #ffb3cc;
  --gold: #ffd36b;
  --hp: #ff4f64;
  --mp: #4fa4ff;
  --xp: #ffd36b;
  --good: #7be07a;
  --bad: #ff6b6b;
  --r: 14px;
  --font: 'M PLUS Rounded 1c', 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b3322; color: var(--text); font-family: var(--font); }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; cursor: pointer; }
input { font-family: inherit; user-select: text; -webkit-user-select: text; }
.ico { image-rendering: pixelated; width: 20px; height: 20px; vertical-align: middle; }
.ico.big { width: 36px; height: 36px; }
.ico.tiny { width: 14px; height: 14px; }

/* ---------- boot ---------- */
#boot { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse at 50% 40%, #3a2440, #140d19 70%); }
#boot button { margin-top: 12px; padding: 8px 16px; border-radius: 10px; border: 0; background: var(--pink); color: #2a0f1c; font-weight: 800; }
.boot-logo { font-size: 44px; font-weight: 800; letter-spacing: 6px; background: linear-gradient(180deg, #fff, var(--pink-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot-sub { color: var(--muted); margin: 6px 0 16px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%; border: 4px solid rgba(255, 179, 204, 0.25); border-top-color: var(--pink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nojs { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #140d19; z-index: 20; }

/* ---------- tombol umum ---------- */
.btn { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); padding: 9px 16px; border-radius: 12px; font-weight: 800; font-size: 14px; transition: transform 0.08s, background 0.15s; }
.btn:hover { background: rgba(255, 255, 255, 0.16); }
.btn:active { transform: scale(0.96); }
.btn.primary { background: linear-gradient(180deg, #ff8db5, #f0628f); border-color: #ffc2d6; color: #2b0d1a; box-shadow: 0 3px 0 #b33a64; }
.btn.primary:hover { background: linear-gradient(180deg, #ff9fc1, #f6729b); }
.btn.danger { background: rgba(255, 90, 90, 0.18); border-color: rgba(255, 120, 120, 0.5); color: #ffd0d0; }
.btn.big { width: 100%; padding: 13px 18px; font-size: 16px; margin: 6px 0; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 9px; box-shadow: none; }
.btn.icon { width: 40px; height: 40px; padding: 0; font-size: 20px; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }

/* ---------- layar login / pesan ---------- */
.screen { position: fixed; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 50% 45%, rgba(20, 10, 30, 0.15), rgba(16, 8, 24, 0.72)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.card.mini { text-align: center; min-width: 240px; }
.card.msg { max-width: 420px; text-align: center; }
.card.msg h2 { margin: 0 0 8px; }
.card.msg p { color: var(--muted); margin: 0 0 16px; line-height: 1.5; }
.logo { text-align: center; margin-bottom: 18px; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5)); }
.logo-jp { color: var(--pink-2); letter-spacing: 8px; font-weight: 700; font-size: 15px; }
.logo h1 { margin: 2px 0; font-size: clamp(46px, 11vw, 84px); letter-spacing: 10px; line-height: 1; background: linear-gradient(180deg, #ffffff 30%, #ffc3d7 70%, #ff8ab1); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 1px rgba(80, 20, 50, 0.35); }
.logo-sub { color: #ffe5ef; font-weight: 700; letter-spacing: 2px; }
.login-card { width: min(380px, 100%); }
.saku { display: inline-flex; width: 26px; height: 26px; border-radius: 8px; background: #2b0d1a; color: var(--pink-2); align-items: center; justify-content: center; margin-right: 10px; font-weight: 800; vertical-align: middle; }
.note { margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); font-size: 13px; line-height: 1.4; }
.note.err { background: rgba(255, 90, 110, 0.16); color: #ffd1d8; border: 1px solid rgba(255, 120, 140, 0.35); }
.small { color: var(--muted); font-size: 12px; margin-top: 12px; line-height: 1.5; text-align: center; }
.foot { position: absolute; bottom: calc(12px + var(--safe-b)); color: rgba(255, 240, 246, 0.7); font-size: 12px; }

/* ---------- pembuatan karakter ---------- */
.create-card { width: min(760px, 100%); max-height: 100%; overflow: auto; }
.create-card h2 { margin: 0; }
.acc { color: var(--muted); font-size: 13px; margin: 2px 0 12px; }
.create-body { display: flex; gap: 20px; align-items: flex-start; }
.preview-box { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; background: radial-gradient(ellipse at 50% 60%, rgba(255, 179, 204, 0.22), rgba(0, 0, 0, 0.15)); border: 1px solid var(--line); }
#cc-preview { width: 160px; height: 240px; image-rendering: pixelated; }
.cc-form { flex: 1; min-width: 0; }
.cc-form label { display: block; font-size: 12px; font-weight: 800; color: var(--pink-2); margin: 10px 0 5px; text-transform: uppercase; letter-spacing: 1px; }
.cc-form input, .chat-in input { width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.3); color: var(--text); font-size: 16px; font-weight: 700; outline: none; }
.cc-form input:focus, .chat-in input:focus { border-color: var(--pink); }
.cc-err { color: #ff9cab; font-size: 13px; min-height: 16px; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-weight: 700; font-size: 13px; }
.chip.on { background: var(--pink); color: #2b0d1a; border-color: #ffd0e0; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 28px; height: 28px; border-radius: 9px; border: 2px solid rgba(0, 0, 0, 0.35); background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.sw.on { outline: 3px solid #fff; outline-offset: 1px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud .panel, #hud button, #hud input, #hud canvas { pointer-events: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.profile { position: absolute; top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px; width: 270px; }
.face { width: 56px; height: 56px; border-radius: 12px; image-rendering: pixelated; background: radial-gradient(circle at 50% 70%, #ffd0de, #9a5d79); border: 2px solid rgba(255, 210, 225, 0.6); object-fit: cover; object-position: center 20%; }
.pinfo { flex: 1; min-width: 0; }
.pname { display: flex; justify-content: space-between; gap: 6px; font-weight: 800; font-size: 15px; white-space: nowrap; }
.pname span:first-child { overflow: hidden; text-overflow: ellipsis; }
.lv { color: var(--gold); font-size: 13px; }
.bar { position: relative; height: 13px; border-radius: 7px; background: rgba(0, 0, 0, 0.45); margin-top: 4px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.4); }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; border-radius: 7px; transition: width 0.25s; }
.bar.hp i { background: linear-gradient(180deg, #ff8090, var(--hp)); }
.bar.hp i.low { animation: pulse 0.8s infinite alternate; }
.bar.mp i { background: linear-gradient(180deg, #8cc4ff, var(--mp)); }
.bar.xp { height: 5px; }
.bar.xp i { background: linear-gradient(90deg, #ffe9a3, var(--xp)); }
.bar span { position: absolute; inset: 0; font-size: 10px; font-weight: 800; line-height: 12px; text-align: center; text-shadow: 0 1px 2px #000; }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.6); } }
.topright { position: absolute; top: calc(10px + var(--safe-t)); right: calc(10px + var(--safe-r)); display: flex; gap: 6px; align-items: center; }
.money { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; font-weight: 800; font-size: 14px; min-width: 76px; }
.hbtn { width: 40px; height: 40px; padding: 0; display: flex; align-items: center; justify-content: center; }
.hbtn .ico { width: 24px; height: 24px; }
.hbtn:active { transform: scale(0.92); }
.mm { position: absolute; top: calc(62px + var(--safe-t)); right: calc(10px + var(--safe-r)); padding: 6px; cursor: pointer; }
.mm-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; padding: 0 2px 4px; color: #ffe5ef; gap: 8px; }
#mm { display: block; width: 160px; height: 120px; border-radius: 8px; image-rendering: pixelated; }
.quests { position: absolute; top: calc(92px + var(--safe-t)); left: calc(10px + var(--safe-l)); width: 250px; padding: 8px 10px; max-height: 40vh; overflow: auto; }
.qhead { font-weight: 800; font-size: 13px; color: var(--gold); display: flex; justify-content: space-between; cursor: pointer; }
.q { margin-top: 8px; padding: 7px 9px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border-left: 3px solid #a99bb8; }
.q.main { border-left-color: var(--gold); }
.q.none { color: var(--muted); font-size: 12px; border-left-color: transparent; }
.qt { font-weight: 800; font-size: 13px; }
.qs { color: var(--muted); font-size: 11px; margin: 2px 0; line-height: 1.35; }
.qp { font-size: 12px; font-weight: 800; color: #bfe6ff; }
.qp.done { color: var(--good); }
.gold { color: var(--gold); }
.chat { position: absolute; left: calc(10px + var(--safe-l)); bottom: calc(10px + var(--safe-b)); width: 340px; display: flex; flex-direction: column; padding: 6px; }
.chat-log { height: 132px; overflow-y: auto; padding: 2px 4px; font-size: 13px; line-height: 1.4; scrollbar-width: thin; user-select: text; -webkit-user-select: text; }
.cm { word-wrap: break-word; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.cm b { color: #9fdcff; }
.cm.me b { color: var(--pink-2); }
.cm.sys { color: #ffe39a; font-size: 12px; }
.chat-in { display: flex; gap: 4px; margin-top: 4px; }
.chat-in input { font-size: 14px; padding: 7px 10px; }
.cbtn { flex: 0 0 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); font-size: 16px; }
.pad { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); width: 240px; height: 210px; pointer-events: none; }
.act { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 2px solid rgba(255, 220, 232, 0.5); background: radial-gradient(circle at 50% 35%, rgba(90, 64, 106, 0.95), rgba(36, 24, 46, 0.95)); display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.15); touch-action: none; }
.act:active { transform: scale(0.92); filter: brightness(1.25); }
.act .ico { width: 30px; height: 30px; }
.act.atk { right: 0; bottom: 0; width: 88px; height: 88px; background: radial-gradient(circle at 50% 35%, #ff7f9f, #b8325a); border-color: #ffd2df; }
.act.atk .ico.big { width: 46px; height: 46px; }
.act.skill { right: 108px; bottom: 6px; }
.act.use { right: 84px; bottom: 82px; }
.act.pot { right: 12px; bottom: 108px; width: 54px; height: 54px; }
.act.run { right: 178px; bottom: 30px; width: 52px; height: 52px; }
.act.run.on { background: radial-gradient(circle at 50% 35%, #7fd0ff, #2c7fc1); border-color: #d6f0ff; }
.act.use.ready { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 211, 107, 0.35), 0 5px 12px rgba(0, 0, 0, 0.45); }
.act .tag { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: rgba(24, 16, 32, 0.92); border: 1px solid var(--line); border-radius: 8px; padding: 1px 7px; font-size: 11px; font-weight: 800; white-space: nowrap; color: #ffe7a3; }
.act .tag:empty { display: none; }
.act b { position: absolute; right: -2px; bottom: -2px; background: #2b1d36; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; padding: 0 5px; }
.act .cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(10, 6, 16, 0.72) var(--cd, 0%), transparent 0); pointer-events: none; }
#toasts { position: absolute; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(460px, 40vw); pointer-events: none; }
/* layar menengah: notifikasi di celah antara panel kiri dan peta kecil */
@media (max-width: 1000px) {
  #toasts { top: calc(62px + var(--safe-t)); left: calc(285px + var(--safe-l)); right: calc(185px + var(--safe-r)); width: auto; transform: none; }
}
.toast { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; font-weight: 700; font-size: 13px; text-align: center; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); animation: toast-in 0.25s ease-out, toast-out 0.4s ease-in 3.4s forwards; }
.toast.good { border-color: rgba(123, 224, 122, 0.6); }
.toast.bad { border-color: rgba(255, 107, 107, 0.6); color: #ffd6d6; }
.toast.quest { border-color: rgba(255, 211, 107, 0.7); background: linear-gradient(180deg, rgba(74, 52, 30, 0.95), rgba(48, 34, 24, 0.95)); color: #fff1c9; }
.toast.level { border-color: var(--gold); background: linear-gradient(180deg, #7a4a12, #4d2c0c); color: #fff3c4; font-size: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- dialog NPC ---------- */
#dialog { position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); width: min(620px, calc(100vw - 24px)); z-index: 3; }
.dlg { display: flex; gap: 12px; padding: 14px; border-color: rgba(255, 211, 107, 0.45); background: linear-gradient(180deg, rgba(40, 28, 50, 0.95), rgba(26, 18, 34, 0.95)); }
.dface { flex: 0 0 76px; height: 76px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 70%, #ffd8e5, #8b5470); border: 2px solid rgba(255, 220, 232, 0.6); }
.dface img { width: 100%; height: 100%; image-rendering: pixelated; object-fit: cover; object-position: center 20%; }
.dmain { flex: 1; min-width: 0; }
.dname { font-weight: 800; color: var(--gold); font-size: 16px; }
.dname span { color: var(--muted); font-size: 12px; margin-left: 8px; font-weight: 700; }
.dtext { margin: 6px 0 10px; min-height: 44px; line-height: 1.5; font-size: 15px; white-space: pre-line; cursor: pointer; }
.dbtns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- panel tas / toko / pengaturan ---------- */
#panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 20px)); max-height: calc(100vh - 120px); z-index: 4; display: flex; }
.pnl { pointer-events: auto; width: 100%; overflow: auto; background: linear-gradient(180deg, rgba(42, 30, 52, 0.97), rgba(26, 18, 34, 0.97)); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.phead { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; margin-bottom: 10px; }
.phead > span { flex: 1; }
.phead .ico { width: 26px; height: 26px; }
.x { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-size: 16px; }
.pgold { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--gold); }
.equip { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); margin-bottom: 10px; }
.einfo { display: flex; flex-direction: column; gap: 2px; }
.einfo small { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 11px; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(0, 0, 0, 0.28); display: flex; align-items: center; justify-content: center; padding: 0; }
.slot .ico { width: 34px; height: 34px; }
.slot b { position: absolute; right: 4px; bottom: 2px; font-size: 12px; text-shadow: 0 1px 2px #000; }
.slot.on { border-color: var(--pink); box-shadow: 0 0 0 2px rgba(255, 122, 168, 0.4); }
.slot.equipped::after { content: 'E'; position: absolute; left: 4px; top: 2px; font-size: 10px; font-weight: 800; color: var(--gold); }
.slot.eq { width: 52px; height: 52px; flex: 0 0 52px; border-color: rgba(255, 211, 107, 0.6); }
.slot.empty { opacity: 0.45; }
.detail { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.detail > div:nth-child(2) { flex: 1; }
.detail p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.detail.hint, .hint { color: var(--muted); font-size: 13px; justify-content: center; text-align: center; padding: 12px; }
.dact { display: flex; flex-direction: column; gap: 6px; }
.tagline { font-size: 12px; color: var(--gold); font-weight: 800; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); font-weight: 800; }
.tabs button.on { background: var(--pink); color: #2b0d1a; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.srow > .ico { width: 32px; height: 32px; }
.si { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.si small { color: var(--muted); font-size: 11px; }
.price { display: flex; align-items: center; gap: 3px; font-weight: 800; color: var(--gold); min-width: 46px; }
.setrow { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-weight: 700; }
.tog { width: 48px; height: 28px; border-radius: 99px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.12); position: relative; padding: 0; }
.tog i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.tog.on { background: var(--pink); }
.tog.on i { left: 24px; }
.zoom { display: flex; align-items: center; gap: 8px; }
.info, .keys { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.egrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ebtn { font-size: 30px; padding: 10px 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }
.ebtn:active { transform: scale(0.92); }
#bigmap { width: 100%; image-rendering: pixelated; border-radius: 10px; display: block; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; }
#overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10, 6, 16, 0.45); z-index: 5; pointer-events: auto; }
.faint { text-align: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 18px; padding: 20px 28px; font-weight: 700; }
.faint .big { font-size: 22px; margin-bottom: 6px; }

/* ---------- layar sedang (tablet kecil) ---------- */
@media (max-width: 760px), (max-height: 520px) {
  .profile { width: 200px; padding: 6px 8px 6px 6px; gap: 7px; }
  .face { width: 42px; height: 42px; }
  .pname { font-size: 13px; }
  .bar { height: 11px; }
  .bar span { font-size: 9px; line-height: 10px; }
  .money { min-width: 0; padding: 4px 8px 4px 6px; font-size: 12px; }
  .money .ico { width: 16px; height: 16px; }
  .hbtn { width: 34px; height: 34px; }
  .mm { top: calc(52px + var(--safe-t)); padding: 4px; }
  #mm { width: 112px; height: 84px; }
  .mm-head { font-size: 9px; }
  .quests { top: calc(74px + var(--safe-t)); width: 190px; max-height: 32vh; padding: 6px 8px; }
  .qs { display: none; }
  .chat { width: min(300px, 46vw); padding: 4px; }
  .chat-log { height: 74px; font-size: 11px; }
  .chat-in input { font-size: 14px; padding: 5px 8px; }
  .pad { transform: scale(0.86); transform-origin: right bottom; }
  .create-body { flex-direction: column; align-items: center; }
  .create-card { padding: 14px; }
  #toasts { top: calc(50px + var(--safe-t)); left: calc(215px + var(--safe-l)); right: calc(135px + var(--safe-r)); }
  .toast { font-size: 12px; padding: 6px 10px; }
}

/* ---------- HP mendatar (landscape): layar pendek ---------- */
@media (max-height: 460px) {
  .profile { width: 172px; padding: 4px 8px 4px 4px; gap: 6px; border-radius: 12px; }
  .face { width: 34px; height: 34px; border-radius: 9px; border-width: 1px; }
  .pname { font-size: 11px; }
  .lv { font-size: 10px; }
  .bar { height: 9px; margin-top: 2px; }
  .bar span { font-size: 7.5px; line-height: 8px; }
  .bar.xp { height: 3px; }
  .topright { gap: 4px; }
  .money { padding: 3px 7px 3px 5px; font-size: 11px; gap: 4px; }
  .money .ico { width: 14px; height: 14px; }
  .hbtn { width: 30px; height: 30px; border-radius: 10px; }
  .hbtn .ico { width: 18px; height: 18px; }
  .mm { top: calc(42px + var(--safe-t)); padding: 3px; border-radius: 10px; }
  #mm { width: 96px; height: 72px; border-radius: 6px; }
  .mm-head { font-size: 8px; padding: 0 1px 2px; }
  .quests { top: calc(64px + var(--safe-t)); width: 172px; max-height: calc(100vh - 180px); padding: 4px 7px; border-radius: 12px; }
  .qhead { font-size: 11px; }
  .q { margin-top: 4px; padding: 3px 6px; }
  .qt { font-size: 11px; }
  .qp { font-size: 10px; }
  .chat { width: 236px; padding: 3px; border-radius: 12px; }
  .chat-log { height: 42px; font-size: 10.5px; line-height: 1.3; }
  .cm.sys { font-size: 10px; }
  .chat-in { margin-top: 3px; }
  .chat-in input { height: 28px; padding: 3px 8px; font-size: 13px; border-radius: 9px; }
  .cbtn { flex-basis: 30px; font-size: 14px; border-radius: 9px; }
  .pad { transform: scale(0.68); }
  #toasts { top: calc(44px + var(--safe-t)); left: calc(188px + var(--safe-l)); right: calc(124px + var(--safe-r)); gap: 4px; }
  .toast { font-size: 11px; padding: 4px 10px; border-radius: 10px; }
  .toast.level { font-size: 12px; }
  #dialog { width: min(560px, calc(100vw - 16px)); bottom: calc(6px + var(--safe-b)); }
  .dlg { padding: 8px; gap: 8px; }
  .dface { flex-basis: 48px; height: 48px; border-radius: 10px; }
  .dname { font-size: 13px; }
  .dtext { font-size: 12.5px; min-height: 0; margin: 3px 0 6px; line-height: 1.4; }
  .dbtns .btn { padding: 5px 10px; font-size: 12px; }
  #panel { top: calc(6px + var(--safe-t)); transform: translateX(-50%); width: min(600px, calc(100vw - 16px)); max-height: calc(100vh - 12px - var(--safe-t) - var(--safe-b)); }
  .pnl { padding: 8px 10px 10px; border-radius: 14px; }
  .phead { font-size: 14px; margin-bottom: 6px; }
  .phead .ico { width: 20px; height: 20px; }
  .x { width: 28px; height: 28px; }
  .grid { grid-template-columns: repeat(10, 1fr); gap: 4px; }
  .slot { border-radius: 9px; }
  .slot .ico { width: 26px; height: 26px; }
  .equip { padding: 6px; margin-bottom: 6px; gap: 8px; }
  .slot.eq { width: 40px; height: 40px; flex-basis: 40px; }
  .detail { margin-top: 6px; padding: 6px 8px; }
  .srow { padding: 4px 8px; }
  .srow > .ico { width: 26px; height: 26px; }
  .setrow { padding: 5px 4px; font-size: 13px; }
  .info, .keys { margin-top: 6px; line-height: 1.45; }
  .egrid { grid-template-columns: repeat(8, 1fr); gap: 6px; }
  .ebtn { font-size: 24px; padding: 6px 0; }
  #bigmap { width: auto; max-width: 100%; height: calc(100vh - 96px); margin: 0 auto; }
  .legend { margin-top: 4px; font-size: 11px; justify-content: center; }
}

/* ---------- HP tegak (portrait): layar sempit ---------- */
@media (max-width: 520px) and (min-height: 461px) {
  .profile { width: 170px; padding: 5px 8px 5px 5px; gap: 6px; }
  .face { width: 36px; height: 36px; }
  .pname { font-size: 12px; }
  .bar { height: 10px; margin-top: 3px; }
  .bar span { font-size: 8px; line-height: 9px; }
  .topright { gap: 4px; }
  .topright .money:nth-child(2) { display: none; }
  .money { padding: 3px 7px 3px 5px; font-size: 11px; gap: 4px; }
  .money .ico { width: 14px; height: 14px; }
  .hbtn { width: 32px; height: 32px; }
  .hbtn .ico { width: 20px; height: 20px; }
  .mm { top: calc(50px + var(--safe-t)); }
  #mm { width: 104px; height: 78px; }
  .quests { top: calc(70px + var(--safe-t)); width: 170px; max-height: 24vh; }
  .chat { width: calc(100vw - 210px - var(--safe-l) - var(--safe-r)); min-width: 160px; }
  .chat-log { height: 84px; font-size: 11px; }
  .chat-in input { font-size: 13px; padding: 4px 7px; }
  .cbtn { flex-basis: 30px; }
  .pad { transform: scale(0.76); }
  #toasts { top: calc(170px + var(--safe-t)); left: 16px; right: 16px; }
  #panel { max-height: calc(100vh - 140px); }
}
