/* Barras superior/inferior, comercio, robo, bots, sala de espera, relieve y paisaje animado */

/* ---------- barra superior ---------- */
#topbar {
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,0) 45%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 140px, rgba(0,0,0,.18) 140px 142px),
    linear-gradient(#4a2b12, #2f1909);
  border-bottom: 0; box-shadow: 0 3px 0 #b88a3e, 0 5px 0 #5a3a1e, 0 8px 18px rgba(0,0,0,.5); z-index: 5; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 8px; text-shadow: 0 2px 0 #1b0d02; }
.brand-hex { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.brand-hex polygon { fill: url(#g-tokenback); stroke: #ffd56b; stroke-width: 1.6; }
.brand-hex text { fill: #ffd56b; font: 900 13px 'Cinzel', serif; text-anchor: middle; }
.code-pill { border: 1px solid rgba(255,213,107,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.tb-goal { display: flex; align-items: baseline; gap: 3px; padding: 3px 12px 3px 8px; border-radius: 20px; font-weight: 900;
  background: linear-gradient(#ffe08a, #d99a26); color: var(--ink); border: 2px solid #5a3a1e; box-shadow: 0 2px 0 #1b0d02, inset 0 1px 0 rgba(255,255,255,.6); }
.tb-goal .star { font-size: 15px; } .tb-goal b { font: 900 19px 'Cinzel', serif; } .tb-goal small { font-weight: 800; opacity: .7; }
.roll-mini { gap: 5px; min-width: 0; }
.roll-mini b { font: 900 18px 'Cinzel', serif; color: var(--gold2); margin-left: 2px; }
.mini-die { box-shadow: inset 0 -3px 0 #c9b98f, 0 2px 4px rgba(0,0,0,.45); transform: rotate(-4deg); }
.mini-die + .mini-die { transform: rotate(5deg); }
.mini-die.off { opacity: .35; }
.bank { gap: 5px; align-items: center; }
.bank-lbl { font-size: 16px; margin-right: 2px; }
.bk { display: flex; align-items: center; gap: 2px; padding: 2px 7px 2px 3px; border-radius: 12px; background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.1); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); font-size: 13px; }
.bk b { font-weight: 900; }
.bk.low b { color: #ff9b8e; }
.bk .ico { filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
.tbtn { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 12px; border-radius: 17px; cursor: pointer;
  font: 800 14px 'Nunito', sans-serif; color: #fbeccb; background: linear-gradient(#5a3618, #3a210d);
  border: 1.5px solid rgba(255,213,107,.45); box-shadow: 0 2px 0 #160a02, inset 0 1px 0 rgba(255,255,255,.12); transition: transform .12s, background .2s; }
.tbtn:hover { background: linear-gradient(#6e4520, #472810); }
.tbtn:active { transform: translateY(1px); box-shadow: 0 1px 0 #160a02; }
.tbtn.emote-top { background: linear-gradient(#ffe08a, #e3a531); color: var(--ink); border-color: #5a3a1e; }
.leave-btn { border-color: rgba(255,120,100,.6) !important; }
.tb-btns { gap: 6px; }

/* ---------- barra inferior ---------- */
#bottom {
  background:
    linear-gradient(0deg, rgba(0,0,0,.2), rgba(0,0,0,0) 50%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0) 0 160px, rgba(0,0,0,.2) 160px 162px),
    linear-gradient(#3f2410, #241309);
  border-top: 0; box-shadow: 0 -3px 0 #b88a3e, 0 -5px 0 #5a3a1e, 0 -8px 18px rgba(0,0,0,.5); z-index: 5; gap: 14px;
}
#mebox { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 14px; flex: none;
  background: linear-gradient(160deg, #f8eccd, #e2c98f); border: 2px solid #5a3a1e; box-shadow: inset 5px 0 0 var(--c), 0 3px 0 #120a04; color: var(--ink); }
#mebox:empty { display: none; }
.me-house { width: 34px; height: 32px; }
.me-txt { display: flex; flex-direction: column; line-height: 1.1; }
.me-txt b { font-size: 14px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-vp { font: 900 18px 'Cinzel', serif; } .me-vp small { font: 800 12px 'Nunito', sans-serif; opacity: .7; }
.me-pcs { display: grid; gap: 1px; font-size: 11.5px; font-weight: 900; opacity: .85; }
#hand { padding: 8px 10px 6px; border-radius: 14px; background: rgba(0,0,0,.28); box-shadow: inset 0 3px 8px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.08); }
.rcard { transition: transform .2s, opacity .2s, box-shadow .2s; }
.rcard:not(.zero):hover { transform: translateY(-4px) rotate(-2deg); }
.rcard::after { content: ''; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.35) 45%, rgba(255,255,255,0) 55%); background-size: 250% 100%; background-position: 120% 0; }
.rcard:not(.zero):hover::after { animation: shine .8s ease-out; }
@keyframes shine { to { background-position: -60% 0; } }
.rcard.zero { opacity: .42; filter: saturate(.4); }
#devhand { padding: 6px 8px; border-radius: 12px; background: rgba(0,0,0,.2); box-shadow: inset 0 2px 6px rgba(0,0,0,.45); }
#devhand:has(.dev-empty) { background: none; box-shadow: none; }
#actions .btn { box-shadow: 0 3px 0 #1b0d02, inset 0 1px 0 rgba(255,255,255,.6); border-radius: 12px; }
#actions .btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #1b0d02; }
#actions .btn.build.on { background: linear-gradient(#bff0a8, #6fbf4a); box-shadow: 0 0 0 3px #ffd56b, 0 3px 0 #1b0d02; }
@media (max-width: 1100px) and (min-width: 761px) { #mebox .me-pcs { display: none; } }

/* ---------- ventana de comercio ---------- */
.trade-ui h2 { margin-bottom: 8px; }
.tsec { border-radius: 14px; padding: 8px 8px 10px; border: 2px solid; }
.tsec.get { background: linear-gradient(#e6f6dc, #cfe9bd); border-color: #5f9a3e; }
.tsec.give { background: linear-gradient(#fbe4d8, #f1c9b4); border-color: #b4573a; }
.tsec-h { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 6px; }
.tsec-h b { font: 900 17px 'Cinzel', serif; }
.tsec-h small { opacity: .65; font-weight: 700; font-size: 12px; }
.tarrow { font-size: 16px; }
.tpks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tpk { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tpk-card { position: relative; width: 100%; max-width: 64px; aspect-ratio: 3/4; border-radius: 9px; border: 2px solid #2a1c0e; cursor: pointer;
  background: linear-gradient(170deg, #fffaf0 0 30%, var(--rc) 30%); display: grid; place-items: center; box-shadow: 0 3px 0 #120a04; transition: transform .15s; }
.tpk-card:disabled { cursor: default; }
.tpk-card:not(:disabled):hover { transform: translateY(-3px); }
.tpk-card .ico { margin-top: -8px; }
.tpk.on .tpk-card { box-shadow: 0 0 0 3px #ffd56b, 0 3px 0 #120a04; }
.tpk.off .tpk-card { opacity: .35; filter: grayscale(.7); }
.tpk-n { position: absolute; top: -8px; right: -8px; min-width: 24px; height: 24px; border-radius: 12px; background: #2a1c0e; color: #ffd56b; font-weight: 900; display: grid; place-items: center; border: 2px solid #e3ad3f; animation: pop .25s; }
.tpk .pk-ctrl { display: flex; gap: 4px; }
.pk-have { font-size: 10.5px; font-weight: 800; opacity: .75; text-align: center; line-height: 1.1; }
.pk-none { font-size: 10.5px; font-weight: 900; color: #b4241a; text-align: center; line-height: 1.1; }
.tswap { display: grid; place-items: center; margin: -6px 0; position: relative; z-index: 1; }
.tswap span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 900;
  background: linear-gradient(#ffe08a, #e3a531); border: 2px solid #5a3a1e; box-shadow: 0 2px 0 #1b0d02; }
.bsugs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 8px; }
.bsugs small { width: 100%; font-weight: 800; opacity: .75; }
.bsug { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; padding: 3px 10px; }
.thint { margin: 8px 0 4px; font-size: 12.5px; }
.tactions { margin-top: 6px; }
.bankbtn { background: linear-gradient(#d8ecff, #8fbde6); }

/* ofertas flotantes: en celular una por vez */
.tf { box-shadow: 0 10px 28px rgba(0,0,0,.5); border-left: 6px solid var(--c, #e3ad3f); }
.tf-stack { display: flex; flex-direction: column; gap: 4px; }
.tf-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 12px; background: rgba(20,12,4,.88); color: #fbeccb; font-weight: 900; }
.tf-nav span { flex: 1; text-align: center; font-size: 13px; }
.tf-min { color: #fbeccb; font-size: 12px; }
.tf-pill { align-self: flex-start; padding: 8px 14px; border-radius: 20px; border: 2px solid #5a3a1e; font: 900 14px 'Nunito', sans-serif; cursor: pointer;
  background: linear-gradient(#ffe08a, #e3a531); color: var(--ink); box-shadow: 0 4px 12px rgba(0,0,0,.45); animation: pop .3s, btnGlow 1.6s ease-in-out infinite; }
@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  #trade-float { top: auto; bottom: auto; left: 6px; right: 6px; top: calc(var(--tf-top, 118px)); max-height: 52vh; flex-direction: column; overflow: visible; }
  #trade-float .tf { width: auto; max-height: 44vh; overflow: auto; padding: 10px; }
  .tf h4 { font-size: 14px; }
}
@media (max-height: 520px) and (orientation: landscape) { #trade-float { right: 200px; --tf-top: 46px; } }

/* ---------- robo ---------- */
.stealcard { position: fixed; left: 0; top: 0; width: 68px; height: 92px; border-radius: 10px; z-index: 66; pointer-events: none; display: grid; place-items: center;
  border: 3px solid #2a1c0e; background: linear-gradient(170deg, #fffaf0 0 30%, var(--rc, #888) 30%); box-shadow: 0 10px 24px rgba(0,0,0,.55); }
.stealcard svg { width: 50px; height: 50px; margin-top: -10px; }
.stealcard.back { background: repeating-linear-gradient(45deg, #5a3517 0 8px, #4a2a10 8px 16px); border-color: #e3ad3f; }
.stealcard.back span { font: 900 40px 'Cinzel', serif; color: #ffd56b; text-shadow: 0 2px 0 #1b0d02; }
.stealhand { position: fixed; z-index: 67; font-size: 54px; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.stealcap { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 66; pointer-events: none; text-align: center;
  font: 900 clamp(16px, 2.6vw, 26px) 'Nunito', sans-serif; color: #fff; background: rgba(20,12,4,.9); padding: 10px 20px; border-radius: 30px;
  border: 2px solid #e3ad3f; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: bigIn .45s cubic-bezier(.3,1.7,.5,1) both; max-width: 92vw; }
.stealcap.good { border-color: #6fd14a; background: linear-gradient(#2d5a1c, #1b3a10); }
.stealcap.bad { border-color: #ff5a4a; background: linear-gradient(#6a1a12, #3a0c08); animation: bigIn .45s cubic-bezier(.3,1.7,.5,1) both, quake .35s .4s 2; }
.stealcap.out { opacity: 0; transition: opacity .3s; }

/* ---------- intercambio ---------- */
.tradeburst { position: fixed; z-index: 64; pointer-events: none; transform: translate(-50%, -50%); display: grid; place-items: center; }
.tb-ring { position: absolute; width: 60px; height: 60px; border-radius: 50%; border: 5px solid #ffd56b; animation: tbRing 1.1s ease-out forwards; box-shadow: 0 0 30px #ffd56b; }
@keyframes tbRing { to { transform: scale(5); opacity: 0; } }
.tb-hands { font-size: 64px; animation: tbHands 1.6s cubic-bezier(.3,1.6,.5,1) both; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
@keyframes tbHands { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 25% { transform: scale(1.25) rotate(8deg); opacity: 1; } 40% { transform: scale(1) rotate(-6deg); } 55% { transform: rotate(6deg); } 85% { opacity: 1; } 100% { transform: scale(1.1); opacity: 0; } }
.tb-names { margin-top: 6px; white-space: nowrap; font: 900 15px 'Nunito', sans-serif; color: #fff; background: rgba(20,12,4,.85); padding: 4px 12px; border-radius: 14px; animation: fadeIn .3s .2s both; }

/* ---------- bots y sala de espera ---------- */
.botbox { margin-bottom: 14px; }
.botbtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.botbtn { display: flex; flex-direction: column; align-items: center; padding: 8px 6px; line-height: 1.15; }
.botbtn b { font-size: 15px; } .botbtn small { font-size: 11.5px; font-weight: 800; opacity: .75; }
.botbtn.lvl-capo { background: linear-gradient(#e6f6dc, #a9d98f); }
.botbtn.lvl-crack { background: linear-gradient(#e2eeff, #96b8ec); }
.botbtn.lvl-maquina { background: linear-gradient(#ffd9d2, #e8806c); }
.botlvl { display: inline-block; font-size: 10.5px; font-weight: 900; padding: 1px 7px; border-radius: 8px; margin-left: 4px; vertical-align: middle; }
.botlvl.lvl-capo { background: #cdeebc; } .botlvl.lvl-crack { background: #c9dcff; } .botlvl.lvl-maquina { background: #ffc4b8; }
.slot { position: relative; }
.slot-x { position: absolute; top: 4px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #8a5d2b; background: #fff6dc; cursor: pointer; font-size: 12px; font-weight: 900; }
.slot-x:hover { background: #f08a7a; color: #fff; }
.waitcard { max-width: 640px; }
.wait-hero { text-align: center; padding: 10px 0 4px; }
.wait-ico { font-size: 64px; animation: bob 2.4s ease-in-out infinite; }
.wait-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.wchip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 14px; background: #fff6dc; border: 2px solid var(--c); font-weight: 800; }

/* ---------- mapa con relieve ---------- */
.hex.popup { animation: hexPop .7s ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes hexPop { 0% { } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
.hexflash { fill: #fff; opacity: 0; animation: hexFlash .7s ease-out forwards; }
@keyframes hexFlash { 15% { opacity: .85; } 100% { opacity: 0; } }
.spark { animation: spark .9s cubic-bezier(.2,.7,.3,1) forwards; opacity: 0; }
@keyframes spark { 0% { opacity: 1; transform: translate(0, 0) scale(1.3); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.3); } }
.shock { fill: none; stroke: #ffd56b; stroke-width: 10; transform-box: fill-box; transform-origin: center; animation: shock 1.4s ease-out forwards; }
.shock.s2 { stroke: #fff; stroke-width: 4; animation-delay: .18s; opacity: 0; }
@keyframes shock { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(28); opacity: 0; } }
/* el temblor va sobre la capa del efecto (mover todo el mapa es muy caro) */
.fogfx { background: radial-gradient(circle, rgba(255,255,255,.12), rgba(10,20,30,.75)); animation: fadeIn .2s, quake .3s .1s 4; overflow: hidden; }
.fog-cloud { position: absolute; top: -10%; bottom: -10%; width: 70%; background:
  radial-gradient(circle at 30% 30%, #f4f7f9 0 18%, transparent 19%), radial-gradient(circle at 70% 45%, #e6edf1 0 22%, transparent 23%),
  radial-gradient(circle at 40% 70%, #eef3f5 0 20%, transparent 21%), radial-gradient(circle at 75% 85%, #dfe7ec 0 18%, transparent 19%),
  radial-gradient(circle at 20% 90%, #f4f7f9 0 16%, transparent 17%), linear-gradient(#e9eff2cc, #cfd9dfcc); filter: blur(6px); }
.fog-cloud.left { left: -5%; animation: fogL 1.5s ease-in forwards; }
.fog-cloud.right { right: -5%; animation: fogR 1.5s ease-in forwards; }
@keyframes fogL { 0%, 25% { transform: translateX(0); } 100% { transform: translateX(-110%); } }
@keyframes fogR { 0%, 25% { transform: translateX(0); } 100% { transform: translateX(110%); } }
.fog-flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: fogFlash 1.2s ease-out forwards; }
@keyframes fogFlash { 0% { opacity: .9; } 10% { opacity: 0; } 20% { opacity: .7; } 30%, 100% { opacity: 0; } }
.fogfx .bigtxt { font-size: clamp(26px, 5.5vw, 70px); }

/* ---------- recursos animados ---------- */
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 3.4s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(3deg) skewX(-2deg); } }
.wave { transform-box: fill-box; transform-origin: 50% 100%; animation: wheatWave 2.8s ease-in-out infinite; }
@keyframes wheatWave { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(4deg); } }
.graze { transform-box: fill-box; transform-origin: 50% 100%; animation: graze 6s ease-in-out infinite; }
@keyframes graze { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 28% { transform: translateX(-4px) rotate(-7deg); } 36% { transform: translateX(-4px) rotate(0); } 60% { transform: translateX(3px); } 66% { transform: translateX(3px) translateY(-2px); } 72% { transform: translateX(3px); } }
.beacon { animation: xlight 1.4s ease-in-out infinite; }
.flag { transform-box: fill-box; transform-origin: 0 50%; animation: flag 1.2s ease-in-out infinite; }
@keyframes flag { 50% { transform: skewY(8deg) scaleX(.9); } }
.lava { animation: lavaFlow 1.2s linear infinite; }
@keyframes lavaFlow { to { stroke-dashoffset: -16; } }
/* recursos con volumen: el ladrillo de arriba salta, un brillo cruza la pila, los cristales destellan, las ovejas mueven la oreja */
.bk-hop { transform-box: fill-box; transform-origin: 50% 100%; animation: bkHop 5.2s ease-in-out infinite; }
@keyframes bkHop { 0%, 78%, 100% { transform: none; } 83% { transform: translateY(-8px) rotate(-10deg); } 88% { transform: translateY(0) rotate(0); } 91% { transform: translateY(-2px) rotate(4deg); } 94% { transform: none; } }
.bk-glint { opacity: 0; animation: bkGlint 5.2s ease-in-out infinite; }
@keyframes bkGlint { 0%, 55% { opacity: 0; transform: translateX(0); } 62% { opacity: 1; } 75%, 100% { opacity: 0; transform: translateX(34px); } }
.spark { opacity: 0; transform-box: fill-box; transform-origin: center; animation: spark 3.6s ease-in-out infinite; }
@keyframes spark { 0%, 66% { opacity: 0; transform: scale(.2) rotate(0); } 78% { opacity: 1; transform: scale(1.35) rotate(45deg); } 90%, 100% { opacity: 0; transform: scale(.2) rotate(90deg); } }
.ear { transform-box: fill-box; transform-origin: 100% 50%; animation: ear 4.4s ease-in-out infinite; }
@keyframes ear { 0%, 86%, 100% { transform: none; } 90% { transform: rotate(-28deg); } 94% { transform: rotate(6deg); } }
body.no-anim .sway, body.no-anim .wave, body.no-anim .graze, body.no-anim .water .waves,
body.no-anim .bk-hop, body.no-anim .bk-glint, body.no-anim .spark, body.no-anim .ear { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .bk-hop, .bk-glint, .spark, .ear { animation: none !important; } }

/* ---------- celular: barras ---------- */
@media (max-width: 760px) {
  #topbar { gap: 4px; padding: calc(4px + env(safe-area-inset-top)) 6px 5px; }
  .tb-main .brand-name, .tb-map { display: none; }
  .brand-hex { width: 26px; height: 26px; }
  .brand .code-pill { display: inline-block !important; margin-left: 0; font-size: 11px; padding: 1px 6px; }
  .tb-goal { padding: 1px 9px 1px 6px; } .tb-goal b { font-size: 16px; } .tb-goal .star { font-size: 13px; }
  .roll-mini b { font-size: 15px; }
  .tbtn { height: 32px; padding: 0 9px; font-size: 16px; }
  .tbtn .txt { display: none; }
  .bk { padding: 1px 6px 1px 2px; font-size: 12px; }
  .bank-lbl { font-size: 14px; }
  #mebox { display: none; }
  #hand { padding: 6px 6px 4px; }
  #devhand { background: none; box-shadow: none; padding: 4px 0 0; }
  .tpks { gap: 4px; }
  .tpk-card .ico { width: 30px; height: 30px; }
  .tsec { padding: 6px 4px 8px; }
  .tsec-h small { display: none; }
  .botbtns { gap: 5px; }
  .botbtn b { font-size: 13px; }
}
@media (max-width: 380px) { .brand .code-pill { display: none !important; } }
@media (max-height: 520px) and (orientation: landscape) {
  #topbar { gap: 8px; }
  .tb-map, .brand .code-pill { display: none; }
  .tbtn { height: 28px; padding: 0 8px; } .tbtn .txt { display: none; }
  #mebox { display: none; }
  #hand { padding: 4px 6px; }
}
@media (max-width: 760px) { .tb-info .ports-title { display: none !important; } }
.fog-cloud { filter: blur(16px); }
.takeover { font-size: 13px; }
.victim small { display: block; font-size: 11px; font-weight: 800; opacity: .75; }
.bank-plan { margin: 2px 0 6px; padding: 6px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 800; text-align: center;
  background: rgba(0,0,0,.06); color: #6b4a22; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px; }
.bank-plan.ok { background: #dcefff; color: #13406b; box-shadow: inset 0 0 0 1.5px #8fbde6; }
.bank-plan .ico { vertical-align: -3px; }
