/* telas.css — diálogos do menu (como jogar, opções, recordes), pausa e fim de corrida
   (pódio animado, números, tabela, Copa). Todos são cartões de vidro (.card) dentro de
   uma .overlay com role="dialog"; o foco fica preso neles (js/ui/dialogs.js). */

/* ------------------------------------------------------------ diálogos */
.sheet { z-index: 30; }
.dialog {
  width: min(720px, 100%); max-height: 100%;
  padding: 0; display: flex; flex-direction: column; text-align: left;
}
.dialog-narrow { width: min(480px, 100%); }
.dialog-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 18px 14px 28px; border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.dialog-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 18px 28px 22px; -webkit-overflow-scrolling: touch; }
.dialog-body h3 { margin: 20px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.dialog-body h3:first-child { margin-top: 0; }
.dialog-body .fine { margin-top: 18px; text-align: center; }
.dialog-lead { color: var(--text-2); font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.dialog-foot { display: flex; justify-content: center; margin-top: 14px; }

.tabs { margin-bottom: 14px; }

/* teclas e gestos */
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.keys li {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 12px;
  padding: 10px 14px; border-radius: var(--r-ctl); background: var(--tile); border: 1px solid var(--line);
}
.keys li > span { grid-row: span 2; display: flex; align-items: center; min-width: 78px; }
.keys li > b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; align-self: end; }
.keys li > b:last-child { grid-row: span 2; align-self: center; }
.keys li > small { grid-column: 2; color: var(--text-2); font-size: 12.5px; line-height: 1.35; align-self: start; }
.keys li.wide { grid-column: 1 / -1; display: block; background: none; border: 0; padding: 4px 4px 0; }
.keys li.wide small { font-size: 13px; line-height: 1.7; }
.key-ic { gap: 2px; color: var(--blue-text); }
.key-ic .ic { width: 24px; height: 24px; }
.key-ic .q { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--blue); color: var(--on-blue); font-size: 17px; font-weight: 800; }

/* o que há na pista e os itens: ícone + nome + explicação */
.things { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.things li {
  display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 0 12px;
  padding: 9px 14px 9px 10px; border-radius: var(--r-ctl); background: var(--tile); border: 1px solid var(--line);
}
.things canvas, .things .thing-ic { grid-row: span 2; width: 48px; height: 48px; }
.things .thing-ic { display: grid; place-items: center; border-radius: 14px; background: var(--blue-soft); color: var(--blue-text); }
.things .thing-ic .ic { width: 26px; height: 26px; }
.things b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; align-self: end; }
.things small { color: var(--text-2); font-size: 12.5px; line-height: 1.35; align-self: start; }

/* lista de opções */
.options-list { display: grid; gap: 8px; }
.option-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 52px; padding: 8px 8px 8px 14px; border-radius: var(--r-ctl); background: var(--tile); border: 1px solid var(--line);
}
.option-row .switch-text { flex: 1 1 150px; }
.seg-small { flex: 1 1 210px; }
.seg-small .option.seg-option { min-height: 44px; padding: 4px 10px; }
.seg-small .option.seg-option b { font-size: 13px; }

/* controle de volume */
.slider {
  display: grid; grid-template-columns: 74px 1fr 38px; align-items: center; gap: 10px;
  min-height: 52px; padding: 4px 14px; border-radius: var(--r-ctl); background: var(--tile); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
}
.slider output { text-align: right; color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.slider input {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y;
  --fill: 50%;
}
.slider input::-webkit-slider-runnable-track { height: 6px; border-radius: 980px; background: linear-gradient(to right, var(--blue) var(--fill), var(--track) var(--fill)); }
.slider input::-moz-range-track { height: 6px; border-radius: 980px; background: linear-gradient(to right, var(--blue) var(--fill), var(--track) var(--fill)); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.08); }
.slider input::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.slider input:focus-visible { outline: 3px solid var(--blue); outline-offset: 0; border-radius: 12px; }
.slider.off { opacity: 0.5; }

/* recordes */
.records { display: grid; gap: 10px; }
.rec-card { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; padding: 10px 16px 10px 10px; border-radius: var(--r-tile); background: var(--tile); border: 1px solid var(--line); }
.rec-card canvas { width: 132px; aspect-ratio: 16 / 10; border-radius: 13px; display: block; }
.rec-card h4 { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.rec-card dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; }
.rec-card dt { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2); }
.rec-card dd { margin: 0; font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.rec-card dd small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.rec-card dd.none { color: var(--text-3); font-weight: 500; }
.rec-cup { grid-template-columns: 1fr; padding: 12px 16px; }
.rec-empty { padding: 26px 12px; text-align: center; color: var(--text-2); font-size: 15px; line-height: 1.5; }

/* ------------------------------------------------------------ pausa */
.card-pause { width: min(440px, 100%); max-height: 100%; overflow-y: auto; touch-action: pan-y; padding: 28px 24px 20px; }
.card-pause > p { margin-bottom: 18px; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pause-actions .btn-soft { padding: 10px 8px; font-size: 14.5px; }
.pause-actions .btn-soft .ic { width: 17px; height: 17px; }
.pause-actions #btnEnd, .pause-actions .btn-full { grid-column: 1 / -1; }
.pause-actions .btn-full[aria-checked="true"] { background: var(--blue); color: var(--on-blue); }
.pause-options { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; text-align: left; }

/* ------------------------------------------------------------ fim de corrida */
#finish { z-index: 22; background: rgba(11, 13, 18, 0.42); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#finish > .card-result { z-index: 1; }      /* o confete passa ATRÁS do cartão: nunca sobre o texto dos botões */
.card-result {
  position: relative; width: min(940px, 100%); max-height: 100%;
  padding: 24px 28px 22px; display: flex; flex-direction: column; gap: 16px;
}
.result-head { flex: none; text-align: center; }
.result-head h2 { font-size: clamp(30px, 4.2vw, 42px); font-weight: 800; letter-spacing: -0.035em; margin: 4px 0 6px; }
.result-head p { color: var(--text-2); font-size: 15px; line-height: 1.45; }
.result-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 0.82fr) minmax(0, 1fr); gap: 24px; align-items: stretch; }
.result-body.solo { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr); align-items: center; }
.result-side { min-width: 0; display: flex; flex-direction: column; gap: 10px; }

/* pódio: degraus 2-1-3, cada piloto com o seu kart */
.podium {
  position: relative; min-height: 250px;
  display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: 6px;
  padding: 0 6px; border-radius: var(--r-tile) var(--r-tile) 0 0;
  background: radial-gradient(90% 70% at 50% 100%, var(--blue-soft), transparent 70%);
  border-bottom: 2px solid var(--line);
}
.pod { position: relative; display: grid; justify-items: center; text-align: center; min-width: 0; }
.pod canvas {
  width: 84%; max-width: 142px; aspect-ratio: 528 / 592; margin-bottom: 2px;
  filter: drop-shadow(0 8px 8px rgba(8, 20, 40, 0.25));
  animation: pod-drop 0.65s var(--pop) both; animation-delay: calc(var(--d) + 0.25s);
}
.pod-1 canvas { width: 98%; max-width: 168px; }
/* kart 3D (ui/kartPreview.js): o quadro dele tem folga em volta (para o balanço e a sombra), então
   é ampliado a partir da base — a caixa do leiaute é a mesma do sprite, e a folga de cima absorve o resto */
.pod canvas[data-art="3d"] { transform-origin: 50% 100%; scale: 1.22; filter: none; }
/* …e o selo sobe um pouco: o 1º lugar comemora com pulinhos e não pode encostar nele */
@media (min-width: 761px) and (min-height: 521px), (min-width: 761px) and (orientation: portrait) { .pod:has(canvas[data-art="3d"]) .medal { translate: 0 -12px; } }
/* (telas compactas: não há folga acima do selo — lá o 1º lugar comemora sem pulinho: result.js) */
.pod b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; }
.pod small { color: var(--text-2); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pod .step {
  order: 3; width: 100%; margin-top: 6px; height: var(--h); border-radius: 14px 14px 0 0;
  display: grid; place-items: start center; padding-top: 6px;
  background: linear-gradient(var(--tile-hov), var(--tile)); border: 1px solid var(--line); border-bottom: 0;
  font-size: 26px; font-weight: 800; font-style: italic; color: var(--text-3);
  transform-origin: 50% 100%; animation: pod-rise 0.5s var(--ease) both; animation-delay: var(--d);
}
.pod-1 { --h: 96px; --d: 0.5s; }
.pod-2 { --h: 66px; --d: 0.25s; }
.pod-3 { --h: 46px; --d: 0s; }
.pod-1 .step { color: #7a5600; background: linear-gradient(#fff3c4, #ffe08a); border-color: rgba(184, 132, 0, 0.3); }
.pod-2 .step { color: #56606c; background: linear-gradient(#f4f6f9, #dde3ea); }
.pod-3 .step { color: #7d4a22; background: linear-gradient(#fbeadb, #f1d2b8); border-color: rgba(168, 105, 58, 0.25); }
html.night .pod-2 .step { color: #cfd6df; background: linear-gradient(rgba(207, 214, 223, 0.26), rgba(207, 214, 223, 0.1)); }
html.night .pod-3 .step { color: #f2b27a; background: linear-gradient(rgba(242, 178, 122, 0.26), rgba(242, 178, 122, 0.1)); }
html.night .pod-1 .step { color: #FACC15; background: linear-gradient(rgba(250, 204, 21, 0.32), rgba(250, 204, 21, 0.14)); }
.pod.me b { color: var(--blue-text); }
.pod.me b::after { content: ' · você'; font-weight: 600; }
.podium.solo { grid-template-columns: 1fr; justify-items: center; }
.podium.solo .pod { width: min(220px, 70%); --h: 54px; --d: 0s; }
.podium.solo .pod canvas { width: 100%; max-width: 190px; }
.podium.solo .pod.me b::after { content: none; }
.pod .medal {
  margin-bottom: 4px; padding: 3px 11px; border-radius: 980px; background: var(--gold); color: #3d2a00;
  font-size: 11.5px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
  animation: pod-drop 0.6s var(--pop) both; animation-delay: 1.1s;
}
@keyframes pod-rise { from { transform: scaleY(0); } }
@keyframes pod-drop { 0% { opacity: 0; transform: translateY(-46px) scale(0.86); } 100% { opacity: 1; transform: none; } }

/* números da corrida */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 8px; }
.stats li { position: relative; padding: 8px 12px 9px; border-radius: var(--r-ctl); background: var(--tile); border: 1px solid var(--line); min-width: 0; }
.stats small { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.stats b { display: block; margin-top: 1px; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats li.record { border-color: rgba(245, 182, 35, 0.9); box-shadow: 0 0 0 3px rgba(245, 182, 35, 0.22); animation: record-pop 0.6s var(--pop) both 0.9s; }
.stats li.record::after {
  content: 'Recorde!'; position: absolute; top: -9px; right: 8px;
  padding: 2px 8px; border-radius: 980px; background: var(--gold); color: #3d2a00;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em;
}
/* estreia no circuito: é o primeiro tempo, não um recorde batido */
.stats li.record.first { border-color: var(--blue-ring); box-shadow: 0 0 0 3px var(--blue-soft); }
.stats li.record.first::after { content: 'Estreia'; background: var(--blue); color: var(--on-blue); }
@keyframes record-pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } }

/* botões recém-nascidos sob os dedos de quem dirige ficam inertes por um instante (ui/guard.js) */
.guarded { opacity: 0.55; }
.result-foot, .card-pause { transition: opacity 0.25s ease; }

/* etapas da Copa */
.steps { display: flex; gap: 6px; }
.steps li { flex: 1; min-width: 0; text-align: center; padding: 6px 10px; border-radius: 12px; background: var(--track); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps li b { margin-right: 5px; font-weight: 800; }
.steps li.done { background: var(--blue-soft); color: var(--blue-text); }
.steps li.now { background: var(--blue-text); color: var(--on-blue); }

/* tabela */
.results { text-align: left; font-size: 14px; font-variant-numeric: tabular-nums; }
.results li {
  display: grid; grid-template-columns: 22px 10px minmax(0, 1fr) 84px 60px 36px; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 11px;
}
.results.with-cup li { grid-template-columns: 22px 10px minmax(0, 1fr) 84px 60px 36px 42px; }
.results.final li { grid-template-columns: 22px 10px minmax(0, 1fr) 76px; padding: 8px 12px; }
.results li:nth-child(even) { background: var(--track); }
.results li.me { background: var(--blue-soft); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--blue-ring); }
.results li.head { padding-top: 0; padding-bottom: 4px; background: none; color: var(--text-2); font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; }
.results li:not(.head) { animation: row-in 0.4s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 0.2s); }
.results.live li:not(.head) { animation: none; }
@keyframes row-in { from { opacity: 0; transform: translateX(14px); } }
.results .pos { font-weight: 800; text-align: center; font-style: italic; }
.results .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9); }
.results .head .dot { box-shadow: none; }
.results .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .time, .results .best, .results .pts { text-align: right; white-space: nowrap; }
.results .best { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.results .best.top { color: var(--good); font-weight: 700; }
.results .pts { color: var(--blue-text); font-weight: 700; }
.results .pts.total { color: var(--text); }
.results .head .pts, .results .head .pts.total { color: var(--text-2); }
.results .time.est { color: var(--text-2); font-style: italic; font-weight: 500; }
.results li.running .who::after { content: ' · na pista'; color: var(--text-2); font-weight: 500; font-size: 12px; }
.result-note { color: var(--blue-text); font-weight: 600; font-size: 13.5px; line-height: 1.45; text-align: center; }

.result-foot { flex: none; display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 10px; }
.result-foot .btn-primary { min-height: 52px; white-space: normal; text-align: center; line-height: 1.2; padding: 10px 22px; }
.result-foot .btn-soft { min-height: 52px; padding: 10px 14px; }

/* ------------------------------------------------------------ formatos */
/* Toque (celular em pé, tablet estreito): tudo em uma coluna. O cartão nunca passa da tela:
   cabeçalho e rodapé ficam fixos e só o MIOLO rola (bloco comum — nada de grade que encolhe).
   "Voltar ao site" sai da zona dos polegares e vira um botão redondo no canto de cima. */
@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  .card-result #btnFinishSite {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  }
  .card-result #btnFinishSite span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .result-foot { grid-template-columns: 1.5fr 1fr; gap: 8px; }
}

@media (max-width: 760px) {
  .dialog-head { padding: 14px 12px 12px 20px; }
  .dialog-head h2 { font-size: 22px; }
  .dialog-body { padding: 14px 16px 18px; }
  .keys, .things { grid-template-columns: 1fr; }
  .rec-card { grid-template-columns: 96px 1fr; gap: 12px; padding: 8px 12px 8px 8px; }
  .rec-card canvas { width: 96px; }
  .rec-card dl { gap: 2px 8px; }
  .rec-card dd { font-size: 14px; }
  .rec-card dt { font-size: 9.5px; letter-spacing: 0.04em; }

  #finish { padding: calc(10px + var(--safe-t)) calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); }
  .card-result { padding: 16px 14px 14px; gap: 10px; border-radius: 24px; }
  .result-head { padding: 0 46px; }
  .result-head h2 { font-size: 28px; margin: 2px 0 4px; }
  .result-head p { font-size: 13px; }
  .result-body, .result-body.solo {
    display: block; flex: 1 1 auto; min-height: 0;
    overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
    /* se o miolo rolar, o fim dele esmaece (fica claro que há mais) em vez de cortar o texto seco */
    padding-bottom: 12px; margin-bottom: -4px;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 14px), transparent); mask-image: linear-gradient(#000 calc(100% - 14px), transparent);
  }
  .result-side { gap: 8px; }
  .podium { min-height: 0; padding: 0 12px; margin-bottom: 14px; }
  .pod canvas { width: 62%; max-width: 86px; }
  .pod-1 canvas { width: 74%; max-width: 104px; }
  .pod-1 { --h: 56px; } .pod-2 { --h: 40px; } .pod-3 { --h: 28px; }
  .pod .step { font-size: 20px; padding-top: 3px; }
  .pod b { font-size: 12.5px; } .pod small { font-size: 11px; }
  .podium.solo .pod { --h: 34px; width: 150px; }
  .stats { padding-top: 9px; }                     /* espaço do selo "Recorde!" */
  .stats li.record { padding-top: 13px; }          /* …e o selo não cobre o rótulo em chips estreitos */
  .stats li.record::after { right: 50%; transform: translateX(50%); white-space: nowrap; }
  .stats b { font-size: 16px; }
  .stats li { padding: 6px 9px 7px; }
  .stats small { font-size: 9.5px; letter-spacing: 0.05em; }
  .steps li { padding: 5px 8px; font-size: 11px; }
  .results { font-size: 13px; }
  .results li, .results.with-cup li { grid-template-columns: 18px 9px minmax(0, 1fr) 76px 30px; gap: 6px; padding: 5px 8px; }
  .results.with-cup li { grid-template-columns: 18px 9px minmax(0, 1fr) 76px 30px 34px; }
  .results .best { display: none; }
  .results li.running .who::after { content: ''; }
  .result-note { font-size: 12.5px; }
  .result-foot .btn-primary { min-height: 50px; padding: 8px 14px; font-size: 16px; }
  .result-foot .btn-soft { min-height: 50px; font-size: 14px; padding: 8px 8px; }

  .card-pause { padding: 22px 18px 16px; }
}
/* estreito (320–360 px): aperta as colunas da tabela */
@media (max-width: 370px) {
  .results li, .results.with-cup li { grid-template-columns: 16px 8px minmax(0, 1fr) 70px 28px; gap: 5px; padding: 5px 6px; }
  .results.with-cup li { grid-template-columns: 16px 8px minmax(0, 1fr) 68px 26px 28px; }
  .result-head h2 { font-size: 25px; }
  .stats li { padding: 5px 7px 6px; }
  .stats b { font-size: 15px; }
  .result-foot #btnFinishMenu .ic { display: none; }
  .steps li b { margin-right: 3px; }
}
/* celular em pé com pouca altura (até ~760 px úteis: iPhone com as barras do Safari): pódio compacto */
@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  .card-result { padding-top: 12px; gap: 8px; }
  .result-head h2 { font-size: 24px; margin: 0 0 2px; }
  .result-head p { display: none; }
  .podium { padding: 0 20px; margin-bottom: 10px; }
  .pod canvas { max-width: 60px; margin-bottom: 0; }
  .pod-1 canvas { max-width: 72px; }
  .pod-1 { --h: 34px; } .pod-2 { --h: 24px; } .pod-3 { --h: 16px; }
  .pod .step { font-size: 14px; padding-top: 0; margin-top: 3px; border-radius: 9px 9px 0 0; }
  .pod b { font-size: 11.5px; } .pod small { font-size: 10.5px; }
  .podium .medal { font-size: 10px; padding: 1px 8px; }
  .podium.solo .pod { --h: 20px; width: 120px; }
  .results li, .results.with-cup li { padding-top: 4px; padding-bottom: 4px; }
  /* na Copa há a linha das etapas: os números da corrida cedem o lugar (os recordes continuam na nota) */
  .result-side:has(.steps:not([hidden])) .stats { display: none; }
}
/* muito baixo (até ~600 px: 375×553, 320×568): o pódio sai e a tabela ocupa o lugar dele */
@media (max-width: 760px) and (max-height: 600px) and (orientation: portrait) {
  .podium { display: none; }
  .result-head .eyebrow { font-size: 10.5px; }
}

/* ---- pausa no celular em pé ---- */
@media (max-width: 760px) and (max-height: 760px) and (orientation: portrait) {
  .card-pause { padding: 16px 16px 14px; }
  .card-pause > .eyebrow { display: none; }
  .card-pause > h2 { font-size: 24px; margin: 0 0 4px; }
  .card-pause > p { font-size: 13.5px; margin-bottom: 12px; }
  .card-pause > .btn-primary { min-height: 50px; }
  .pause-actions { margin-top: 8px; }
  .pause-options { margin-top: 12px; padding-top: 12px; gap: 6px; }
  .pause-options .options-list { gap: 6px; }
  .pause-options .switch, .pause-options .slider { min-height: 46px; }
  .pause-options .switches-compact { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pause-options .switches-compact .switch { padding: 6px 8px; gap: 7px; }
  .pause-options .switches-compact .switch-text b { font-size: 12px; }
  .pause-options .switch-text small { display: none; }
}
@media (max-width: 760px) and (max-height: 600px) and (orientation: portrait) {
  .card-pause { padding: 12px 14px 12px; }
  .card-pause > p { display: none; }
  .card-pause > h2 { font-size: 21px; margin-bottom: 8px; }
  .pause-actions { gap: 6px; margin-top: 6px; }
  .pause-actions .btn-soft { min-height: 44px; }
  .pause-options { margin-top: 8px; padding-top: 8px; }
  .pause-options .switch, .pause-options .slider { min-height: 44px; }
  .slider input { height: 40px; }
}

/* bem estreito (320 px): na pausa as ajudas ficam uma embaixo da outra */
@media (max-width: 340px) {
  .pause-options .switches-compact { grid-template-columns: 1fr; }
  .card-pause { padding-left: 12px; padding-right: 12px; }
  .pause-actions .btn-soft { font-size: 13.5px; }
}

/* ---- paisagem baixa (celular deitado) ---- */
@media (max-height: 520px) and (orientation: landscape) {
  .overlay { padding: calc(8px + var(--safe-t)) calc(12px + var(--safe-r)) calc(8px + var(--safe-b)) calc(12px + var(--safe-l)); }
  .dialog-head { padding: 8px 10px 8px 20px; }
  .dialog-head h2 { font-size: 20px; }
  .dialog-body { padding: 12px 18px 14px; }
  .keys, .things { grid-template-columns: 1fr 1fr; }
  .card-result { width: min(820px, 100%); padding: 8px 14px 10px; gap: 6px; border-radius: 22px; }
  .result-head { display: flex; align-items: center; justify-content: center; gap: 2px 12px; flex-wrap: wrap; padding: 0 52px; min-height: 44px; }
  .card-result #btnFinishSite { top: 8px; right: 8px; }
  .result-head .eyebrow { font-size: 10.5px; }
  .result-head h2 { font-size: 21px; margin: 0; }
  .result-head p { display: none; }
  .result-body, .result-body.solo { display: grid; grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr); gap: 14px; align-items: end; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
  .result-side { gap: 6px; align-self: start; }
  .podium { min-height: 0; padding: 0 4px; margin: 0; align-self: end; }
  .pod canvas { width: 70%; max-width: 54px; margin-bottom: 0; }
  .pod-1 canvas { width: 82%; max-width: 64px; }
  .pod-1 { --h: 36px; } .pod-2 { --h: 25px; } .pod-3 { --h: 16px; }
  .pod .step { font-size: 14px; padding-top: 0; margin-top: 3px; border-radius: 9px 9px 0 0; }
  .pod b { font-size: 11px; } .pod small { font-size: 10px; }
  .podium .medal { font-size: 10px; padding: 1px 8px; }
  .podium.solo .pod { --h: 22px; width: 110px; }
  .podium.solo .pod canvas { max-width: 84px; }
  .stats { display: none; }
  /* sozinho (contra o relógio, treino) não há tabela: os números ocupam a coluna da direita */
  .result-body.solo { align-items: center; }
  .result-body.solo .result-side { align-self: center; gap: 10px; }
  .result-body.solo .stats { display: grid; padding-top: 9px; }
  .result-body.solo .result-note { display: block; font-size: 12.5px; }
  .steps li { padding: 3px 8px; font-size: 10.5px; }
  .results { font-size: 12.5px; }
  .results li, .results.with-cup li { grid-template-columns: 18px 9px minmax(0, 1fr) 74px 54px 30px; gap: 6px; padding: 2px 8px; }
  .results.with-cup li { grid-template-columns: 18px 9px minmax(0, 1fr) 72px 50px 28px 30px; }
  .results.final li { padding: 3px 10px; }
  .results .best { display: block; font-size: 11.5px; }
  .results li.head { padding-bottom: 1px; font-size: 9.5px; }
  .result-note { font-size: 11.5px; line-height: 1.3; }
  .result-foot .btn-primary, .result-foot .btn-soft { min-height: 44px; padding: 6px 12px; font-size: 14.5px; }
  .card-pause { width: min(640px, 100%); padding: 12px 16px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; text-align: left; align-content: center; }
  .card-pause > .eyebrow, .card-pause > h2, .card-pause > p, .card-pause > .btn-primary, .card-pause > .pause-actions { grid-column: 1; }
  .card-pause > .eyebrow, .card-pause > p { display: none; }
  .card-pause > h2 { font-size: 21px; margin: 0 0 2px; }
  .card-pause > .btn-primary { min-height: 46px; }
  .pause-actions { margin-top: 0; gap: 6px; }
  .pause-actions .btn-soft { min-height: 44px; padding: 6px 6px; font-size: 13.5px; }
  .pause-options { grid-column: 2; grid-row: 1 / span 6; margin: 0; padding: 0 0 0 16px; border-top: 0; border-left: 1px solid var(--line); align-content: center; gap: 6px; }
  .pause-options .options-list { gap: 6px; }
  .pause-options .switch, .pause-options .slider { min-height: 44px; padding-top: 2px; padding-bottom: 2px; }
  .pause-options .switch-text small { display: none; }
  .pause-options .switches-compact { grid-template-columns: 1fr 1fr; gap: 6px; }
  .pause-options .switches-compact .switch { padding: 4px 8px; gap: 6px; }
  .pause-options .switches-compact .switch-text b { font-size: 11.5px; }
  .slider input { height: 40px; }
}
/* deitado e estreito (≤ 700 px de largura): a tabela dispensa a coluna da melhor volta */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 700px) {
  .results li, .results.with-cup li { grid-template-columns: 16px 8px minmax(0, 1fr) 70px 28px; }
  .results.with-cup li { grid-template-columns: 16px 8px minmax(0, 1fr) 68px 26px 28px; }
  .results .best { display: none; }
  .result-body, .result-body.solo { grid-template-columns: minmax(0, 0.55fr) minmax(0, 1fr); gap: 10px; }
  .result-foot #btnFinishMenu .ic { display: none; }
  .pod.me b::after { content: none; }
}
/* pausa deitada e estreita: as duas ajudas uma embaixo da outra (lado a lado não cabem) */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 700px) {
  .pause-options .switches-compact { grid-template-columns: 1fr; }
  .pause-options, .pause-options .options-list { gap: 5px; }
}
/* deitado e bem baixo (≤ 340 px): linhas da tabela no mínimo */
@media (max-height: 340px) and (orientation: landscape) {
  .card-result { padding: 6px 12px 8px; gap: 4px; }
  .card-result #btnFinishSite { top: 6px; }
  .podium.solo .pod canvas { max-width: 60px; }
  .result-head h2 { font-size: 19px; }
  .results { font-size: 12px; }
  .results li, .results.with-cup li { padding-top: 1px; padding-bottom: 1px; }
  .result-note { display: none; }
  .card-pause { padding: 8px 14px; gap: 5px 14px; }
  .card-pause > h2 { font-size: 19px; }
}
