/* v8 · ritmo: falas que não param o jogo, botão rápido, barra de descarga, moedas, clarão e o final no mirante (js/ritmo.js) */
#ritmo { position:fixed; inset:0; pointer-events:none; z-index:24; font-family:Inter, system-ui, sans-serif; }
#rsay { position:absolute; left:50%; bottom:calc(max(18px, env(safe-area-inset-bottom)) + 96px); transform:translate(-50%, 14px); max-width:min(560px, 72vw);
  background:rgba(14,20,28,.86); color:#f6f1e7; border-radius:16px; padding:10px 16px 11px; box-shadow:0 10px 30px rgba(0,0,0,.35);
  opacity:0; transition:opacity .25s, transform .3s cubic-bezier(.2,1.3,.4,1); font-size:15px; line-height:1.38; }
#rsay.show { opacity:1; transform:translate(-50%, 0); }
#rsay b { display:block; font-size:11.5px; letter-spacing:.08em; text-transform:uppercase; color:#ffcf6b; margin-bottom:2px; }
#rsay.nowho b { display:none; }
#rsay.spark { background:linear-gradient(135deg, rgba(64,28,6,.92), rgba(28,14,4,.92)); border:1px solid rgba(255,170,70,.55); }
#rsay.spark b { color:#ffb347; }
/* v8 (toque, INT-2): a conduzir no ecrã tátil, a fala vai para a direita da coluna do OLHO e acaba antes do ⬆ (não pisa o OLHO nem o ▶) */
body.touch.driving #rsay { left:calc(min(300px, 40vw) + 24px); transform:translateY(14px); max-width:calc(100vw - min(300px, 40vw) - 140px); }
body.touch.driving #rsay.show { transform:none; }
/* v8 (toque, INT-2/T7): no tablet, com o aviso de agir à vista a fala sobe para cima dele (com o botão rápido à vista fica onde está,
   para não lhe cair em cima). No PC fica como estava. */
@media (min-height: 501px) { body.touch:has(#prompt.show):not(:has(#rquick.show)) #rsay { bottom:calc(24% + 58px); } }
#rask { position:absolute; left:50%; bottom:calc(max(18px, env(safe-area-inset-bottom)) + 92px); transform:translate(-50%, 14px); width:min(520px, 80vw);
  background:rgba(14,20,28,.9); color:#f6f1e7; border-radius:16px; padding:11px 14px 12px; opacity:0; transition:opacity .25s, transform .3s; pointer-events:none; }
#rask.show { opacity:1; transform:translate(-50%, 0); pointer-events:auto; }
#rask .q { font-size:15px; margin-bottom:8px; } #rask .q b { color:#ffcf6b; }
#rask .b { display:flex; gap:8px; flex-wrap:wrap; }
#rask button { flex:1 1 180px; min-height:44px; border:0; border-radius:12px; background:#f2e7cf; color:#1d2530; font:600 14px Inter, system-ui, sans-serif; padding:8px 10px; cursor:pointer; }
#rask button i { font-style:normal; display:inline-block; width:20px; height:20px; line-height:20px; border-radius:50%; background:#1d2530; color:#f2e7cf; font-size:11px; margin-right:6px; }
/* v8 (toque, T8 e RASK): no ecrã tátil a pergunta fica em cima, longe do polegar do joystick, da fala e das mensagens do OLHO;
   só os botões apanham o dedo e os números 1/2 (teclas) saem, como no diálogo */
body.touch #rask { top:32%; bottom:auto; }
body.touch #rask.show { pointer-events:none; }
body.touch #rask.show button { pointer-events:auto; }
body.touch #rask button i { display:none; }
#rquick { position:absolute; left:68%; top:56%; transform:translate(-50%, -50%) scale(.6); min-width:120px; min-height:64px; padding:10px 18px;
  border:0; border-radius:999px; background:#ffb020; color:#1d1405; font:800 18px Inter, system-ui, sans-serif; box-shadow:0 0 0 0 rgba(255,176,32,.7), 0 10px 26px rgba(0,0,0,.35);
  opacity:0; pointer-events:none; transition:opacity .15s, transform .25s cubic-bezier(.2,1.6,.4,1); overflow:hidden; cursor:pointer; }
#rquick.show { opacity:1; pointer-events:auto; transform:translate(-50%, -50%) scale(1); animation:rqpulse .6s ease-out infinite; }
#rquick::after { content:''; position:absolute; left:0; bottom:0; height:4px; width:100%; background:rgba(29,20,5,.45); transform-origin:left; }
#rquick.show::after { animation:rqtime var(--ms, 1700ms) linear forwards; }
#rquick kbd { display:inline-grid; place-items:center; min-width:28px; height:28px; padding:0 7px; margin-right:9px; border-radius:9px; background:#1d1405; color:#ffb020; font:900 15px Inter, system-ui, sans-serif; vertical-align:middle; }
@keyframes rqpulse { to { box-shadow:0 0 0 14px rgba(255,176,32,0), 0 10px 26px rgba(0,0,0,.35); } }
@keyframes rqtime { to { transform:scaleX(0); } }
/* v8 (prova): com o jogo parado (mapa, mochila, diálogo, telemóvel ao alto) o botão rápido e a pergunta escondem-se e a barra do tempo pára */
body.rhold #rquick, body.rhold #rask, body.rhold #rask button { opacity:0 !important; pointer-events:none !important; }
body.rhold #rquick.show, body.rhold #rquick.show::after { animation-play-state:paused; }
#rbar { position:absolute; left:50%; top:max(122px, calc(env(safe-area-inset-top) + 110px)); transform:translate(-50%, -8px); background:rgba(14,20,28,.88); color:#fff; border-radius:999px;
  padding:8px 16px 9px; font:700 14px Inter, system-ui, sans-serif; opacity:0; transition:opacity .2s, transform .2s; text-align:center; min-width:200px; }
#rbar.show { opacity:1; transform:translate(-50%, 0); }
#rbar i { display:block; height:5px; margin-top:6px; border-radius:3px; background:rgba(255,255,255,.18); overflow:hidden; }
#rbar s { display:block; height:100%; width:0; background:#7fd3ff; }
#rbar.nob i { display:none; }
#rflash { position:absolute; inset:0; background:#fff; opacity:0; }
#rflash.go { animation:rflash .22s ease-out; }
@keyframes rflash { 0% { opacity:var(--a, .5); } 100% { opacity:0; } }
.rcoin { position:fixed; left:-11px; top:-11px; z-index:26; width:22px; height:22px; border-radius:50%; background:radial-gradient(circle at 35% 30%, #fff3b0, #f4b400 55%, #b97800);
  color:#6b4200; font:800 12px/22px Inter, system-ui, sans-serif; text-align:center; font-style:normal; pointer-events:none; box-shadow:0 2px 6px rgba(0,0,0,.3); will-change:transform; }
/* final no mirante */
body.rcine-on #hud, body.rcine-on #runBtn, body.rcine-on #joy, body.rcine-on #drive, body.rcine-on #btnE, body.rcine-on #skipBtn, body.rcine-on #tip, body.rcine-on #toast { opacity:0 !important; pointer-events:none !important; }
#rcine { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; padding:0 16px calc(max(16px, env(safe-area-inset-bottom)) + 20px);
  opacity:0; transition:opacity .6s; background:linear-gradient(to top, rgba(8,10,16,.72), rgba(8,10,16,0) 52%); }
#rcine.show { opacity:1; pointer-events:auto; cursor:pointer; }
body:has(#dialog.show) #rsay, body:has(#card.show) #rsay, body:has(#coach.show) #rsay { opacity:0; }
#rcine .rows { display:flex; flex-direction:column; align-items:flex-start; gap:6px; width:fit-content; max-width:min(560px, 92vw); }
/* as linhas leem-se por cima das casas de cal: cada uma traz a sua faixa escura translúcida, de legenda, que entra com ela (sem desfoque) */
#rcine .r, #rcine .last { border-radius:999px; background:rgba(6,12,20,.6); box-shadow:0 0 18px 3px rgba(6,12,20,.32); }
#rcine .r { padding:3px 14px 3px 4px; }
#rcine .last { padding:4px 16px; }
#rcine .r { display:flex; gap:10px; align-items:baseline; color:#fff; font:600 15px/1.35 Inter, system-ui, sans-serif; opacity:0; transform:translateY(10px); transition:opacity .45s, transform .45s; text-shadow:0 1px 3px rgba(0,0,0,.6); }
#rcine .r.on { opacity:1; transform:none; }
#rcine .r span { flex:0 0 52px; font-size:11px; letter-spacing:.1em; text-transform:uppercase; text-align:center; border-radius:999px; padding:3px 0; }
#rcine .r.tu span { background:#ffcf6b; color:#2a1a00; }
#rcine .r.olho span { background:#7fd3ff; color:#06202e; }
#rcine .last { margin:12px 0 0; color:#7fd3ff; font:700 17px Fraunces, Georgia, serif; opacity:0; transition:opacity .8s; text-align:center; }
#rcine.end .last { opacity:1; }
#end .rsum { list-style:none; padding:0; margin:10px 0; }
#end .rsum li { display:flex; gap:10px; align-items:baseline; padding:5px 0; border-bottom:1px solid rgba(0,0,0,.08); }
#end .rsum li b { flex:0 0 52px; font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; text-align:center; border-radius:999px; padding:3px 0; }
#end .rsum li.tu b { background:#ffcf6b; color:#2a1a00; }
#end .rsum li.olho b { background:#7fd3ff; color:#06202e; }
/* sticky: no telemóvel a caixa do leilão rola e o botão ficava escondido por baixo; assim fica sempre à vista */
#auction .rapp { position:sticky; bottom:8px; z-index:2; width:fit-content; box-shadow:0 8px 22px rgba(0,0,0,.5); display:flex; flex-direction:column; align-items:center; gap:2px; margin:12px auto 0; min-height:48px; padding:9px 18px; border:2px solid #7fd3ff; border-radius:14px;
  background:#06202e; color:#e8f7ff; font:600 13px Inter, system-ui, sans-serif; cursor:pointer; opacity:0; transform:translateY(6px); transition:opacity .3s, transform .3s; pointer-events:none; }
#auction .rapp span { font:800 20px Inter, system-ui, sans-serif; color:#7fd3ff; }
#auction .rapp.on { opacity:1; transform:none; pointer-events:auto; }
#auction .rapp:disabled { opacity:.35; }
/* v8 (toque, B-5): o mesmo corte do index.html e do main.js (500 px); entre 481 e 500 px de altura ficava o leilão antigo */
@media (max-height: 500px) {
  #rsay { bottom:calc(max(10px, env(safe-area-inset-bottom)) + 76px); font-size:14px; padding:8px 13px 9px; max-width:min(520px, 60vw, calc(100vw - 2 * (max(14px, env(safe-area-inset-right)) + 152px))); } /* v8 (toque, INT-2): nos estreitos acaba antes da coluna do mapa */
  /* v8 (toque, INT-2/T7): com o aviso de agir à vista, a fala sobe para cima dele (não com a pergunta ou o botão rápido à vista) */
  body:has(#prompt.show):not(:has(#rask.show, #rquick.show)) #rsay { bottom:calc(24% + 46px); }
  #rask { bottom:calc(max(10px, env(safe-area-inset-bottom)) + 70px); width:min(480px, 64vw); }
  /* v8 (toque, RASK): em cima (ritmo.css, body.touch #rask), mais baixa e, nos telemóveis estreitos, puxada para a esquerda até não tocar na coluna do mapa */
  body.touch #rask { left:min(50%, calc(100% - max(14px, env(safe-area-inset-right)) - 152px - min(240px, 32vw))); padding:8px 12px 9px; }
  body.touch #rask .q { font-size:14px; margin-bottom:6px; }
  #rquick { top:54%; min-height:56px; font-size:16px; }
  #rbar { top:37%; } /* por baixo das dicas (à direita do objetivo) e logo acima da carrinha */
  #rcine .r { font-size:13.5px; } #rcine .rows { gap:4px; }
  #auction .rapp { margin-top:8px; min-height:42px; padding:6px 14px; } #auction .rapp span { font-size:17px; }
  /* leilão: o botão da aplicação fica por baixo do anel do preço, na coluna da esquerda; não tapa compradores e vê-se sem rolar */
  #auction .box { width:min(720px, 94vw); padding:10px 16px; display:grid; grid-template-columns:150px minmax(0, 1fr); column-gap:14px; align-items:start; }
  #auction .kick { grid-area:1 / 1 / 2 / 3; }
  #auction .lot { grid-area:2 / 1 / 3 / 3; font-size:13px; margin:2px 0; }
  #auction .how { grid-area:3 / 1 / 4 / 3; max-width:none; margin:4px 0 6px; }
  #auction .row { display:contents; }
  /* o preço com cêntimos («76,50 €», e 8 % maior quando vende) e «euros pela caixa» cabem dentro do anel, sem tocar no aro */
  /* v9: painel eletrónico (preço, frescura, martelo) na coluna da esquerda; compradores e lances na direita */
  #auction .clock { grid-area:4 / 1 / 5 / 2; justify-self:stretch; width:150px; min-height:0; height:auto; gap:5px; padding:7px 8px 8px; }
  #auction .price { font-size:23px; } #auction .unit { font-size:11px; } #auction .board .count { font-size:11px; min-height:1.2em; } #auction .hammer { padding:8px 6px; font-size:13px; min-height:40px; }
  #auction .side { grid-area:4 / 2 / 6 / 3; align-self:center; gap:5px; } #auction .buyers { gap:4px; } #auction .feed { min-height:0; font-size:11.5px; } #auction .feed .ln:nth-child(n+3) { display:none; }
  #auction .by { grid-template-columns:30px 1fr auto; padding:4px 8px; } #auction .by .av { width:30px; height:30px; font-size:12px; } #auction .by .bid { font-size:12.5px; }
  #auction .hint { grid-area:6 / 1 / 7 / 3; margin-top:2px; font-size:11px; }
  #auction .rapp { grid-area:5 / 1 / 6 / 2; position:relative; bottom:auto; width:100%; margin:6px 0 0; padding:6px 8px; gap:0; }
  #auction .who { grid-area:7 / 1 / 8 / 3; margin-top:2px; font-size:13px; } /* -4 px aqui pagam o anel 4 px maior */
}
