* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #7ed957;
  font-family: "Trebuchet MS", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none; -webkit-user-select: none; color: #2d2340;
}
canvas { display: block; touch-action: none; position: fixed; inset: 0; }
.hidden { display: none !important; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; z-index: 5;
}
.hud-left, .hud-right { display: flex; gap: 8px; flex-wrap: wrap; pointer-events: auto; }
.hud-right { justify-content: flex-end; }
.pill {
  background: rgba(255,255,255,.92); border-radius: 999px; padding: 6px 14px; font-size: 16px;
  display: flex; align-items: center; gap: 6px; box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.pill.name { font-weight: bold; color: #6b3fd6; }
.coin-ico { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6a8, #ffc928 55%, #e0a100); border: 2px solid #c98a00; display: inline-block; }
.hbtn {
  border: 0; background: #fff; border-radius: 14px; padding: 8px 12px; font-size: 15px; font-weight: bold;
  color: #2d2340; box-shadow: 0 3px 0 rgba(0,0,0,.18); font-family: inherit;
}
.hbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }

#action {
  position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom));
  width: 96px; height: 96px; border-radius: 50%; border: 4px solid #fff;
  background: radial-gradient(circle at 35% 30%, #ffd86b, #ff9f1c); color: #4a2500;
  font-size: 16px; font-weight: bold; font-family: inherit; box-shadow: 0 5px 0 rgba(0,0,0,.25); z-index: 6;
}
#action:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }

#decorBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.95);
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 10px; box-shadow: 0 -3px 10px rgba(0,0,0,.15); flex-wrap: wrap;
}
.decor-title { width: 100%; font-size: 13px; color: #6a6080; }
#decorItems { display: flex; gap: 8px; overflow-x: auto; flex: 1; padding-bottom: 4px; }
.ditem {
  flex: 0 0 auto; width: 70px; border-radius: 12px; border: 3px solid #e6e0f0; background: #faf8ff;
  text-align: center; font-size: 11px; padding: 3px; position: relative;
}
.ditem.sel { border-color: #ff9f1c; background: #fff4e0; }
.ditem canvas { position: static; width: 56px; height: 44px; display: block; margin: 0 auto; }
.ditem .cnt { position: absolute; top: -6px; right: -6px; background: #6b3fd6; color: #fff; border-radius: 999px; padding: 1px 6px; font-size: 11px; font-weight: bold; }
.empty { color: #8a80a0; font-size: 13px; padding: 10px; }

#arcadeHud { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 0; right: 0; display: flex; justify-content: center; gap: 10px; z-index: 5; pointer-events: none; }

#overlay {
  position: fixed; inset: 0; background: rgba(40, 20, 70, .55); z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
#panel {
  background: #fff; border-radius: 22px; width: min(760px, 100%); max-height: 100%; overflow: auto;
  padding: 16px 18px; box-shadow: 0 8px 0 rgba(0,0,0,.2); position: relative;
}
#panel h1 { margin: 0 0 6px; font-size: 24px; color: #6b3fd6; }
#panel h2 { margin: 10px 0 6px; font-size: 15px; color: #6a6080; text-transform: uppercase; letter-spacing: .5px; }
#panel p { margin: 4px 0 10px; }
.close-x { position: absolute; top: 10px; right: 12px; border: 0; background: #f0ebfa; border-radius: 50%; width: 36px; height: 36px; font-size: 18px; font-weight: bold; color: #6b3fd6; }

.btn {
  border: 0; border-radius: 14px; padding: 10px 18px; font-size: 16px; font-weight: bold; font-family: inherit;
  background: #efeaf8; color: #2d2340; box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.btn.primary { background: #ff9f1c; color: #fff; }
.btn.green { background: #2ecc71; color: #fff; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.center { justify-content: center; }

.creator { display: flex; gap: 16px; }
.creator .preview { flex: 0 0 170px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.creator .preview canvas { position: static; width: 170px; height: 200px; background: linear-gradient(#c9f0ff, #e8fbd9); border-radius: 18px; }
.creator .opts { flex: 1; min-width: 0; }
.sw-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sw { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #ddd; }
.sw.sel { box-shadow: 0 0 0 3px #ff9f1c; }
.chip { border: 0; border-radius: 999px; padding: 6px 12px; background: #f0ebfa; font-family: inherit; font-size: 14px; color: #2d2340; }
.chip.sel { background: #6b3fd6; color: #fff; }
input.name {
  font-family: inherit; font-size: 18px; padding: 8px 12px; border-radius: 12px; border: 3px solid #e6e0f0; width: 100%; outline: none;
}
input.name:focus { border-color: #6b3fd6; }

.tabs { display: flex; gap: 8px; margin: 6px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.card { border: 3px solid #eee8f7; border-radius: 16px; padding: 8px; text-align: center; background: #fcfbff; }
.card canvas { position: static; width: 100px; height: 76px; display: block; margin: 0 auto; }
.card .nm { font-weight: bold; margin: 2px 0; }
.card .pr { color: #b37a00; font-weight: bold; font-size: 14px; margin-bottom: 4px; }
.card .btn { padding: 6px 12px; font-size: 14px; width: 100%; }
.card .own { font-size: 12px; color: #6a6080; }

#toast {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%) translateY(-20px); opacity: 0;
  background: #2d2340; color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: bold; z-index: 20;
  transition: all .25s; pointer-events: none; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.title-big { font-size: 34px !important; text-align: center; }
.big-score { font-size: 48px; font-weight: bold; text-align: center; color: #ff9f1c; margin: 6px 0; }

@media (max-height: 430px) {
  #panel { padding: 12px 14px; }
  #panel h1 { font-size: 20px; }
  .creator .preview { flex-basis: 130px; }
  .creator .preview canvas { width: 130px; height: 150px; }
  #action { width: 80px; height: 80px; font-size: 14px; }
  .hbtn { padding: 6px 10px; font-size: 13px; }
}
@media (max-width: 560px) {
  .creator { flex-direction: column; }
  .creator .preview { flex-basis: auto; }
}

/* ---------- 3D ---------- */
#title {
  position: fixed; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: radial-gradient(ellipse at center, rgba(255,255,255,.0) 40%, rgba(40,20,90,.25));
}
#title > * { position: relative; }
#title .title-bg {
  position: absolute; inset: -30px; background: url(img/titulo-boring.jpg) center / cover no-repeat;
  filter: blur(14px) saturate(1.15); opacity: .55;
}
#title .logo-img {
  width: min(88vw, 760px, 118vh); height: auto; border-radius: 22px; border: 4px solid #fff;
  box-shadow: 0 10px 0 rgba(0,0,0,.18), 0 18px 40px rgba(0,0,0,.35);
  animation: bob 2.6s ease-in-out infinite; pointer-events: none; user-select: none;
}
@media (max-height: 520px) { #title { gap: 10px; } #title .logo-img { width: min(62vw, 100vh); } }
#title .tap {
  background: #fff; color: #6b3fd6; font-weight: bold; font-size: 20px; padding: 10px 26px; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(0,0,0,.2); animation: pulse 1.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes pulse { 50% { transform: scale(1.06); } }

#mini { top: auto; right: auto;
  position: fixed; left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom));
  width: 120px; height: 120px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); z-index: 5; pointer-events: none;
}
#joy {
  position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%;
  background: rgba(255,255,255,.22); border: 3px solid rgba(255,255,255,.65); z-index: 5; pointer-events: none;
}
#knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,.85); transform: translate(-50%,-50%); box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
#jumpBtn {
  position: fixed; right: max(130px, calc(env(safe-area-inset-right) + 130px)); bottom: max(24px, env(safe-area-inset-bottom));
  width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff; z-index: 6;
  background: radial-gradient(circle at 35% 30%, #8fe3ff, #2fa4e7); color: #fff; font-size: 26px; font-weight: bold;
  font-family: inherit; box-shadow: 0 5px 0 rgba(0,0,0,.25); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
#jumpBtn small { font-size: 11px; margin-top: 2px; }
#jumpBtn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
#flash { position: fixed; inset: 0; background: #ff3c3c; opacity: 0; pointer-events: none; z-index: 4; }
.pvbox { width: 170px; height: 200px; border-radius: 18px; overflow: hidden; background: linear-gradient(#c9f0ff, #e8fbd9); touch-action: none; }
@media (max-height: 430px) {
  .pvbox { width: 140px; height: 160px; }
  #mini { width: 90px; height: 90px; }
  #jumpBtn { width: 64px; height: 64px; right: 112px; }
}
@media (max-width: 560px) { .pvbox { width: 100%; } }

/* ---------- v3: emotes, pets, pesca, mapa, decoração ---------- */
.hbtn.ico { padding: 8px 10px; font-size: 18px; min-width: 42px; }
#btnEmote {
  position: fixed; right: max(118px, calc(env(safe-area-inset-right) + 118px)); bottom: max(108px, calc(env(safe-area-inset-bottom) + 108px));
  width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; z-index: 6; font-size: 26px;
  background: radial-gradient(circle at 35% 30%, #ffe680, #ffb300); box-shadow: 0 4px 0 rgba(0,0,0,.22);
}
#emoteBar {
  position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(176px, calc(env(safe-area-inset-bottom) + 176px)); z-index: 7;
  background: rgba(255,255,255,.96); border-radius: 18px; padding: 8px; display: grid; grid-template-columns: repeat(3, 62px); gap: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
#emoteBar button { border: 0; background: #f3effc; border-radius: 12px; font-size: 24px; padding: 6px 0; display: flex; flex-direction: column; align-items: center; font-family: inherit; }
#emoteBar button small { font-size: 10px; color: #4a3a6a; margin-top: 2px; }
#emoteBar button:active { transform: scale(.94); }
.decor-tools { width: 100%; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.decor-tools .decor-title { width: auto; margin-left: 6px; }
.pet-head { display: flex; gap: 14px; align-items: center; }
.pet-head #petImg img { width: 140px; height: 106px; background: linear-gradient(#e8f6ff, #f4ffe9); border-radius: 16px; }
.lvl { background: #6b3fd6; color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 13px; margin-left: 6px; vertical-align: 3px; }
.xpbar { height: 14px; background: #eee8f7; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.xpbar div { height: 100%; background: linear-gradient(90deg, #ffd23f, #ff9f1c); border-radius: 999px; transition: width .3s; }
.fishbar { position: relative; height: 46px; background: linear-gradient(#7ccaf5, #2f8fd0); border-radius: 14px; overflow: hidden; margin: 8px 0; border: 3px solid #fff; box-shadow: 0 0 0 2px #cde; }
.fzone { position: absolute; top: 0; bottom: 0; background: rgba(46, 204, 113, .85); border-left: 3px solid #fff; border-right: 3px solid #fff; }
.needle { position: absolute; top: 4px; font-size: 28px; transform: translateX(-50%); filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.fish-caught { text-align: center; font-size: 30px; min-height: 36px; }
.btn.big { font-size: 22px; padding: 12px 34px; }
.zone-card { padding: 12px; }
.zone-card.vila { background: #effbe6; } .zone-card.praia { background: #fff6dc; } .zone-card.parque { background: #fde8f4; }
.zone-emoji { font-size: 44px; }
@media (max-height: 430px) {
  #btnEmote { width: 48px; height: 48px; font-size: 22px; right: 104px; bottom: 96px; }
  #emoteBar { bottom: 152px; grid-template-columns: repeat(6, 54px); }
  .hbtn.ico { padding: 6px 8px; font-size: 16px; min-width: 36px; }
}

/* ---------- v4: chat, multiplayer, ajuda, avatares ---------- */
.title-hint { background: rgba(255,255,255,.85); color: #4a3a6a; border-radius: 999px; padding: 6px 16px; font-size: 14px; }
.pill.net { background: #2fa4e7; color: #fff; }
.hbtn.on { background: #2fa4e7; color: #fff; }
#chatLog {
  position: fixed; left: max(10px, env(safe-area-inset-left)); top: 58px; z-index: 5; max-width: min(46vw, 420px);
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
#chatLog .cl { background: rgba(30,20,60,.62); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 13px; transition: opacity 1s; overflow-wrap: anywhere; }
#chatLog .cl.old { opacity: 0; }
#chatLog .cl b { color: #ffd23f; }
#chatLog .cl.me b { color: #c9b6ff; } #chatLog .cl.peer b { color: #7fd3ff; } #chatLog .cl.npc b { color: #b6f5a0; }
#chatLog .cl.sys { background: rgba(47,164,231,.75); } #chatLog .cl.sys b { color: #fff; }
#chatBox {
  position: fixed; left: 50%; top: max(8px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 12;
  width: min(620px, calc(100vw - 20px)); background: rgba(255,255,255,.97); border-radius: 18px; padding: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.chat-row { display: flex; gap: 6px; }
#chatIn { flex: 1; min-width: 0; font-family: inherit; font-size: 17px; padding: 8px 12px; border-radius: 12px; border: 3px solid #e6e0f0; outline: none; }
#chatIn:focus { border-color: #6b3fd6; }
.quick { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; padding-bottom: 2px; }
.quick .chip { flex: 0 0 auto; }
#btnChat {
  position: fixed; left: max(142px, calc(env(safe-area-inset-left) + 142px)); bottom: max(18px, env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%; border: 3px solid #fff; z-index: 6; font-size: 24px;
  background: radial-gradient(circle at 35% 30%, #b39dff, #6b3fd6); box-shadow: 0 4px 0 rgba(0,0,0,.22);
}
table.keys { width: 100%; border-collapse: collapse; font-size: 15px; }
table.keys td { padding: 5px 6px; border-bottom: 1px solid #f0ebfa; vertical-align: middle; }
table.keys td:first-child { white-space: nowrap; width: 1%; }
.kbd { display: inline-block; background: #f3effc; border: 2px solid #d9cff2; border-bottom-width: 4px; border-radius: 8px; padding: 2px 8px; font-weight: bold; font-size: 13px; color: #4a2a7a; }
.card.cur { border-color: #6b3fd6; background: #f6f1ff; }
.card .col { display: flex; flex-direction: column; gap: 6px; }
.btn.small { font-size: 13px; padding: 6px 10px; }
.new-av { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 170px; cursor: pointer; border-style: dashed; }
.new-av .plus { font-size: 52px; color: #6b3fd6; line-height: 1; }
.muted { color: #6a6080; } .small { font-size: 12px; }
.net-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.net-box { border: 3px solid #eee8f7; border-radius: 16px; padding: 12px; background: #fcfbff; }
.net-box.ok { border-color: #2fa4e7; background: #f0f9ff; }
.net-box h2 { margin-top: 0 !important; }
.bigip { font-size: 34px; font-weight: 900; color: #2fa4e7; letter-spacing: 1px; margin: 8px 0; }
@media (max-height: 430px) {
  #btnChat { width: 46px; height: 46px; font-size: 20px; left: 112px; }
  #chatLog { top: 50px; }
}

/* ---------- v5: online, admin, mundos ---------- */
#announce {
  position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 21; max-width: min(90vw, 640px);
  background: linear-gradient(90deg, #ffb300, #ff6f00); color: #fff; font-weight: 900; font-size: 18px;
  padding: 12px 22px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.3); text-align: center; text-shadow: 0 2px 0 rgba(0,0,0,.2);
}
#chatLog .cl.adm { background: rgba(245,170,0,.88); } #chatLog .cl.adm b { color: #fff; }
.chip.adm { background: #ffcc00; color: #4a2a00; font-weight: bold; }
.adm-badge { display: inline-block; margin: 8px 0 4px; background: linear-gradient(90deg, #ffd23f, #ff9f1c); color: #4a2a00; font-weight: 900; padding: 6px 14px; border-radius: 999px; }
.map-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.map-grid .zone-emoji { font-size: 36px; }
.online { color: #2e7d32; font-weight: bold; font-size: 13px; margin: 2px 0 6px; }
#title .dl { background: #2ecc71; color: #fff; text-decoration: none; font-weight: bold; padding: 10px 20px; border-radius: 999px; box-shadow: 0 4px 0 rgba(0,0,0,.2); }

/* v6: contas */
.acc-form { display: flex; flex-direction: column; gap: 4px; max-width: 420px; margin: 0 auto; text-align: left; }
.acc-form label { font-weight: 800; font-size: 14px; color: #5b4a86; margin-top: 6px; }
.acc-form label.check { font-weight: 600; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #6d6488; }
.acc-form label.check input { margin-top: 2px; width: 18px; height: 18px; flex: none; }
.acc-form .row { margin-top: 10px; }
.acc-form .err { color: #d63b4f; font-weight: 700; min-height: 1.2em; margin: 6px 0 0; font-size: 14px; }
.btn.big { font-size: 18px; padding: 12px 28px; }
button.link { background: none; border: 0; color: #6b3fd6; font-weight: 800; text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; }
.acc-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #f6f2ff; border-radius: 12px; padding: 8px 10px; margin: 4px 0 10px; font-size: 14px; }
.acc-line span { flex: 1; min-width: 180px; }

/* v7: abertura NicRP Studios */
#splash { position: fixed; inset: 0; z-index: 100; background: #000; overflow: hidden; cursor: pointer; transition: opacity .6s; }
#splash.out { opacity: 0; pointer-events: none; }
#splash .slide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .55s; }
#splash .slide.show { opacity: 1; }
#splash .slide .bg { position: absolute; inset: -40px; background: var(--img) center / cover no-repeat; filter: blur(18px); opacity: .7; }
#splash .slide.dark .bg { display: none; }
#splash .slide img { position: relative; width: 100%; height: 100%; object-fit: contain; transform: scale(.94); transition: transform 2.6s ease-out; user-select: none; }
#splash .slide.show img { transform: scale(1); }
#splash .skip { position: absolute; bottom: 14px; right: 18px; color: rgba(255,255,255,.55); font-size: 13px; }
