/* Crisp fsweb UI atlas icons (assets/ui/fsweb/atlas.webp) & animated chat emoji sprite rules */
.fsweb-hud-icon{
  display:block;
  flex:none;
  width:calc(var(--aw,26px) * var(--s,1));
  height:calc(var(--ah,40px) * var(--s,1));
  background-image:url('assets/ui/fsweb/atlas.webp');
  background-repeat:no-repeat;
  background-size:calc(256px * var(--s,1)) calc(91px * var(--s,1));
  background-position:calc(var(--ax,0px) * var(--s,1)) calc(var(--ay,0px) * var(--s,1));
  image-rendering:auto;
  pointer-events:none;
}
.fsweb-hud-icon-f2{--aw:49px;--ah:49px;--ax:0px;--ay:0px}
.fsweb-hud-icon-bag{--aw:26px;--ah:40px;--ax:-51px;--ay:0px}
.fsweb-hud-icon-char{--aw:26px;--ah:40px;--ax:-79px;--ay:0px}
.fsweb-hud-icon-friend{--aw:26px;--ah:40px;--ax:-107px;--ay:0px}
.fsweb-hud-icon-guild{--aw:26px;--ah:40px;--ax:-135px;--ay:0px}
.fsweb-hud-icon-horse{--aw:26px;--ah:40px;--ax:-163px;--ay:0px}
.fsweb-hud-icon-i_pk{--aw:26px;--ah:40px;--ax:-191px;--ay:0px}
.fsweb-hud-icon-info{--aw:26px;--ah:40px;--ax:-219px;--ay:0px}
.fsweb-hud-icon-mining{--aw:26px;--ah:40px;--ax:0px;--ay:-51px}
.fsweb-hud-icon-quest{--aw:26px;--ah:40px;--ax:-28px;--ay:-51px}
.fsweb-hud-icon-skill{--aw:26px;--ah:40px;--ax:-56px;--ay:-51px}
.fsweb-hud-icon-sys{--aw:26px;--ah:40px;--ax:-84px;--ay:-51px}
.fsweb-hud-icon-team{--aw:26px;--ah:40px;--ax:-112px;--ay:-51px}
.fsweb-hud-icon-auto{--aw:67px;--ah:29px;--ax:-140px;--ay:-51px}

/* Bottom toolbar cards cleanly replaced by fsweb atlas.webp */
.game-shell .native-toolbar-button.fsweb-atlas-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:visible;
  --s:1.3;
}
.game-shell .native-toolbar-button.fsweb-atlas-btn[data-native-key="IBShop"]{
  --s:1.0612;
}
.game-shell .native-toolbar-button.fsweb-atlas-btn[data-native-key="PK"]::after{
  right:3px;
  bottom:3px;
  width:7px;
  height:7px;
}

/* Ride card in chat-actions (flush above chat box, no circular mask) */
.game-shell .chat-actions .native-toolbar-button.fsweb-atlas-btn{
  --s:0.85;
  overflow:visible;
  border-radius:0;
  filter:brightness(.88) drop-shadow(0 1px 3px rgba(0,0,0,.85));
}
.game-shell .chat-actions .native-toolbar-button.fsweb-atlas-btn[aria-pressed="true"]{
  box-shadow:none;
  filter:brightness(1.16) drop-shadow(0 0 6px rgba(255,215,0,.82)) drop-shadow(0 1px 3px rgba(0,0,0,.85));
}

/* Minimap Settings gear button matches Phúc lợi & Xếp hạng size & gold frame */
.game-shell #minimapTools #miniSystem.fsweb-mini-sys{
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  padding:0;
}
.game-shell #minimapTools #miniSystem.fsweb-mini-sys .fsweb-hud-icon-sys{
  display:block!important;
  --aw:22px;
  --ah:30px;
  --ax:-86px;
  --ay:-58px;
  --s:0.93;
  filter:drop-shadow(0 1px 1px #000a);
}
@media(orientation:portrait) and (max-width:480px){
  .game-shell #minimapTools #miniSystem.fsweb-mini-sys .fsweb-hud-icon-sys{
    --s:0.80;
  }
}

/* AUTO pill directly left of "Về thành" on minimap bottom-left; hold 2s to configure */
.game-shell .quick{
  align-items:flex-end;
}
.game-shell .minimap > .hud-auto-switch.fsweb-auto-pill{
  position:absolute;
  right:calc(100% + 4px);
  bottom:2px;
  z-index:6;
  width:auto!important;
  height:auto!important;
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  gap:0!important;
  border:0!important;
  border-radius:999px!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:row;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  transition:transform .12s ease,filter .12s ease;
  --s:0.86;
  filter:brightness(.76) saturate(.78) drop-shadow(0 2px 3px rgba(0,0,0,.85));
}
.game-shell .minimap > .hud-auto-switch.fsweb-auto-pill[aria-pressed="true"]{
  filter:brightness(1.16) saturate(1.15) drop-shadow(0 0 6px #6dff8f) drop-shadow(0 2px 3px rgba(0,0,0,.85));
}
.game-shell .minimap > .hud-auto-switch.fsweb-auto-pill.is-holding{
  transform:scale(.95);
  filter:brightness(1.22) saturate(1.18) drop-shadow(0 0 7px #ffd866) drop-shadow(0 2px 3px rgba(0,0,0,.85));
}
.game-shell .minimap > .hud-auto-switch.fsweb-auto-pill.is-holding::after{
  content:'';
  position:absolute;
  left:6px;
  right:6px;
  bottom:-4px;
  height:2px;
  border-radius:2px;
  background:linear-gradient(90deg,#ffd866,#7cff9b);
  box-shadow:0 0 4px #ffd866;
  transform-origin:left center;
  animation:tg-auto-hold 2s linear forwards;
  pointer-events:none;
}
@keyframes tg-auto-hold{
  from{transform:scaleX(0)}
  to{transform:scaleX(1)}
}
@media(prefers-reduced-motion:reduce){
  .game-shell .minimap > .hud-auto-switch.fsweb-auto-pill.is-holding::after{
    animation:none;
    transform:scaleX(1);
  }
}
.game-shell .minimap > .hud-auto-switch.fsweb-auto-pill i{
  position:absolute;
  right:3px;
  top:2px;
  width:5px;
  height:5px;
}
@media(max-width:600px){
  .game-shell .minimap > .hud-auto-switch.fsweb-auto-pill{--s:0.80}
}
@media(max-height:550px) and (orientation:landscape){
  .game-shell .minimap > .hud-auto-switch.fsweb-auto-pill{--s:0.70}
}

/* Portrait map-transition loading overlay (assets/ui/fsweb/bg_fsweb_p.webp) */
.tg-loading-overlay{
  position:fixed;
  inset:0;
  z-index:99;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding:max(20px,env(safe-area-inset-top)) max(18px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left));
  box-sizing:border-box;
  background:radial-gradient(ellipse at 50% 42%,rgba(12,10,6,.48),rgba(4,4,3,.82) 72%),#070604 url('assets/ui/fsweb/bg_fsweb_p.webp') center/cover no-repeat;
  color:#f4ead0;
  font:13px/1.45 'TG Vietnamese Serif',Georgia,serif;
  text-align:center;
  opacity:0;
  pointer-events:none;
  transition:opacity .22s ease;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}
.tg-loading-overlay.is-visible{
  opacity:1;
  pointer-events:auto;
}
.tg-loading-overlay .tg-loading-ring{
  position:relative;
  width:52px;
  height:52px;
  border-radius:50%;
  border:3px solid rgba(201,162,74,.25);
  border-top-color:#f0c96a;
  box-shadow:0 0 18px rgba(240,201,106,.28);
  animation:tg-loading-spin 1s linear infinite;
}
.tg-loading-overlay .tg-loading-ring::after{
  content:'';
  position:absolute;
  inset:8px;
  border-radius:50%;
  border:2px solid rgba(201,162,74,.2);
  border-bottom-color:#b57e27;
  animation:tg-loading-spin 1.5s linear infinite reverse;
}
@keyframes tg-loading-spin{to{transform:rotate(360deg)}}
.tg-loading-overlay h2{
  margin:4px 0 0;
  color:#f5d685;
  font:700 17px/1.2 'TG Vietnamese Serif',Georgia,serif;
  letter-spacing:.08em;
  text-shadow:0 2px 6px #000;
}
.tg-loading-overlay p{
  margin:0;
  color:#e4d9bc;
  font-size:12px;
  text-shadow:0 1px 4px #000;
}
@media(prefers-reduced-motion:reduce){
  .tg-loading-overlay,.tg-loading-overlay .tg-loading-ring,.tg-loading-overlay .tg-loading-ring::after{
    transition:none;
    animation:none;
  }
}

/* Minimap tap-to-walk target marker */
.game-shell .mini-wrap{
  cursor:pointer;
  touch-action:manipulation;
}
.game-shell .mini-dest-dot{
  position:absolute;
  width:8px;
  height:8px;
  border-radius:50%;
  border:1.5px solid #1a1206;
  background:#ffe26a;
  box-shadow:0 0 6px #ffcf33;
  transform:translate(-50%,-50%);
  pointer-events:none;
  animation:tg-mini-dest-pulse 1.2s ease-out forwards;
}
@keyframes tg-mini-dest-pulse{
  0%{transform:translate(-50%,-50%) scale(1.25);opacity:1}
  100%{transform:translate(-50%,-50%) scale(.75);opacity:0}
}

/* Animated Phong Than sprite-sheet chat emojis (95 entries in emoji.webp) */
.chat-emoji-anim{
  display:inline-block;
  width:var(--emoji-size,20px);
  height:var(--emoji-size,20px);
  vertical-align:middle;
  background-image:url('assets/ui/fsweb/emoji.webp');
  background-repeat:no-repeat;
  background-size:calc(var(--emoji-size,20px) * 16) calc(var(--emoji-size,20px) * 12);
  background-position:calc(var(--emoji-col,0) * var(--emoji-size,20px) * -1) calc(var(--emoji-row,0) * var(--emoji-size,20px) * -1);
  image-rendering:auto;
}
#chatPanel .chat-emoticon.chat-emoji-anim{--emoji-size:18px}
.chat-emoticon-picker .chat-emoticon-btn{display:grid;place-items:center;padding:3px;min-height:30px}
.chat-emoticon-picker .chat-emoji-anim{--emoji-size:22px}

/* Crisp SVG max-opt blue star in item tooltips */
.equipment-max-star:has(>svg){
  background:none!important;
  vertical-align:-1px;
}
.equipment-max-star>svg{
  display:block;
  width:100%;
  height:100%;
  filter:drop-shadow(0 0 2px #1a58a8);
}

/* Live countdown beneath timed buff icons */
.game-shell .effect-slot{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  width:18px;
}
.game-shell .effect-timer{
  font:700 8px/1 Tahoma,Arial,sans-serif;
  color:#fff2a6;
  text-shadow:1px 1px #000,-1px -1px #000,1px -1px #000,-1px 1px #000;
  margin-top:1px;
  white-space:nowrap;
}

/* Soft radial ground shadows under town NPCs & chests (never modifies canvas pixels) */
.game-shell .newcomer-actor canvas,
.game-shell .storage-world-actor canvas,
.game-shell .battle-signup-npc canvas{z-index:1}
.game-shell .newcomer-actor::before,
.game-shell .storage-world-actor::before,
.game-shell .battle-signup-npc::before{
  content:'';
  position:absolute;
  width:46px;
  height:20px;
  border-radius:50%;
  background:radial-gradient(ellipse at center,rgba(0,0,0,.44) 0%,rgba(0,0,0,.28) 45%,rgba(0,0,0,.09) 76%,rgba(0,0,0,0) 100%);
  transform:translate(-50%,-50%);
  pointer-events:none;
  z-index:0;
}
.game-shell .newcomer-actor::before{left:50%;top:97%}
.game-shell .storage-world-actor[data-storage-actor="keeper"]::before{left:26.2%;top:78.2%}
.game-shell .storage-world-actor[data-storage-actor="chest"]::before{left:50%;top:94%;width:52px;height:22px}
.game-shell .battle-signup-npc::before{left:0;top:2px}

/* Vòng Thái Tuế — Càn Khôn Luân Modal (mobile portrait first) */
.can-khon-dialog[hidden]{display:none!important}
.can-khon-dialog{
  box-sizing:border-box;
  position:fixed;
  inset:0;
  margin:auto;
  width:min(414px,calc(100vw - 12px));
  max-width:min(414px,calc(100vw - 12px));
  max-height:calc(100dvh - 16px);
  padding:8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  border:1px solid #c6a049;
  border-radius:4px;
  box-shadow:inset 0 0 0 2px #443114,0 10px 30px rgba(0,0,0,.85);
  background:radial-gradient(ellipse at 50% 35%,#1d170d,#090b07 78%);
  color:#efe2ba;
  font:12px/1.35 'TG Vietnamese Serif',Georgia,serif;
  z-index:62;
}
.can-khon-dialog button{margin:0;width:auto;min-height:0}
.can-khon-dialog::backdrop{background:rgba(0,0,0,.62)}
.can-khon-dialog .ck-header{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  padding:4px 6px;
  box-sizing:border-box;
  border-bottom:1px solid #967736;
  background:linear-gradient(95deg,#251b0e,#332613,#19140b);
}
.can-khon-dialog .ck-title-group{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.can-khon-dialog .ck-title-group strong{font-size:13px;color:#ffd978;text-shadow:0 1px 2px #000}
.can-khon-dialog .ck-spins-pill{
  padding:1px 6px;
  border-radius:10px;
  background:rgba(24,42,20,.85);
  border:1px solid #6b9e45;
  color:#c9ff9e;
  font-size:11px;
  white-space:nowrap;
}
.can-khon-dialog .ck-close{
  flex:0 0 28px;
  width:28px;
  height:26px;
  min-height:26px;
  padding:0;
  border:1px solid #987a3b;
  border-radius:2px;
  background:#1f180d;
  color:#f5deb0;
  font:20px/22px Georgia,serif;
  cursor:pointer;
}
.can-khon-dialog .ck-stage-wrap{
  position:relative;
  flex:0 0 auto;
  overflow:hidden;
  margin:0 auto;
}
.can-khon-dialog .ck-stage{
  position:relative;
  width:389px;
  height:357px;
  transform-origin:top left;
  background:url('assets/ui/fsweb/wheel-bg.webp') 0 0/389px 357px no-repeat;
  user-select:none;
  -webkit-user-select:none;
}
.can-khon-dialog .ck-slot{
  position:absolute;
  display:flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  min-width:0;
  min-height:0;
  padding:1px;
  margin:0;
  border-radius:6px;
  border:1px solid transparent;
  background:transparent;
  color:#eed284;
  font:700 8.5px/1.05 'TG Vietnamese Serif',Georgia,serif;
  text-align:center;
  text-shadow:0 1px 2px #000,0 0 3px #000;
  cursor:pointer;
  transition:box-shadow .14s ease,border-color .14s ease,background-color .14s ease,color .14s ease;
}
.can-khon-dialog .ck-slot span{pointer-events:none;display:block}
.can-khon-dialog .ck-slot:hover,
.can-khon-dialog .ck-slot.is-active{
  border-color:#ffd866;
  color:#fff6c7;
  background:radial-gradient(circle,rgba(255,220,100,.26),rgba(255,165,0,.08) 65%,transparent);
  box-shadow:0 0 12px rgba(255,210,72,.75),inset 0 0 8px rgba(255,245,180,.55);
}
.can-khon-dialog .ck-ptr{
  position:absolute;
  width:44px;
  height:44px;
  transform:translate(-50%,-50%);
  pointer-events:none;
  filter:drop-shadow(0 0 6px #ffae00);
  animation:ck-ptr-pulse .8s ease-in-out infinite alternate;
  z-index:2;
}
.can-khon-dialog .ck-ptr[hidden]{display:none}
@keyframes ck-ptr-pulse{
  0%{transform:translate(-50%,-50%) scale(.96)}
  100%{transform:translate(-50%,-50%) scale(1.06)}
}
.can-khon-dialog .ck-action-btn{
  position:absolute;
  left:194px;
  top:311px;
  transform:translate(-50%,-50%);
  width:116px;
  min-width:116px;
  max-width:136px;
  height:28px;
  min-height:28px;
  margin:0;
  padding:0 12px;
  border:1px solid #f0c96a;
  border-radius:14px;
  background:linear-gradient(180deg,#8b5a14,#4e2f06);
  color:#fff2bd;
  font:700 12px/1 'TG Vietnamese Serif',Georgia,serif;
  text-shadow:0 1px 2px #000;
  box-shadow:0 2px 8px rgba(0,0,0,.8),inset 0 1px 0 rgba(255,235,170,.45);
  cursor:pointer;
  z-index:3;
}
.can-khon-dialog .ck-action-btn:disabled{
  opacity:.55;
  cursor:default;
}
.can-khon-dialog .ck-footer{
  width:100%;
  display:flex;
  flex-direction:column;
  gap:5px;
}
.can-khon-dialog .ck-wallet-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:6px;
  padding:5px 7px;
  border:1px solid #4e3b1b;
  border-radius:3px;
  background:rgba(15,12,7,.85);
}
.can-khon-dialog .ck-cost-badge.is-free{color:#7bf07b;font-weight:700}
.can-khon-dialog .ck-cost-badge.is-exhausted{color:#ff847c;font-weight:700}
.can-khon-dialog .ck-balances{color:#cbbd94;font-size:11px}
.can-khon-dialog .ck-pay-toggle{display:flex;gap:4px}
.can-khon-dialog .ck-pay-toggle button{
  min-height:26px;
  padding:2px 8px;
  border:1px solid #755b2c;
  border-radius:2px;
  background:#1c160c;
  color:#dfd0a3;
  font:11px/1.2 'TG Vietnamese Serif',Georgia,serif;
  cursor:pointer;
}
.can-khon-dialog .ck-pay-toggle button[aria-pressed="true"]{
  border-color:#f2cb68;
  background:#4d3812;
  color:#fff1b8;
  font-weight:700;
}
.can-khon-dialog .ck-buff-bar{
  padding:4px 8px;
  border:1px solid #598931;
  border-radius:3px;
  background:rgba(24,48,16,.85);
  color:#bfff8e;
  font-size:11px;
  text-align:center;
}
.can-khon-dialog .ck-buff-bar[hidden]{display:none}
.can-khon-dialog .ck-info-box{
  padding:6px 8px;
  border:1px solid #54401d;
  border-radius:3px;
  background:rgba(13,11,8,.92);
  display:flex;
  flex-direction:column;
  gap:2px;
}
.can-khon-dialog .ck-info-box strong{color:#ffd978;font-size:12px}
.can-khon-dialog .ck-info-box span{color:#d8c99d;font-size:11.5px;line-height:1.35}
.can-khon-dialog .ck-info-box.is-win{
  border-color:#d8a93e;
  background:linear-gradient(180deg,rgba(56,39,12,.92),rgba(20,16,8,.95));
}