/* Madrugada no Cais — jogo em tela cheia, paisagem: cena + HUD flutuante + painel lateral */
:root {
  --bg: #06101c; --bg2: #0d2236; --glass: rgba(255,255,255,.055); --glass2: rgba(255,255,255,.09);
  --hud: rgba(6,16,28,.62); --edge: rgba(150,205,255,.18); --edge2: rgba(150,205,255,.34);
  --text: #e8f4ff; --muted: #8fb0c8; --accent: #3de0c4; --accent2: #ffb86b; --coral: #ff6f4e;
  --radius: 14px; --u: clamp(11px, 1.55vmin, 15px);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.35; background: var(--bg); }
.hidden { display: none !important; }
button, select { font-family: inherit; cursor: pointer; }
button, .card, label { user-select: none; -webkit-user-select: none; }

#app {
  position: fixed; inset: 0; height: 100dvh;
  background: radial-gradient(900px 500px at 20% 0%, #14405e 0%, transparent 60%), radial-gradient(800px 500px at 100% 100%, #1b2a66 0%, transparent 55%), linear-gradient(180deg, var(--bg2), var(--bg));
}

/* ---------- cena (16:9 centralizada) ---------- */
.stage {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 1px var(--edge), 0 0 80px rgba(61,224,196,.08);
}
#scene { display: block; width: 100%; height: 100%; image-rendering: pixelated; background: #000; }

/* ---------- HUD ---------- */
.hud {
  position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  font-size: var(--u);
}
.hud button, .hud label, .hud select, .hud .chip, .hud .player { pointer-events: auto; }
.hud-top, .hud-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud-bottom { align-items: flex-end; }
.hud-left, .hud-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hud-right { align-items: flex-end; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; max-width: 42%; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: .3em .85em; border-radius: 10px; white-space: nowrap; font-weight: 700; font-size: 1em;
  background: var(--hud); border: 1px solid var(--edge); color: var(--text); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.chip.coin { color: #ffe08a; border-color: rgba(255,224,138,.4); font-size: 1.12em; }
.chip.round { width: 2.2em; height: 2.2em; padding: 0; justify-content: center; }
.chip.round:hover { background: var(--glass2); }

/* jogador: medalhão + nível + xp */
.player {
  display: flex; align-items: center; gap: .6em; padding: .35em 1em .35em .35em; border-radius: 999px;
  background: var(--hud); border: 1px solid var(--edge); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.avatar { width: 2.9em; height: 2.9em; border-radius: 50%; padding: 2px; background: conic-gradient(var(--accent), var(--accent2), var(--accent)); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; image-rendering: pixelated; background: #0a1a2c; display: block; }
.pinfo { min-width: 9.5em; }
#level { font-weight: 800; font-size: 1em; margin-bottom: .25em; white-space: nowrap; }
.xpbar { position: relative; height: 1.15em; background: rgba(0,0,0,.45); border-radius: 999px; overflow: hidden; border: 1px solid var(--edge); }
#xpfill { height: 100%; width: 0; background: linear-gradient(90deg, #2f8cff, var(--accent)); transition: width .4s; box-shadow: 0 0 10px rgba(61,224,196,.55); }
#xptext { position: absolute; inset: 0; text-align: center; font-size: .72em; font-weight: 700; line-height: 1.6; text-shadow: 0 1px 2px #000a; }

/* pesqueiro (centro do topo) */
.spot {
  display: flex; align-items: center; gap: .4em; padding: .3em .5em .3em .8em; border-radius: 999px; margin-top: .2em;
  background: var(--hud); border: 1px solid var(--edge2); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.spot { position: relative; }
.spot select { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.loc-btn { background: transparent; color: var(--text); border: 0; font: inherit; font-weight: 700; font-size: 1.05em; padding: .15em .9em .15em .2em; max-width: 14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.loc-btn::after { content: "▾"; margin-left: .5em; opacity: .7; }
.loc-menu {
  position: absolute; top: calc(100% + .45em); left: 50%; transform: translateX(-50%); min-width: 100%; z-index: 30; display: flex; flex-direction: column; gap: .15em; padding: .35em;
  background: rgba(8,20,34,.94); border: 1px solid var(--edge2); border-radius: 14px; box-shadow: 0 12px 34px rgba(0,0,0,.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.loc-menu button { background: transparent; color: var(--text); border: 0; border-radius: 10px; font: inherit; font-weight: 600; text-align: left; white-space: nowrap; padding: .6em .9em; cursor: pointer; }
.loc-menu button:hover { background: var(--glass2); }
.loc-menu button.sel { background: rgba(61,224,196,.16); color: var(--accent); }
.hud .spot { pointer-events: auto; }
select option { background: #0d2236; color: var(--text); }

/* evento e cartão de captura */
.event {
  position: absolute; left: 50%; top: calc(max(10px, env(safe-area-inset-top)) + 4.6em); transform: translateX(-50%);
  padding: .3em 1em; font-size: .95em; font-weight: 700; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(90deg, rgba(110,60,200,.88), rgba(200,60,140,.88)); border: 1px solid #ffe24a; animation: glow 1.4s infinite alternate;
}
@keyframes glow { from { box-shadow: 0 0 4px #ffe24a; } to { box-shadow: 0 0 16px #ffe24a; } }
.catch-card {
  position: absolute; left: 0; right: 0; margin: 0 auto; top: 24%; width: fit-content; min-width: 13em; padding: .8em 1.3em; text-align: center; border-radius: 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc, #888) 24%, rgba(6,16,28,.92)), rgba(6,16,28,.95));
  border: 2px solid var(--rc, #888); box-shadow: 0 0 34px color-mix(in srgb, var(--rc) 60%, transparent);
  animation: pop .4s cubic-bezier(.2,1.4,.4,1); pointer-events: none;
}
.catch-card b { font-size: 1.15em; }
.catch-card .rar { font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; font-size: .8em; color: var(--rc); }
@keyframes pop { from { transform: scale(.4) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* canto inferior esquerdo: diário + atalhos */
.hud-bl { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; flex: 1 1 0; min-width: 0; }
.log { display: flex; flex-direction: column-reverse; gap: 3px; max-width: 24em; pointer-events: none; }
.log p { margin: 0; padding: .25em .8em; font-size: .9em; width: fit-content; border-radius: 8px; background: rgba(6,16,28,.6); animation: fade 9s forwards; }
.log p:nth-child(n+4) { display: none; }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.toggles { display: flex; gap: 6px; }
.tog {
  display: flex; align-items: center; gap: .35em; padding: .3em .8em .3em .5em; border-radius: 999px; font-size: .85em; font-weight: 700; color: var(--muted); cursor: pointer;
  background: var(--hud); border: 1px solid var(--edge); transition: .15s;
}
.tog input { display: none; }
.tog i { font-style: normal; filter: grayscale(1) opacity(.7); }
.tog:has(input:checked) { color: #fff; border-color: var(--accent); background: rgba(61,224,196,.2); box-shadow: 0 0 12px rgba(61,224,196,.3); }
.tog:has(input:checked) i { filter: none; }

/* dock de menus (centro inferior) */
.dock {
  display: flex; gap: .4em; padding: .4em; border-radius: 18px; pointer-events: auto; flex: 0 0 auto;
  background: var(--hud); border: 1px solid var(--edge2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.dock button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1em; width: 4.1em; height: 3.9em;
  background: transparent; border: 1px solid transparent; border-radius: 12px; color: var(--muted); transition: .15s;
}
.dock button i { font-style: normal; font-size: 1.7em; line-height: 1; }
.dock button span { font-size: .72em; font-weight: 700; }
.dock button:hover { background: var(--glass2); color: var(--text); transform: translateY(-2px); }
.dock button.open { background: linear-gradient(180deg, rgba(61,224,196,.3), rgba(61,224,196,.1)); color: #fff; border-color: rgba(61,224,196,.7); box-shadow: 0 0 14px rgba(61,224,196,.3); }

/* botão de pescar (canto inferior direito) */
.hud-br { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: 1 1 0; min-width: 0; }
.status {
  padding: .3em 1em; font-size: .9em; font-weight: 600; max-width: 100%; text-align: right;
  background: var(--hud); border: 1px solid var(--edge); border-radius: 999px; backdrop-filter: blur(6px);
}
.primary {
  position: relative; overflow: hidden; pointer-events: auto; width: 7.6em; height: 7.6em; border-radius: 50%; border: 3px solid rgba(255,255,255,.55);
  font-size: 1.15em; font-weight: 800; letter-spacing: .5px; line-height: 1.15; color: #fff; padding: 0 .4em;
  background: radial-gradient(circle at 35% 25%, #ffa07a, var(--coral) 55%, #c9431f); box-shadow: 0 6px 0 #8f2d15, 0 12px 28px rgba(255,111,78,.4);
  transition: transform .1s, filter .1s, box-shadow .1s;
}
.primary:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-2px); }
.primary:not(:disabled):active { transform: translateY(5px); box-shadow: 0 1px 0 #8f2d15; }
.primary:disabled { filter: grayscale(.5) brightness(.8); cursor: not-allowed; }
.primary .cd { position: absolute; left: 0; bottom: 0; height: 100%; width: 0; background: rgba(255,255,255,.28); }
.primary span { position: relative; }
.primary.hook { background: radial-gradient(circle at 35% 25%, #ff8a8a, #e23030 60%, #9a1414); box-shadow: 0 6px 0 #6b1010, 0 0 40px rgba(255,80,80,.8); animation: pulse .22s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* ---------- painel lateral ---------- */
.panel {
  position: absolute; z-index: 10; top: 0; right: 0; bottom: 0; width: min(560px, 58vw); display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) 14px;
  background: linear-gradient(180deg, rgba(10,26,44,.94), rgba(6,16,28,.96)); border-left: 1px solid var(--edge2);
  box-shadow: -20px 0 50px rgba(0,0,0,.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: slide .22s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel h2 { margin: 0; font-size: 1.35em; font-weight: 800; background: linear-gradient(90deg, #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.x { width: 2.2em; height: 2.2em; border-radius: 50%; background: var(--glass2); border: 1px solid var(--edge2); color: var(--text); font-size: 1em; }
.x:hover { background: rgba(255,111,78,.35); }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; padding-right: 4px; }
.panel .grid { max-height: none; overflow: visible; }
.equip { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.equip div { background: var(--glass); border: 1px solid var(--edge); padding: 3px 10px; font-size: 11px; border-radius: 999px; }
.equip b { color: var(--accent2); font-weight: 700; }
.panel-body::-webkit-scrollbar { width: 8px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--edge2); border-radius: 8px; }

/* ---------- aviso de rotação ---------- */
.rotate { display: none; position: absolute; inset: 0; z-index: 50; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; background: var(--bg); color: var(--muted); }
.rotate b { color: var(--text); font-size: 22px; }
.rotate .phone { font-size: 64px; animation: turn 2.2s ease-in-out infinite; }
@keyframes turn { 0%, 30% { transform: rotate(0); } 70%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (max-width: 900px) { .rotate { display: flex; } }

.toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
select, .toolbar button {
  background: var(--glass2); color: var(--text); border: 1px solid var(--edge2); padding: 6px 10px; border-radius: 9px;
}
.sell-all { background: linear-gradient(180deg, #8a52e8, #5b2fa3) !important; font-weight: 700; border-color: #b58aff !important; }

/* ---------- cartões (inventário, bestiário) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; max-height: 540px; overflow-y: auto; padding: 2px; }
.card {
  position: relative; padding: 8px 4px 7px; text-align: center; font-size: 11px; cursor: pointer; border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--rc, #888) 20%, rgba(255,255,255,.03)), rgba(255,255,255,.03) 70%);
  border: 1px solid color-mix(in srgb, var(--rc, #888) 55%, transparent);
  transition: transform .12s, box-shadow .12s;
}
.card::before { content: ""; position: absolute; left: 10%; right: 10%; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--rc, transparent); opacity: .9; }
.card:not(.locked):hover { transform: translateY(-3px); box-shadow: 0 8px 20px color-mix(in srgb, var(--rc, #888) 40%, transparent); }
.card .ic { min-height: 38px; display: flex; align-items: center; justify-content: center; }
.card .nm { font-weight: 700; margin-top: 2px; }
.card .sub { color: var(--muted); }
.card.locked { opacity: .32; cursor: default; filter: grayscale(1) brightness(.8); }
.card.locked::before { display: none; }
.empty-slot { opacity: .45; cursor: default; border-style: dashed; }
.grid.aq { max-height: none; margin-bottom: 10px; }

/* ---------- loja e listas ---------- */
.shop h3 { margin: 16px 0 8px; color: var(--accent); font-size: 14px; letter-spacing: .5px; }
.item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; padding: 9px 12px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--edge);
}
.item b { font-weight: 700; }
.item small { color: var(--muted); display: block; margin-top: 2px; }
.item button {
  background: linear-gradient(180deg, #2fbf8a, #1f8a63); color: #fff; border: 1px solid #62e8b4; padding: 7px 12px; min-width: 92px; border-radius: 9px; font-weight: 700;
}
.item button:hover:not(:disabled) { filter: brightness(1.12); }
.item button:disabled { background: rgba(255,255,255,.07); border-color: var(--edge); color: #7d93a6; cursor: not-allowed; }
.item button.equipped { background: linear-gradient(180deg, #d99a3a, #a8701c); border-color: var(--accent2); }
.item button.ghost { background: transparent; border-color: var(--edge2); color: var(--muted); min-width: 0; }
.order { align-items: center; }
.ordimg .spr { width: 58px; }
.btncol { display: flex; flex-direction: column; gap: 5px; }
.dex-h { margin: 16px 0 8px; color: var(--accent); font-size: 13px; font-weight: 700; }
.dex-h small { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 12px; line-height: 1.55; }
.ach { cursor: pointer; opacity: .5; }
.ach.done { opacity: 1; border-color: rgba(255,184,107,.7); box-shadow: inset 0 0 18px rgba(255,184,107,.12); }
.tag { background: var(--accent2); color: #1a1206; padding: 2px 9px; font-size: 11px; font-weight: 800; border-radius: 999px; }
.empty { color: var(--muted); text-align: center; padding: 34px 0; }
.mbar { height: 7px; margin-top: 7px; background: rgba(0,0,0,.4); border-radius: 999px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: linear-gradient(90deg, #3de0c4, #d8f060); border-radius: 999px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 20; max-width: 90vw; text-align: center;
  background: rgba(7,18,31,.92); border: 1px solid var(--accent); border-radius: 999px; padding: 9px 20px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 20px rgba(61,224,196,.2); animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translate(-50%, 14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- sprites ---------- */
.spr { image-rendering: pixelated; width: 58px; height: auto; vertical-align: middle; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.spr.big { width: 110px; filter: drop-shadow(0 0 10px var(--rc)); }
.spr.sm { width: 28px; }

/* rolagem discreta */
.grid::-webkit-scrollbar, .log::-webkit-scrollbar { width: 8px; }
.grid::-webkit-scrollbar-thumb, .log::-webkit-scrollbar-thumb { background: var(--edge2); border-radius: 8px; }
.grid::-webkit-scrollbar-track, .log::-webkit-scrollbar-track { background: transparent; }

/* ---------- telas baixas (celular na horizontal) ---------- */
@media (max-height: 460px) {
  :root { --u: 11px; }
  .hud { padding-top: 6px; padding-bottom: 6px; }
  .pinfo { min-width: 7.5em; }
  .dock button { width: 3.6em; height: 3.3em; }
  .dock button span { display: none; }
  .dock button i { font-size: 1.6em; }
  .primary { width: 6em; height: 6em; font-size: 1.05em; }
  .hud-right { max-width: 38%; }
  .event { top: 3.8em; }
  .catch-card { top: 18%; padding: .5em 1em; }
  .spr.big { width: 70px; }
  .panel { width: min(520px, 64vw); }
  .tog span { display: none; }
  .tog { padding: .35em .5em; }
  .log p:nth-child(n+3) { display: none; }
  .toast { bottom: 4.5em; }
}
@media (max-width: 700px) and (orientation: landscape) { .hud-right .chip:not(.round):not(#wx) { display: none; } #bag { display: inline-flex !important; } }

/* com o menu aberto o HUD recua para o lado da cena */
.panel { --pw: min(560px, 58vw); width: var(--pw); }
.panel-open .hud { padding-right: calc(var(--pw) + 12px); }
.panel-open .hud-bl, .panel-open .hud-right, .panel-open .event { display: none; }
.panel-open .hud-bottom { justify-content: center; }
.panel-open .hud-br { flex: 0 0 auto; }
.panel-open .status { display: none; }
@media (max-height: 460px) {
  .panel { --pw: min(520px, 64vw); }
  .panel-open .hud-br { display: none; }
}
@media (max-height: 460px) {
  .panel-open .hud-bottom { justify-content: flex-start; }
  .panel-open .dock { gap: .15em; padding: .25em; }
  .panel-open .dock button { width: 2.9em; height: 2.9em; }
  .panel-open .dock button i { font-size: 1.35em; }
}

/* abertura com a marca do jogo */
.splash {
  position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(700px 400px at 50% 40%, #14405e, var(--bg)); animation: splash 2.2s forwards; pointer-events: none;
}
.splash img { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 22px; box-shadow: 0 0 40px rgba(61,224,196,.4); animation: bob 1.2s ease-in-out infinite alternate; }
.splash b { font-size: 30px; letter-spacing: 2px; background: linear-gradient(90deg, #fff, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash span { color: var(--muted); font-size: 13px; }
@keyframes bob { from { transform: translateY(-5px); } to { transform: translateY(5px); } }
@keyframes splash { 0%, 70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.dock button, .primary, .chip.round, .x { font-size: inherit; }

/* barra de XP mais legível (todas as plataformas) */
.xpbar { height: 1.5em; }
#xptext { font-size: .82em; line-height: 1.85; }
.pinfo { min-width: 11em; }
.key { display: none; }

/* =====================================================================
   HUD DO PC (mouse + teclado): menu em coluna na esquerda, botão em pílula embaixo
   ===================================================================== */
html.pc { --u: clamp(14px, 1.15vw, 17px); }
html.pc .hud-bottom { position: static; }
html.pc .dock {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: 9.2em; flex-direction: column; gap: .25em; padding: .4em;
}
html.pc .dock button { flex-direction: row; justify-content: flex-start; gap: .6em; width: 10.2em; height: 2.75em; padding: 0 .7em; text-align: left; }
html.pc .dock button i { font-size: 1.35em; }
html.pc .dock button span { font-size: .9em; flex: 1; }
html.pc .dock button .key {
  display: inline-block; font-size: .72em; font-weight: 800; min-width: 1.6em; text-align: center; padding: .1em .3em; border-radius: 5px;
  background: rgba(255,255,255,.1); border: 1px solid var(--edge2); color: var(--muted);
}
html.pc .dock button:hover { transform: translateX(3px); }
html.pc .hud-br { position: absolute; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); align-items: center; flex: none; }
html.pc .primary { width: 17em; height: 3.3em; border-radius: 999px; font-size: 1.1em; display: flex; align-items: center; justify-content: center; gap: .8em; }
html.pc .primary::after {
  content: "ESPAÇO"; position: relative; font-size: .55em; letter-spacing: 1px; padding: .2em .7em; border-radius: 6px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.4);
}
html.pc .status { text-align: center; }
html.pc .hud-bl { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); flex: none; }
html.pc .toggles { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
html.pc .tog { font-size: 1em; padding: .4em .9em .4em .6em; }
html.pc .panel { --pw: min(480px, 40vw); }
html.pc .panel-open .hud-bl, html.pc .panel-open .hud-right, html.pc .panel-open .event, html.pc .panel-open .status { display: flex; }
html.pc .panel-open .event { display: block; }
html.pc .panel-open .hud-bottom { justify-content: space-between; }
html.pc .panel-open .hud-br { display: flex; }
html.pc .panel-open .toggles { right: calc(var(--pw) + 12px); }
html.pc .panel-open .dock { gap: .25em; padding: .4em; }
html.pc .panel-open .dock button { width: 10.2em; height: 2.75em; }
html.pc .panel-open .dock button i { font-size: 1.35em; }
html.pc .panel-open .hud-br { left: calc((100% - var(--pw)) / 2); }

/* =====================================================================
   HUD DO CELULAR (toque, horizontal): alvos grandes, ícones, polegares nos cantos
   ===================================================================== */
html.touch .dock button { min-width: 44px; min-height: 44px; }
html.touch .primary { width: 8em; height: 8em; }
html.touch .tog { padding: .5em .8em; }
#app { --pw: min(560px, 58vw); }
html.pc #app { --pw: min(480px, 40vw); }
@media (max-height: 460px) { html.touch #app { --pw: min(520px, 64vw); } }
html.pc .panel-open .log { display: none; }

/* ---------- conta / nuvem ---------- */
#cloud-chip { cursor: pointer; font: inherit; color: inherit; }
#cloud-chip.on { border-color: rgba(61,224,196,.5); color: var(--accent); }
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(3,8,14,.72); backdrop-filter: blur(4px); font-size: var(--u); padding: 12px; }
.modal .card { width: min(26em, 100%); max-height: 100%; overflow: auto; background: #0b1c2e; border: 1px solid var(--edge2); border-radius: 16px; padding: 1.3em 1.4em; box-shadow: 0 20px 60px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: .7em; font-size: 1.15em; }
.modal h3 { margin: 0; font-size: 1.2em; }
.modal p { margin: 0; }
.modal .note { color: var(--muted); font-size: .9em; }
.modal .mail { font-weight: 700; word-break: break-all; }
.modal input { font: inherit; color: var(--text); background: rgba(0,0,0,.35); border: 1px solid var(--edge2); border-radius: 10px; padding: .6em .8em; }
.modal input:focus { outline: 2px solid var(--accent); }
.modal .msg { min-height: 1.2em; color: var(--accent2); font-size: .9em; }
.modal .row { display: flex; gap: .6em; flex-wrap: wrap; }
.modal button { font: inherit; color: var(--text); background: var(--glass2); border: 1px solid var(--edge2); border-radius: 10px; padding: .6em 1em; cursor: pointer; flex: 1; }
.modal button.go { background: var(--accent); color: #04221c; border-color: var(--accent); font-weight: 700; }
.modal button:disabled { opacity: .5; }
.modal button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; flex: none; }
.modal .cmp { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; }
.modal .cmp > div { background: rgba(0,0,0,.3); border: 1px solid var(--edge); border-radius: 10px; padding: .6em .8em; font-size: .9em; }
@media (max-width: 700px) and (orientation: landscape) { #cloud-chip { display: inline-flex !important; } .modal .card { gap: .4em; padding: .8em 1em; } }
.modal .form { display: flex; flex-direction: column; gap: .7em; flex: 1; min-width: 0; }
.modal .art { display: none; }
html.pc .modal .card { flex-direction: row; gap: 0; padding: 0; width: min(44em, 92%); overflow: hidden; }
html.pc .modal .art {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; flex: 0 0 15em; padding: 1.5em; text-align: center;
  background: radial-gradient(circle at 50% 30%, rgba(61,224,196,.22), transparent 65%), linear-gradient(180deg, #14405e, #0a1830); border-right: 1px solid var(--edge);
}
html.pc .modal .art img { width: 7em; image-rendering: pixelated; filter: drop-shadow(0 0 16px rgba(61,224,196,.5)); border-radius: 16px; }
html.pc .modal .art b { letter-spacing: 2px; font-size: .95em; }
html.pc .modal .art span { color: var(--muted); font-size: .8em; }
html.pc .modal .form { padding: 1.6em 1.8em; justify-content: center; }
html.pc .modal input { padding: .75em 1em; }
html.pc .modal button.go { padding: .75em 1em; }
.splash .by, .modal .art .by { font-style: normal; font-size: 12px; letter-spacing: 1.5px; color: var(--accent); opacity: .85; }

/* ---------- barra de título própria (app do PC) ---------- */
#titlebar { display: none; }
html.tauri #titlebar {
  display: flex; align-items: center; position: fixed; top: 0; left: 0; right: 0; height: 32px; z-index: 60;
  background: #060f1a; border-bottom: 1px solid var(--edge); color: var(--muted); font-size: 12px; letter-spacing: .3px; user-select: none;
}
html.tauri #titlebar .tb-icon { width: 18px; height: 18px; margin: 0 8px 0 10px; border-radius: 4px; image-rendering: pixelated; pointer-events: none; }
html.tauri #titlebar .tb-title { pointer-events: none; font-weight: 600; }
html.tauri .tb-btns { margin-left: auto; display: flex; height: 100%; }
html.tauri .tb-btns button { width: 46px; height: 100%; border: 0; background: transparent; display: grid; place-items: center; cursor: default; }
html.tauri .tb-btns svg { width: 10px; height: 10px; fill: none; stroke: var(--text); stroke-width: 1; opacity: .8; }
html.tauri .tb-btns button:hover { background: rgba(255,255,255,.08); }
html.tauri .tb-btns #tb-close:hover { background: #c42b1c; }
html.tauri .tb-btns .ico-rest { display: none; }
html.tauri .tb-btns #tb-max.is-max .ico-max { display: none; }
html.tauri .tb-btns #tb-max.is-max .ico-rest { display: block; }
html.tauri #app { top: 32px; height: auto; }
html.tauri:fullscreen #titlebar, html:fullscreen.tauri #titlebar { display: none; }
html.tauri:fullscreen #app { top: 0; }

/* barra de título embutida no jogo: a cena ocupa a janela toda; só uma faixa de arrastar e os botões sobre a imagem */
html.tauri #titlebar { height: 26px; background: transparent; border: 0; }
html.tauri #titlebar .tb-icon, html.tauri #titlebar .tb-title { display: none; }
html.tauri #app { top: 0; }
html.tauri .hud { padding-top: 30px; }
html.tauri .tb-btns { height: 24px; background: var(--hud); border: 1px solid var(--edge); border-top: 0; border-right: 0; border-radius: 0 0 0 10px; overflow: hidden; backdrop-filter: blur(6px); }
html.tauri .tb-btns button { width: 38px; }
html.tauri:fullscreen #app { top: 0; }

/* PWA instalado no PC: o jogo ocupa a barra de título e o navegador desenha só os botões do Windows por cima */
@media (display-mode: window-controls-overlay) {
  #titlebar {
    display: block; position: fixed; z-index: 60; background: transparent; border: 0;
    left: env(titlebar-area-x, 0); top: env(titlebar-area-y, 0); width: env(titlebar-area-width, 100%); height: env(titlebar-area-height, 33px);
    -webkit-app-region: drag; app-region: drag;
  }
  #titlebar .tb-icon, #titlebar .tb-title, #titlebar .tb-btns { display: none; }
  #app { top: 0; }
  .hud { padding-top: calc(env(titlebar-area-height, 33px) + 4px); }
  .hud button, .hud label, .hud select, .hud .chip, .hud .player { -webkit-app-region: no-drag; app-region: no-drag; }
}

/* app do PC: botões da janela planos, na mesma linha do HUD (sem bloco separado); a linha do topo arrasta a janela */
html.tauri #titlebar { height: 10px; }
html.tauri .hud { padding-top: 12px; }
html.tauri .hud-top, html.tauri .hud-left, html.tauri .hud-right { pointer-events: auto; }
html.tauri .hud-right { margin-right: 116px; }
html.tauri .tb-btns { position: fixed; top: 12px; right: 12px; height: 32px; gap: 2px; background: none; border: 0; border-radius: 0; backdrop-filter: none; overflow: visible; }
html.tauri .tb-btns button { width: 34px; height: 32px; border-radius: 9px; }
html.tauri:fullscreen .tb-btns { display: none; }

/* a cena cobre a janela (corta um pouco em cima e embaixo) em vez de deixar faixas nas laterais; em telas muito largas volta a caber inteira */
#app { overflow: hidden; }
.stage { width: clamp(min(100vw, calc(100dvh * 16 / 9)), max(100vw, calc(100dvh * 16 / 9)), calc(min(100vw, calc(100dvh * 16 / 9)) * 1.15)); }

#backdrop { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(22px) saturate(1.15) brightness(.75); pointer-events: none; }
.loc-menu { max-height: calc(100dvh - 5em); overflow-y: auto; }
html.touch .loc-menu button { padding: .8em 1.1em; }

/* os botões da janela (app do PC e PWA instalado) ficam acima do painel, sem cobrir o ✕ dele */
html.tauri .panel { padding-top: 52px; }
@media (display-mode: window-controls-overlay) { .panel { padding-top: calc(env(titlebar-area-height, 33px) + 12px); } }

/* tela cheia da janela (app do PC): some a barra e os botões da janela */
html.win-fs #titlebar { display: none; }

/* o seletor de pesqueiro fica sempre no centro exato da tela, não importa o tamanho dos lados */
.hud-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 10px; }
.hud-top .spot { grid-column: 2; }
.hud-top .hud-right { grid-column: 3; justify-self: end; max-width: 100%; }

/* colunas nunca menores que o conteúdo: o seletor fica no centro quando há espaço e a direita nunca quebra em duas linhas */
.hud-top { grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
.hud-top .hud-right { flex-wrap: nowrap; }
@media (max-width: 1150px) { html.pc #tod { display: none; } }

/* janelas de largura média: o chip "Dia" sai (já aparece na faixa de baixo) para o seletor ficar no centro sem apertar os outros */
@media (max-width: 1350px) { html.pc #tod { display: none; } }

/* janela de novidades da versão */
.modal .card.news { gap: .6em; }
html.pc .modal .card.news { flex-direction: column; padding: 1.4em 1.7em; width: min(36em, 92%); max-height: 92%; overflow-y: auto; }
.modal .card.news .art { display: none; }
.news section { border-top: 1px solid var(--edge); padding-top: .6em; }
.news section:first-of-type { border-top: 0; padding-top: 0; }
.news h4 { margin: 0; font-size: 1.05em; }
.news h4 small { color: var(--muted); font-weight: 400; margin-left: .5em; }
.news ul { margin: .4em 0 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: .35em; font-size: .95em; }
.news .ver { text-align: center; font-size: .75em; }
.modal button.go { flex: 1; }
.modal .card.news { width: min(38em, 94%); }
