html, body { margin: 0; height: 100%; overflow: hidden; font-family: system-ui, sans-serif; }
#app { position: fixed; inset: 0; }

/* Coluna da esquerda: controlos e vista de planta empilhados — cabem sem
   scroll. A classificação é uma janela à parte (`#standings`, fora da rail):
   com 9 barcos a tabela estourava a coluna e era ela que criava o scroll. */
#rail {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 10;
  width: 300px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px; overflow-y: auto; overscroll-behavior: contain;
}
#rail > * { flex: 0 0 auto; }          /* a coluna faz scroll; os painéis não encolhem */
#rail::-webkit-scrollbar { width: 8px; }
#rail::-webkit-scrollbar-thumb { background: #37474f; border-radius: 4px; }

#toolbar {
  background: rgba(16, 20, 24, 0.82); color: #e8ecef;
  padding: 0 14px 12px; border-radius: 10px;
  display: flex; flex-direction: column; gap: 10px; font-size: 13px;
  backdrop-filter: blur(6px);
}
#toolbar .panel-subtitle { margin: 10px 0 0; font-size: 12px; letter-spacing: 0.3px; color: #e8ecef; }
#toolbar .panel-subtitle span { display: block; font-size: 11px; font-weight: 400; color: #9fb2bd; }
#toolbar > .panel-body { display: flex; flex-direction: column; gap: 10px; }
#toolbar fieldset { border: 1px solid #3a4650; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
#toolbar legend { font-size: 11px; color: #9fb2bd; padding: 0 4px; }
#toolbar label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#toolbar select { background: #232c33; color: #e8ecef; border: 1px solid #3a4650; border-radius: 6px; padding: 3px 6px; max-width: 170px; }
#toolbar input[type="range"] { width: 120px; }
#toolbar .hint { margin: 0; font-size: 11px; color: #8fa1ad; }

#info {
  position: fixed; right: 12px; top: 12px; z-index: 10;
  background: rgba(16, 20, 24, 0.88); color: #e8ecef;
  padding: 14px 16px; border-radius: 10px; width: 320px; max-height: 80vh; overflow-y: auto;
  font-size: 13px; display: none; backdrop-filter: blur(6px);
}
#info h2 { margin: 0 0 6px; font-size: 15px; }
#info p { margin: 0 0 10px; color: #b8c4cc; line-height: 1.45; }
#info table { width: 100%; border-collapse: collapse; }
#info td { padding: 3px 4px; border-top: 1px solid #2c363f; vertical-align: top; }
#info td:first-child { color: #9fb2bd; }
#info .src { margin-top: 10px; font-size: 11px; color: #7f919d; }

.dim-label {
  background: rgba(16, 20, 24, 0.85); color: #ffd54f;
  font-size: 11px; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}

#toolbar button {
  background: #2f6f4f; color: #fff; border: none; border-radius: 8px;
  padding: 7px 10px; font-size: 13px; cursor: pointer;
}
#toolbar button:hover { background: #3a8561; }
#toolbar .panel-actions button { width: 22px; height: 22px; padding: 0; border: 1px solid #3a4650; border-radius: 5px; background: #232c33; color: #cfd8dc; line-height: 18px; font-size: 16px; }
#toolbar .panel-actions button:hover { background: #3a4650; color: #fff; }

/* Chrome comum: todos os quadros têm uma barra arrastável, minimizar e fechar. */
.panel-window { overflow: hidden; }
.panel-bar {
  display: flex; align-items: center; gap: 8px; min-height: 30px;
  padding: 0 8px; color: #e8ecef; border-bottom: 1px solid #2c363f;
  user-select: none; cursor: grab;
}
.panel-bar:active, .panel-window.is-dragging .panel-bar { cursor: grabbing; }
.panel-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.panel-actions { display: flex; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.panel-actions button {
  width: 22px; height: 22px; padding: 0; border: 1px solid #3a4650; border-radius: 5px;
  background: #232c33; color: #cfd8dc; cursor: pointer; line-height: 18px; font-size: 16px;
}
.panel-actions button:hover { background: #3a4650; color: #fff; }
.panel-window.is-minimized > .panel-body { display: none !important; }
.panel-window.is-closed { display: none !important; }
.panel-help-popover {
  position: fixed; z-index: 100; max-width: 250px; padding: 8px 10px;
  border: 1px solid #3a4650; border-radius: 7px; background: #11181d;
  color: #dce5e9; box-shadow: 0 5px 18px rgba(0,0,0,.35); font-size: 11px; line-height: 1.35;
  pointer-events: none;
}
.param-help {
  width: 13px; height: 13px; padding: 0; margin-left: 3px; border: 1px solid #53636d;
  border-radius: 50%; background: transparent; color: #9fb2bd; font-size: 9px; line-height: 11px;
  cursor: help; vertical-align: 1px;
}
.param-help:hover { color: #fff; border-color: #cfd8dc; }

#hud {
  position: fixed; right: 12px; top: 12px; z-index: 20;
  background: rgba(16, 20, 24, 0.85); color: #e8ecef;
  padding: 0 10px 12px; border-radius: 10px; width: 230px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 5px; font-size: 13px;
  backdrop-filter: blur(6px);
}
#hud .hud-row { display: flex; justify-content: space-between; align-items: baseline; }
#hud > .panel-body { display: flex; flex-direction: column; gap: 5px; padding-top: 8px; }
#hud .hud-row span { color: #9fb2bd; }
#hud .hud-row.big span:first-child { font-size: 34px; font-weight: 700; color: #fff; }
#hud .hud-row.big small { color: #9fb2bd; }
#hud .hud-row.big2 b { font-size: 20px; color: #7ee787; }
#hud .hud-row.dim { opacity: 0.7; font-size: 11px; }

#windarrow {
  position: fixed; right: 270px; top: 18px; z-index: 20;
  font-size: 34px; color: #ffd54f;
  transition: transform 0.2s linear;
}

.hud-flash {
  position: fixed; top: 18%; left: 50%; transform: translateX(-50%);
  background: rgba(16, 20, 24, 0.9); color: #ffd54f; z-index: 30;
  font-size: 22px; font-weight: 600; padding: 14px 26px; border-radius: 12px;
}

/* ---- treino de largadas: painel de resultado ---- */
#startDebrief, #raceResults {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 30; background: rgba(16, 20, 24, 0.94); color: #e8ecef;
  padding: 18px 22px; border-radius: 10px; width: 400px; max-width: 92vw;
  font-size: 13px; backdrop-filter: blur(6px); border: 1px solid #3a4650;
  max-height: 86vh; overflow-y: auto;
}
#startDebrief h2, #raceResults h2 { margin: 0 0 6px; font-size: 16px; }
#startDebrief .grade, #raceResults .grade { font-size: 34px; font-weight: 700; color: #ffd54f; }
#startDebrief .grade span, #raceResults .grade span { font-size: 15px; color: #e8ecef; margin-left: 8px; font-weight: 400; }
#startDebrief table, #raceResults table { width: 100%; border-collapse: collapse; margin: 8px 0; }
#startDebrief td, #startDebrief th, #raceResults td, #raceResults th { text-align: left; padding: 3px 6px; border-top: 1px solid #2c363f; }
#startDebrief td:first-child, #raceResults td:first-child { color: #9fb2bd; }
#startDebrief .fleet .me td, #raceResults .fleet .me td { color: #7ee787; font-weight: 700; }
#startDebrief .fav, #raceResults .fav { color: #8fa1ad; font-size: 12px; margin: 6px 0; }
#startDebrief .btns, #raceResults .btns { display: flex; gap: 10px; margin-top: 10px; }
#startDebrief button, #raceResults button {
  flex: 1; padding: 8px; border: none; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: 13px;
}
#startDebrief #btnAgain, #raceResults #btnAgain { background: #2f6f4f; color: #fff; }
#startDebrief #btnQuit, #raceResults #btnQuit { background: #37474f; color: #cfd8dc; }

/* ---- nota informativa de contacto (RRV) ---- */
#contactNote {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 40; background: rgba(30, 24, 16, 0.95); color: #f3ead8;
  padding: 12px 18px; border-radius: 10px; max-width: 520px;
  font-size: 13px; line-height: 1.45; border: 1px solid #8a6d3b;
  backdrop-filter: blur(6px);
}
#contactNote b { color: #ffd54f; }
#contactNote .rule { color: #ffb74d; font-size: 12px; margin-left: 6px; }
#contactNote p { margin: 6px 0 0; }
#contactNote .pen { color: #d7c9a8; font-size: 12px; }

/* classificação ORC: coluna da classe e destaque do teu barco */
#raceResults { max-width: 560px; }
#raceResults .course { color: #8fa1ad; font-size: 12px; margin: 2px 0 8px; }
#raceResults .fleet .cls { color: #7d8f9b; font-size: 11px; margin-left: 8px; }
#raceResults .fleet td:nth-child(4) { color: #ffd54f; font-weight: 600; }
#raceResults #btnRaceAgain { background: #2f6f4f; color: #fff; }
#raceResults #btnRaceQuit { background: #37474f; color: #cfd8dc; }

/* ---- caixa recolhível: inspecção do modelo ---- */
#toolbar .fold { border: 1px solid #3a4650; border-radius: 8px; }
#toolbar .fold > summary {
  list-style: none; cursor: pointer; padding: 6px 8px;
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: #cfd8dc;
}
#toolbar .fold > summary::-webkit-details-marker { display: none; }
#toolbar .fold > summary .chev {
  display: inline-block; transition: transform 0.15s ease; color: #7ee787; font-weight: 700;
}
#toolbar .fold[open] > summary .chev { transform: rotate(90deg); }
#toolbar .fold > summary .sub { margin-left: auto; font-size: 10px; color: #7d8f9b; }
#toolbar .fold .body { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
#toolbar .fold .body > label { font-size: 12px; }

/* ---- janela da vista de planta (250×250), só durante a regata ---- */
#planta {
  display: none; overflow: hidden; border-radius: 10px;
  align-self: flex-start;              /* a janela é 250×250, não a largura da coluna */
  background: rgba(16, 20, 24, 0.82); border: 1px solid rgba(58, 70, 80, 0.6);
  backdrop-filter: blur(6px);
}
#planta.on { display: block; }
#planta .bar {
  display: flex; align-items: center; gap: 6px; padding: 4px 8px;
  font-size: 11px; color: #9fb2bd; border-bottom: 1px solid #2c363f;
}
#planta .plant-actions { position: absolute; top: 4px; right: 38px; z-index: 1; }
#planta .plant-actions button { background: #232c33; color: #cfd8dc; border: 1px solid #3a4650; border-radius: 6px; padding: 1px 7px; font-size: 12px; cursor: pointer; }
#planta .plant-actions button:hover { background: #2f3a42; color: #fff; }
#planta .panel-body { position: relative; }
#planta .bar b { color: #e8ecef; font-weight: 600; }
#planta .bar button {
  margin-left: auto; background: #232c33; color: #cfd8dc; border: 1px solid #3a4650;
  border-radius: 6px; padding: 1px 7px; font-size: 12px; cursor: pointer;
}
#planta .bar button:hover { background: #2f3a42; color: #fff; }
#plantaCv { display: block; width: 250px; height: 250px; cursor: pointer; }

/* ---- classificação em prova (tempo corrigido): terceira fold da toolbar.
   Sem chrome própria — quem a abre e fecha é a fold; a tabela é o conteúdo.
   Com as folds recolhidas a coluna cabe sem scroll (o objectivo original). */
#standings {
  display: none; width: 100%; box-sizing: border-box; font-size: 12px; color: #e8ecef;
}
#standings.on { display: block; }
#foldClassif .panel-bar { display: none; }             /* a fold é o cabeçalho */
#foldClassif #classifHint { margin: 0; }
#foldClassif:has(#standings.on) #classifHint { display: none; }
#standings.on { display: block; }
#standings .head { padding: 8px 10px 4px; }
#standings .head .rule { display: block; font-size: 10px; color: #8fa1ad; margin-top: 2px; }
#standings table { width: 100%; table-layout: fixed; border-collapse: collapse; }
#standings .c-pos { width: 8%; } #standings .c-boat { width: 38%; } #standings .c-water { width: 13%; }
#standings .c-time { width: 15%; } #standings .c-corr { width: 19%; } #standings .c-delta { width: 9%; } #standings .c-prog { width: 10%; }
#standings td, #standings th { padding: 1px 3px; text-align: left; border-top: 1px solid #232c33; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#standings th { font-size: 10px; color: #7d8f9b; font-weight: 400; }
#standings .me td { color: #7ee787; font-weight: 700; }
#standings .pos { color: #9fb2bd; width: 16px; }
#standings .corr { color: #ffd54f; }
#standings .cls { display: inline-block; max-width: calc(100% - 8px); color: #7d8f9b; font-size: 10px; margin-left: 3px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
#standings .prog { width: auto; }
#standings .prog i { display: block; height: 3px; background: #4d7ea8; border-radius: 2px; }
#standings .prog span { display: block; height: 3px; background: #2c363f; border-radius: 2px; }
#standings .foot { padding: 4px 10px 8px; font-size: 10px; color: #7d8f9b; margin: 0; }

/* ── Quadro de meteorologia ────────────────────────────────────────────────
   Tabela horária no formato do Windguru, mas com escalas sequenciais de
   luminosidade monótona sobre o fundo escuro: mais claro = mais intenso. O
   valor está sempre escrito na célula — a cor é redundante, nunca sozinha. */
#meteo {
  position: fixed; top: 46%; left: 50%; transform: translate(-50%, -50%);
  z-index: 32; background: rgba(16, 20, 24, 0.96); color: #e8ecef;
  border: 1px solid #3a4650; border-radius: 10px;
  width: 980px; max-width: 94vw; max-height: 88vh;
  font-size: 12px; backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
}
#meteo > .panel-body { padding: 10px 12px 12px; overflow: auto; }

#meteo .meteo-ctl { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#meteo .meteo-ctl label { display: flex; gap: 5px; align-items: center; color: #9fb2bd; }
#meteo select {
  background: #232c33; color: #e8ecef; border: 1px solid #3a4650;
  border-radius: 6px; padding: 3px 6px; font-size: 12px;
}
#meteo .m-refresh {
  background: #232c33; color: #cfd8dc; border: 1px solid #3a4650;
  border-radius: 6px; width: 26px; height: 24px; cursor: pointer; font-size: 13px;
}
#meteo .m-refresh:hover { background: #2f3a42; color: #fff; }

#meteo .meteo-status { margin: 7px 0 4px; color: #8fa1ad; font-size: 11px; }
#meteo .meteo-status.aviso { color: #e0a44c; }

#meteo .meteo-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
#meteo .meteo-scroll::-webkit-scrollbar { height: 8px; }
#meteo .meteo-scroll::-webkit-scrollbar-thumb { background: #37474f; border-radius: 4px; }

#meteo .meteo-tab { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
#meteo .meteo-tab th, #meteo .meteo-tab td {
  width: 34px; min-width: 34px; height: 20px; padding: 0;
  text-align: center; font-weight: 400; font-variant-numeric: tabular-nums;
  /* 2 px de folga entre células: separa marcas adjacentes sem linhas de grelha */
  border: 1px solid rgba(16, 20, 24, 0.96); border-width: 1px;
  color: #cfd8dc; cursor: pointer;
}
#meteo .meteo-tab tr > th:first-child {
  width: 122px; min-width: 122px; text-align: right; padding-right: 8px;
  color: #9fb2bd; cursor: default; position: sticky; left: 0;
  background: rgba(16, 20, 24, 0.96); z-index: 1;
}
#meteo .meteo-tab .h-dia th.dia {
  color: #e8ecef; font-weight: 600; border-bottom: 1px solid #3a4650;
  text-align: center; letter-spacing: 0.3px;
}
#meteo .meteo-tab .h-hora th { color: #8fa1ad; font-size: 11px; }
#meteo .meteo-tab .r-vento td { font-weight: 700; }
#meteo .meteo-tab .r-fina td { color: #9fb2bd; font-size: 11px; }
#meteo .meteo-tab td.dir { font-size: 14px; color: #cfd8dc; }
#meteo .meteo-tab td.dir .arw { display: inline-block; line-height: 1; }
#meteo .meteo-tab td.vazio { width: auto; color: #8fa1ad; padding: 12px; cursor: default; }
/* passagem do rato e hora escolhida: anel de 2 px, sem mexer no fundo */
#meteo .meteo-tab .hov { outline: 2px solid #5d7480; outline-offset: -2px; }
#meteo .meteo-tab .sel { outline: 2px solid #7ee787; outline-offset: -2px; }

#meteo .meteo-tide { overflow-x: auto; margin-top: 2px; }
#meteo .meteo-tide .tide-h { color: #9fb2bd; font-size: 11px; margin: 6px 0 2px; }
#meteo .tide-line { fill: none; stroke: #63bba4; stroke-width: 2; }
#meteo .tide-zero { stroke: #3a4650; stroke-width: 1; stroke-dasharray: 3 3; }
#meteo .tide-lbl { fill: #9fb2bd; font-size: 10px; text-anchor: middle; }

#meteo .meteo-legend { display: flex; align-items: center; gap: 0; margin-top: 10px; flex-wrap: wrap; }
#meteo .meteo-legend .lg-t { color: #9fb2bd; margin-right: 8px; }
#meteo .meteo-legend .lg-b {
  width: 30px; text-align: center; font-size: 11px; padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
#meteo .meteo-legend .lg-n { color: #7f919d; font-size: 11px; margin-left: 10px; }

#meteo .meteo-src { color: #7f919d; font-size: 11px; line-height: 1.5; margin: 10px 0 0; }
/* crédito obrigatório da licença CC BY 4.0 da Open-Meteo: sempre visível */
#meteo .meteo-credito { color: #7f919d; font-size: 11px; margin: 6px 0 0; }
#meteo .meteo-credito a { color: #9fd8ff; }

/* ── Race 1 oficial vs simulado: janela flutuante centrada (variante A do
   protótipo #17). Oficial em branco/âmbar, simulado em verde, Δ em laranja. ── */
#oficial {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 28; display: none; width: 620px; max-width: 94vw;
  max-height: 86vh; overflow-y: auto;
  background: rgba(16, 20, 24, 0.94); color: #e8ecef;
  border: 1px solid #3a4650; border-radius: 10px; font-size: 12px;
  backdrop-filter: blur(6px);
}
#oficial.on { display: block; }
#oficial > .panel-body { padding: 8px 14px 12px; }
#oficial .setup { color: #8fa1ad; font-size: 11px; margin: 4px 0 8px; }
#oficial table { width: 100%; border-collapse: collapse; }
#oficial th { font-size: 10px; color: #7d8f9b; font-weight: 400; }
#oficial td, #oficial th { padding: 2px 4px; text-align: left; border-top: 1px solid #232c33; white-space: nowrap; }
#oficial th.sim { color: #4d7ea8; }
#oficial .pos { color: #9fb2bd; }
#oficial .boat { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
#oficial .vela { color: #7d8f9b; font-size: 10px; margin-left: 5px; }
#oficial .corr { color: #ffd54f; }
#oficial td.sim { color: #7ee787; }
#oficial .delta { color: #e0a44c; }
#oficial .foot { color: #7f919d; font-size: 10px; line-height: 1.5; margin: 10px 0 0; }

#toolbar #btnOficial {
  background: #232c33; color: #cfd8dc; border: 1px solid #3a4650;
  border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 400;
}
#toolbar #btnOficial:hover { background: #2f3a42; color: #fff; }
#meteo .meteo-src b { color: #9fb2bd; }

#toolbar #fsMeteo { gap: 6px; }
#toolbar #fsMeteo button {
  background: #232c33; color: #cfd8dc; border: 1px solid #3a4650;
  border-radius: 6px; padding: 5px 8px; font-size: 12px; font-weight: 400;
}
#toolbar #fsMeteo button:hover { background: #2f3a42; color: #fff; }
#toolbar #fsMeteo label { justify-content: flex-start; gap: 6px; }
#toolbar #meteoNote { margin: 2px 0 0; }

/* ── Introdução (#intro, js/ui/intro.js) ───────────────────────────────────
   Cartaz à esquerda, coluna à direita; no telemóvel, um por baixo do outro.
   Cores tiradas do cartaz: azul-noite, creme do título, coral do «Príncipe».
   Está por cima de tudo (z-index 1000) e faz o seu próprio scroll: o body
   tem overflow hidden por causa do canvas. */
#intro {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; gap: 40px;
  padding: 24px; box-sizing: border-box; overflow-y: auto;
  background: radial-gradient(ellipse at 30% 20%, #1c3a66 0%, #0b1628 70%);
  color: #f2e6c9;
  transition: opacity 0.45s ease;
}
#intro[hidden] { display: none; }
#intro.intro-saindo { opacity: 0; pointer-events: none; }
.intro-poster {
  flex: 0 0 auto; display: block;
  height: auto; width: auto; max-height: calc(100vh - 48px); max-width: 52vw;
  border-radius: 6px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.intro-side { flex: 0 1 400px; display: flex; flex-direction: column; gap: 14px; }
.intro-side h1 { margin: 0; font-size: 30px; line-height: 1.15; color: #f2dfae; }
.intro-side h2 { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #e8c36a; }
.intro-lede { margin: 0; font-size: 15px; line-height: 1.55; color: #dfe6ee; }
.intro-keys { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #dfe6ee; }
.intro-keys kbd {
  display: inline-block; min-width: 1.4em; padding: 1px 6px; text-align: center;
  font: 600 12px/1.6 system-ui, sans-serif; color: #0b1628; background: #f2dfae;
  border-radius: 4px; box-shadow: 0 2px 0 #b89c5c;
}
.intro-touch { display: none; margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 14px; background: rgba(232, 195, 106, 0.14); color: #f2dfae; }
@media (pointer: coarse) { .intro-touch { display: block; } }
#btnEntrar {
  align-self: flex-start; margin-top: 4px; padding: 14px 34px;
  font: 700 17px system-ui, sans-serif; color: #fff; background: #d9503f;
  border: 0; border-radius: 8px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(217, 80, 63, 0.35);
}
#btnEntrar:hover:not(:disabled) { background: #e8604e; }
#btnEntrar:focus-visible { outline: 3px solid #f2dfae; outline-offset: 3px; }
#btnEntrar:disabled { background: #4a5663; color: #c3ccd5; cursor: progress; box-shadow: none; }
.intro-erro { margin: 0; font-size: 14px; color: #ffb4a6; }
.intro-nota { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: #9fb2c6; }

@media (max-width: 760px) {
  #intro { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 20px; padding: 16px; }
  .intro-poster { max-width: 100%; max-height: none; width: 100%; }
  .intro-side { flex: 0 0 auto; }
  .intro-side h1 { font-size: 24px; }
  #btnEntrar { align-self: stretch; }
}
@media (prefers-reduced-motion: reduce) { #intro { transition: none; } }

.hud-aids { cursor: pointer; }
.hud-aids input { vertical-align: -2px; margin: 0 4px 0 0; }

/* ── botão de regata + "Gráficos leves" (js/main.js) ───────────────────── */
.race-start { display: flex; align-items: center; gap: 10px; }
.race-start #btnRace { flex: 1; }
.race-light { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #cfd8dc; white-space: nowrap; cursor: pointer; }
.race-light input { margin: 0; }

/* ── controlos de toque (js/ui/touch.js) ───────────────────────────────── */
.tq { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.tq[hidden] { display: none; }
.tq * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tq-botoes { position: fixed; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; }
.tq-botoes button {
  min-width: 42px; height: 42px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(16, 20, 24, 0.72); color: #fff; font: 700 15px system-ui, sans-serif;
}
.tq-botoes button.ligado { background: rgba(46, 125, 80, 0.85); }
.tq-roda {
  position: fixed; left: 50%; bottom: 18px; width: 150px; height: 150px; margin-left: -75px; border-radius: 50%;
  border: 10px solid rgba(40, 44, 48, 0.85); background: rgba(16, 20, 24, 0.3); pointer-events: auto; touch-action: none;
}
.tq-roda::before {
  content: ''; position: absolute; left: 50%; top: 3px; width: 8px; height: 34px; margin-left: -4px;
  background: #ffd54f; border-radius: 4px;
}
.tq-escota {
  position: fixed; right: 12px; bottom: 18px; width: 46px; height: 34%; border-radius: 23px;
  background: rgba(16, 20, 24, 0.6); border: 1px solid rgba(255, 255, 255, 0.25); pointer-events: auto; touch-action: none;
}
.tq-escota[hidden] { display: none; }
.tq-escota i { position: absolute; left: 4px; right: 4px; bottom: 4px; border-radius: 19px; background: rgba(79, 195, 247, 0.8); }
.tq-dica {
  position: fixed; left: 50%; bottom: 180px; transform: translateX(-50%); padding: 4px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font: 12px system-ui, sans-serif; white-space: nowrap;
  animation: tq-some 1s 8s forwards;
}
@keyframes tq-some { to { opacity: 0; } }
/* ☰: esconde os painéis de desktop para se ver o barco num ecrã pequeno */
body.tq-sem-paineis #rail, body.tq-sem-paineis #hud, body.tq-sem-paineis #planta,
body.tq-sem-paineis #windarrow { visibility: hidden !important; }

/* fantasma de outra versão do núcleo (race/ghosts.js, especificação da app §8) */
.nc { display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 6px; background: #5a4a1e; color: #ffd54f; font-size: 10px; vertical-align: middle; }
.ghost-io { display: flex; gap: 6px; margin: 2px 0 6px; }
.ghost-io button { flex: 1; font-size: 12px; padding: 4px 6px; }
