/* Guerra das Descargas — 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: #bfe9ff;
  --edge: #1b1b2f;
  --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);
  /* ── Escala de texto partilhada com o hub (services/hub-web/public/assets/base.css) ──
     A mesma escala para o hub e para todos os jogos. Encolhe com o ecrã, mas nunca abaixo do
     mínimo. Regra da casa: quando um rótulo não cabe, passa a duas linhas — não se corta. */
  --fs-3xs: 11px;
  --fs-2xs: clamp(11px, 1.8vmin, 12.5px);
  --fs-xs:  clamp(12px, 2vmin, 13.5px);
  --fs-sm:  clamp(13px, 2.2vmin, 14px);
  --fs-md:  clamp(13.5px, 2.4vmin, 15px);
  --fs-lg:  clamp(15px, 2.8vmin, 17px);
  --top-h: 44px;
  --panel-h: 164px;
  --mini: 148px;
  --act: 48px;
}
html.touch { --top-h: 38px; --panel-h: 104px; --mini: 92px; --act: 42px; }
@media (orientation: portrait) { html.touch { --panel-h: 150px; --mini: 84px; --act: 46px; } }
@media (max-height: 360px) { html.touch { --panel-h: 94px; --mini: 82px; --act: 38px; --top-h: 34px; } }

* { 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; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; }
html.touch .pc-only, html:not(.touch) .touch-only { display: none !important; }

/* ───────── botões ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .5em 1em; min-height: 42px;
  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.big { min-height: 50px; font-size: clamp(14px, 2.2vmin, 17px); }
.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: .45rem; justify-content: center; flex-wrap: wrap; }
.muted { color: var(--ink-2); font-size: .9em; }
kbd { display: inline-block; min-width: 1.6em; padding: .05em .35em; margin: 0 .1em; border: 2px solid var(--edge); border-bottom-width: 3px; border-radius: 6px; background: #fff; font: 700 .72em 'Unbounded', sans-serif; text-align: center; }

/* ───────── ecrãs ───────── */
.screen {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center;
  padding: max(8px, var(--safe-t)) max(10px, var(--safe-r)) max(8px, var(--safe-b)) max(10px, var(--safe-l));
  background: rgba(191, 233, 255, .55); backdrop-filter: blur(3px);
}
#sTitle { background: linear-gradient(170deg, #bfe9ff 0%, #d9f5ff 45%, #fff1c7 100%); backdrop-filter: none; }
.card {
  width: min(560px, 100%); max-height: 100%; overflow: hidden;
  background: var(--paper); border: 3px solid var(--edge); border-radius: 22px; box-shadow: 0 7px 0 var(--edge);
  padding: clamp(10px, 2.6vmin, 24px); text-align: center;
  display: flex; flex-direction: column; gap: clamp(6px, 1.3vmin, 12px);
  animation: pop .28s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(.92) translateY(10px); opacity: 0; } }
h1, h2 { font-family: 'Unbounded', sans-serif; margin: 0; line-height: 1.05; }
h1 { font-size: clamp(1.3rem, 5.2vmin, 2.4rem); 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(1rem, 3.6vmin, 1.6rem); font-weight: 800; }
p { margin: 0; line-height: 1.3; font-size: clamp(.78rem, 2.1vmin, .98rem); }
.menu { display: flex; flex-direction: column; gap: clamp(6px, 1.2vmin, 10px); align-items: stretch; min-height: 0; overflow-y: auto; }

.title-card { width: min(640px, 100%); }
/* o cartão corta nos cantos: os enfeites do logótipo precisam de uma folga em cima */
.title-card .logo { margin-top: 6px; }
.title-side { display: flex; flex-direction: column; gap: clamp(3px, .9vmin, 8px); align-items: center; }
.logo { font-size: clamp(2rem, 8vmin, 3.6rem); line-height: 1; position: relative; display: inline-block; animation: bob 2.2s ease-in-out infinite; }
.logo .duck { position: absolute; left: -.75em; bottom: -.1em; font-size: .5em; animation: bob 1.4s ease-in-out infinite reverse; }
.logo .roll { position: absolute; right: -.7em; top: -.2em; font-size: .5em; animation: spin 2.6s linear infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-4deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.tag { color: var(--ink-2); font-weight: 600; }
.user { font-weight: 700; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); gap: clamp(4px, 1vmin, 8px) 10px; text-align: left; }
.opt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opt > span { font: 700 11px/1.2 'Unbounded', sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.opt > span small { text-transform: none; letter-spacing: 0; font-weight: 600; }
.opt-wide { grid-column: 1 / -1; }
.factions { display: flex; gap: 4px; min-width: 0; }
.factions button { flex: 1; min-width: 0; min-height: 36px; padding: 4px 5px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; cursor: pointer;
  font: 700 clamp(11px, 1.6vmin, 13px)/1.15 'Onest', sans-serif; text-wrap: balance; }
.factions button[data-f="aflitos"] { background: #e3f4ff; }
.factions button[data-f="sifao"] { background: #ffe9d1; }
.factions button[data-f="aleatoria"] { background: #f1ecff; }
.factions button b { font-family: 'Unbounded', sans-serif; font-size: .9em; }
.segmented { display: flex; border: 3px solid var(--edge); border-radius: 12px; overflow: hidden; background: #fff; min-width: 0; }
.segmented button { flex: 1; min-width: 0; min-height: 36px; padding: 4px 5px; border: 0; border-left: 2px solid var(--edge); background: #fff; cursor: pointer; font: 700 clamp(11px, 1.6vmin, 13px)/1.15 'Onest', sans-serif; text-wrap: balance; }
.segmented button:first-child { border-left: 0; }
.segmented button.on { background: #9be7ff; }
.segmented button:disabled { opacity: .4; }
@media (orientation: landscape) and (max-height: 500px) {
  .title-card {
    width: min(880px, 100%); display: grid; align-items: start;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    grid-template-rows: auto minmax(0, 1fr); column-gap: 14px; row-gap: 8px;
  }
  .title-side { grid-column: 1; grid-row: 1; }
  .title-card .menu { grid-column: 1; grid-row: 2; justify-content: start; }
  .title-card .options { grid-column: 2; grid-row: 1 / 3; align-content: start; grid-template-columns: 1fr 1fr; }
  .logo { font-size: 2rem; }
  .title-card h1 { font-size: 1.5rem; }
  .title-card .tag { display: none; }        /* o subtítulo repete o que o resto do ecrã já diz */
  .btn.big { min-height: 44px; }
}

.wait-card { width: min(420px, 100%); align-items: center; }
.spinner { font-size: 2.6rem; animation: spin 1.2s linear infinite; }
.help-card { width: min(720px, 100%); }
.help-scroll { overflow: auto; text-align: left; display: flex; flex-direction: column; gap: 8px; min-height: 0; touch-action: pan-y; }
.help-scroll p { font-size: clamp(.76rem, 2vmin, .92rem); }
.keys p { margin: 3px 0; }
.sound-card { width: min(460px, 100%); }
.over-card { width: min(760px, 100%); }
.big-emoji { font-size: clamp(2rem, 8vmin, 3.4rem); line-height: 1; }
.stats-wrap { overflow: auto; min-height: 0; touch-action: pan-x pan-y; }
.stats { width: 100%; border-collapse: collapse; font-size: clamp(11px, 1.8vmin, 14px); }
.stats th, .stats td { padding: 3px 6px; border-bottom: 2px solid rgba(27, 27, 47, .12); white-space: nowrap; }
.stats th { font-family: 'Unbounded', sans-serif; font-size: .9em; }
.stats td:first-child { text-align: left; font-weight: 800; }
.stats .dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; border: 2px solid var(--edge); margin-right: 4px; vertical-align: -1px; }
.stats tr.win td { background: #fff4c2; }
.sound-settings { display: flex; flex-direction: column; gap: 10px; }
.ss-row { display: grid; grid-template-columns: 5.5em 1fr 5em auto; gap: 8px; align-items: center; text-align: left; font-weight: 700; }
.ss-row input { width: 100%; }

/* ───────── HUD ───────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) max(6px, var(--safe-r)) 0 max(6px, var(--safe-l));
  display: flex; align-items: center; gap: clamp(3px, 1vw, 10px);
  background: rgba(255, 253, 245, .92); border-bottom: 3px solid var(--edge);
  font: 700 clamp(.72rem, 1.9vmin, .95rem) 'Unbounded', sans-serif; overflow: hidden;
}
.res { display: flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 0; padding: 2px 6px; border-radius: 10px; background: #fff; border: 2px solid rgba(27, 27, 47, .15); }
.res i { font-style: normal; }
.res.flash { background: #ffd6de; }
.res.clock { margin-left: auto; }
.tb-btn { display: flex; align-items: center; gap: 3px; height: calc(var(--top-h) - 8px); min-width: calc(var(--top-h) - 8px); padding: 0 8px; border: 2px solid var(--edge); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.tb-btn i { font-style: normal; }
.tb-btn.idle.some { background: #ffe066; }
html.touch .res { padding: 1px 4px; }
@media (max-width: 420px) { .res.clock { display: none; } .res { gap: 1px; padding: 1px 3px; } #topbar { gap: 3px; font-size: .68rem; } .res.age b { display: none; } }
.res.age { background: #fff4c2; }
@media (max-width: 380px) { .res.age { display: none; } }
.res.age.up { background: #ffe066; }
#wonderBar { z-index: 40; pointer-events: none; position: absolute; top: calc(var(--top-h) + var(--safe-t) + 4px); right: max(8px, var(--safe-r)); padding: 3px 10px; border: 2px solid var(--edge); border-radius: 12px;
  background: #ffe066; box-shadow: 0 3px 0 var(--edge); font: 800 clamp(11px, 1.7vmin, 13px)/1.2 'Unbounded', sans-serif; pointer-events: none; text-align: right; max-width: min(calc(100% - 16px), 340px); overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
#wonderBar.bad { background: #ffd6de; }
#wonderBar:not(.hidden) ~ #toasts { top: calc(var(--top-h) + var(--safe-t) + 34px); }

#toasts { z-index: 41; position: absolute; top: calc(var(--top-h) + var(--safe-t) + 6px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 20px)); display: flex; flex-direction: column; gap: 4px; pointer-events: none; }
.toast { background: var(--paper); border: 2px solid var(--edge); border-radius: 12px; padding: 4px 10px; box-shadow: 0 3px 0 var(--edge); font-size: clamp(11.5px, 1.9vmin, 13.5px); line-height: 1.25; font-weight: 600; animation: pop .25s; text-align: center; }
.toast b { font-family: 'Unbounded', sans-serif; font-size: .9em; }
.toast.bad { background: #ffe0e6; }
.toast.good { background: #e3ffe9; }

#panel {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--panel-h) + var(--safe-b));
  padding: 6px max(6px, var(--safe-r)) calc(6px + var(--safe-b)) max(6px, var(--safe-l));
  display: grid; grid-template-columns: var(--mini) minmax(0, 1fr) auto; gap: 8px;
  background: rgba(255, 253, 245, .95); border-top: 3px solid var(--edge);
}
#miniBox { width: var(--mini); height: var(--mini); align-self: center; position: relative; }
#minimap { width: 100%; height: 100%; display: block; border-radius: 8px; cursor: pointer; touch-action: none; }
#info { min-width: 0; overflow: hidden; display: flex; flex-direction: column; gap: 4px; font-size: clamp(11px, 1.8vmin, 14px); }
#actions { display: grid; grid-template-columns: repeat(7, var(--act)); grid-auto-rows: var(--act); gap: 5px; align-content: center; }
html.touch #actions { grid-template-columns: none; grid-auto-flow: column; grid-template-rows: repeat(2, var(--act)); grid-auto-columns: var(--act); overflow-x: auto; overflow-y: hidden; max-width: 46vw; touch-action: pan-x; scrollbar-width: none; }
@media (orientation: portrait) {
  html.touch #panel { grid-template-columns: var(--mini) minmax(0, 1fr); grid-template-rows: var(--mini) minmax(0, 1fr); row-gap: 4px; }
  html.touch #actions { grid-column: 1 / 3; grid-template-rows: var(--act); max-width: none; }
}
@media (max-height: 360px) { html.touch #actions { grid-template-rows: repeat(2, var(--act)); } }

.act {
  position: relative; display: grid; place-items: center; width: var(--act); height: var(--act);
  border: 2px solid var(--edge); border-radius: 11px; background: #fff; box-shadow: 0 3px 0 var(--edge);
  font-size: calc(var(--act) * .44); line-height: 1; cursor: pointer; padding: 0;
}
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.act.on { background: #9be7ff; }
.act.off { opacity: .45; }
.act .k { position: absolute; top: 1px; left: 3px; font: 700 .55rem 'Unbounded', sans-serif; opacity: .6; }
.act .n { position: absolute; bottom: 1px; right: 3px; font: 800 .6rem 'Unbounded', sans-serif; }
.act.small .ic { font-size: .62em; letter-spacing: -.05em; white-space: nowrap; }
.act .cd { position: absolute; inset: 0; border-radius: 9px; background: rgba(27, 27, 47, .45); color: #fff; display: grid; place-items: center; font: 800 .8rem 'Unbounded', sans-serif; }
html.touch .act .k { display: none; }

.sel-head { display: flex; gap: 8px; align-items: center; min-width: 0; }
.portrait { font-size: 1.9em; width: 1.6em; height: 1.6em; display: grid; place-items: center; border: 2px solid var(--edge); border-radius: 12px; background: #fff; flex: none; }
.sel-name { font: 800 clamp(.72rem, 1.9vmin, .95rem) 'Unbounded', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel-sub { color: var(--ink-2); font-size: .92em; line-height: 1.2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.hp { height: 9px; border: 2px solid var(--edge); border-radius: 6px; background: #d9d9e6; overflow: hidden; }
.hp > i { display: block; height: 100%; background: var(--green); }
.hp.prog > i { background: var(--blue); }
.stats-line { display: flex; gap: 8px; flex-wrap: wrap; color: var(--ink-2); font-weight: 700; }
.queue { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; }
.qi { position: relative; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--edge); border-radius: 8px; background: #fff; cursor: pointer; font-size: 1rem; padding: 0; flex: none; }
.qi > i { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--blue); }
.multi { display: flex; flex-wrap: wrap; gap: 4px; overflow: hidden; }
.mu { display: flex; align-items: center; gap: 2px; padding: 2px 6px; border: 2px solid var(--edge); border-radius: 9px; background: #fff; cursor: pointer; font: 700 .8rem 'Onest', sans-serif; }
.warn { color: #c0163f; font-weight: 800; }
html.touch #info { font-size: 11px; }
html.touch .portrait { font-size: 1.4em; }
@media (orientation: landscape) { html.touch .stats-line { display: none; } }

#touchTools { position: absolute; right: max(8px, var(--safe-r)); bottom: calc(var(--panel-h) + var(--safe-b) + 8px); display: flex; flex-direction: column; gap: 8px; }
.tool { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--edge); background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 var(--edge); font-size: 1.2rem; display: grid; place-items: center; padding: 0; }
.tool.on { background: #9be7ff; }
@media (max-height: 360px) { #touchTools { flex-direction: row; } }
#placeBar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--panel-h) + var(--safe-b) + 10px); display: flex; gap: 8px; }
#modeHint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--panel-h) + var(--safe-b) + 10px); background: var(--paper); border: 2px solid var(--edge); border-radius: 12px; padding: 4px 12px; font-weight: 700; font-size: clamp(12px, 1.9vmin, 13.5px); line-height: 1.25; text-align: center; pointer-events: none; max-width: min(calc(100% - 20px), 420px); overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
html.touch #placeBar:not(.hidden) ~ #modeHint { bottom: calc(var(--panel-h) + var(--safe-b) + 64px); }
#ctx { position: absolute; display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--paper); border: 3px solid var(--edge); border-radius: 14px; box-shadow: 0 4px 0 var(--edge); z-index: 5; }
#ctx button { min-height: 40px; padding: 4px 12px; border: 2px solid var(--edge); border-radius: 10px; background: #fff; font-weight: 700; font-size: clamp(12px, 1.9vmin, 14px); line-height: 1.2; }

#selbox { position: fixed; border: 2px solid #1b1b2f; background: rgba(61, 220, 132, .18); pointer-events: none; z-index: 9; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.floater { position: absolute; left: 0; top: 0; font: 800 .8rem 'Unbounded', sans-serif; color: #fff; text-shadow: 0 2px 0 var(--edge), 0 0 3px var(--edge); white-space: nowrap; }
.floater.gold { color: #ffd23f; }
.floater.heal { color: #7dffb0; }
.floater.bad { color: #ff8fa6; }

/* ───────── lobby online (fase 3) ───────── */
.btn.sun { background: #ffe9d1; }
.btn.small { min-height: 36px; padding: 4px 10px; font-size: clamp(12px, 1.8vmin, 13.5px); line-height: 1.15; }
.online-card { width: min(520px, 100%); }
.friend-hint { margin: -2px 0 0; font-size: clamp(11px, 1.8vmin, 12.5px); font-weight: 700; color: var(--ink-2, #6b6f86); }
.join-row { display: flex; gap: 6px; }
#joinCode {
  flex: 1; min-width: 0; min-height: 44px; text-align: center; border: 3px solid var(--edge); border-radius: 12px; background: #fff;
  font: 900 clamp(1rem, 4vmin, 1.4rem) 'Unbounded', sans-serif; letter-spacing: .18em; text-transform: uppercase; padding: 0 6px;
}
.rooms-scroll { flex: 1; min-height: 64px; overflow: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#roomList { display: flex; flex-direction: column; gap: 6px; }
.room-item {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 10px; align-items: center; text-align: left;
  width: 100%; min-height: 52px; padding: 6px 10px; border: 3px solid var(--edge); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--edge); cursor: pointer;
}
.room-item:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.room-item .rc { grid-row: 1 / 3; font: 900 clamp(.95rem, 3.4vmin, 1.25rem) 'Unbounded', sans-serif; letter-spacing: .1em; background: var(--gold); border: 2px solid var(--edge); border-radius: 10px; padding: 4px 7px; }
.room-item .rn { font-weight: 800; font-size: clamp(.74rem, 2vmin, .9rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item .rm { grid-column: 2; color: var(--ink-2); font-size: clamp(11px, 1.8vmin, 13px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-item .rs { grid-column: 2; color: var(--ink-2); font-size: clamp(11px, 1.7vmin, 12.5px); font-weight: 700; }

.room-card { width: min(700px, 100%); }
.room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.room-head h2 { display: flex; align-items: baseline; gap: 6px; }
#roomCode { background: var(--gold); border: 3px solid var(--edge); border-radius: 12px; padding: 1px 10px; letter-spacing: .16em; }
#roomPub { font: 700 .62rem 'Onest', sans-serif; color: var(--ink-2); }
.room-body { flex: 1 1 auto; display: grid; grid-template-columns: 1fr; gap: 8px; min-height: 0; overflow: auto; touch-action: pan-y; text-align: left; }
#joinCode, .seed-inp { user-select: text; -webkit-user-select: text; touch-action: manipulation; }
.room-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 6px 10px; align-content: start; }
.opt-line { font-size: clamp(.72rem, 1.9vmin, .86rem); }
.seed-row { display: flex; gap: 6px; }
.seed-inp { flex: 1; min-width: 0; min-height: 34px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; text-align: center; font: 700 .85rem 'Onest', sans-serif; }
.room-slots { display: grid; grid-template-columns: 1fr; gap: 6px; align-content: start; }
.room-slots.two { grid-template-columns: 1fr 1fr; }
.team-box { display: flex; flex-direction: column; gap: 6px; padding: 5px; border: 3px dashed rgba(27, 27, 47, .28); border-radius: 14px; min-height: 58px; }
.team-box.over { border-color: var(--blue); background: rgba(58, 134, 255, .1); }
.team-h { font: 800 11px/1.2 'Unbounded', sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.slot { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border: 3px solid var(--edge); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--edge); touch-action: none; }
.slot.aberto { background: #f4f2ea; border-style: dashed; box-shadow: none; }
.slot.cpu { background: #f1ecff; }
.slot.eu { background: #e3f4ff; }
.slot.dragging { opacity: .6; transform: scale(.97); }
.slot-name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: clamp(.72rem, 1.9vmin, .88rem); }
.slot-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Unbounded', sans-serif; font-size: .92em; }
.slot-name .ic { font-style: normal; }
.slot-name .tag { margin-left: auto; flex: none; font: 700 11px/1.5 'Onest', sans-serif; color: var(--ink-2); border: 2px solid rgba(27, 27, 47, .25); border-radius: 8px; padding: 0 5px; }
.slot-name .tag.ok { background: #d8ffe6; color: #14633f; }
.slot-row { display: flex; gap: 5px; }
.slot .fac { flex: 1; min-width: 0; min-height: 36px; padding: 3px 5px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; cursor: pointer; font: 700 clamp(11px, 1.7vmin, 13px)/1.15 'Onest', sans-serif; text-wrap: balance; }
.slot .fac[data-f="aflitos"] { background: #e3f4ff; }
.slot .fac[data-f="sifao"] { background: #ffe9d1; }
.slot .fac[data-f="aleatoria"] { background: #f1ecff; }
.slot .fac:disabled { opacity: .55; }
.slot .mini { min-width: 38px; min-height: 36px; padding: 0 6px; border: 3px solid var(--edge); border-radius: 12px; background: #fff; cursor: pointer; font: 700 .75rem 'Onest', sans-serif; }
.slot .mini.kick { background: #ffd6de; }
@media (orientation: landscape) and (max-height: 500px) {
  .room-body { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .room-opts { grid-template-columns: 1fr 1fr; }
  .online-card { width: min(680px, 100%); }
  .friend-hint { display: none; }      /* ecrã deitado: o botão já diz tudo */
}

/* emotes e bancada */
#emoteBar { position: absolute; left: max(8px, var(--safe-l)); bottom: calc(var(--panel-h) + var(--safe-b) + 8px); display: flex; align-items: flex-end; gap: 8px; }
#emoteList { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; padding: 7px; background: var(--paper); border: 3px solid var(--edge); border-radius: 16px; box-shadow: 0 4px 0 var(--edge); }
.emote { width: 44px; height: 44px; border: 2px solid var(--edge); border-radius: 12px; background: #fff; font-size: 1.3rem; cursor: pointer; padding: 0; }
.emote:active { transform: translateY(2px); }
#specBar { position: absolute; top: calc(var(--top-h) + var(--safe-t) + 4px); left: max(8px, var(--safe-l)); padding: 3px 10px; background: var(--paper); border: 2px solid var(--edge); border-radius: 12px; font: 700 clamp(.66rem, 1.8vmin, .8rem) 'Onest', sans-serif; }


/* Linha do tutorial/missões: uma só linha, e o menu do título continua a caber num ecrã pequeno. */
#rowAprender { flex-wrap: nowrap; }
#rowAprender .btn { flex: 1; min-width: 0; min-height: 40px; padding: .4em .5em; }
@media (max-height: 700px) {
  .title-card .opt > span { font-size: 10px; }
  .title-card .segmented button, .title-card .factions button { min-height: 32px; }
  #rowAprender .btn { min-height: 36px; font-size: var(--fs-sm); }
}

/* ───────── tutorial: o Ministério a dar instruções ─────────
   Fica em cima, à esquerda, para deixar livre o painel de baixo (é lá que estão os botões
   que ele manda carregar). Os avisos descem o que for preciso (--tut-h, medido no cliente). */
#tutBox {
  position: absolute; z-index: 7;
  top: calc(var(--top-h) + var(--safe-t) + 5px); left: max(8px, var(--safe-l));
  width: min(360px, calc(100% - 16px));
  padding: 5px 8px 8px; display: flex; flex-direction: column; gap: 5px;
  background: var(--paper); border: 3px solid var(--edge); border-radius: 16px; box-shadow: 0 4px 0 var(--edge);
  animation: pop .25s;
}
.tut-top { display: flex; align-items: center; gap: 6px; cursor: pointer; min-width: 0; }
.tut-face { font-size: 1.25em; line-height: 1; animation: bob 2.4s ease-in-out infinite; flex: none; }
.tut-top b { font: 800 var(--fs-sm)/1.15 'Unbounded', sans-serif; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tut-count { margin-left: auto; flex: none; font: 700 var(--fs-3xs)/1.2 'Unbounded', sans-serif; color: var(--ink-2); }
.tut-fold { flex: none; width: 28px; height: 28px; padding: 0; border: 2px solid var(--edge); border-radius: 9px; background: #fff; cursor: pointer; font-size: .8rem; line-height: 1; }
.tut-body { display: flex; flex-direction: column; gap: 6px; }
#tutBox.dobrado .tut-body { display: none; }
#tutText { font-size: var(--fs-xs); line-height: 1.32; font-weight: 600; }
.tut-hint { font-size: var(--fs-2xs); line-height: 1.3; font-weight: 600; background: #fff4c2; border: 2px solid rgba(27, 27, 47, .18); border-radius: 10px; padding: 3px 7px; }
#tutSkip { align-self: flex-start; min-height: 32px; padding: 3px 9px; font-size: var(--fs-2xs); }
html.tut #toasts { top: calc(var(--top-h) + var(--safe-t) + var(--tut-h, 92px) + 12px); }
/* o botão que é preciso carregar a seguir pisca (no painel e no topo) */
.act.tut-pulse, .tb-btn.tut-pulse, .tool.tut-pulse { outline: 3px solid var(--gold); outline-offset: 2px; animation: tutPulse 1.15s ease-in-out infinite; }
@keyframes tutPulse { 50% { outline-color: #ff8c1a; transform: scale(1.06); } }

/* ───────── missões ───────── */
.missoes-card { width: min(680px, 100%); }
.missoes-scroll { flex: 1; min-height: 80px; overflow: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#missaoLista { display: flex; flex-direction: column; gap: 6px; }
.missao-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left;
  width: 100%; padding: 6px 10px; border: 3px solid var(--edge); border-radius: 14px; background: #fff;
  box-shadow: 0 3px 0 var(--edge); cursor: pointer; font-family: inherit; color: inherit;
}
.missao-item:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.missao-item.feita { background: #e3ffe9; }
.mi-ic { font-size: 1.5rem; line-height: 1; }
.mi-txt { min-width: 0; }
.mi-cab { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.mi-cab b { font: 800 var(--fs-sm)/1.2 'Unbounded', sans-serif; }
.mi-estrelas { font-size: var(--fs-3xs); letter-spacing: -.08em; }
.mi-desc { font-size: var(--fs-2xs); line-height: 1.28; color: var(--ink-2); font-weight: 600; }
.mi-go { font-size: 1.1rem; }
.small-note { font-size: var(--fs-2xs); }

/* ───────── ajuda rápida (duas linhas por assunto) ───────── */
.tips-card { width: min(720px, 100%); }
.tips-scroll { flex: 1; min-height: 80px; overflow: auto; touch-action: pan-y; text-align: left; }
#tipsBox { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 6px; }
.aj-item { display: flex; gap: 7px; align-items: flex-start; padding: 5px 8px; border: 2px solid rgba(27, 27, 47, .18); border-radius: 12px; background: #fff; }
.aj-ic { font-size: 1.25rem; line-height: 1.1; flex: none; }
.aj-txt { min-width: 0; font-size: var(--fs-2xs); line-height: 1.3; font-weight: 600; color: var(--ink-2); }
.aj-txt b { display: block; font: 800 var(--fs-xs)/1.2 'Unbounded', sans-serif; color: var(--ink); }
@media (orientation: landscape) and (max-height: 500px) { #tipsBox { grid-template-columns: 1fr 1fr; } }
