@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

:root {
  font-family: "Nunito", system-ui, sans-serif;
  color: #242426;
  background: #e7e7e5;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body, #game { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button { font: inherit; }

#game {
  position: relative;
  background: #ededeb;
  touch-action: none;
  user-select: none;
}

#world {
  position: absolute;
  left: 0; top: 0;
  width: 1900px; height: 1300px;
  transform: translate3d(0, 0, 0);
  background-color: #f3f3f0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,.055) 1px, transparent 1.5px),
    linear-gradient(45deg, rgba(255,255,255,.45) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.45) 75%);
  background-size: 28px 28px, 56px 56px;
  border: 8px solid #d3d3cf;
  will-change: transform;
}

.road { position: absolute; background: #d7d7d4; box-shadow: inset 0 0 0 3px rgba(255,255,255,.65); }
.road::after { content: ""; position: absolute; background: repeating-linear-gradient(90deg, #fafafa 0 36px, transparent 36px 70px); opacity: .8; }
.road-h { left: 0; right: 0; top: 610px; height: 160px; }
.road-h::after { left: 0; right: 0; top: 77px; height: 5px; }
.road-v { top: 0; bottom: 0; left: 870px; width: 160px; }
.road-v::after { top: 0; bottom: 0; left: 77px; width: 5px; background: repeating-linear-gradient(0deg, #fafafa 0 36px, transparent 36px 70px); }

.plaza {
  position: absolute; left: 734px; top: 500px; width: 432px; height: 380px;
  border-radius: 50%; background: #e5e5e1; border: 8px solid #fafafa;
  box-shadow: 0 12px 28px rgba(0,0,0,.08), inset 0 0 0 2px #cacac7;
}
.plaza-one { position: absolute; inset: 74px; display: grid; place-items: center; border-radius: 50%; color: #d1d1ce; border: 5px dashed #c9c9c5; font-size: 120px; font-weight: 900; }

.building { position: absolute; width: 270px; height: 180px; border-radius: 22px; border: 5px solid #bdbdb9; background: #fff; box-shadow: 0 18px 0 #c8c8c4, 0 25px 30px rgba(0,0,0,.12); }
.building::before { content: ""; position: absolute; left: 102px; bottom: 0; width: 66px; height: 83px; border-radius: 34px 34px 0 0; background: #d4d4d0; border: 4px solid #b2b2af; }
.building::after { content: ""; position: absolute; left: 24px; right: 24px; top: 61px; height: 37px; background: repeating-linear-gradient(90deg, #e2f0f0 0 43px, #aaa 43px 47px, transparent 47px 69px); }
.building span { position: absolute; left: 0; right: 0; top: 17px; text-align: center; font-size: 17px; font-weight: 900; letter-spacing: 1px; }
.school { left: 340px; top: 270px; }
.cafe { left: 1290px; top: 850px; }
.station {
  left: 1100px; top: 120px;
  background: #edf1ff; border-color: #8fa2e6;
  box-shadow: 0 18px 0 #bcc6ee, 0 25px 30px rgba(0,0,0,.12);
}
.station::before { background: #d5dffd; border-color: #7d90d4; }
.station::after { background: repeating-linear-gradient(90deg, #ffffff 0 43px, #9fb0e8 43px 47px, transparent 47px 69px); }
.station span { color: #33407a; }
.station::before { left: 118px; }
.station::after { left: 18px; right: 18px; }

.tree { position: absolute; width: 92px; height: 92px; border-radius: 50%; background: #c6c6c2; border: 6px solid #a8a8a4; box-shadow: 7px 11px 0 rgba(0,0,0,.08), inset 14px 12px 0 rgba(255,255,255,.35); }
.tree::after { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: #b2b2ae; left: 28px; top: 30px; }
.tree-1 { left: 180px; top: 830px; }.tree-2 { left: 1460px; top: 230px; }.tree-3 { left: 1560px; top: 540px; }.tree-4 { left: 430px; top: 980px; }
.bench { position: absolute; width: 112px; height: 38px; background: repeating-linear-gradient(0deg, #aaa 0 7px, #ddd 7px 10px); border: 3px solid #969692; border-radius: 8px; box-shadow: 5px 7px 0 rgba(0,0,0,.1); }
.bench-1 { left: 660px; top: 920px; transform: rotate(8deg); }.bench-2 { left: 1140px; top: 390px; transform: rotate(-12deg); }

.fountain {
  position: absolute; left: 908px; top: 700px; width: 86px; height: 86px; border-radius: 50%;
  background: #b9d7ee; border: 6px solid #8fb4d6; box-shadow: inset 0 0 0 6px #ffffff, 0 10px 14px rgba(0,0,0,.16);
}
.fountain::before {
  content: ""; position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  width: 16px; height: 26px; border-radius: 8px; background: #7d98b4; box-shadow: 0 6px 0 #87a7c4;
}
.fountain::after {
  content: "⛲"; position: absolute; left: 50%; top: -26px; transform: translateX(-50%);
  font-size: 40px; line-height: 1;
}

.police-car {
  position: absolute; left: 1320px; top: 315px; width: 150px; height: 64px; border-radius: 16px;
  background: #eef2ff; border: 4px solid #778cd4; box-shadow: 0 10px 16px rgba(0,0,0,.18);
}
.police-car::before {
  content: ""; position: absolute; left: 26px; right: 26px; top: 12px; height: 30px; border-radius: 8px;
  background: #c3d0fa; border: 3px solid #778cd4;
}
.police-car::after {
  content: "◣◥"; position: absolute; left: 64px; top: -2px; transform: translateX(-50%);
  color: #e33; font-weight: 900; font-size: 20px; line-height: 1;
}
.police-car .wheel { position: absolute; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: #2b2e33; border: 3px solid #9da0a6; }
.police-car .wheel.-l { left: -2px; }.police-car .wheel.-r { right: -2px; }

.kiosk {
  position: absolute; left: 1600px; top: 960px; width: 120px; height: 120px; border-radius: 16px;
  background: #f3d9a8; border: 4px solid #c49b60; box-shadow: 0 14px 0 #a87f44, 0 18px 20px rgba(0,0,0,.15);
}
.kiosk::before {
  content: "HOUSE OF"; position: absolute; left: 0; right: 0; top: 16px; text-align: center;
  color: #8a5f26; font-size: 12px; font-weight: 900; letter-spacing: 1px;
}
.kiosk::after {
  content: "🍔"; position: absolute; left: 50%; top: 46px; transform: translateX(-50%); font-size: 44px; line-height: 1;
}

.lamp { position: absolute; width: 14px; height: 74px; background: #9b9ea4; border-radius: 6px; box-shadow: 0 8px 12px rgba(0,0,0,.12); }
.lamp::before { content: ""; position: absolute; left: -7px; right: -7px; top: -11px; height: 22px; border-radius: 6px; background: #c4c7cc; box-shadow: inset 0 0 8px rgba(255,255,255,.7); }
.lamp-1 { left: 540px; top: 500px; }.lamp-2 { left: 1010px; top: 900px; }.lamp-3 { left: 500px; top: 180px; }

.flowers { position: absolute; width: 66px; height: 66px; }
.flowers::before, .flowers::after {
  content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: #ef5d9e; box-shadow: inset -6px -6px 0 rgba(0,0,0,.12);
}
.flowers::before { left: 22px; top: 8px; }
.flowers::after { left: 44px; top: 30px; background: #f0b23c; box-shadow: inset -6px -6px 0 rgba(0,0,0,.12); }
.flowers-1 { left: 1380px; top: 300px; }.flowers-2 { left: 1180px; top: 500px; }.flowers-3 { left: 1680px; top: 1140px; }

.scene { position: absolute; left: 0; top: 0; transform: translate3d(0, 0, 0); will-change: transform; }
.interior {
  width: 1100px; height: 800px;
  background-color: #e0b57e;
  background-image:
    linear-gradient(rgba(120,72,28,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,72,28,.10) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.55), transparent 60%);
  background-size: 46px 46px, 46px 46px, 100% 100%;
  box-shadow: inset 0 0 0 8px #7a4e22;
}
.room-wall {
  position: absolute; left: 0; right: 0; top: 0; height: 150px;
  background: linear-gradient(#e8d9c2, #d9c5a6);
  border-bottom: 12px solid #b58a52;
  box-shadow: inset 0 -24px 0 rgba(255,255,255,.4);
}
.room-wall::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -58px; height: 46px;
  background: repeating-linear-gradient(90deg, transparent 0 46px, #a5713a 46px 60px);
  opacity: .5;
}
.bar-wrap { position: absolute; left: 50%; top: 195px; transform: translateX(-50%); }
.barista {
  position: absolute; left: 50%; top: -95px; transform: translateX(-50%);
  width: 62px; height: 62px; display: grid; place-items: center;
  color: #fff; font-size: 34px; font-weight: 900; border-radius: 10px;
  background: #eb153f; border: 3px solid #fff; box-shadow: 0 0 0 3px #ac0a27, 0 8px 14px rgba(0,0,0,.18);
}
.counter {
  width: 760px; height: 104px; border-radius: 18px;
  background: linear-gradient(#f5efe2, #e3d4ba); border: 4px solid #9a7444;
  box-shadow: 0 14px 0 #8a6238, 0 20px 26px rgba(0,0,0,.18);
}
.counter::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 18px; height: 30px;
  background: repeating-linear-gradient(90deg, #eadfca 0 60px, #baa27e 60px 8px);
}
.table {
  position: absolute; width: 118px; height: 118px; border-radius: 20px;
  background: #a8733d; border: 6px solid #7c4f20; box-shadow: 0 10px 0 #6a4218, 0 14px 18px rgba(0,0,0,.16);
}
.table::after {
  content: ""; position: absolute; inset: 26px; border-radius: 14px;
  background: radial-gradient(circle, #e9dcc0 30%, #cfb181 30%);
  opacity: .9;
}
.table .chair {
  position: absolute; width: 40px; height: 40px; border-radius: 9px; background: #c79a5f;
  border: 3px solid #7c4f20; box-shadow: 0 6px 0 #6a4218;
}
.table .c1 { left: 39px; top: -30px; }
.table .c2 { left: 39px; bottom: -30px; }
.t1 { left: 170px; top: 440px; }
.t2 { left: 491px; top: 440px; }
.t3 { left: 812px; top: 440px; }
.t1 .c1, .t3 .c1 { left: -30px; top: 39px; }
.t1 .c2, .t3 .c2 { left: auto; right: -30px; top: 39px; bottom: auto; }
.plant {
  position: absolute; left: 46px; bottom: 40px; width: 74px; height: 74px; border-radius: 50%;
  background: #7fa85a; border: 6px solid #5c8038; box-shadow: inset -12px -9px 0 rgba(0,0,0,.15);
}
.plant::before { content: ""; position: absolute; left: 30px; top: 46px; width: 14px; height: 30px; background: #8a6238; border-radius: 4px; }
.chalkboard {
  position: absolute; left: 50%; top: 30px; transform: translateX(-50%);
  width: 380px; height: 92px; border-radius: 12px; background: #4a5d43; border: 10px solid #6f4d26;
  box-shadow: inset 0 0 20px rgba(0,0,0,.35), 0 8px 12px rgba(0,0,0,.15);
}
.chalkboard::after {
  content: "BLOCK CAFÉ"; position: absolute; left: 0; right: 0; top: 22px; text-align: center;
  color: #e8e2c6; font-size: 21px; font-weight: 900; letter-spacing: 4px; opacity: .85;
}
.exit-door {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 96px; height: 86px; border-radius: 14px 14px 0 0;
  background: linear-gradient(#8f6a3e, #61421f); border: 4px solid #412f15;
}
.exit-door::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,.25);
  background: repeating-linear-gradient(45deg, rgba(0,0,0,.18) 0 10px, transparent 10px 20px);
}
.exit-door::after { content: ""; position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; border-radius: 50%; background: #ffd76a; }

.door-btn {
  position: absolute; z-index: 29; left: 50%; bottom: 100px; transform: translateX(-50%);
  min-width: 120px; height: 46px; border: 0; border-radius: 15px; color: #fff; background: #252527;
  box-shadow: 0 10px 26px rgba(0,0,0,.22); cursor: pointer; font-size: 14px; font-weight: 900;
}
.door-btn.hidden { display: none; }

.cafe-menu { width: min(360px, calc(100% - 30px)); }
.cafe-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px solid #d1d1ce; border-radius: 18px; background: #fff; padding: 16px 8px 13px;
  cursor: pointer; transition: transform .14s, border-color .14s;
}
.menu-item:hover { transform: translateY(-2px); border-color: #ec103a; }
.mi-emoji { font-size: 40px; line-height: 1; }
.menu-item strong { font-size: 14px; }
.menu-item small { color: #949494; font-size: 10px; font-weight: 700; }

.bar-wrap.serving .barista { animation: serve-bump .6s ease-out; }
@keyframes serve-bump { 0% { transform: translateX(-50%) scale(1); } 35% { transform: translateX(-50%) scale(.82) rotate(-7deg); } 100% { transform: translateX(-50%) scale(1); } }

#players, #interiorPlayers { position: absolute; inset: 0; }

.office {
  width: 1100px; height: 800px;
  background-color: #c9d0d8;
  background-image:
    linear-gradient(rgba(74,86,102,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,86,102,.12) 1px, transparent 1px);
  background-size: 44px 44px, 44px 44px;
  box-shadow: inset 0 0 0 8px #4a5666;
}
.office-wall {
  position: absolute; left: 0; right: 0; top: 0; height: 150px;
  background: linear-gradient(#d6dde6, #aeb9c9); border-bottom: 12px solid #7b8796;
  box-shadow: inset 0 -26px 0 rgba(255,255,255,.35);
}
.office-sign {
  position: absolute; left: 50%; top: 26px; transform: translateX(-50%);
  width: 250px; height: 70px; border-radius: 12px; text-align: center;
  color: #ffffff; background: #2f3a4d; border: 6px solid #6c7a8c; box-shadow: 0 8px 12px rgba(0,0,0,.2);
  font-size: 26px; font-weight: 900; letter-spacing: 6px; line-height: 58px;
}
.o-desk { position: absolute; left: 220px; top: 250px; width: 300px; height: 96px; border-radius: 16px;
  background: linear-gradient(#e3e8ee, #c3ccd8); border: 4px solid #8d99a8; box-shadow: 0 14px 0 #78848f, 0 20px 24px rgba(0,0,0,.16); }
.o-block {
  position: absolute; left: 50%; top: -70px; transform: translateX(-50%);
  width: 62px; height: 62px; display: grid; place-items: center;
  color: #fff; font-size: 34px; font-weight: 900; border-radius: 10px;
  background: #3f6fc4; border: 3px solid #fff; box-shadow: 0 0 0 3px #234a8f, 0 8px 14px rgba(0,0,0,.18);
}
.cell {
  position: absolute; left: 680px; top: 210px; width: 320px; height: 220px; border-radius: 14px;
  background: #b9c2cf; box-shadow: inset 0 0 30px rgba(0,0,0,.25), 0 16px 22px rgba(0,0,0,.18);
}
.cell::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: 0; border-radius: 14px;
  background: repeating-linear-gradient(90deg, #6c7a8c 0 8px, transparent 8px 20px),
    repeating-linear-gradient(0deg, #6c7a8c 0 8px, transparent 8px 44px);
  border: 8px solid #5f6b7a;
}
.cell-block {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; display: grid; place-items: center;
  color: #fff; font-size: 28px; font-weight: 900; border-radius: 9px;
  background: #ff7200; border: 3px solid #fff; box-shadow: 0 0 0 3px #a900df;
}
.cell-block::after { content: "🔒"; position: absolute; left: 50%; top: -18px; transform: translateX(-50%); font-size: 16px; }
.file-cabinet { position: absolute; left: 90px; top: 460px; width: 120px; height: 210px; border-radius: 10px;
  background: #7b8796; border: 4px solid #5f6b7a; box-shadow: 0 10px 16px rgba(0,0,0,.16); }
.file-cabinet::before, .file-cabinet::after {
  content: ""; position: absolute; left: 8px; right: 8px; height: 54px; border-radius: 6px;
  background: #a6b1c0; border: 3px solid #5f6b7a;
}
.file-cabinet::before { top: 14px; }.file-cabinet::after { bottom: 14px; }
.plant-office { left: auto; right: 46px; bottom: 40px; }
.office-exit-door { height: 92px; }

#officePlayers { position: absolute; inset: 0; }
.player { position: absolute; width: 108px; height: 150px; transform: translate(-50%, -78%); transition: filter .2s; z-index: 10; }
.player.local { z-index: 12; filter: drop-shadow(0 10px 6px rgba(0,0,0,.18)); }
.player.walking .sprite-wrap { animation: walk .28s infinite alternate ease-in-out; }
.sprite-wrap { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 96%; }
.sprite { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity 0s; }
.sprite-blink { opacity: 0; }
.sprite-emote { opacity: 0; }
.player.blinking .sprite-open { opacity: 0; }
.player.blinking .sprite-blink { opacity: 1; }
.player.blinking .sprite { filter: brightness(.98); }
.player.dancing .sprite-open, .player.dancing .sprite-blink { opacity: 0; }
.player.dancing .sprite-emote { opacity: 1; }
.player.dancing .sprite-wrap { animation: guitar-dance .38s infinite alternate ease-in-out; }
.player.dancing .held-item { opacity: 0; }
.name-tag { position: absolute; left: 50%; top: -19px; transform: translateX(-50%); white-space: nowrap; background: rgba(255,255,255,.94); border: 2px solid #ccc; box-shadow: 0 3px 7px rgba(0,0,0,.12); border-radius: 12px; padding: 3px 9px; font-size: 11px; font-weight: 900; }
.local .name-tag { border-color: #ec103a; }
.held-item { position: absolute; z-index: 3; right: -11px; bottom: 21px; font-size: 33px; line-height: 1; filter: drop-shadow(0 3px 2px rgba(0,0,0,.24)); transform: rotate(8deg); }
.action-effect { position: absolute; z-index: 4; left: 50%; top: -52px; opacity: 0; transform: translate(-50%, 10px) scale(.8); white-space: nowrap; border: 2px solid #ddd; border-radius: 16px; padding: 5px 10px; background: white; box-shadow: 0 6px 14px rgba(0,0,0,.14); font-size: 15px; font-weight: 900; }
.player.show-effect .action-effect { animation: item-pop .85s ease-out; }
.player.eating .sprite-wrap { animation: nibble .18s 3 alternate ease-in-out; }
.player.hugging .sprite-wrap { animation: hug .55s ease-in-out; }
@keyframes walk { from { transform: rotate(-2.5deg) translateY(0); } to { transform: rotate(2.5deg) translateY(-5px); } }
@keyframes nibble { from { transform: rotate(-2deg) scale(1); } to { transform: rotate(2deg) scale(.96, 1.03); } }
@keyframes hug { 0%, 100% { transform: scale(1); } 45% { transform: scale(.92, 1.07) rotate(-3deg); } 70% { transform: scale(1.04, .97) rotate(2deg); } }
@keyframes guitar-dance { from { transform: rotate(-5deg) translate(-4px, 1px); } to { transform: rotate(5deg) translate(4px, -7px); } }
@keyframes item-pop { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 20%, 72% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -13px) scale(.95); } }

.hud { position: absolute; z-index: 30; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; gap: 12px; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: 9px; }
.hud-right { display: flex; gap: 9px; align-items: center; }
.pill, .icon-btn { border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); box-shadow: 0 7px 20px rgba(0,0,0,.12); min-height: 48px; border-radius: 17px; }
.pill { display: flex; align-items: center; gap: 10px; padding: 6px 14px; font-weight: 900; }
.primary { cursor: pointer; border: 0; color: #fff; background: #252527; padding-right: 18px; transition: transform .15s, box-shadow .15s; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 23px rgba(0,0,0,.2); }
.add-bot { cursor: pointer; color: #29292b; background: rgba(255,255,255,.92); transition: transform .15s, border-color .15s; }
.add-bot span { color: #ec103a; font-size: 20px; line-height: 1; }
.add-bot:hover { transform: translateY(-2px); border-color: #ec103a; }
.mini-one, .card-block { display: grid; place-items: center; color: white; background: #eb153f; border-radius: 8px; border: 2px solid white; box-shadow: 0 0 0 2px #ac0a27; font-weight: 900; }
.mini-one { width: 31px; height: 31px; }
.online { font-size: 12px; min-height: 43px; padding: 5px 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #f3ae28; box-shadow: 0 0 0 4px rgba(243,174,40,.15); }
.online.connected .dot { background: #31b76a; box-shadow: 0 0 0 4px rgba(49,183,106,.15); }
.icon-btn { width: 48px; font-size: 25px; font-weight: 900; cursor: pointer; }
.icon-btn.active { background: #252527; color: white; }

.hint { position: absolute; z-index: 20; left: 50%; bottom: 98px; transform: translateX(-50%); background: rgba(255,255,255,.86); border: 1px solid #ccc; border-radius: 12px; padding: 7px 12px; font-size: 11px; font-weight: 900; letter-spacing: .4px; color: #777; pointer-events: none; }

.item-tray { position: absolute; z-index: 27; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 9px; padding: 7px; border: 1px solid rgba(0,0,0,.14); border-radius: 20px; background: rgba(250,250,248,.9); backdrop-filter: blur(12px); box-shadow: 0 10px 28px rgba(0,0,0,.16); }
.item-slot { position: relative; width: 58px; height: 58px; display: grid; place-items: center; border: 2px solid #d3d3d0; border-radius: 15px; background: #fff; cursor: pointer; transition: transform .14s, border-color .14s, background .14s; }
.item-slot:hover { transform: translateY(-2px); }
.item-slot.selected { border-color: #ec103a; background: #fff3f5; box-shadow: 0 0 0 3px rgba(236,16,58,.1); }
.item-slot:disabled { opacity: .38; cursor: default; transform: none; }
.item-emoji { font-size: 31px; line-height: 1; }
.item-count { position: absolute; right: -4px; bottom: -4px; min-width: 21px; height: 21px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; border-radius: 11px; color: #fff; background: #29292b; font-size: 10px; font-weight: 900; }
.emote-slot { border-color: #c000ff; background: #fff5ff; }
.emote-slot.hidden { display: none; }
.emote-slot:hover { border-color: #8e00bd; }
.emote-note { position: absolute; right: 5px; top: 3px; color: #8e00bd; font-size: 15px; font-weight: 900; }
.item-actions { position: absolute; left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%); display: flex; gap: 7px; width: max-content; opacity: 1; transition: opacity .14s, transform .14s; }
.item-actions.hidden { transform: translate(-50%, 5px); }
.item-actions button { min-width: 84px; height: 39px; padding: 0 14px; border: 0; border-radius: 13px; color: #fff; background: #29292b; box-shadow: 0 6px 16px rgba(0,0,0,.18); cursor: pointer; font-size: 12px; font-weight: 900; }
.item-actions button:last-child { background: #ec103a; }

#joystick { display: none; position: absolute; z-index: 25; left: max(25px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom)); width: 116px; height: 116px; border-radius: 50%; background: rgba(255,255,255,.45); border: 3px solid rgba(50,50,50,.18); box-shadow: inset 0 0 25px rgba(0,0,0,.07); touch-action: none; }
#stick { position: absolute; left: 33px; top: 33px; width: 50px; height: 50px; border-radius: 50%; background: #2e2e30; border: 4px solid rgba(255,255,255,.75); box-shadow: 0 6px 12px rgba(0,0,0,.2); }

.backdrop { position: absolute; inset: 0; z-index: 39; background: rgba(20,20,22,.25); backdrop-filter: blur(3px); opacity: 1; transition: opacity .2s; }
.sheet { position: absolute; z-index: 40; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 30px)); border: 1px solid #c9c9c7; background: rgba(249,249,247,.97); border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.26); padding: 22px; opacity: 1; transition: opacity .18s, transform .18s; }
.hidden { opacity: 0 !important; pointer-events: none !important; }
.sheet.hidden { transform: translate(-50%, -46%) scale(.96); }
.sheet-head { display: flex; align-items: center; min-height: 56px; gap: 12px; margin-bottom: 17px; }
.sheet-head > div { flex: 1; }
.sheet h1 { margin: 0; font-size: 26px; letter-spacing: -.7px; }
.eyebrow { display: block; font-size: 10px; letter-spacing: 1.7px; font-weight: 900; color: #999; margin-bottom: 3px; }
.close-btn, .back-btn { width: 42px; height: 42px; border: 1px solid #d0d0ce; background: #fff; border-radius: 50%; cursor: pointer; font-size: 27px; line-height: 1; }
.character-card { width: 100%; display: flex; align-items: center; gap: 17px; border: 2px solid #d1d1ce; border-radius: 20px; padding: 14px; background: #fff; cursor: pointer; text-align: left; }
.character-card:hover { border-color: #ec103a; }
.character-card + .character-card { margin-top: 10px; }
.character-card.character-two:hover { border-color: #a900df; }
.card-block { width: 63px; height: 63px; font-size: 30px; flex: 0 0 auto; }
.card-block-two { border-color: white; background: #ff7200; box-shadow: 0 0 0 2px #a900df; }
.character-card strong { display: block; font-size: 17px; }.character-card small { display: block; color: #909090; margin-top: 2px; }.arrow { margin-left: auto; font-size: 30px; color: #aaa; }
.coming { text-align: center; color: #999; font-size: 12px; font-weight: 700; margin: 17px 0 2px; }
.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.style-grid.two-styles { grid-template-columns: repeat(2, 1fr); }
.style-card { position: relative; border: 2px solid #d1d1ce; border-radius: 19px; background: #fff; min-width: 0; padding: 14px 8px 12px; cursor: pointer; }
.style-card.selected { border-color: #ec103a; box-shadow: 0 0 0 3px rgba(236,16,58,.1); }
.style-card img { width: 100%; height: 134px; object-fit: contain; display: block; }
.style-card strong { display: block; margin-top: 6px; text-align: center; font-size: 14px; }
.style-card .check { position: absolute; right: 8px; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: #ec103a; color: #fff; display: none; place-items: center; font-size: 13px; }
.style-card.selected .check { display: grid; }
.bot-sheet { width: min(690px, calc(100% - 30px)); max-height: min(92vh, 780px); overflow-y: auto; }
.bot-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 17px; }
.bot-field { display: flex; flex-direction: column; gap: 6px; color: #626266; font-size: 12px; font-weight: 900; }
.bot-field input, .bot-field select { width: 100%; height: 44px; border: 1px solid #d1d1ce; border-radius: 12px; padding: 0 12px; color: #29292b; background: #fff; outline: none; font: 800 13px "Nunito", sans-serif; }
.bot-field input:focus, .bot-field select:focus { border-color: #ec103a; box-shadow: 0 0 0 3px rgba(236,16,58,.08); }
.map-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 900; }
#botCountryMap { height: 300px; border: 1px solid #d0d0ce; border-radius: 17px; overflow: hidden; background: #dce6eb; z-index: 0; }
#botCountryMap .leaflet-control-attribution { font-size: 9px; }
.country-status { min-height: 20px; margin: 9px 2px 13px; color: #777; font-size: 12px; font-weight: 800; }
.create-bot-btn { width: 100%; min-height: 46px; border: 0; border-radius: 14px; color: #fff; background: #ec103a; box-shadow: 0 7px 16px rgba(236,16,58,.2); cursor: pointer; font-size: 14px; font-weight: 900; }
.create-bot-btn:disabled { background: #bdbdbd; box-shadow: none; cursor: default; }
.name-tag { display: flex; flex-direction: column; align-items: center; gap: 0; }
.player-country { color: #747474; font-size: 9px; line-height: 1.1; font-weight: 800; }
.player-country[hidden] { display: none; }
.settings-sheet { max-width: 480px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 2px; border-top: 1px solid #dededb; }
.setting-row > span { display: flex; flex-direction: column; }
.setting-row strong { font-size: 15px; }
.setting-row small { margin-top: 2px; color: #929292; font-size: 11px; }
.setting-row select { max-width: 210px; min-width: 155px; height: 42px; padding: 0 35px 0 12px; border: 1px solid #cececb; border-radius: 12px; background: #fff; color: #29292b; font: 800 13px "Nunito", sans-serif; cursor: pointer; }
.switch { position: relative; flex: 0 0 auto; width: 54px; height: 31px; border: 0; border-radius: 18px; background: #bcbcbc; padding: 3px; cursor: pointer; transition: .2s; }
.switch span { display: block; width: 25px; height: 25px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.22); transition: transform .2s; }
.switch[aria-checked="true"] { background: #ec103a; }
.switch[aria-checked="true"] span { transform: translateX(23px); }

.chat-panel { position: absolute; z-index: 28; right: 18px; bottom: 18px; width: min(330px, calc(100% - 36px)); height: 270px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(0,0,0,.13); border-radius: 20px; background: rgba(250,250,248,.93); backdrop-filter: blur(14px); box-shadow: 0 15px 40px rgba(0,0,0,.17); transition: .2s; }
.chat-panel.closed { opacity: 0; transform: translateY(14px) scale(.96); pointer-events: none; }
.chat-head { height: 47px; flex: 0 0 auto; padding: 0 10px 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #dededb; }
.chat-head strong { font-size: 14px; }
.chat-head button { width: 31px; height: 31px; border: 0; border-radius: 50%; background: transparent; font-size: 21px; cursor: pointer; color: #666; }
.chat-head button:hover { background: #e6e6e3; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; }
.chat-empty { margin: auto; max-width: 200px; text-align: center; color: #999; font-size: 11px; font-weight: 700; }
.chat-message { align-self: flex-start; max-width: 88%; }
.chat-message.mine { align-self: flex-end; text-align: right; }
.chat-message b { display: block; margin: 0 5px 2px; color: #777; font-size: 9px; font-weight: 900; }
.chat-message p { margin: 0; padding: 7px 10px; border-radius: 12px 12px 12px 4px; background: #fff; border: 1px solid #dededb; font-size: 12px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.chat-message.mine p { color: #fff; background: #29292b; border-color: #29292b; border-radius: 12px 12px 4px 12px; }
.chat-form { display: flex; gap: 7px; flex: 0 0 auto; padding: 9px; border-top: 1px solid #dededb; }
.chat-form input { flex: 1; min-width: 0; height: 39px; border: 1px solid #d2d2cf; border-radius: 12px; background: #fff; padding: 0 12px; outline: none; font: 700 12px "Nunito", sans-serif; }
.chat-form input:focus { border-color: #ec103a; box-shadow: 0 0 0 3px rgba(236,16,58,.08); }
.chat-form button { flex: 0 0 auto; width: 39px; height: 39px; border: 0; border-radius: 12px; background: #ec103a; color: #fff; cursor: pointer; font-size: 15px; }
.toast { position: absolute; z-index: 50; left: 50%; top: 92px; transform: translate(-50%, -10px); opacity: 0; pointer-events: none; background: #252527; color: white; border-radius: 13px; padding: 9px 15px; font-size: 12px; font-weight: 800; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (pointer: coarse), (max-width: 700px) {
  #joystick { display: block; }
  .hint { display: none; }
  .online { max-width: 48px; overflow: hidden; padding: 5px 12px; }
  .online span:last-child { display: none; }
  .pill.primary { min-height: 44px; font-size: 13px; padding-left: 8px; }
  .hud-left { gap: 6px; }
  .add-bot { min-height: 42px; padding: 5px 9px; gap: 5px; font-size: 12px; }
  .icon-btn { width: 44px; min-height: 44px; }
  .player { width: 96px; height: 136px; }
  .style-card img { height: 112px; }
  .chat-panel { left: 15px; right: 15px; bottom: max(155px, calc(env(safe-area-inset-bottom) + 140px)); width: auto; height: 245px; }
}

@media (max-width: 430px) {
  .sheet { padding: 17px; border-radius: 23px; }
  .style-grid { gap: 7px; }
  .style-card { padding: 9px 5px; border-radius: 15px; }
  .style-card img { height: 100px; }
  .style-card strong { font-size: 12px; }
  .hud { gap: 7px; }
  .hud-right { gap: 6px; }
  .online { display: none; }
  .setting-row select { min-width: 145px; max-width: 170px; }
  .bot-sheet { padding: 14px; }
  #botCountryMap { height: 245px; }
  .bot-fields { gap: 8px; }
  .bot-field { font-size: 11px; }
  .bot-field input, .bot-field select { padding: 0 8px; font-size: 11px; }
}

@media (max-width: 370px) {
  #charactersLabel { display: none; }
}
