/* ================= Nông Trại Nhỏ — trang chủ / nhân vật / cửa hàng / màn nông trại ================= */
.me-tile { overflow: hidden; border-color: #9ccf6a; background: linear-gradient(#cfeeff, #bfe6a0); }
.me-tile img { position: absolute; left: 50%; bottom: -6px; width: 118%; transform: translateX(-50%); pointer-events: none; }
.me-tile .me-avemo { inset: auto 0 0 auto; width: 24px; height: 24px; font-size: 16px; border-radius: 8px; border: 2px solid #fff; background: #fff; }
.big .bt { display: none; }
.big-look { --bar: #8a5cff !important; }
.big-resume { --bar: #00a862 !important; }

/* ---------- nhân vật ---------- */
.look-stage { display: flex; justify-content: center; margin: 6px 0 12px; padding: 14px 0 0; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(#d4efff 0, #d4efff 55%, #a8da72 55%, #8fcb5c 100%); overflow: hidden; }
.look-stage img { width: min(230px, 62vw); display: block; margin-bottom: -6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px #c9ccd1; }
.swatches button.on { box-shadow: 0 0 0 3px #335fff; }

/* ---------- thẻ món (cửa hàng + tủ đồ): khối giá dính đáy, hai hàng cố định ---------- */
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 8px 10px; text-align: center; cursor: pointer; }
.item .pv { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 10px; background: #f2f4f5; overflow: hidden; }
.item .pv img { width: 100%; height: 100%; object-fit: contain; display: block; }
.item .nm { font-size: 14px; font-weight: 800; line-height: 1.2; min-height: 34px; display: grid; place-items: center; }
.item .rar { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; }
.item .lockl { position: absolute; left: 6px; top: 6px; z-index: 1; padding: 1px 7px; border-radius: 999px; background: rgba(25, 27, 29, .78); color: #fff; font-size: 11px; font-weight: 800; }
.item .it-pay { margin-top: auto; display: flex; flex-direction: column; gap: 2px; width: 100%; padding-top: 4px; font-size: 14px; font-weight: 800; }
.item .it-pay span { min-height: 21px; display: block; }
.item .it-pay .gem { color: #1a93d6; }
.item .it-pay .none { color: #9aa0a6; font-weight: 600; font-size: 12px; }
.item .it-pay .hid { visibility: hidden; }
.item.dim { opacity: .55; }
.item.on { border-color: #00a862 !important; box-shadow: inset 0 0 0 1px #00a862; }

/* ---------- màn nông trại ---------- */
body.mb-light.fm-on { background: #86c852 !important; }
#scFarm { animation: none; }
.fm { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: #86c852; touch-action: none; -webkit-user-select: none; user-select: none; }
.fm > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.wood { background: linear-gradient(#b98a52, #8c6234); border: 3px solid #4a2a14; box-shadow: inset 0 2px 0 rgba(255, 230, 170, .45), 0 3px 0 rgba(74, 42, 20, .8); }
.fm-top { position: absolute; left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); z-index: 3; display: flex; align-items: center; gap: 0; }
.fm-back { position: absolute; left: 0; top: -2px; z-index: 2; width: 30px; height: 30px; padding: 0; border: 2px solid #4a2a14; border-radius: 50%; background: linear-gradient(#b98a52, #8c6234); color: #fff4dc; display: grid; place-items: center; }
.fm-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.fm-av { position: relative; z-index: 1; flex: none; width: 68px; height: 68px; margin-top: 12px; padding: 0; border: 4px solid #8c6234; border-radius: 50%; outline: 3px solid #4a2a14; background: linear-gradient(#bfe8ff, #d8f0a8); overflow: hidden; box-shadow: 0 3px 0 rgba(74, 42, 20, .7); }
.fm-av img { position: absolute; left: 0; top: 4px; width: 100%; }
.fm-hud { flex: 1; min-width: 0; margin-left: -12px; padding: 7px 8px 7px 20px; border-radius: 0 16px 16px 0; background: linear-gradient(#b98a52, #8c6234); border: 3px solid #4a2a14; border-left: 0; box-shadow: inset 0 2px 0 rgba(255, 230, 170, .45), 0 3px 0 rgba(74, 42, 20, .8); display: flex; flex-direction: column; gap: 6px; }
.fm-row { display: flex; align-items: center; gap: 6px; }
.fm-lv { padding: 2px 9px; border-radius: 6px; background: #6a4524; border: 2px solid #4a2a14; color: #fff4dc; font-size: 13px; font-weight: 900; white-space: nowrap; }
.fm .chip { flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 2px 6px; border-radius: 999px; background: #6a4524; border: 2px solid #4a2a14; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35); color: #fff4dc; font-size: 14px; font-weight: 900; white-space: nowrap; }
.fm .chip .gem-chip, .fm .gem-chip b { color: #8fe0ff; }
.fm-xp { display: flex; align-items: center; gap: 6px; }
.fm-xp em { font-style: normal; font-size: 14px; font-weight: 900; color: #8fe04a; text-shadow: 0 1px 0 #4a2a14, 1px 0 0 #4a2a14, -1px 0 0 #4a2a14, 0 -1px 0 #4a2a14; }
.fm-xp .xpbar { flex: 1; height: 13px; border-radius: 999px; background: #6a4524; border: 2px solid #4a2a14; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .35); overflow: hidden; }
.fm .plus { flex: none; width: 20px; height: 20px; margin-left: auto; padding: 0; border: 2px solid #4a2a14; border-radius: 6px; background: linear-gradient(#ffe27a, #e8a820); color: #4a2a14; font-size: 16px; font-weight: 900; line-height: 1; display: grid; place-items: center; }
.fm-zoom { position: absolute; right: calc(8px + env(safe-area-inset-right)); bottom: calc(112px + env(safe-area-inset-bottom)); z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fm-mini { position: static; width: 112px; height: auto; border: 3px solid #4a2a14; border-radius: 12px; background: #86c852; box-shadow: 0 3px 0 rgba(74, 42, 20, .8); touch-action: none; }
.fm-zoom button { width: 38px; height: 38px; padding: 0; border: 3px solid #4a2a14; border-radius: 12px; background: linear-gradient(#c8985c, #94683a); color: #fff4dc; font-size: 24px; font-weight: 900; line-height: 1; box-shadow: inset 0 2px 0 rgba(255, 230, 170, .5), 0 3px 0 rgba(74, 42, 20, .8); display: grid; place-items: center; }
.fm-xp .xpbar i { display: block; height: 100%; background: linear-gradient(#b8f070, #4fb030); }
/* Nút tròn bóng có nhãn (cột phải + thanh dưới) */
.rb { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0; border: 0; background: none; }
.rb i { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; border: 3px solid #4a2a14; box-shadow: inset 0 3px 3px rgba(255, 255, 255, .55), inset 0 -4px 4px rgba(0, 0, 0, .22), 0 3px 0 #4a2a14; transition: transform .12s; }
.rb i::after { content: ''; position: absolute; left: 12%; top: 7%; width: 42%; height: 24%; border-radius: 50%; background: rgba(255, 255, 255, .5); transform: rotate(-28deg); }
.rb img { position: relative; z-index: 1; width: 36px; height: 36px; filter: drop-shadow(0 1px 0 rgba(74, 42, 20, .5)); }
.rb span { max-width: 78px; font-size: 10px; font-weight: 900; letter-spacing: .2px; text-transform: uppercase; color: #fff; white-space: nowrap; text-shadow: 0 1.5px 0 #4a2a14, 1.5px 0 0 #4a2a14, -1.5px 0 0 #4a2a14, 0 -1.5px 0 #4a2a14, 1.5px 1.5px 0 #4a2a14, -1.5px 1.5px 0 #4a2a14; }
.rb-orange i { background: radial-gradient(circle at 50% 30%, #ffd36a, #f0902a); }
.rb-blue i { background: radial-gradient(circle at 50% 30%, #9fdcff, #3a98e8); }
.rb-lime i { background: radial-gradient(circle at 50% 30%, #c8f27a, #5ab838); }
.rb-green i { background: radial-gradient(circle at 50% 30%, #86e49a, #2fa85a); }
.rb-pink i { background: radial-gradient(circle at 50% 30%, #ffb0c8, #e8507a); }
.rb-red i { background: radial-gradient(circle at 50% 30%, #ff9c84, #d8402c); }
.rb.on i { transform: translateY(-5px); box-shadow: inset 0 3px 3px rgba(255, 255, 255, .55), inset 0 -4px 4px rgba(0, 0, 0, .22), 0 0 0 3px #fff, 0 3px 0 3px #4a2a14; }
.rb:active i { transform: translateY(1px) scale(.96); }
.rb:disabled { opacity: .5; }
.rb u { position: absolute; right: 2px; top: -4px; z-index: 2; min-width: 20px; padding: 0 5px; border-radius: 999px; background: #e8453c; color: #fff; border: 2px solid #4a2a14; font-size: 12px; font-weight: 900; text-decoration: none; line-height: 16px; text-align: center; }
.rb u.zero { display: none; }
.fm-side { position: absolute; right: 4px; top: calc(100px + env(safe-area-inset-top)); z-index: 3; display: flex; flex-direction: column; gap: 10px; }
.fm-side .rb i { width: 58px; height: 58px; }
.fm-side .rb img { width: 40px; height: 40px; }
.fm-side .rb { width: 72px; }
.fm-side .rb span { font-size: 9.5px; }
.fm-hint { position: absolute; left: 50%; bottom: calc(118px + env(safe-area-inset-bottom)); z-index: 3; transform: translateX(-50%); max-width: 86vw; padding: 7px 14px; border-radius: 999px; background: rgba(60, 40, 22, .88); color: #fff4dc; font-size: 13px; font-weight: 700; text-align: center; pointer-events: none; opacity: 0; transition: opacity .2s; }
.fm-hint.on { opacity: 1; }
.fm-bar { position: absolute; left: 6px; right: 6px; bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 3; display: flex; justify-content: space-around; align-items: flex-end; padding: 12px 4px 7px; border-radius: 18px; background: linear-gradient(#c8985c, #94683a); border: 3px solid #4a2a14; box-shadow: inset 0 3px 0 rgba(255, 230, 170, .5), inset 0 -4px 0 rgba(74, 42, 20, .35), 0 4px 0 rgba(74, 42, 20, .8); }
.fm-bar .rb { flex: 1; min-width: 0; margin-top: -26px; }
.fm-bar .rb span { max-width: 100%; }
@media (max-width: 380px) { .rb i { width: 48px; height: 48px; } .rb img { width: 32px; height: 32px; } .rb span { font-size: 9px; } }
/* Màn ngang (điện thoại xoay ngang / máy tính bảng): HUD gọn, nút nhỏ lại, chừa tai thỏ */
@media (orientation: landscape) and (max-height: 540px) {
  .fm-top { left: calc(8px + env(safe-area-inset-left)); right: auto; width: min(430px, 52vw); transform: none; top: calc(6px + env(safe-area-inset-top)); }
  .fm-av { width: 56px; height: 56px; margin-top: 8px; }
  .fm-hud { padding: 5px 8px 5px 18px; gap: 4px; }
  .fm-side { right: calc(8px + env(safe-area-inset-right)); top: calc(6px + env(safe-area-inset-top)); gap: 6px; }
  .fm-side .rb { width: 62px; } .fm-side .rb i { width: 44px; height: 44px; } .fm-side .rb img { width: 30px; height: 30px; } .fm-side .rb span { font-size: 9px; }
  .fm-bar { left: 50%; right: auto; width: min(560px, 70vw); transform: translateX(-50%); padding: 8px 4px 4px; bottom: calc(4px + env(safe-area-inset-bottom)); }
  .fm-bar .rb { margin-top: -20px; } .fm-bar .rb i { width: 46px; height: 46px; } .fm-bar .rb img { width: 31px; height: 31px; } .fm-bar .rb span { font-size: 9px; }
  .fm-hint { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fm-zoom { right: calc(8px + env(safe-area-inset-right)); bottom: calc(8px + env(safe-area-inset-bottom)); }
  .fm-mini { width: 128px; }
}
@media (min-width: 700px) and (min-height: 541px) { .fm-top { left: 50%; right: auto; width: 520px; transform: translateX(-50%); } .fm-bar { left: 50%; right: auto; width: 520px; transform: translateX(-50%); } }

/* ---------- hộp thoại trong game ---------- */
.dialog .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; margin: 8px 0; }
.dialog .cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 12px; font-weight: 800; line-height: 1.2; text-align: center; }
.dialog .cell img { width: 48px; height: 48px; object-fit: contain; }
.dialog .cell.dim { opacity: .5; }
.dialog .cell.on { border-color: #00a862; box-shadow: inset 0 0 0 1px #00a862; background: #f0faf5; }
.dialog .cell small { color: var(--muted); font-weight: 700; font-size: 11px; }
.dialog .cell u { position: absolute; right: 2px; top: 2px; min-width: 18px; padding: 0 4px; border-radius: 999px; background: #335fff; color: #fff; font-size: 11px; font-weight: 900; text-decoration: none; line-height: 18px; }
.dialog .ord { display: flex; align-items: center; gap: 8px; padding: 8px; margin: 6px 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.dialog .ord .need { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.dialog .ord .need span { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px 1px 1px; border-radius: 999px; background: #f2f4f5; font-size: 12px; font-weight: 800; }
.dialog .ord .need span.ok { background: #e6f6ee; color: #008f53; }
.dialog .ord .need img { width: 26px; height: 26px; }
.dialog .ord .who { font-size: 12px; color: var(--muted); font-weight: 700; display: block; }
.dialog .ord button { padding: 8px 12px; border: 0; border-radius: 10px; background: #00a862; color: #fff; font-weight: 800; }
.dialog .ord button:disabled { background: #c9ccd1; }
.dialog .penhead { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.dialog .penhead img { width: 64px; height: 64px; border-radius: 12px; background: #f2f4f5; padding: 4px; }
.dialog .meter { height: 10px; border-radius: 9px; background: #e3e5e8; overflow: hidden; margin: 6px 0; }
.dialog .meter i { display: block; height: 100%; background: #4fb04a; }
.dialog .stack { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dialog .stack button { padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 800; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog .stack button.pri { background: #00a862; border-color: #00a862; color: #fff; }
.dialog .stack button:disabled { opacity: .5; }
.tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; white-space: nowrap; padding-left: 14px; padding-right: 14px; }
.tabs button img { vertical-align: -5px; }
