/*
 * Biscoitando — estilos do app. Cores, tipos, espaços e raios vêm de tokens.css;
 * componentes do Design System vêm de bundle.css. Aqui ficam só o layout e as peças do app.
 */

/* Extensões do Design System pedidas pelo Gui em 06/11/2026 (anotadas no CLAUDE.md):
   verde de "disponível/recomendado" na Grade e de comemoração no match. */
:root { --bc-online: #3fcf7e; --bc-online-deep: #1e7a4a; }

#app.bc-content { gap: var(--bc-space-6); }
body.has-sheet { overflow: hidden; }
/* Só para leitor de tela. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Barra de carregamento (progress.js): cresce até 85% e completa; parada no movimento reduzido. */
.loadbar { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; height: 3px; width: 0; background: var(--bc-accent); z-index: 200; opacity: 0; pointer-events: none;
  transition: width 1.6s var(--bc-ease-out), opacity var(--bc-duration-touch) ease; }
.loadbar.is-on { width: 85%; opacity: 1; }
.loadbar.is-done { width: 100%; opacity: 0; transition: width 180ms ease, opacity 260ms ease 120ms; }
.loadbar.is-reset { transition: none; width: 0; }
/* Botão esperando o servidor; tela antiga esperando a nova (app.js). */
.bc-control.is-busy, .bc-icon-btn.is-busy { opacity: .7; cursor: progress; }
.view { display: contents; }
.view.is-stale > * { opacity: .55; pointer-events: none; transition: opacity 180ms ease; }
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
img { max-width: 100%; }
h1, h2, h3, p, ul, ol { margin: 0; }
a { color: inherit; }

.stack { display: grid; gap: var(--bc-space-4); align-content: start; }
.stack-tight { display: grid; gap: var(--bc-space-2); align-content: start; }
.grow { flex: 1; display: flex; flex-direction: column; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--bc-space-3); }
.text-secondary { color: var(--bc-text-secondary); }
.link-quiet { display: inline-flex; align-items: center; min-height: var(--bc-touch-target); color: var(--bc-accent); text-decoration: none; justify-self: center; }
.plain-list { list-style: none; padding: 0; }

/* Cabeçalhos */
.app-logo-link { display: inline-flex; align-items: center; min-height: 32px; color: inherit; border-radius: 6px; }
.app-header__actions { display: flex; margin: -4px -12px 0 0; }
.screen-head { display: flex; align-items: center; gap: var(--bc-space-2); margin-left: -12px; min-height: var(--bc-touch-target); }
.screen-head__title { flex: 1; }

/* Formulários */
.form { gap: var(--bc-space-4); }
.field { display: grid; gap: var(--bc-space-2); }
.field__input {
  box-sizing: border-box; width: 100%; min-height: var(--bc-touch-target);
  padding: 12px 16px; border: 1px solid var(--bc-border); border-radius: var(--bc-radius-control);
  background: var(--bc-surface); color: var(--bc-text); font: 400 16px/24px var(--font-ui);
}
.field__input::placeholder { color: var(--bc-text-secondary); }
.field__input--code { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; }
.field__input--area { min-height: 176px; resize: vertical; }
.field__hint { color: var(--bc-text-secondary); }
.form__error:empty { display: none; }
.join-title { margin-top: var(--bc-space-2); }

/* Opções do questionário e da calibração */
.options { display: grid; gap: var(--bc-space-3); }
.options--2 { grid-template-columns: 1fr 1fr; }
.option { justify-content: space-between; min-height: 56px; text-align: left; }
.option.is-selected { border-color: var(--bc-accent); background: var(--bc-surface-raised); }
.option__mark { color: var(--bc-accent); }
.chips { display: flex; flex-wrap: wrap; gap: var(--bc-space-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--bc-space-1);
  min-height: var(--bc-touch-target); padding: 0 var(--bc-space-4);
  border: 1px solid var(--bc-border); border-radius: var(--bc-radius-pill);
  background: var(--bc-surface); color: var(--bc-text); cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.chip.is-selected { border-color: var(--bc-accent); background: var(--bc-surface-raised); }
.chip.is-selected .bc-icon { color: var(--bc-accent); }
.sticky-actions {
  position: sticky; bottom: 0; display: grid; gap: var(--bc-space-2);
  padding: var(--bc-space-4) 0 max(var(--bc-space-2), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bc-bg) 75%, transparent);
}

/* Primeiro acesso */
.onb-head { display: grid; gap: var(--bc-space-3); }
.onb-body { gap: var(--bc-space-6); }
.progress { height: 4px; border-radius: var(--bc-radius-pill); background: var(--bc-surface-raised); overflow: hidden; }
.progress__bar { display: block; height: 100%; width: 0; background: var(--bc-accent); transition: width var(--bc-duration-vote) var(--bc-ease-out); }
.howto { display: grid; gap: var(--bc-space-3); padding-left: var(--bc-space-6); }
.howto li::marker { color: var(--bc-accent); font-weight: 700; }

.provider-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--bc-space-3); }
@media (max-width: 359px) { .provider-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.provider {
  position: relative; display: grid; justify-items: center; gap: var(--bc-space-2);
  padding: var(--bc-space-3) var(--bc-space-2); border: 1px solid transparent; border-radius: var(--bc-radius-control);
  background: var(--bc-surface); color: var(--bc-text); cursor: pointer; text-align: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.provider.is-selected { border-color: var(--bc-accent); background: var(--bc-surface-raised); }
.provider__logo { width: 56px; height: 56px; border-radius: var(--bc-radius-poster); object-fit: cover; background: var(--bc-surface-raised); }
.provider__logo--empty { display: grid; place-items: center; font: 700 20px/1 var(--font-ui); color: var(--bc-text-secondary); }
.provider__name { color: var(--bc-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.provider__check { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--bc-radius-pill); background: var(--bc-accent); color: var(--bc-on-accent); }

.calib { justify-items: center; text-align: center; }
.calib__poster { width: clamp(150px, calc((100dvh - 470px) * .6667), 220px); }
.calib__info { display: grid; gap: var(--bc-space-1); justify-items: center; }
.calib__actions { display: grid; gap: var(--bc-space-3); width: 100%; }

/* Cartões e listas */
.card { display: grid; gap: var(--bc-space-3); padding: var(--bc-space-4); border-radius: var(--bc-radius-control); background: var(--bc-surface); }
.card--title { grid-template-columns: 72px minmax(0, 1fr); align-items: start; }
/* Cartão inteiro tocável (vistos): abre a folha de correção. */
.card--action { width: 100%; border: 0; margin: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  transition: background-color var(--bc-duration-touch) ease; }
.card--action:active { background: var(--bc-surface-raised); }
.card--action:focus-visible { outline: var(--bc-focus-width) solid var(--bc-focus); outline-offset: var(--bc-focus-offset); }
.card__thumb { width: 72px; }
.card__thumb-btn { padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: var(--bc-radius-poster); }
.card__main { display: grid; gap: var(--bc-space-2); align-content: start; min-width: 0; }
.card--tonight .card--title { display: grid; gap: var(--bc-space-3); }
.list-heading { margin-top: var(--bc-space-4); }
.badges { display: flex; flex-wrap: wrap; gap: var(--bc-space-2); }
.notice-actions { display: flex; flex-wrap: wrap; gap: var(--bc-space-2); margin-top: var(--bc-space-2); }

/* QR code do convite: módulos escuros sobre fundo claro (leitores de QR precisam do contraste). */
.invite-qr { display: grid; justify-items: center; gap: var(--bc-space-2); margin: var(--bc-space-2) 0; }
.invite-qr svg { width: 196px; height: 196px; border-radius: var(--bc-radius-control); }
.invite-qr__bg { fill: var(--bc-text); }
.invite-qr__dots { fill: var(--bc-bg); }
.invite-code { font: 700 32px/40px var(--font-ui); letter-spacing: .24em; text-align: center; padding: var(--bc-space-2) 0; color: var(--bc-text); }
.home { gap: var(--bc-space-6); }
.home .bc-statement { flex: 0; }
.home .bc-statement__body { padding-block: var(--bc-space-6); }
.home-links { display: grid; gap: var(--bc-space-2); }
.link-row {
  display: flex; align-items: center; gap: var(--bc-space-3); min-height: 56px; padding: 0 var(--bc-space-4);
  border-radius: var(--bc-radius-control); background: var(--bc-surface); text-decoration: none; color: var(--bc-text);
}
.link-row__icon { display: inline-flex; color: var(--bc-accent); }
.link-row__chevron { margin-left: auto; display: inline-flex; color: var(--bc-text-secondary); }

.badge {
  justify-self: start; width: max-content;
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px;
  border-radius: var(--bc-radius-pill); background: var(--bc-surface-raised); color: var(--bc-text);
  font: 500 12px/18px var(--font-ui);
}
.badge--accent, .badge--rever { background: var(--bc-accent); color: var(--bc-on-accent); }
.reason { color: var(--bc-text); }

.poster-empty { display: grid; place-items: center; color: var(--bc-text-secondary); }

/* Toast */
.toast-wrap {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: max(var(--bc-space-4), env(safe-area-inset-bottom));
  width: min(calc(100% - 2 * var(--bc-gutter)), calc(var(--bc-content-max) - 2 * var(--bc-gutter)));
  animation: bc-rise var(--bc-duration-vote) var(--bc-ease-out) both;
}
.bc-toast { border: 1px solid var(--bc-divider); }
.bc-toast--error .bc-toast__icon { color: var(--bc-error); }
@keyframes bc-rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Folha inferior */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(23, 19, 24, .82); }
.sheet__panel {
  position: relative; width: min(100%, var(--bc-content-max)); max-height: 88dvh; overflow: auto;
  padding: var(--bc-space-2) var(--bc-gutter) max(var(--bc-space-6), env(safe-area-inset-bottom));
  border-radius: var(--bc-radius-modal) var(--bc-radius-modal) 0 0; background: var(--bc-surface);
  animation: bc-sheet var(--bc-duration-match) var(--bc-ease-out) both; outline: none;
}
.sheet__bar { display: flex; justify-content: flex-end; margin-right: -12px; }
@keyframes bc-sheet { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.details__head { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--bc-space-4); align-items: start; }
.where-list { list-style: none; padding: 0; display: grid; gap: var(--bc-space-2); }
.where { display: flex; align-items: center; gap: var(--bc-space-3); min-height: 40px; }
.where__logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: var(--bc-surface-raised); }
.where__logo--plex { display: grid; place-items: center; color: var(--bc-accent); }
.attribution { color: var(--bc-text-secondary); }
.details a.bc-control { text-decoration: none; }

/* Votação */
.vote-mode { margin-top: calc(-1 * var(--bc-space-2)); }
.vote-band:empty, .vote-main:empty { display: none; }
.vote-main { display: grid; gap: var(--bc-space-4); align-content: start; }
#app:has(.vote-main) { gap: var(--bc-space-4); }
.match-band {
  display: flex; align-items: center; gap: var(--bc-space-3); width: 100%; min-height: 56px;
  padding: var(--bc-space-2) var(--bc-space-3); border: 1px solid var(--bc-accent); border-radius: var(--bc-radius-control);
  background: var(--bc-surface); color: var(--bc-text); cursor: pointer; text-align: left;
}
.match-band__posters { display: flex; }
.match-band__poster { width: 28px; border-radius: 6px; border: 2px solid var(--bc-surface); }
.match-band__poster + .match-band__poster { margin-left: -10px; }
.match-band__text { flex: 1; }
.match-band__cta { display: inline-flex; align-items: center; color: var(--bc-accent); }

.deck-card .bc-deck__poster { max-width: clamp(180px, calc((100dvh - 470px) * .6667), 310px); }
.deck-card .bc-deck__info { gap: var(--bc-space-2); }
/* Texto do cartão com altura fixa, para os botões não subirem e descerem entre um título e outro. */
/* O bloco tem a altura do caso mais longo (título em 2 linhas + meta + motivo em 2 linhas); o texto fica
   colado em cima e a sobra vai para baixo dele. */
.deck-card .deck-info { height: calc(60px + 24px + 40px + 2 * var(--bc-space-2)); align-content: start; overflow: hidden; }
.deck-info__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: 60px; overflow-wrap: anywhere; }
.deck-info__meta { display: flex; align-items: center; gap: var(--bc-space-2); height: 24px; min-width: 0; overflow: hidden; white-space: nowrap; }
.deck-info__meta .badge { flex: none; }
.deck-info__meta .bc-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.deck-info__reason { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-height: 40px; }
.deck-info__reason:empty { display: none; }
.bc-icon-btn:disabled { opacity: .35; cursor: default; }
/* Pôster-esqueleto: forma do pôster na cor de superfície, parado (o Design System proíbe brilho e loop). */
.skeleton-row { display: flex; justify-content: center; gap: var(--bc-space-3); margin-top: var(--bc-space-8); }
.skeleton-poster { width: 76px; aspect-ratio: 2 / 3; border-radius: var(--bc-radius-poster); background: var(--bc-surface); border: 1px solid var(--bc-surface-raised); }
.skeleton-poster:nth-child(2) { width: 92px; background: var(--bc-surface-raised); }
.deck-seen { display: grid; grid-template-columns: 1fr 1fr; gap: var(--bc-space-2); margin-top: calc(-1 * var(--bc-space-2)); }
.deck-seen .bc-control--quiet { color: var(--bc-text-secondary); padding-inline: var(--bc-space-2); }
.deck-note { text-align: center; margin-top: calc(-1 * var(--bc-space-2)); }
.vote-header .bc-header__sub { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.deck-drag { touch-action: none; user-select: none; -webkit-user-select: none; will-change: transform; cursor: grab; }
.deck-drag .bc-poster { pointer-events: none; -webkit-user-drag: none; }
.deck-card .bc-deck__actions { margin-top: 0; }
.second-look-label { text-align: center; color: var(--bc-accent); }
.bc-control--primary.is-armed { background: var(--bc-accent-pressed); }
.bc-control.is-armed:not(.bc-control--primary) { background: var(--bc-surface-raised); border-color: var(--bc-text); }
.bc-control--quiet.is-armed { color: var(--bc-accent); }
.grade-note { text-align: center; }

/* Grade densa, no jeito das grades de perfis: pôsteres colados de ponta a ponta, sinais nos cantos. */
.grade-dense { gap: 3px; margin-inline: calc(-1 * var(--bc-gutter)); }
.grade-dense .bc-poster, .grade-dense .bc-poster-vote { border-radius: 3px; }
.grade-dense .bc-poster-vote[aria-pressed="true"] { outline: 3px solid var(--bc-accent); outline-offset: -3px; }
.grade-dense .bc-tile__details { top: 2px; right: 2px; }
.grade-dense .bc-tile__seal { right: 6px; bottom: 6px; }
.grade-dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: var(--bc-radius-pill); background: var(--bc-online); box-shadow: 0 0 0 2px var(--bc-bg); }
.grade-dot--tile { position: absolute; left: 8px; top: 8px; width: 12px; height: 12px; }
.grade-dot--tile + .grade-partner { left: 26px; }
.grade-partner { position: absolute; left: 6px; top: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: var(--bc-radius-pill); background: var(--bc-bg); box-shadow: 0 0 0 1.5px var(--bc-accent); }
.grade-partner--key { position: static; width: 18px; height: 18px; box-shadow: 0 0 0 1px var(--bc-accent); }
.grade-legend { display: flex; flex-direction: column; gap: var(--bc-space-1); }
.grade-legend__keys { display: flex; flex-wrap: wrap; gap: var(--bc-space-1) var(--bc-space-4); }
.grade-key { display: inline-flex; align-items: center; gap: var(--bc-space-2); }

/* Match e escolha (camada por cima da tela) */
.overlay { position: fixed; inset: 0; z-index: 20; overflow: auto; background: var(--bc-bg); }
.overlay .bc-content { gap: var(--bc-space-6); }
.overlay__center { justify-content: center; }
.match-where { color: var(--bc-text); }
.bc-match a.bc-control { text-decoration: none; }

/* Match em festa (pedido do Gui em 06/11/2026): verde no título, no brilho e no contorno do pôster;
   partículas no canvas .match-burst (celebrate.js). O botão "É esse!" continua âmbar: é a ação. */
.match-burst { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
.match-celebrate .bc-match__head { position: relative; isolation: isolate; }
.match-celebrate .bc-match__head::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 28px; width: 220px; height: 220px; transform: translate(-50%, -50%);
  border-radius: var(--bc-radius-pill); background: radial-gradient(circle, color-mix(in srgb, var(--bc-online) 38%, transparent) 0%, transparent 70%); }
.match-celebrate .bc-display { color: var(--bc-online); }
.match-celebrate .bc-match__poster { box-shadow: 0 0 0 3px var(--bc-online), 0 0 40px color-mix(in srgb, var(--bc-online) 35%, transparent); }

/* Desempate */
.tiebreak-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--bc-space-3); }
.tiebreak__item {
  display: grid; gap: var(--bc-space-2); justify-items: start; padding: 0; border: 0; background: transparent;
  color: var(--bc-text); text-align: left; cursor: pointer; border-radius: var(--bc-radius-poster);
}
.tiebreak__item:disabled { cursor: default; }
.tiebreak__item.is-out { opacity: .4; }

/* Ajustes */
.settings { gap: var(--bc-space-8); }
.settings-section { gap: var(--bc-space-3); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: var(--bc-space-4); min-height: var(--bc-touch-target); }
.settings-row__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.switch { position: relative; flex: 0 0 auto; width: 56px; height: var(--bc-touch-target); padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: var(--bc-radius-pill); }
.switch::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 56px; height: 32px;
  border: 1px solid var(--bc-border); border-radius: var(--bc-radius-pill); background: var(--bc-surface);
  box-sizing: border-box; transition: background-color var(--bc-duration-touch) ease;
}
.switch__thumb { position: absolute; top: 12px; left: 4px; width: 24px; height: 24px; border-radius: var(--bc-radius-pill); background: var(--bc-text-secondary); transition: transform var(--bc-duration-vote) var(--bc-ease-out); }
.switch.is-on::before { background: var(--bc-accent); border-color: transparent; }
.switch.is-on .switch__thumb { transform: translateX(24px); background: var(--bc-on-accent); }
.attribution-block { padding-top: var(--bc-space-4); border-top: 1px solid var(--bc-divider); }

@media (prefers-reduced-motion: reduce) {
  .loadbar, .loadbar.is-done { transition: none !important; }
  .loadbar.is-on { width: 100%; }
  .toast-wrap, .sheet__panel { animation: none !important; }
  .progress__bar, .switch__thumb, .switch::before { transition: none !important; }
}

/* Bandeira do arco-íris (temática LGBTQIA+, pedido do Gui em 06/11/2026): canto de baixo à esquerda do
   pôster, num selo escuro para aparecer sobre qualquer arte. Exceção à regra "sem marca sobre a arte". */
.lgbt-flag { display: inline-grid; place-items: center; line-height: 0; flex: none; }
.lgbt-flag__svg { display: block; border-radius: 2px; }
.poster-flag { position: absolute; left: 8px; bottom: 8px; padding: 5px; border-radius: 6px; background: color-mix(in srgb, var(--bc-bg) 82%, transparent); pointer-events: none; }
.poster-flag--tile { left: 4px; bottom: 4px; padding: 4px; border-radius: 4px; }
.poster-flag--tile .lgbt-flag__svg { width: 15px; height: 10px; }
.lgbt-line { display: inline-flex; align-items: center; gap: var(--bc-space-2); }
