/* Nhân vật chủ quán (client/owner-avatar.js) — Phòng thay đồ + hero hồ sơ. Mọi lớp có tiền tố oa- để không đụng CSS gốc.
 * Phong cách pixel của game: viền mực 2–3 px, bóng lệch không mờ, góc ≤ 6 px, nút dùng .btn của game. */
:root { --oa-N: #9aa3b8; --oa-R: #4aa8e8; --oa-SR: #b07aff; --oa-SSR: #ffb02e; --oa-UR: #ff4f6d; --oa-ink: #2a1c1c; --oa-paper: #fff8ea; --oa-paper2: #fdefd2; --oa-line: #c9b48a; }
.oa-wrap canvas, .oa-hero canvas, .oa-starter-modal canvas, .oa-pt { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
canvas.oa-smooth { image-rendering: auto; }
.oa-fig { position: relative; width: 100%; overflow: hidden; }
.oa-fig canvas { position: absolute; left: 0; top: 0; }

/* ---------- Phòng thay đồ ---------- */
.oa-wrap { position: fixed; inset: 0; z-index: 140; display: flex; align-items: center; justify-content: center; background: rgba(16, 8, 20, .7); padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); color: var(--oa-ink); }
.oa-wd { width: min(1280px, 100%); height: min(880px, 100%); display: grid; grid-template-columns: minmax(300px, 44%) 1fr; grid-template-rows: auto 1fr; background: var(--oa-paper); border: 3px solid var(--oa-ink); border-radius: 6px; box-shadow: inset 0 0 0 3px #fffbf2, 6px 6px 0 rgba(0, 0, 0, .55); overflow: hidden; }
.oa-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: linear-gradient(#4a3a5c 0 50%, #3b2e48 50%); border-bottom: 3px solid var(--oa-ink); color: #fff; }
.oa-head h2 { margin: 0; flex: 1; font: 800 20px/1.1 var(--display, sans-serif); text-shadow: 0 2px 0 #000; }
.oa-head h2 small { font: 700 12px var(--font, sans-serif); color: #c9b6e4; margin-left: 6px; text-shadow: none; }
.oa-wallet { display: flex; gap: 6px; }
.oa-pill { background: #0e0814; border: 2px solid #000; box-shadow: inset 0 0 0 1px #4a3a5c; border-radius: 4px; padding: 3px 10px; font-weight: 800; font-size: 13px; color: #fff; white-space: nowrap; }
.oa-pill.cp { color: #ffd8ec; }
.oa-x { width: 40px; height: 40px; border-radius: 6px; border: 2px solid var(--oa-ink); background: linear-gradient(#ff7a6e 0 50%, #ef5a4e 50%); color: #fff; box-shadow: 0 3px 0 #8f1d1b; font: 800 18px var(--display, sans-serif); cursor: pointer; }
.oa-stage { position: relative; min-height: 0; min-width: 0; border-right: 3px solid var(--oa-ink); background: #2a1a2e; overflow: hidden; }
.oa-stage > .oa-fig { position: absolute; inset: 0; height: 100% !important; }
.oa-badges { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.oa-badges span, .oa-tags span { background: rgba(14, 8, 20, .86); color: #fff; border: 2px solid #000; border-radius: 4px; padding: 2px 8px; font: 800 12px var(--display, sans-serif); }
.oa-grade[data-g="B"] { color: #9fe0ff !important; } .oa-grade[data-g="A"] { color: #8ef08a !important; }
.oa-grade[data-g="S"], .oa-grade[data-g="SS"] { background: linear-gradient(#ffe066 0 50%, #ffcd36 50%) !important; color: var(--oa-ink) !important; }
.oa-theme { color: #ffd0a0 !important; font-size: 11px !important; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-mirror { position: absolute; left: 10px; bottom: 10px; padding: 6px 6px 2px; background: linear-gradient(#c79a4a, #9a6a2a); border: 3px solid var(--oa-ink); border-radius: 30px 30px 4px 4px; box-shadow: 3px 3px 0 rgba(0, 0, 0, .5), inset 0 0 0 2px #ffe0a0; }
.oa-mirror canvas { background: linear-gradient(#cfe8f6, #9cc8e6); border: 2px solid var(--oa-ink); border-radius: 22px 22px 2px 2px; }
.oa-mirror span { display: block; text-align: center; font: 800 10px var(--display, sans-serif); color: #fff; text-shadow: 0 1px 0 #000; }
.oa-poses { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.oa-poses button { min-width: 44px; min-height: 36px; padding: 2px 8px; border: 2px solid #000; border-radius: 4px; background: rgba(22, 14, 31, .88); color: #fff; font: 800 12px var(--display, sans-serif); box-shadow: 0 3px 0 #000; cursor: pointer; }
.oa-poses button.on { background: #ffcf33; color: var(--oa-ink); box-shadow: 0 3px 0 #b07f00; }
.oa-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.oa-top { padding: 10px 12px 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.oa-tabs { display: flex; border: 2px solid var(--oa-ink); border-radius: 6px; overflow: hidden; background: #f3dfb8; }
.oa-tabs button { flex: 1; min-height: 38px; border: 0; border-right: 2px solid var(--oa-ink); background: transparent; font: 800 13px var(--display, sans-serif); color: #5a4a3a; cursor: pointer; }
.oa-tabs button:last-child { border-right: 0; }
.oa-tabs button.on { background: linear-gradient(#fffdf6 0 50%, #fff4dc 50%); color: var(--oa-ink); box-shadow: inset 0 -3px 0 #ff8f1f; }
.oa-rail { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; min-width: 0; scrollbar-width: thin; }
.oa-slotbtn { flex: 0 0 auto; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 3px; border: 2px solid var(--oa-line); border-radius: 5px; background: #fffdf6; box-shadow: 0 3px 0 var(--oa-line); font: 800 11px var(--display, sans-serif); color: #5a4a3a; cursor: pointer; }
.oa-slotbtn canvas { width: 34px; height: 34px; }
.oa-ph { width: 34px; height: 34px; display: grid; place-items: center; font-size: 19px; opacity: .55; }
.oa-ph.oa-skin { opacity: 1; width: 28px; height: 28px; background: var(--sw); border: 2px solid var(--oa-ink); border-radius: 4px; margin: 3px; }
.oa-slotbtn.on { border-color: var(--oa-ink); background: linear-gradient(#fff4c2 0 50%, #ffe98f 50%); color: var(--oa-ink); box-shadow: 0 3px 0 var(--oa-ink); }
.oa-slotbtn i { font-style: normal; font-size: 9px; line-height: 1; color: #c7600a; }
.oa-grid { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; padding: 4px 12px 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); grid-auto-rows: max-content; gap: 8px; align-content: start; overscroll-behavior: contain; }
.oa-card, .oa-setcard { position: relative; display: flex; flex-direction: column; align-items: stretch; padding: 0; border: 2px solid var(--oa-ink); border-radius: 5px; background: #fffdf6; box-shadow: 0 3px 0 rgba(42, 28, 28, .35); overflow: hidden; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.oa-card > *, .oa-setcard > * { flex-shrink: 0; }
.oa-ic { position: relative; height: 80px; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc) 30%, #fff) 0 34%, color-mix(in srgb, var(--rc) 10%, #fff8ea) 72%); border-bottom: 2px solid var(--rc); }
.oa-ic canvas { width: 68px; height: 68px; }
.oa-hot { position: absolute; left: 4px; bottom: 3px; font-size: 13px; filter: drop-shadow(0 1px 0 #000); }
.oa-gem { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; transform: rotate(45deg); background: var(--rc); border: 2px solid var(--oa-ink); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .55); }
.oa-nm { padding: 4px 6px 0; font: 800 12px/1.15 var(--display, sans-serif); min-height: 2.3em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oa-pr { padding: 2px 6px 5px; font-weight: 800; font-size: 11.5px; color: #5a4a3a; }
.oa-pr.own { color: #2e8a3a; }
.oa-card.trying { box-shadow: 0 0 0 3px #ff8f1f, 0 3px 0 rgba(42, 28, 28, .35); }
.oa-card.worn { box-shadow: 0 0 0 3px #ffcf33, 0 3px 0 rgba(42, 28, 28, .35); }
.oa-rib { position: absolute; left: -2px; top: 6px; padding: 1px 6px 1px 4px; background: #ffcf33; border: 2px solid var(--oa-ink); border-left: 0; font: 800 10px var(--display, sans-serif); }
.oa-card.trying .oa-rib { background: #ff8f1f; color: #fff; }
.oa-bac { position: absolute; left: 4px; top: 5px; min-width: 22px; padding: 0 4px; text-align: center; background: var(--rc); color: #fff; border: 2px solid var(--oa-ink); border-radius: 3px; font: 800 10px/1.35 var(--display, sans-serif); text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.oa-bach { margin-top: 4px; }
.oa-bach b { padding: 1px 7px; color: #fff; background: var(--rc); border: 2px solid var(--oa-ink); border-radius: 3px; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.oa-bach small { font: 700 11px var(--body, sans-serif); color: #7a6650; }
.oa-bacl { padding: 0 6px; font: 800 10.5px var(--display, sans-serif); color: #7a5a2a; }
.oa-card.none .oa-ic { background: repeating-linear-gradient(45deg, #fbf1dc 0 6px, #f6e6c5 6px 12px); }
.oa-card.none .oa-ic span { font: 800 26px var(--display, sans-serif); color: var(--oa-line); }
.oa-skinbig { width: 44px; height: 44px; background: var(--sw); border: 3px solid var(--oa-ink); border-radius: 6px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15), inset 0 3px 0 rgba(255, 255, 255, .4); }
.oa-empty { grid-column: 1 / -1; text-align: center; padding: 24px 8px; color: #7a6a5a; font-weight: 700; }
.oa-empty b { display: block; font: 800 16px var(--display, sans-serif); color: #5a4a3a; margin-bottom: 4px; }
.oa-gh { grid-column: 1 / -1; font: 800 13px var(--display, sans-serif); color: #5a4a3a; display: flex; align-items: center; gap: 6px; }
.oa-gh::after { content: ''; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--oa-line) 0 4px, transparent 4px 8px); }
.oa-th { height: 124px; display: grid; place-items: end center; background: radial-gradient(circle at 50% 75%, color-mix(in srgb, var(--rc, #ff6fa8) 30%, #fff) 0 36%, color-mix(in srgb, var(--rc, #ff6fa8) 10%, #fff8ea) 75%); border: 0; border-bottom: 2px solid var(--rc, #ff6fa8); padding: 0; width: 100%; }
.oa-setcard.mine.empty { border-style: dashed; }
.oa-setcard.mine.empty .oa-th span { align-self: center; font: 800 34px var(--display, sans-serif); color: #f0a0c4; }
.oa-acts { display: flex; gap: 4px; padding: 0 4px 6px; }
.oa-acts .btn { flex: 1; min-width: 0; padding: 2px 4px; font-size: 12px; min-height: 30px; }
.oa-detail { border-top: 3px solid var(--oa-line); background: var(--oa-paper2); padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.oa-ttl { display: flex; align-items: center; gap: 6px; font: 800 15px var(--display, sans-serif); min-width: 0; }
.oa-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oa-own { margin-left: auto; white-space: nowrap; }
.oa-rar { display: inline-block; padding: 1px 6px; border-radius: 3px; font: 800 11px/1.4 var(--display, sans-serif); color: #fff; background: var(--rc); border: 1.5px solid rgba(0, 0, 0, .35); }
.oa-dye { display: flex; align-items: center; gap: 6px; min-width: 0; }
.oa-dye > b { flex: 0 0 64px; font: 800 11px var(--display, sans-serif); color: #5a4a3a; }
.oa-sws { display: flex; gap: 4px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; min-width: 0; }
.oa-sw { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 3px; border: 2px solid var(--oa-ink); background: var(--sw); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), inset 0 2px 0 rgba(255, 255, 255, .35); padding: 0; cursor: pointer; }
.oa-sw.on { outline: 3px solid #ffcf33; outline-offset: 1px; }
.oa-dyes { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.oa-dyebtn { display: none; flex: 0 0 auto; align-items: center; gap: 5px; min-height: 32px; padding: 2px 8px; border: 2px solid var(--oa-ink); border-radius: 4px; background: linear-gradient(#fffdf6 0 50%, #fff4dc 50%); box-shadow: 0 2px 0 var(--oa-ink); font: 800 12px var(--display, sans-serif); color: var(--oa-ink); cursor: pointer; }
.oa-dyebtn:active { transform: translateY(2px); box-shadow: none; }
.oa-dyebtn.on { background: linear-gradient(#fff4c2 0 50%, #ffe98f 50%); }
.oa-dyechips { display: inline-flex; gap: 2px; }
.oa-dyechips i { width: 14px; height: 14px; background: var(--sw); border: 2px solid var(--oa-ink); border-radius: 2px; }
.oa-car { font-size: 10px; }
.oa-foot { border-top: 3px solid var(--oa-ink); background: linear-gradient(#f3dfb8 0 50%, #eed4a4 50%); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: stretch; }
.oa-foot .btn { flex: 1; flex-direction: column; gap: 1px; }
.oa-foot .btn small { display: block; }
.oa-foot .oa-undo { flex: 0 0 auto; }

/* ---------- hồ sơ / thẻ người chơi / bước tạo ---------- */
.oa-prof { margin: 4px 0 10px; }
.oa-hero { position: relative; border: 3px solid var(--oa-ink); border-radius: 5px; overflow: hidden; box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
.oa-tags { position: absolute; left: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.oa-prof-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.oa-prof-row .btn { margin-left: auto; }
.oa-chip { background: var(--oa-paper2); border: 2px solid var(--oa-line); border-radius: 4px; padding: 2px 8px; font: 800 12px var(--display, sans-serif); }
.oa-off { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; font-weight: 700; color: #7a6a5a; }
.oa-new { display: flex; align-items: center; gap: 10px; padding: 10px; border: 2px dashed #f0a0c4; border-radius: 6px; background: #fff0f6; }
.oa-new b { display: block; font: 800 15px var(--display, sans-serif); }
.oa-new small { display: block; color: #7a6a5a; font-weight: 600; }
.oa-new .btn { margin-left: auto; flex: 0 0 auto; }
.oa-starter-modal .oa-fig { border: 3px solid var(--oa-ink); border-radius: 5px; }
.oa-sec { margin: 10px 0 6px; font: 800 14px var(--display, sans-serif); }
.oa-pick2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.oa-pick2 button { min-height: 44px; border-radius: 6px; border: 2px solid var(--oa-ink); background: #fffdf6; box-shadow: 0 3px 0 rgba(42, 28, 28, .35); font: 800 16px var(--display, sans-serif); cursor: pointer; }
.oa-pick2 button.on { background: linear-gradient(#e9f8e5 0 50%, #d7f1d2 50%); box-shadow: 0 0 0 3px #43a047, 0 3px 0 rgba(42, 28, 28, .35); }
.oa-pt { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 760px) {
  .oa-wrap { padding: 0; }
  .oa-wd { width: 100%; height: 100%; border-radius: 0; border: 0; grid-template-columns: 1fr; grid-template-rows: auto minmax(200px, 33%) 1fr; box-shadow: none; }
  .oa-head { padding-top: calc(8px + env(safe-area-inset-top)); }
  .oa-head h2 { font-size: 18px; } .oa-head h2 small { display: none; }
  .oa-stage { border-right: 0; border-bottom: 3px solid var(--oa-ink); }
  .oa-top { padding: 8px 10px 0; gap: 6px; }
  .oa-tabs button { min-height: 34px; }
  .oa-slotbtn { width: 54px; font-size: 10px; padding: 3px 1px 2px; }
  .oa-slotbtn canvas, .oa-ph { width: 30px; height: 30px; }
  .oa-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; padding: 2px 10px 10px; }
  .oa-ic { height: 70px; } .oa-ic canvas { width: 60px; height: 60px; }
  .oa-detail { padding: 6px 10px; gap: 4px; } .oa-ttl { font-size: 13px; } .oa-sw { width: 26px; height: 26px; }
  .oa-grid { min-height: 150px; }
  .oa-detail { position: relative; }
  .oa-dyebtn { display: inline-flex; } .oa-own { margin-left: auto; } .oa-own + .oa-dyebtn { margin-left: 4px; }
  .oa-dyes { display: none; position: absolute; left: 0; right: 0; bottom: 100%; z-index: 3; padding: 8px 10px 6px; background: var(--oa-paper2); border-top: 3px solid var(--oa-ink); box-shadow: 0 -4px 0 rgba(42, 28, 28, .25); }
  .oa-detail.open .oa-dyes { display: flex; }
  .oa-mirror canvas { width: 38px !important; height: 48px !important; }
  .oa-badges span { font-size: 11px; padding: 1px 6px; } .oa-badges .oa-lv { display: none; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .oa-wd { grid-template-columns: minmax(220px, 40%) 1fr; grid-template-rows: auto 1fr; }
  .oa-stage { border-right: 3px solid var(--oa-ink); border-bottom: 0; }
  .oa-head { padding: 4px 8px 4px 12px; } .oa-head h2 { font-size: 16px; } .oa-head h2 small { display: none; } .oa-x { width: 34px; height: 34px; }
  .oa-top { padding: 6px 10px 0; gap: 4px; } .oa-tabs button { min-height: 28px; font-size: 12px; }
  .oa-slotbtn { width: 48px; font-size: 9px; padding: 2px 1px; } .oa-slotbtn canvas, .oa-ph { width: 24px; height: 24px; }
  .oa-detail { padding: 3px 10px; gap: 2px; } .oa-dye > b { flex-basis: 52px; font-size: 10px; } .oa-sw { width: 22px; height: 22px; }
  .oa-detail { position: relative; }
  .oa-dyebtn { display: inline-flex; min-height: 26px; } .oa-own + .oa-dyebtn { margin-left: 4px; }
  .oa-dyes { display: none; position: absolute; left: 0; right: 0; bottom: 100%; z-index: 3; padding: 6px 10px 4px; background: var(--oa-paper2); border-top: 3px solid var(--oa-ink); box-shadow: 0 -4px 0 rgba(42, 28, 28, .25); }
  .oa-detail.open .oa-dyes { display: flex; }
  .oa-foot { padding: 5px 10px calc(5px + env(safe-area-inset-bottom)); } .oa-foot .btn { min-height: 38px; font-size: 13px; }
  .oa-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; } .oa-ic { height: 58px; } .oa-ic canvas { width: 50px; height: 50px; }
  .oa-mirror { display: none; }
}
.oa-newgame { display: flex; align-items: center; gap: 8px; margin: 8px 0 4px; padding: 6px 10px; border: 2px dashed #f0a0c4; border-radius: 6px; background: #fff0f6; font-weight: 800; font-size: 13px; }
.oa-newgame input { width: 18px; height: 18px; accent-color: #f05a98; }

/* 31/10 nhân vật vẽ tay: hàng màu mắt trong ô Mặt trải hết lưới; chân dung lựa chọn mặt nét như pixel */
.oa-sws.oa-wide { grid-column: 1 / -1; flex-wrap: wrap; overflow: visible; }
.oa-card .oa-ic canvas, .oa-slotbtn canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
