/* Batalha de Papel Higiénico — claro e vibrante, tudo num ecrã (sem scroll), pensado para ecrã inteiro. */
@font-face { font-family: 'Unbounded'; src: url('/assets/fonts/unbounded-latin-wght-normal.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Onest'; src: url('/assets/fonts/onest-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --ink: #1b1b2f;
  --ink-2: #4a4e69;
  --paper: #fffdf5;
  --gold: #ffd23f;
  --blue: #3a86ff;
  --pink: #ff4d7e;
  --green: #2ec27e;
  --sky: #c9eeff;
  --edge: #1b1b2f;
  --t0: #3a86ff;
  --t1: #ff4d7e;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font-family: 'Onest', system-ui, sans-serif; }
body { position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#view.aiming { cursor: crosshair; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }

/* ───────── botões ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .55em 1.05em; min-height: 44px;
  border: 3px solid var(--edge); border-radius: 14px; background: #fff; color: var(--ink);
  font-family: 'Unbounded', sans-serif; font-weight: 700; font-size: clamp(12.5px, 1.8vmin, 15px); line-height: 1.15;
  text-align: center; text-wrap: balance;
  box-shadow: 0 4px 0 var(--edge); cursor: pointer; text-decoration: none; transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #fff7d6; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn.primary { background: var(--gold); }
.btn.primary:hover { background: #ffe066; }
.btn.sun { background: #9be7ff; }
.btn.danger { background: #ffd6de; }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(27, 27, 47, .25); }
.btn:disabled { opacity: .45; pointer-events: none; }
.row { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.muted { color: var(--ink-2); font-size: .9em; }
kbd { display: inline-block; min-width: 1.7em; padding: .1em .4em; margin: 0 .1em; border: 2px solid var(--edge); border-bottom-width: 4px; border-radius: 7px; background: #fff; font: 700 .78em 'Unbounded', sans-serif; text-align: center; }
html.touch .pc-only, html:not(.touch) .touch-only, html:not(.touch) .pc-hide { display: none !important; }

/* ───────── ecrãs ───────── */
.screen {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  padding: max(10px, var(--safe-t)) max(12px, var(--safe-r)) max(10px, var(--safe-b)) max(12px, var(--safe-l));
  background: rgba(201, 238, 255, .5); backdrop-filter: blur(3px);
}
#sTitle { background: linear-gradient(180deg, rgba(201, 238, 255, .1), rgba(255, 244, 200, .45)); backdrop-filter: none; }
.card {
  width: min(540px, 100%); max-height: 100%; overflow: hidden;
  background: var(--paper); border: 3px solid var(--edge); border-radius: 24px; box-shadow: 0 8px 0 var(--edge);
  padding: clamp(12px, 3vmin, 26px); text-align: center;
  display: flex; flex-direction: column; gap: clamp(6px, 1.4vmin, 12px);
  animation: pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.9) translateY(10px); opacity: 0; } }
h1, h2 { font-family: 'Unbounded', sans-serif; margin: 0; line-height: 1.05; }
h1 { font-size: clamp(1.4rem, 5.6vmin, 2.5rem); font-weight: 900; letter-spacing: -.02em; }
h1 em { font-style: normal; color: #fff; text-shadow: 3px 3px 0 var(--edge); -webkit-text-stroke: 1.5px var(--edge); display: block; }
h2 { font-size: clamp(1.05rem, 3.8vmin, 1.7rem); font-weight: 800; }
p { margin: 0; line-height: 1.35; font-size: clamp(.82rem, 2.2vmin, 1rem); }
.menu { display: flex; flex-direction: column; gap: clamp(6px, 1.2vmin, 10px); align-items: stretch; min-height: 0; overflow-y: auto; }   /* rede de segurança: rola dentro do cartão, nunca a página */

.title-card { width: min(520px, 100%); }
/* o cartão corta nos cantos: os enfeites do logótipo precisam de uma folga em cima */
.title-card .logo { margin-top: 6px; }
/* Ecrãs curtos: o menu tem de caber inteiro — encolhe-se a arrumação, não a letra. */
@media (max-height: 780px) {
  .title-card { padding: 10px 12px; gap: 6px; }
  .title-card .logo { font-size: clamp(1.9rem, 7vmin, 2.8rem); }
  .title-card .tag { display: none; }
  .title-card .title-side { gap: 4px; }
  .title-card .box { padding: 8px; gap: 6px; }
  .title-card .menu { gap: 6px; }
  .title-card .menu > .row { gap: 6px; }
  .title-card .menu > .row .btn { min-height: 38px; padding: .3em .75em; }
  .title-card .btn { min-height: 40px; }
}
@media (max-height: 700px) {
  /* o fundo do menu fica sempre à vista: os botões pequenos em três colunas */
  .title-card .menu > .row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .title-card .menu > .row .btn { min-height: 36px; padding: .25em .5em; font-size: clamp(11.5px, 1.7vmin, 13px); }
  .title-card .box-hint { display: none; }   /* o botão já diz o que faz */
  .title-card .box { gap: 5px; }
  .title-card .user { display: none; }       /* quem sou eu já está na barra do hub */
  .title-card h1 { font-size: clamp(1.15rem, 4.6vmin, 1.9rem); }
}
@media (max-height: 560px) {
  .title-card .user { display: none; }
  .title-card h1 { font-size: clamp(1.2rem, 4.4vmin, 1.7rem); }
}
/* Telemóvel deitado: título em linha e menu em duas colunas — nada fica em baixo do cartão. */
@media (orientation: landscape) and (max-height: 520px) {
  .title-card { width: min(900px, 100%); padding: 8px 12px; gap: 6px; }
  .title-card .title-side { flex-direction: row; align-items: center; justify-content: center; gap: 10px; }
  .title-card .logo { font-size: 1.9rem; margin-top: 0; }
  .title-card h1 { font-size: 1.25rem; }
  .title-card .menu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-content: start; }
  .title-card .menu > * { min-width: 0; }
  .title-card .menu > .row { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .title-card .row2 { flex-wrap: wrap; min-width: 0; }
  .title-card .row2 > .btn { flex: 1 1 auto; }
  .title-card .join-row { flex: 1 1 100%; min-width: 0; }
  .title-card .join-row input { min-width: 96px; letter-spacing: .04em; font-size: .8rem; padding: 0 4px; }
  .title-card .btn { min-height: 38px; }
}
.title-side { display: flex; flex-direction: column; gap: clamp(4px, 1vmin, 10px); align-items: center; }
.logo { font-size: clamp(2.2rem, 9vmin, 4rem); line-height: 1; position: relative; display: inline-block; animation: bob 2.2s ease-in-out infinite; }
.logo .duck { position: absolute; left: -.7em; bottom: -.1em; font-size: .55em; animation: bob 1.4s ease-in-out infinite reverse; }
.logo .boom { position: absolute; right: -.6em; top: -.25em; font-size: .5em; animation: twinkle 1.1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes twinkle { 50% { transform: scale(1.35) rotate(15deg); } }
.tag { color: var(--ink-2); font-weight: 600; }
.user { font-size: .82rem; color: var(--ink-2); }
.box { display: flex; flex-direction: column; gap: 7px; padding: 10px; border: 2px dashed rgba(27, 27, 47, .25); border-radius: 16px; background: #fff; }
.box-label { font: 800 11px/1.3 'Unbounded', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.box-hint { margin: -2px 0 0; font-size: clamp(11px, 1.7vmin, 12.5px); font-weight: 700; color: var(--ink-2); }
.row2 { display: flex; gap: 8px; }
.row2 > .btn { flex: 0 0 auto; }
.join-row { display: flex; gap: 6px; flex: 1; min-width: 0; }
.join-row input { flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; border: 3px solid var(--edge); border-radius: 14px; font: 900 1rem 'Unbounded', sans-serif; letter-spacing: .2em; text-transform: uppercase; text-align: center; background: #fff; color: var(--ink); }
.segmented { display: flex; border: 3px solid var(--edge); border-radius: 14px; overflow: hidden; }
.seg { flex: 1; min-height: 40px; border: 0; border-right: 2px solid var(--edge); background: #fff; font: 700 .8rem 'Unbounded', sans-serif; cursor: pointer; }
.seg:last-child { border-right: 0; }
.seg[aria-pressed='true'] { background: var(--gold); }

.wait-card, .menu-card, .over-card, .sound-card { width: min(440px, 100%); }
.spinner { font-size: 3rem; animation: spin 1.2s linear infinite; display: inline-block; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.room-code { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; border: 3px dashed var(--edge); border-radius: 16px; background: #fff; }
.room-code span, .room-code small { font-size: .75rem; font-weight: 700; color: var(--ink-2); }
.room-code b { font: 900 clamp(1.6rem, 7vmin, 2.4rem) 'Unbounded', sans-serif; letter-spacing: .25em; user-select: all; -webkit-user-select: all; }

.help-card { width: min(780px, 100%); text-align: left; }
.help-card h2 { text-align: center; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; min-height: 0; overflow: hidden; }
.help-grid > div { display: flex; flex-direction: column; gap: 8px; }
.help-lead { font-size: clamp(.8rem, 2vmin, .95rem); }
.keys p { margin: .2em 0; font-size: clamp(.76rem, 2vmin, .9rem); }
.weapons-help { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.weapons-help li { display: grid; grid-template-columns: 1.8em 1fr; gap: 6px; align-items: start; font-size: clamp(.72rem, 1.9vmin, .86rem); line-height: 1.25; }
.weapons-help li span { font-size: 1.3em; }
.weapons-help b { font-family: 'Unbounded', sans-serif; font-size: .9em; }
.big-emoji { font-size: clamp(2.4rem, 10vmin, 4rem); }
.rating { font: 800 1rem 'Unbounded', sans-serif; }
.rating.up { color: #1f9d55; } .rating.down { color: #d62839; }

.sound-settings { display: grid; gap: 10px; text-align: left; }
.ss-row { display: grid; grid-template-columns: 5.5em 1fr 5.5em auto; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.ss-row input[type=range] { width: 100%; accent-color: var(--blue); }
.ss-val { font-size: .8rem; color: var(--ink-2); }
.ss-mute { min-height: 36px; padding: .3em .7em; font-size: clamp(11px, 1.7vmin, 12.5px); }

/* ───────── HUD ───────── */
#hud {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0; pointer-events: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 8px;
  padding: max(8px, var(--safe-t)) max(10px, var(--safe-r)) 0 max(10px, var(--safe-l));
}
.team { background: rgba(255, 253, 245, .92); border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--edge); padding: 5px 8px; max-width: 330px; display: flex; flex-direction: column; gap: 4px; transition: transform .2s; }
.team.t1 { justify-self: end; text-align: right; }
.team.active { transform: translateY(2px) scale(1.03); }
.team.t0.active { background: #e3eeff; } .team.t1.active { background: #ffe3ec; }
.team-head { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; min-width: 0; }
.team.t1 .team-head { flex-direction: row-reverse; }
.team-name { font: 800 clamp(11px, 1.6vmin, 13px)/1.15 'Unbounded', sans-serif; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.t0 .team-name { color: var(--t0); } .t1 .team-name { color: var(--t1); }
.team-who { font-size: clamp(11px, 1.7vmin, 12.5px); font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hpbar { height: 10px; border: 2px solid var(--edge); border-radius: 8px; background: #fff; overflow: hidden; }
.hpbar i { display: block; height: 100%; width: 100%; transition: width .4s; }
.t0 .hpbar i { background: var(--t0); } .t1 .hpbar i { background: var(--t1); margin-left: auto; }
.members { display: flex; gap: 4px; flex-wrap: wrap; }
.t1 .members { justify-content: flex-end; }
.member { font: 700 11px/1.5 'Onest', sans-serif; padding: 1px 6px; border-radius: 8px; border: 2px solid rgba(27, 27, 47, .2); background: #fff; white-space: nowrap; }
.member b { font-family: 'Unbounded', sans-serif; font-size: .9em; }
.member.cur { border-color: var(--edge); background: var(--gold); }
.member.dead { opacity: .45; text-decoration: line-through; }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.turn-row { display: flex; gap: 6px; align-items: center; }
.icon-btn { pointer-events: auto; width: 42px; height: 42px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--edge); font-size: 1.05rem; cursor: pointer; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.turn-chip { display: flex; gap: 8px; align-items: center; padding: 4px 6px 4px 12px; background: #fff; border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 3px 0 var(--edge); font: 800 clamp(11px, 1.7vmin, 14px) 'Unbounded', sans-serif; white-space: nowrap; max-width: 52vw; }
.turn-chip span { overflow: hidden; text-overflow: ellipsis; }
.turn-chip.mine { background: var(--gold); animation: bump .5s; }
.turn-chip b { min-width: 2.2em; height: 2.2em; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: .95em; }
.turn-chip b.warn { background: #ff4d6d; animation: blink .5s infinite; }
@keyframes bump { 40% { transform: scale(1.12); } }
@keyframes blink { 50% { opacity: .55; } }
.wind { display: flex; align-items: center; gap: 6px; padding: 3px 8px; background: rgba(255, 253, 245, .9); border: 2px solid var(--edge); border-radius: 10px; font: 700 .7rem 'Unbounded', sans-serif; }
.wbar { position: relative; width: clamp(80px, 16vmin, 140px); height: 10px; border: 2px solid var(--edge); border-radius: 6px; background: #fff; overflow: hidden; }
.wbar::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--edge); }
.wbar i { position: absolute; top: 0; bottom: 0; background: #4cc9f0; width: 0; transition: width .4s; }
.wbar .wl { right: 50%; } .wbar .wr { left: 50%; }
.wval { min-width: 3.2em; text-align: center; }

/* etiquetas por cima das personagens */
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.tag3d { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; will-change: transform; }
.tag3d .nm { padding: 1px 6px; border: 2px solid var(--edge); border-radius: 8px; font: 800 .62rem 'Unbounded', sans-serif; white-space: nowrap; color: #fff; }
.tag3d.t0 .nm { background: var(--t0); } .tag3d.t1 .nm { background: var(--t1); }
.tag3d .hp { font: 900 .68rem 'Unbounded', sans-serif; padding: 0 5px; border-radius: 6px; background: rgba(255, 255, 255, .92); border: 2px solid var(--edge); }
.tag3d.cur .nm { outline: 3px solid var(--gold); }
.tag3d.cur::before { content: '▼'; font-size: .8rem; color: var(--ink); animation: bob 0.8s infinite; order: 3; }
.tag3d.off .nm::before { content: attr(data-arrow); margin-right: 3px; }
.tag3d.off { opacity: .85; }

#popups { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.popup { position: absolute; transform: translate(-50%, -50%); font: 900 clamp(.95rem, 3vmin, 1.4rem) 'Unbounded', sans-serif; color: #fff; -webkit-text-stroke: 1.5px var(--edge); text-shadow: 2px 2px 0 var(--edge); white-space: nowrap; animation: rise 1.3s ease-out forwards; }
.popup.small { font-size: clamp(.7rem, 2vmin, .95rem); }
.popup.heal { color: #9be58f; }
@keyframes rise { to { transform: translate(-50%, -190%); opacity: 0; } }

#banner { position: fixed; z-index: 12; left: 50%; top: 32%; transform: translate(-50%, -50%); padding: 10px 20px; background: #fff; border: 3px solid var(--edge); border-radius: 18px; box-shadow: 0 6px 0 var(--edge); font: 900 clamp(1rem, 4vmin, 1.8rem) 'Unbounded', sans-serif; text-align: center; pointer-events: none; animation: bannerIn .35s cubic-bezier(.2, 1.6, .4, 1); max-width: 92vw; }
#banner small { display: block; font: 700 clamp(.7rem, 2vmin, .95rem) 'Onest', sans-serif; margin-top: 2px; color: var(--ink-2); }
#banner.t0 { background: #dceaff; } #banner.t1 { background: #ffe0ea; } #banner.gold { background: var(--gold); }
@keyframes bannerIn { from { transform: translate(-50%, -50%) scale(.6) rotate(-4deg); opacity: 0; } }
#toast { position: fixed; z-index: 13; left: 50%; transform: translateX(-50%); top: calc(max(8px, var(--safe-t)) + 96px); max-width: min(560px, 88vw); padding: 8px 14px; background: #fff; border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 4px 0 var(--edge); font-weight: 700; text-align: center; font-size: clamp(.78rem, 2vmin, .95rem); animation: pop .25s; pointer-events: none; }
#toast.warn { background: #ffe0e6; }

/* ───────── controlos ───────── */
#controls {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; pointer-events: none;
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: 'move arsenal fire'; align-items: end; gap: 10px;
  padding: 0 max(12px, var(--safe-r)) max(10px, var(--safe-b)) max(12px, var(--safe-l));
}
#controls.waiting .arsenal, #controls.waiting .fire-box, #controls.waiting .move-pad { opacity: .45; }
#controls.waiting * { pointer-events: none !important; }
.move-pad { grid-area: move; display: flex; gap: 8px; align-items: end; pointer-events: auto; }
.arsenal { grid-area: arsenal; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: auto; }
.fire-box { grid-area: fire; justify-self: end; display: flex; gap: 8px; align-items: center; pointer-events: auto; }
.tbtn { touch-action: none; width: clamp(54px, 12vmin, 72px); height: clamp(54px, 12vmin, 72px); border-radius: 50%; border: 3px solid var(--edge); background: rgba(255, 253, 245, .9); box-shadow: 0 4px 0 var(--edge); font-size: clamp(1.2rem, 4.5vmin, 1.7rem); display: grid; place-items: center; cursor: pointer; }
.tbtn.small { width: clamp(40px, 9vmin, 52px); height: clamp(40px, 9vmin, 52px); font-weight: 900; }
.tbtn.jump { background: #c9f2dd; }
.tbtn.on, .tbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); background: #fff3b0; }
.fire { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: clamp(70px, 15vmin, 96px); height: clamp(70px, 15vmin, 96px); border-radius: 50%; border: 3px solid var(--edge); background: #ff8a3d; box-shadow: 0 5px 0 var(--edge); font-size: clamp(1.5rem, 5vmin, 2.1rem); cursor: pointer; touch-action: none; }
.fire span { font: 800 clamp(11px, 1.5vmin, 12px)/1.1 'Unbounded', sans-serif; }
.fire:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge); }
.aim-info { display: flex; gap: 8px; align-items: center; padding: 3px 10px; background: rgba(255, 253, 245, .92); border: 2px solid var(--edge); border-radius: 10px; font: 700 clamp(11px, 1.6vmin, 13px) 'Unbounded', sans-serif; white-space: nowrap; }
.power { width: clamp(70px, 14vmin, 130px); height: 12px; border: 2px solid var(--edge); border-radius: 7px; background: #fff; overflow: hidden; }
.power i { display: block; height: 100%; width: 60%; background: linear-gradient(90deg, #2ec27e, #ffd23f 60%, #ff4d6d); }
.weapons { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 6px; touch-action: pan-x; }
.weapons::-webkit-scrollbar { display: none; }
.wpn { position: relative; flex: 0 0 auto; width: clamp(44px, 8.5vmin, 58px); height: clamp(44px, 8.5vmin, 58px); border: 3px solid var(--edge); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--edge); font-size: clamp(1.2rem, 4vmin, 1.6rem); cursor: pointer; display: grid; place-items: center; }
.wpn[aria-pressed='true'] { background: var(--gold); transform: translateY(-3px); }
.wpn:disabled { opacity: .35; cursor: default; }
.wpn i { position: absolute; right: -6px; top: -7px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--ink); color: #fff; font: 800 .62rem/20px 'Unbounded', sans-serif; font-style: normal; }
.wpn kbd { position: absolute; left: -5px; bottom: -6px; font-size: .55rem; min-width: 1.4em; padding: 0 .2em; border-bottom-width: 2px; }
.keys-hint { font-size: .7rem; font-weight: 600; color: var(--ink); background: rgba(255, 253, 245, .8); padding: 2px 8px; border-radius: 8px; }

/* telemóvel ao alto: armas por cima, andar e lançar por baixo */
@media (max-aspect-ratio: 1/1) {
  #controls { grid-template-columns: 1fr 1fr; grid-template-areas: 'arsenal arsenal' 'move fire'; row-gap: 6px; }
  .arsenal { width: 100%; }
  .weapons { justify-content: flex-start; width: 100%; }
  #hud { grid-template-columns: 1fr 1fr; }
  .hud-mid { grid-column: 1 / -1; grid-row: 2; }
  .team { max-width: none; }
  .members { display: none; }
  #toast { top: calc(max(8px, var(--safe-t)) + 118px); }
}

/* ───────── ecrãs baixos (telemóvel deitado) ───────── */
@media (max-height: 520px) {
  .card { border-radius: 18px; box-shadow: 0 5px 0 var(--edge); gap: 6px; }
  .title-card { width: min(760px, 100%); display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: 14px; text-align: center; }
  .btn { min-height: 36px; padding: .4em .8em; }
  .box { padding: 7px; gap: 5px; }
  .box-hint { display: none; }
  .join-row input { min-height: 36px; }
  .seg { min-height: 34px; }
  .members { display: none; }
  .team { padding: 3px 6px; }
  .keys-hint { display: none; }
  .aim-info { padding: 2px 8px; }
  #hud { padding-top: max(4px, var(--safe-t)); }
  .help-grid { gap: 10px; }
  #banner { top: 38%; }
}
/* PC/tablet deitado com pouca altura: menu inicial em duas colunas */
@media (max-height: 700px) and (min-width: 700px) {
  .title-card { width: min(780px, 100%); display: grid; grid-template-columns: 1fr 1.15fr; align-items: center; gap: 16px; }
}
/* telemóvel pequeno ao alto */
@media (max-height: 700px) and (max-aspect-ratio: 1/1) {
  .tag { display: none; }
  .logo { font-size: 2rem; }
  .card { padding: 10px; }
}
@media (max-width: 560px) {
  .help-grid { grid-template-columns: 1fr; }
  .weapons-help { display: none; }
  .row2 { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .logo, .logo span, .spinner, .tag3d.cur::before { animation: none; } }
