/* ══════════════════════════════════════════════════════════
   EMOJI WORLD - UI STYLES
   Chat, Dialogs, Inventory Panel, Market Game
   ══════════════════════════════════════════════════════════ */

/* NPC DIALOG OVERLAY */
#npcOv, #deliveryOv {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 960;
  display: none;
  align-items: center;
  justify-content: center;
}

#npcOv.show, #deliveryOv.show {
  display: flex;
}

#npcOv.show.long {
  align-items: flex-start;
}

#npcDlg, #deliveryDlg {
  background: linear-gradient(160deg, var(--panel), var(--p2));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 24px;
  padding: 32px 28px 40px;
  width: min(520px, 95vw);
  max-height: 85vh;
  animation: su .25s ease-out;
}

#npcDlg.short {
  margin: auto;
}

#npcDlg.long {
  width: 100%;
  max-width: 100%;
  max-height: 100vh;
  border-radius: 0;
  overflow-y: auto;
}

@keyframes su {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ndh {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.ndav {
  font-size: 48px;
  line-height: 1;
}

.ndnm {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: var(--tx);
}

.ndrl {
  font-size: 12px;
  color: var(--g);
  font-weight: 700;
}

.ndms {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0;
}

.ndm {
  background: var(--dark);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--tx);
  line-height: 1.5;
  border-left: 3px solid var(--g);
}

.ndm em {
  color: var(--yl);
  font-style: normal;
  font-weight: 800;
}

.ndcl {
  margin-top: 18px;
  background: var(--g2);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}

/* DELIVERY MODAL SPECIFIC */
.dl-card {
  background: linear-gradient(160deg, var(--panel), var(--p2));
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 32px;
  padding: 32px;
  width: min(420px, 90vw);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: su .3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.dl-hdr {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: var(--yl);
  text-align: center;
  margin-bottom: 24px;
}

.dl-body {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
}

.dl-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

#dlTargetAv {
  font-size: 56px;
  line-height: 1;
}

#dlTargetNm {
  font-family: 'Fredoka One', cursive;
  font-size: 18px;
  color: #fff;
}

.dl-req {
  font-size: 15px;
  color: var(--tx2);
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 12px;
}

.dl-req b {
  color: var(--tx);
  font-weight: 800;
}

.dl-hint {
  font-size: 12px;
  color: var(--or);
  font-weight: 700;
  background: rgba(255, 107, 53, 0.1);
  padding: 8px;
  border-radius: 8px;
}

.dl-btns {
  display: flex;
  gap: 12px;
}

.dl-btn-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}

.dl-btn-cancel:hover { background: rgba(255, 255, 255, 0.15); }

.dl-btn-confirm {
  flex: 2;
  background: var(--g);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s;
}

.dl-btn-confirm:disabled {
  background: #333;
  color: #666;
  cursor: not-allowed;
  opacity: 0.6;
}

.dl-btn-confirm:not(:disabled):hover {
  background: var(--g2);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 200, 83, 0.4);
}

/* REWARDS POPUP */
#rwPop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
}

#rwPop.show {
  display: flex;
}

.rwc {
  background: linear-gradient(135deg, var(--panel), var(--p2));
  border: 2px solid var(--g);
  border-radius: 22px;
  padding: 30px 26px;
  text-align: center;
  width: min(320px, 90vw);
  animation: rwp .4s cubic-bezier(.175, .885, .32, 1.275);
  box-shadow: 0 0 80px rgba(0, 200, 83, .25);
}

@keyframes rwp {
  from {
    transform: scale(.5);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.rwem {
  font-size: 64px;
  margin-bottom: 14px;
  animation: rws 2s ease-in-out infinite;
}

@keyframes rws {
  0%, 100% {
    transform: rotate(-5deg);
  }
  50% {
    transform: rotate(5deg) scale(1.08);
  }
}

.rwt {
  font-family: 'Fredoka One', cursive;
  font-size: 24px;
  color: var(--yl);
  margin-bottom: 8px;
}

.rwd {
  font-size: 13px;
  color: var(--tx2);
  margin-bottom: 16px;
  line-height: 1.6;
}

.rwxp {
  font-size: 32px;
  font-weight: 900;
  color: var(--g);
  margin-bottom: 20px;
}

.rwbtn {
  background: var(--g);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 13px 36px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.rwbtn:hover {
  background: var(--g2);
}

/* INBOX PANEL */
#ibPanel {
  background: var(--dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  width: 0;
  transition: width .3s cubic-bezier(.4, 0, .2, 1);
  border-left: 1px solid var(--bdr);
}

#ibPanel.open {
  width: min(400px, 42vw);
}

@media(max-width:899px) {
  #ibPanel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100dvh;
    min-height: 100dvh;
    width: 100% !important;
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    border: none;
    z-index: 970;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow: hidden;
    background: var(--dark);
    position: fixed;
  }

  #ibPanel.open {
    transform: translateX(0);
  }

  /* Chat panel - cubre todo el ibPanel tipo WhatsApp */
  #chPanel {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    inset: auto !important;
    background: var(--dark);
    z-index: 10;
    display: none;
    flex-direction: column;
    overflow: hidden;
  }

  #chPanel.show {
    display: flex !important;
  }
}

.ibhdr {
  background: var(--panel);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  min-height: 52px;
}

.ibl {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ibt {
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: var(--g);
}

.ibx {
  font-size: 22px;
  color: var(--tx);
  cursor: pointer;
  padding: 6px 10px;
  line-height: 1;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  font-weight: 700;
  transition: all .15s;
}

.ibx:hover {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

/* PROFILE BAR */
.pbar {
  background: linear-gradient(135deg, #1a2f38, #0d1f26);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 168, 132, .2);
  flex-shrink: 0;
  min-height: 56px;
  gap: 6px;
}

.pbl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.pbav {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--g2), var(--g));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.pbnm {
  font-size: 13px;
  font-weight: 700;
  color: var(--tx);
}

.pblv {
  font-size: 11px;
  color: var(--g);
  font-weight: 700;
}

.pbst {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.pbs {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pbsv {
  font-size: 14px;
  font-weight: 800;
  color: var(--tx);
}

.pbsl {
  font-size: 9px;
  color: var(--tx3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* MISSIONS SECTION */
.slbl {
  padding: 7px 16px;
  font-size: 11px;
  color: var(--g);
  font-weight: 800;
  letter-spacing: .8px;
  background: rgba(0, 168, 132, .07);
  border-bottom: 1px solid rgba(0, 168, 132, .12);
  flex-shrink: 0;
}

.clist {
  flex: 1;
  overflow-y: auto;
}

.clist::-webkit-scrollbar {
  width: 4px;
}

.clist::-webkit-scrollbar-thumb {
  background: var(--p2);
  border-radius: 4px;
}

.ci {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  gap: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, .04);
  transition: background .1s;
}

.ci-slide-in {
  animation: ciSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes ciSlideIn {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.empty-inbox-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  font-family: 'Nunito', sans-serif;
  text-align: center;
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.ci:hover {
  background: var(--panel);
}

.ciav {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
  position: relative;
}

.cidot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  background: var(--g);
  border-radius: 50%;
  border: 2px solid var(--dark);
}

.cimeta {
  flex: 1;
  min-width: 0;
}

.citop {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  gap: 6px;
}

.cinm {
  font-size: 15px;
  font-weight: 700;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.citm {
  font-size: 11px;
  color: var(--tx3);
  flex-shrink: 0;
}

.citm.u {
  color: var(--g);
}

.cibot {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cipv {
  font-size: 13px;
  color: var(--tx3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.cibg {
  background: var(--g);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

.cidn {
  background: linear-gradient(135deg, var(--yl), var(--or));
  color: #1a0b00;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* CHAT PANEL */
#chPanel {
  position: absolute;
  inset: 0;
  background: var(--dark);
  z-index: 40;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#chPanel.show {
  display: flex;
}

#chPanel .chinp {
  flex-shrink: 0 !important;
  min-height: 52px;
  z-index: 50;
  background: var(--dark);
}
#chPanel .msgs {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.chhdr {
  background: var(--panel);
  display: flex;
  align-items: center;
  padding: 10px 14px;
  gap: 10px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  min-height: 56px;
}

.chbk {
  color: var(--tx2);
  font-size: 28px;
  cursor: pointer;
  padding: 2px 8px 2px 0;
  line-height: 1;
  background: none;
  border: none;
}

.chbk:hover {
  color: var(--tx);
}

.chav {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.chinf {
  flex: 1;
  min-width: 0;
}

.chnm {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chst {
  font-size: 12px;
  color: var(--g);
  font-weight: 600;
}

.chact {
  display: flex;
  gap: 18px;
  color: var(--tx2);
  font-size: 21px;
  flex-shrink: 0;
}

/* MISSION CHIP */
.mchip {
  background: linear-gradient(135deg, rgba(255, 215, 61, .1), rgba(255, 107, 53, .1));
  border: 1px solid rgba(255, 215, 61, .22);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mcic {
  font-size: 17px;
}

.mctx {
  font-size: 12px;
  color: var(--yl);
  font-weight: 700;
  flex: 1;
  line-height: 1.3;
}

.mcxp {
  font-size: 11px;
  font-weight: 800;
  color: var(--or);
  background: rgba(255, 107, 53, .14);
  padding: 3px 9px;
  border-radius: 10px;
  white-space: nowrap;
}

/* MESSAGES */
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msgs::-webkit-scrollbar {
  width: 4px;
}

.msgs::-webkit-scrollbar-thumb {
  background: var(--p2);
  border-radius: 4px;
}

.dchip {
  align-self: center;
  background: var(--panel);
  color: var(--tx2);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 8px;
  margin: 8px 0;
}

.mrow {
  display: flex;
  margin-bottom: 2px;
}

.mrow.in {
  justify-content: flex-start;
}

.mrow.out {
  justify-content: flex-end;
}

.mbub {
  max-width: 76%;
  padding: 8px 13px 6px;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  animation: mp .22s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes mp {
  from {
    transform: scale(.84) translateY(8px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.mrow.in .mbub {
  background: var(--panel);
  border-top-left-radius: 2px;
}

.mrow.out .mbub {
  background: #005C4B;
  border-top-right-radius: 2px;
}

.mrow.in .mbub::before {
  content: '';
  position: absolute;
  top: 0;
  left: -9px;
  border-top: 9px solid var(--panel);
  border-left: 9px solid transparent;
}

.mrow.out .mbub::after {
  content: '';
  position: absolute;
  top: 0;
  right: -9px;
  border-top: 9px solid #005C4B;
  border-right: 9px solid transparent;
}

.mtxt {
  font-size: 14px;
  color: var(--tx);
  line-height: 1.5;
  word-break: break-word;
}

.mtxt em {
  color: var(--yl);
  font-style: normal;
  font-weight: 700;
}

.mmeta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 3px;
}

.mtime {
  font-size: 10px;
  color: rgba(255, 255, 255, .38);
}

.mtick {
  font-size: 12px;
  color: var(--blue);
}

/* TYPING INDICATOR */
.typr {
  padding: 0 14px 5px;
}

.typ {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 10px 14px 9px;
  background: var(--panel);
  border-radius: 10px;
  border-top-left-radius: 2px;
  width: 64px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

.typ.show {
  display: flex;
}

.td {
  width: 7px;
  height: 7px;
  background: var(--tx3);
  border-radius: 50%;
  animation: tb 1.2s ease-in-out infinite;
}

.td:nth-child(2) {
  animation-delay: .2s;
}

.td:nth-child(3) {
  animation-delay: .4s;
}

@keyframes tb {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: .4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* CHAT INPUT */
.chinp {
  background: var(--dark);
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  border-top: 1px solid var(--bdr);
  position: relative;
  z-index: 2;
}

.embtn {
  color: var(--tx3);
  font-size: 25px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

.inpw {
  flex: 1;
  background: var(--p2);
  border-radius: 24px;
  display: flex;
  align-items: flex-end;
  padding: 8px 14px;
  min-height: 46px;
  max-height: 120px;
}

.minp {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--tx);
  font-size: 15px;
  resize: none;
  font-family: inherit;
  line-height: 1.5;
  max-height: 104px;
  overflow-y: auto;
  scrollbar-width: none;
}

.minp::-webkit-scrollbar {
  display: none;
}

.minp::placeholder {
  color: var(--tx3);
}

.sndbtn {
  width: 46px;
  height: 46px;
  background: var(--g);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 22px;
  border: none;
  transition: all .1s;
}

.sndbtn:hover {
  background: var(--g2);
}

.sndbtn:active {
  transform: scale(.9);
}

.hintbtn {
  background: rgba(255, 215, 61, .12);
  border: 1px solid rgba(255, 215, 61, .28);
  border-radius: 16px;
  padding: 7px 18px;
  color: var(--yl);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  align-self: center;
  margin: 5px 0;
  font-family: inherit;
}

.hintbtn:hover {
  background: rgba(255, 215, 61, .22);
}

/* PERMIT CHIP */
#permitChipWrap {
  display: none;
  padding: 4px 10px 6px;
}

#permitChipBtn {
  width: 100%;
  background: linear-gradient(135deg,#1B5E20,#2E7D32);
  color: #A5D6A7;
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

/* MARKET GAME - uses .game-frame-ov class for overlay styling */

.market-game {
  --cs: clamp(28px, calc((100vw - 40px) / 8), 54px);
  --gap: clamp(2px, .5vw, 5px);
  --wood1: #6D4C41;
  --wood2: #5D4037;
  --wood3: #4E342E;
  --board: #8D6E63;
  --board2: #795548;
  --wall: #FFF8F0;
  --wall2: #FFF3E0;
  --g: #2E7D32;
  --g2: #43A047;
  --g3: #C8E6C9;
  --gold: #F9A825;
  --gold2: #FF8F00;
  --gold3: #FFF9C4;
  --dark: #2d1a08;
  --tx2: #5a3e28;
  --shadow: rgba(0, 0, 0, .22);
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--wall);
  border-radius: 16px;
  overflow: hidden;
}

.market-game .screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity .35s, transform .35s;
  background: var(--wall);
}

.market-game .screen.off {
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
}

.market-game #sIntro {
  background: linear-gradient(180deg, #FFE0A3 0%, #FFD07A 40%, #FFC55A 100%);
  align-items: center;
  justify-content: flex-end;
  padding: 0;
}

.market-game .intro-sky {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px 12px 0;
  min-height: 0;
}

.market-game .store-building {
  width: min(460px, 98vw);
  display: flex;
  flex-direction: column;
}

.market-game .store-roof {
  background: linear-gradient(180deg, #D4813A, #C4712A);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px 0;
  box-shadow: 0 -3px 0 #A05020;
}

.market-game .store-sign {
  background: linear-gradient(135deg, #2E7D32, #1B5E20);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  border: 3px solid #FFD700;
  box-shadow: 0 0 20px rgba(255, 215, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .18);
  margin-bottom: 12px;
}

.market-game .sign-em {
  font-size: clamp(26px, 6vw, 36px);
  display: block;
}

.market-game .sign-nm {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(17px, 4.5vw, 25px);
  color: #FFD700;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}

.market-game .sign-sub {
  font-size: clamp(9px, 2.5vw, 11px);
  color: #A5D6A7;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.market-game .store-windows {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 0;
}

.market-game .win {
  width: clamp(64px, 17vw, 84px);
  height: clamp(50px, 13vw, 64px);
  background: linear-gradient(135deg, #87CEEB, #B0E0FF);
  border: 4px solid #8B6914;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 15px;
}

.market-game .win::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(139, 105, 20, .4);
}

.market-game .win::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(139, 105, 20, .4);
}

.market-game .store-door {
  background: linear-gradient(180deg, #FFF8F0, #FFF0D8);
  border-radius: 16px 16px 0 0;
  padding: 14px 16px 0;
  margin-top: 8px;
  border: 3px solid #C4712A;
  border-bottom: none;
}

.market-game .shopkeeper-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.market-game .sk {
  font-size: clamp(46px, 11vw, 64px);
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2));
  animation: skBob 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes skBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.market-game .bubble {
  background: #fff;
  border-radius: 16px 16px 16px 3px;
  padding: 12px 14px;
  box-shadow: 0 3px 12px var(--shadow);
  border: 2px solid #E8D5B0;
  flex: 1;
  min-width: 0;
}

.market-game .bubble-name {
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  color: var(--g);
  margin-bottom: 4px;
  letter-spacing: .4px;
}

.market-game .bubble-txt {
  font-size: clamp(12px, 3vw, 14px);
  color: var(--dark);
  line-height: 1.5;
  font-weight: 700;
}

.market-game .bubble-txt em {
  color: var(--g2);
  font-style: normal;
  font-weight: 900;
}

.market-game .bubble-txt strong {
  color: var(--gold2);
  font-weight: 900;
}

.market-game .intro-actions {
  width: min(460px, 98vw);
  padding: 12px 16px clamp(12px, 4vw, 24px);
  background: linear-gradient(180deg, #FFF8F0, #FFF0D8);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: none;
  flex-shrink: 0;
}

.market-game .btn-main {
  background: linear-gradient(135deg, var(--g2), var(--g));
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: clamp(11px, 2.5vw, 14px) 24px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(14px, 3.5vw, 17px);
  cursor: pointer;
  letter-spacing: .4px;
  box-shadow: 0 4px 0 var(--g), 0 6px 20px rgba(46, 125, 50, .3);
  transition: all .1s;
  width: 100%;
}

.market-game .btn-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 var(--g);
}

.market-game .btn-main:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--g);
}

.market-game .btn-skip {
  background: none;
  border: 2px solid rgba(0, 0, 0, .12);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 800;
  color: var(--tx2);
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
  align-self: center;
}

.market-game .btn-skip:hover {
  background: rgba(0, 0, 0, .05);
}

.market-game #hud {
  background: linear-gradient(135deg, var(--g), #1B5E20);
  padding: clamp(6px, 1.5vw, 9px) clamp(10px, 2.5vw, 16px);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
  z-index: 10;
}

.market-game .hud-t {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(14px, 3.5vw, 18px);
  color: #fff;
  flex: 1;
}

.market-game .hud-chip {
  background: rgba(255, 255, 255, .15);
  border-radius: 12px;
  padding: 3px 9px;
  font-size: clamp(11px, 2.5vw, 12px);
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.market-game .hud-hint-btn {
  background: rgba(255, 215, 0, .18);
  border: 1.5px solid rgba(255, 215, 0, .5);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  color: #FFD700;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}

.market-game .hud-hint-btn:hover {
  background: rgba(255, 215, 0, .32);
}

.market-game #progWrap {
  height: 5px;
  background: rgba(0, 0, 0, .1);
  flex-shrink: 0;
}

.market-game #progBar {
  height: 100%;
  background: linear-gradient(90deg, #81C784, #2E7D32);
  transition: width .35s ease;
}

.market-game #gameMain {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

@media(min-width:640px) {
  .market-game #gameMain {
    flex-direction: row;
  }
}

.market-game #shelfZone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

@media(min-width:640px) {
  .market-game #shelfZone {
    flex: 1;
    padding: clamp(8px, 2vw, 14px);
  }
}

.market-game .shelf-wrap {
  background: linear-gradient(180deg, var(--wood1), var(--wood2));
  border-radius: 10px;
  padding: 6px 8px;
  box-shadow: 0 5px 0 var(--wood3), 0 8px 20px rgba(0, 0, 0, .38);
  border: 3px solid var(--board);
  width: calc(8 * var(--cs) + 7 * var(--gap) + 16px);
  max-width: 100%;
  position: relative;
  box-sizing: border-box;
}

@media(min-width:640px) {
  .market-game .shelf-wrap {
    padding: clamp(6px, 1.5vw, 10px) clamp(8px, 2vw, 12px);
    width: calc(8 * var(--cs) + 7 * var(--gap) + 24px);
  }
}

.market-game .shelf-wrap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,.22), rgba(255,255,255,.07));
  border-radius: 10px 10px 0 0;
}

.market-game .shelf-row {
  display: grid;
  grid-template-columns: repeat(8, var(--cs));
  gap: var(--gap);
  justify-content: center;
  padding: var(--gap) 0;
}

.market-game .shelf-board {
  height: clamp(8px, 1.6vw, 13px);
  background: linear-gradient(180deg, var(--board), var(--board2));
  margin: 0 -1px;
  box-shadow: 0 3px 0 var(--wood3), inset 0 1px 0 rgba(255,255,255,.15);
  border-radius: 2px;
}

.market-game .cell {
  width: var(--cs);
  height: var(--cs);
  border-radius: 6px;
  border: 2px dashed rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cs) * .55);
  transition: background .1s, border-color .1s, transform .1s;
  position: relative;
  background: rgba(0,0,0,.1);
}

.market-game .cell.filled {
  border-style: solid;
  cursor: grab;
}

.market-game .cell.filled:active {
  cursor: grabbing;
}

.market-game .cell.hl-ok {
  background: rgba(129, 199, 132, .35) !important;
  border: 2.5px solid #66BB6A !important;
  transform: scale(1.05);
}

.market-game .cell.hl-bad {
  background: rgba(239, 83, 80, .22) !important;
  border: 2.5px solid #EF5350 !important;
}

.market-game .cell.star-hint {
  border-color: rgba(255, 215, 0, .5);
  animation: sPulse 1.3s ease-in-out infinite;
}

@keyframes sPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, .3); }
  50% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0); }
}

.market-game .cell.fok {
  animation: fok .4s ease-out;
}

@keyframes fok {
  0% { background: rgba(76, 175, 80, .6); transform: scale(1.14); }
  100% { transform: scale(1); }
}

.market-game .cell.fbad {
  animation: fbad .35s ease-out;
}

@keyframes fbad {
  0%, 50% { background: rgba(229, 57, 53, .45); transform: scale(.93); }
  100% { transform: scale(1); }
}

.market-game #sidePanel {
  background: var(--wall2);
  display: flex;
  flex-direction: column;
  border-top: 2px solid rgba(0,0,0,.07);
  overflow: hidden;
  flex-shrink: 0;
  height: 165px;
}

@media(max-width:639px) {
  .market-game .tray {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 5px;
    padding: 4px 7px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .market-game .tray::-webkit-scrollbar { display: none; }
  .market-game .ti {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 7px;
    min-width: 58px;
    max-width: 68px;
    text-align: center;
  }
  .market-game .ti-nm  { font-size: 10px; white-space: nowrap; }
  .market-game .ti-em  { font-size: 22px; }
  .market-game .ti-txt { font-size: 8px; }
  .market-game .emoji-row { padding: 5px 7px; }
}

@media(min-width:640px) {
  .market-game #sidePanel {
    width: 250px;
    height: auto;
    border-top: none;
    border-left: 2px solid rgba(0,0,0,.07);
  }
}

@media(min-width:860px) {
  .market-game #sidePanel {
    width: 280px;
  }
}

.market-game .mango-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: rgba(255,243,224,.92);
  border-bottom: 1.5px solid rgba(0,0,0,.06);
  flex-shrink: 0;
  border-radius: 10px 10px 0 0;
  margin-bottom: 6px;
  width: calc(8 * var(--cs) + 7 * var(--gap) + 16px);
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

@media(min-width:640px) {
  .market-game .mango-bar {
    width: calc(8 * var(--cs) + 7 * var(--gap) + 24px);
    padding: 6px 12px;
  }
}

.market-game .mango-em {
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1;
  flex-shrink: 0;
  animation: skBob 2s ease-in-out infinite;
}

.market-game .mango-bbl {
  background: transparent;
  border-radius: 0;
  padding: 0;
  font-size: clamp(10px, 2.2vw, 12px);
  font-weight: 700;
  color: var(--dark);
  line-height: 1.4;
  border: none;
  flex: 1;
}

.market-game .mango-bbl em {
  color: var(--g2);
  font-style: normal;
  font-weight: 900;
}

.market-game .mango-bbl strong {
  color: var(--gold2);
  font-weight: 900;
}

.market-game .tray-lbl {
  padding: 6px 10px 3px;
  font-size: 10px;
  font-weight: 900;
  color: var(--g);
  letter-spacing: .7px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.market-game .tray {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 3px 7px 7px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.market-game .tray::-webkit-scrollbar {
  width: 4px;
}

.market-game .tray::-webkit-scrollbar-thumb {
  background: #C8A97E;
  border-radius: 4px;
}

.market-game .ti {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border-radius: 10px;
  padding: 7px 9px;
  border: 2px solid transparent;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .07);
  transition: all .14s;
  position: relative;
  flex-shrink: 0;
}

.market-game .ti:active {
  cursor: grabbing;
}

.market-game .ti:hover:not(.placed) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .13);
}

.market-game .ti.placed {
  opacity: .4;
  pointer-events: none;
  filter: grayscale(.5);
}

.market-game .ti.dragging {
  border-color: var(--gold);
  background: var(--gold3);
  box-shadow: 0 0 0 3px rgba(249, 168, 37, .22);
}

.market-game .ti-em {
  font-size: clamp(22px, 5vw, 28px);
  line-height: 1;
  flex-shrink: 0;
}

.market-game .ti-nm {
  font-size: clamp(11px, 2.7vw, 13px);
  font-weight: 800;
  color: var(--dark);
}

.market-game .ti-plan {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.market-game .ti-shape {
  display: grid;
  gap: 2px;
}

.market-game .ti-sc {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.market-game .ti-txt {
  font-size: 9px;
  font-weight: 700;
  color: var(--tx2);
}

.market-game .ti-check {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

.market-game .ti-star {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--gold);
  color: #7A4800;
  font-size: 8px;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 6px;
  letter-spacing: .4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .15);
}

.market-game .emoji-row {
  padding: 7px 9px;
  border-top: 1.5px solid rgba(0, 0, 0, .07);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  background: #FFF8F0;
}

.market-game .emoji-inp {
  flex: 1;
  background: #fff;
  border: 2px solid #E8D5B0;
  border-radius: 20px;
  padding: 8px 13px;
  font-size: 20px;
  outline: none;
  font-family: inherit;
  color: var(--dark);
  caret-color: var(--g);
  transition: border-color .14s;
}

.market-game .emoji-inp:focus {
  border-color: var(--g2);
}

.market-game .emoji-inp::placeholder {
  font-size: 11px;
  color: #bbb;
}

.market-game .add-btn {
  background: linear-gradient(135deg, var(--g2), var(--g));
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 12px;
  font-family: 'Fredoka One', cursive;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--g);
  transition: all .1s;
}

.market-game .add-btn:hover {
  transform: translateY(-1px);
}

.market-game .add-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--g);
}

.market-game #ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -65%);
}

.market-game .gcell {
  border-radius: 7px;
  border: 2.5px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4vw, 24px);
  opacity: .82;
}

.market-game .win-card {
  background: linear-gradient(160deg, #1B5E20, #2E7D32);
  border: 3px solid #FFD700;
  border-radius: 22px;
  padding: clamp(20px, 4vw, 30px);
  text-align: center;
  width: min(370px, 96vw);
  box-shadow: 0 0 50px rgba(255, 215, 0, .2), 0 20px 50px rgba(0, 0, 0, .5);
  animation: pop .4s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes pop {
  from { transform: scale(.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.market-game .win-em {
  font-size: clamp(56px, 13vw, 76px);
  display: block;
  margin-bottom: 10px;
  animation: wRock 2s ease-in-out infinite;
}

@keyframes wRock {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg) scale(1.07); }
}

.market-game .win-t {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(20px, 5vw, 27px);
  color: #FFD700;
  margin-bottom: 6px;
}

.market-game .win-s {
  font-size: clamp(12px, 3vw, 14px);
  color: rgba(255, 255, 255, .82);
  margin-bottom: 14px;
  line-height: 1.5;
}

.market-game .clue-box {
  background: rgba(0, 0, 0, .3);
  border: 2px solid rgba(255, 215, 0, .38);
  border-radius: 13px;
  padding: 13px;
  margin-bottom: 14px;
}

.market-game .clue-lbl {
  font-size: 9px;
  font-weight: 900;
  color: rgba(255, 215, 0, .7);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.market-game .clue-body {
  font-size: clamp(13px, 3.2vw, 15px);
  color: #fff;
  font-weight: 700;
  line-height: 1.5;
}

.market-game .clue-body strong {
  color: #FFD700;
}

.market-game .win-btn {
  background: var(--gold);
  color: #7A4800;
  border: none;
  border-radius: 22px;
  padding: 11px 28px;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(14px, 3.5vw, 16px);
  cursor: pointer;
  box-shadow: 0 4px 0 #E65100;
  transition: all .1s;
}

.market-game .win-btn:hover {
  transform: translateY(-2px);
}

.market-game .win-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #E65100;
}

.market-game .hint-card {
  background: #FFF8F0;
  border-radius: 20px;
  padding: 16px 16px 18px;
  width: min(440px, 100%);
  animation: slideUp .25s ease-out;
  border: 2px solid #E8D5B0;
  box-shadow: 0 -4px 22px rgba(0, 0, 0, .22);
}

@keyframes slideUp {
  from { transform: translateY(36px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.market-game .hint-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.market-game .hint-face {
  font-size: 36px;
  line-height: 1;
}

.market-game .hint-nm {
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: var(--g);
}

.market-game .hint-role {
  font-size: 10px;
  color: var(--tx2);
  font-weight: 600;
}

.market-game .hint-msgs {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 13px;
}

.market-game .hint-msg {
  background: rgba(46, 125, 50, .07);
  border-left: 3px solid var(--g2);
  border-radius: 0 9px 9px 0;
  padding: 8px 11px;
  font-size: clamp(12px, 3vw, 13px);
  font-weight: 700;
  color: var(--dark);
  line-height: 1.45;
}

.market-game .hint-msg em {
  color: var(--g2);
  font-style: normal;
  font-weight: 900;
}

.market-game .hint-msg strong {
  color: var(--gold2);
  font-weight: 900;
}

.market-game .hint-close {
  width: 100%;
  background: linear-gradient(135deg, var(--g2), var(--g));
  color: #fff;
  border: none;
  border-radius: 18px;
  padding: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  cursor: pointer;
}

.market-game .cf {
  position: fixed;
  pointer-events: none;
  z-index: 700;
  font-size: 20px;
  animation: cfFall 1.1s ease-out forwards;
}

@keyframes cfFall {
  0% { opacity: 1; transform: translateY(-10px) rotate(0); }
  100% { opacity: 0; transform: translateY(88vh) rotate(520deg); }
}
