/* Rewind — Alataj
   Paleta: #000000 · #FFFFFF · #FA2B2C · #DADADA
   Tipografia: Inter Tight (substituta da Field Gothic) */

:root {
  --black: #000000;
  --white: #FFFFFF;
  --red: #FA2B2C;
  --grey: #DADADA;
  --font: 'Inter Tight', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--black);
  color: var(--black);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { max-width: 480px; min-height: 100dvh; margin: 0 auto; background: var(--white); position: relative; }
.display { font-weight: 900; letter-spacing: -0.01em; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.logo-white { filter: invert(1); mix-blend-mode: screen; display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  width: 100%; min-height: 56px; border: 0; padding: 0 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 18px; font-weight: 800; text-decoration: none;
}
.btn--red { background: var(--red); color: var(--white); }
.btn--black { background: var(--black); color: var(--white); }
.btn--outline { background: var(--white); color: var(--black); border: 2px solid var(--black); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn--split { justify-content: space-between; }

/* ---------- Apresentação ---------- */
.intro { display: flex; min-height: 100dvh; background: var(--black); color: var(--white); }
.intro__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; padding: 28px 24px; }
.intro__header { display: flex; justify-content: space-between; align-items: center; }
.intro__header img { height: 16px; width: auto; }
.intro__date { font-size: 12px; color: var(--grey); letter-spacing: 0.08em; }
.intro__spacer { flex: 1 1 auto; min-height: 32px; }
.intro .eyebrow { color: var(--red); margin-bottom: 14px; }
.intro h1 { margin: 0; font-size: 46px; line-height: 0.92; }
.intro__lede { margin: 20px 0 0; font-size: 18px; line-height: 1.4; color: var(--grey); }
.rules { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--grey); }
.rules li { display: flex; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--grey); font-size: 15px; color: var(--grey); }
.rules span:first-child { font-size: 13px; font-weight: 900; color: var(--red); width: 24px; flex: 0 0 auto; }
.intro .btn--red { margin-top: 32px; }
.link-btn {
  margin-top: 12px; min-height: 44px; padding: 0; border: 0; background: none;
  color: var(--grey); font-size: 14px; text-decoration: underline; text-align: left;
}
.intro__meta { margin: 8px 0 0; font-size: 12px; color: var(--grey); letter-spacing: 0.04em; }
.intro__streak { margin: 16px 0 0; font-size: 14px; color: var(--white); }
.intro__streak strong { color: var(--red); }
.intro__band { flex: 0 0 56px; background: var(--red); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 16px 0 28px; }
.intro__band img { width: 48px; height: 48px; }
.intro__band span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 22px; line-height: 1; color: var(--white); }

/* ---------- Desafio ---------- */
.challenge { display: flex; flex-direction: column; min-height: 100dvh; padding: 20px 20px 24px; }
.challenge__header { display: flex; justify-content: space-between; align-items: center; }
.icon-btn { width: 44px; height: 44px; margin-left: -10px; border: 0; background: none; color: var(--black); display: flex; align-items: center; justify-content: center; }
.challenge__header img { width: 52px; height: 52px; }
.timer { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 64px; justify-content: flex-end; }
.challenge__meta { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 13px; }
.challenge__meta .display { letter-spacing: 0.04em; }
.challenge__meta .red { color: var(--red); }
.bars { display: flex; gap: 4px; }
.bars span { width: 28px; height: 4px; background: var(--grey); }
.bars span.on { background: var(--black); }
.challenge h1 { margin: 20px 0 0; font-size: 22px; line-height: 1.2; font-weight: 800; }
.axis { margin: 16px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; }
.axis--end { margin: 8px 0 0; }

.cards { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--black); position: relative; }
.card {
  display: flex; align-items: center; gap: 14px; min-height: 80px;
  border-bottom: 1px solid var(--grey); background: var(--white);
  position: relative; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform 160ms ease;
}
.card.dragging { transition: none; z-index: 2; box-shadow: 0 10px 24px rgba(0,0,0,0.18); cursor: grabbing; }
.card__num {
  flex: 0 0 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--grey); font-size: 18px; font-weight: 900; cursor: grab;
}
.card.is-right .card__num { background: var(--black); border-color: var(--black); color: var(--white); }
.card.is-wrong .card__num { border: 2px solid var(--red); }
.card__body { flex: 1 1 auto; min-width: 0; padding: 10px 0; cursor: grab; }
.card__title { margin: 0; font-size: 15px; line-height: 1.3; font-weight: 700; }
.card__place { margin: 4px 0 0; font-size: 13px; }
.card__moves { display: flex; flex-direction: column; }
.card__moves button { width: 44px; height: 38px; border: 0; background: none; color: var(--black); display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.card__moves button:disabled { opacity: 0.2; cursor: default; }

.challenge__spacer { flex: 1 1 auto; min-height: 20px; }
.hint { margin: 0 0 12px; font-size: 13px; text-align: center; }
.feedback { margin: 0 0 12px; font-size: 15px; font-weight: 700; text-align: center; }
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1 1 0; font-size: 16px; padding: 0 12px; }

/* ---------- Resultado ---------- */
.result__hero { background: var(--black); color: var(--white); padding: 20px 20px 28px; }
.result__header { display: flex; justify-content: space-between; align-items: center; }
.result__header .logo-white:first-child { height: 22px; width: auto; }
.result__header .logo-white:last-child { width: 60px; height: 60px; margin: -10px -10px -10px 0; }
.result__hero .eyebrow { margin-top: 36px; color: var(--grey); }
.result__hero .eyebrow b { color: var(--white); font-weight: 700; }
.result__hero .eyebrow .red { color: var(--red); }
.score-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 8px; }
.score { margin: 0; font-size: 96px; line-height: 0.85; }
.score .red { color: var(--red); }
.squares { display: flex; gap: 6px; padding-bottom: 6px; }
.squares span { width: 18px; height: 18px; }
.squares .hit { background: var(--white); }
.squares .miss { border: 2px solid var(--red); }
.stats { margin: 28px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--grey); }
.stats div { padding-top: 14px; }
.stats dt { font-size: 10px; letter-spacing: 0.12em; color: var(--grey); }
.stats dd { margin: 6px 0 0; font-size: 22px; font-weight: 900; }

.section { padding: 28px 20px 0; }
.section h2.eyebrow { color: var(--black); }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; border-top: 2px solid var(--black); }
.timeline li { display: flex; gap: 16px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--grey); }
.timeline .year { flex: 0 0 60px; font-size: 20px; font-weight: 900; }
.timeline .miss .year { color: var(--red); }
.timeline .text { flex: 1 1 auto; font-size: 14px; line-height: 1.35; }
.timeline svg { flex: 0 0 auto; }

.share-box { border: 1px solid var(--grey); padding: 16px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.6; white-space: pre-line; }
.share-actions { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }

.lead { margin: 28px 20px 0; padding: 24px 20px; background: var(--grey); }
.lead h2 { margin: 0; font-size: 22px; line-height: 1.1; }
.lead p { margin: 10px 0 0; font-size: 14px; line-height: 1.45; }
.form { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.form label.field { font-size: 13px; font-weight: 700; }
.form input[type=email] { min-height: 52px; padding: 0 14px; border: 1px solid var(--black); background: var(--white); font-size: 16px; border-radius: 0; color: var(--black); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.4; min-height: 44px; padding-top: 6px; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--black); flex: 0 0 auto; }
.form-note { margin: 2px 0 0; font-size: 12px; }
.form-note a { color: var(--black); }
.form-status { margin: 0; font-size: 14px; font-weight: 700; }
.lead--done h2 { color: var(--black); }

.result__footer { padding: 28px 20px 32px; display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.result__footer .display { font-size: 18px; font-variant-numeric: tabular-nums; }

/* ---------- Diálogo de login e aviso ---------- */
dialog { border: 0; padding: 0; max-width: 440px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,0.7); }
dialog .lead { margin: 0; }
.dialog__close { position: absolute; top: 8px; right: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--black); color: var(--white); padding: 12px 18px; font-size: 14px; font-weight: 700;
  z-index: 10;
}

/* ======================================================
   Telas médias (tablet): coluna mais larga
   ====================================================== */
@media (min-width: 600px) {
  .app { max-width: 680px; }
  .intro__main { padding: 40px 48px; }
  .intro h1 { font-size: 72px; }
  .intro__band { flex-basis: 72px; }
  .intro__band img { width: 60px; height: 60px; }
  .challenge { padding: 28px 40px 40px; }
  .section { padding-left: 40px; padding-right: 40px; }
  .lead { margin-left: 40px; margin-right: 40px; }
  .result__hero { padding: 28px 40px 36px; }
  .result__footer { padding-left: 40px; padding-right: 40px; }
}

/* ======================================================
   Telas grandes (notebook e desktop)
   ====================================================== */
@media (min-width: 960px) {
  body { background: var(--white); }
  .app { max-width: none; }

  /* Apresentação: duas colunas editoriais */
  .intro__main {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
    column-gap: clamp(48px, 7vw, 120px);
    grid-template-rows: auto 1fr repeat(7, auto);
    grid-template-areas:
      "header header"
      "spacer spacer"
      "eyebrow rules"
      "title   rules"
      "lede    rules"
      "streak  rules"
      "cta     rules"
      "login   rules"
      "meta    rules";
    padding: 48px clamp(48px, 6vw, 96px) 56px;
  }
  .intro__header { grid-area: header; }
  .intro__header img { height: 22px; }
  .intro__date { font-size: 14px; }
  .intro__spacer { grid-area: spacer; min-height: 48px; }
  .intro .eyebrow { grid-area: eyebrow; font-size: 14px; margin-bottom: 20px; }
  .intro h1 { grid-area: title; font-size: clamp(96px, 11vw, 184px); line-height: 0.85; }
  .intro__lede { grid-area: lede; font-size: 24px; max-width: 620px; margin-top: 32px; }
  .intro__streak { grid-area: streak; font-size: 16px; }
  .intro .btn--red { grid-area: cta; max-width: 420px; margin-top: 40px; min-height: 64px; font-size: 20px; }
  .link-btn { grid-area: login; justify-self: start; font-size: 15px; }
  .intro__meta { grid-area: meta; font-size: 13px; }
  .rules { grid-area: rules; align-self: end; margin: 0; }
  .rules li { padding: 22px 0; font-size: 18px; }
  .rules span:first-child { font-size: 15px; width: 32px; }
  .intro__band { flex-basis: 112px; padding: 40px 0 56px; }
  .intro__band img { width: 88px; height: 88px; }
  .intro__band span { font-size: 40px; }

  /* Desafio: coluna central confortável */
  .challenge { max-width: 820px; margin: 0 auto; padding: 40px 48px 56px; }
  .challenge__header img { width: 64px; height: 64px; }
  .timer { font-size: 18px; }
  .challenge__meta { font-size: 15px; margin-top: 20px; }
  .bars span { width: 40px; height: 5px; }
  .challenge h1 { font-size: 40px; font-weight: 900; margin-top: 32px; letter-spacing: -0.01em; }
  .axis { font-size: 12px; margin-top: 28px; }
  .card { min-height: 92px; gap: 20px; }
  .card__num { flex-basis: 52px; height: 52px; font-size: 22px; }
  .card__title { font-size: 19px; }
  .card__place { font-size: 15px; }
  .card__moves { flex-direction: row; gap: 4px; }
  .card__moves button { width: 48px; height: 48px; }
  .challenge__spacer { min-height: 32px; flex-grow: 0; }
  .hint { font-size: 14px; }
  .actions .btn, #check-btn { min-height: 64px; font-size: 20px; }

  /* Resultado: placar fixo à esquerda, detalhes à direita */
  .result:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(380px, 5fr) minmax(0, 7fr);
    min-height: 100dvh;
  }
  .result__hero {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column;
    padding: 48px clamp(40px, 4vw, 72px);
  }
  .result__header .logo-white:first-child { height: 26px; }
  .result__header .logo-white:last-child { width: 80px; height: 80px; margin: -14px -14px -14px 0; }
  .result__hero .eyebrow { margin-top: auto; font-size: 13px; }
  .score-row { flex-direction: column; align-items: flex-start; gap: 28px; margin-top: 16px; }
  .score { font-size: clamp(140px, 14vw, 220px); }
  .squares { gap: 10px; padding: 0; }
  .squares span { width: 40px; height: 40px; }
  .squares .miss { border-width: 3px; }
  .stats { margin-top: 48px; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 8px; }
  .stats dt { font-size: 12px; }
  .stats dd { font-size: 32px; }

  .result__body { padding: 48px clamp(40px, 5vw, 96px) 0; max-width: 820px; }
  .result__body .section { padding: 0 0 40px; }
  .timeline li { padding: 20px 0; }
  .timeline .year { flex-basis: 84px; font-size: 28px; }
  .timeline .text { font-size: 17px; }
  .share-actions { flex-direction: row; }
  .share-actions .btn { flex: 1 1 0; }
  .result__body .lead { margin: 0; padding: 36px; }
  .lead h2 { font-size: 30px; }
  .lead p { font-size: 16px; max-width: 520px; }
  .result__body .form { max-width: 520px; }
  .result__body .result__footer { padding: 32px 0 48px; font-size: 15px; }
  .result__footer .display { font-size: 24px; }
}

/* Pistas e cartões travados */
.card.is-locked { background: var(--white); }
.card.is-locked .card__body, .card.is-locked .card__num { cursor: default; }
.card__year { font-weight: 900; }
.card__hint { margin: 6px 0 0; font-size: 13px; font-weight: 800; color: var(--black); }
.card__hint span { color: var(--red); font-size: 15px; }
.card__lock { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
@media (min-width: 960px) {
  .card__hint { font-size: 15px; }
  .card__lock { width: 100px; }
}

/* Foco visível dentro da paleta */
.form input[type=email]:focus-visible { outline: 3px solid var(--red); outline-offset: 0; }
.lead--pregame .eyebrow { margin-bottom: 10px; }
.lead--pregame .btn--outline { background: transparent; }

/* Aviso de novidades (base: legítimo interesse) */
.form-consent { margin: 4px 0 2px; font-size: 13px; line-height: 1.4; }

/* Resultado da primeira tentativa, mostrado acima do botão */
.hint--feedback { font-size: 15px; font-weight: 800; }
@media (min-width: 960px) { .hint--feedback { font-size: 17px; } }
