/* === Tokens ===================================================== */

:root {
  --laranja: #ff6101;
  --laranja-quente: #ff7a2a;
  --laranja-escuro: #c84800;

  --grafite: #0e0e10;
  --grafite-2: #1b1b1f;
  --carbono: #2b2b30;
  --bruma: #6b6b73;
  --bege-suave: #f5f1ec;
  --osso: #fafaf7;
  --linha: #e6e2dc;
  --erro: #c43838;
  --ambar: #e89324;
  --nps-vermelho: #d93025;
  --nps-amarelo: #f5b301;
  --nps-verde: #3aa345;

  --radius-s: 6px;
  --radius-m: 14px;
  --radius-l: 22px;

  --container: 38rem;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 2.75rem;
  --space-7: 3.5rem;

  --shadow-soft: 0 1px 2px rgba(14, 14, 16, 0.06), 0 10px 30px rgba(14, 14, 16, 0.05);
  --shadow-cta: 0 6px 18px rgba(255, 97, 1, 0.28);

  --display: "Bebas Neue", "Anton", Impact, sans-serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* === Reset enxuto ============================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--osso);
  color: var(--grafite);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
button { font: inherit; }

/* === Banner Notion-style ========================================= */

.banner {
  position: relative;
  width: 100%;
  height: clamp(140px, 32vw, 280px);
  overflow: hidden;
  background: var(--grafite);
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
}

.banner-grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(14, 14, 16, 0) 60%, rgba(14, 14, 16, 0.45) 100%),
    linear-gradient(180deg, rgba(14, 14, 16, 0.15) 0%, rgba(14, 14, 16, 0) 25%);
}

/* faixa laranja decorativa abaixo do banner */
.banner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--laranja);
}

/* === Layout da página =========================================== */

.page {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-7);
}

.tela[hidden] { display: none; }

.tela {
  animation: enter 360ms ease-out both;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === Tipografia ================================================= */

.eyebrow {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--laranja);
  margin: 0 0 var(--space-3);
}

.headline {
  font-family: var(--body);
  font-weight: 600;
  font-size: clamp(1.45rem, 4.6vw + 0.6rem, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--grafite-2);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--bruma);
  margin: 0 0 var(--space-5);
  text-wrap: pretty;
}

/* === Hero da nota =============================================== */

.tela-nota {
  text-align: center;
}

.tela-nota .eyebrow,
.tela-nota .headline {
  margin-left: auto;
  margin-right: auto;
}

.tela-nota .headline {
  max-width: 22ch;
  margin-bottom: var(--space-5);
}

.tela-nota .actions {
  align-items: center;
  justify-content: center;
}

.tela-nota .btn-primary {
  width: min(100%, 320px);
}

/* === Seletor de nota (modo escolha) ============================== */

.nota-modo-confirmar[hidden],
.nota-modo-selecionar[hidden] { display: none; }

.legenda-escala {
  font-size: 0.85rem;
  color: var(--bruma);
  margin: 0 0 var(--space-4);
  letter-spacing: 0.01em;
}

.grid-notas {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
  max-width: 28rem;
  margin: 0 auto var(--space-4);
}

.nota-opcao {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-family: var(--display);
  font-size: 1.5rem;
  padding: 0.75rem 0;
  cursor: pointer;
  min-height: 56px;
  transition: filter 140ms ease, box-shadow 140ms ease,
              transform 120ms cubic-bezier(0.34, 1.32, 0.64, 1);
}

/* Cores por faixa NPS */
.nota-opcao[data-nota-opcao="0"],
.nota-opcao[data-nota-opcao="1"],
.nota-opcao[data-nota-opcao="2"],
.nota-opcao[data-nota-opcao="3"],
.nota-opcao[data-nota-opcao="4"],
.nota-opcao[data-nota-opcao="5"],
.nota-opcao[data-nota-opcao="6"] {
  background: var(--nps-vermelho);
  color: white;
}

.nota-opcao[data-nota-opcao="7"],
.nota-opcao[data-nota-opcao="8"] {
  background: var(--nps-amarelo);
  color: var(--grafite);
}

.nota-opcao[data-nota-opcao="9"],
.nota-opcao[data-nota-opcao="10"] {
  background: var(--nps-verde);
  color: white;
}

.nota-opcao:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(14, 14, 16, 0.18);
}

.nota-opcao:active {
  transform: translateY(0);
}

.nota-opcao:focus-visible {
  outline: 3px solid var(--grafite);
  outline-offset: 3px;
}

.nota-opcao[aria-pressed="true"] {
  outline: 3px solid var(--grafite);
  outline-offset: 3px;
  transform: scale(1.06);
  box-shadow: 0 8px 18px rgba(14, 14, 16, 0.22);
}

@media (min-width: 560px) {
  .grid-notas {
    grid-template-columns: repeat(11, 1fr);
    gap: var(--space-1);
  }
  .nota-opcao {
    font-size: 1.35rem;
    min-height: 60px;
  }
}

.hero-nota {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: var(--space-2) 0 var(--space-5);
  line-height: 0.85;
}

.nota-numero {
  font-family: var(--display);
  font-size: clamp(5.5rem, 22vw, 9rem);
  color: var(--laranja);
  letter-spacing: -0.02em;
  line-height: 0.85;
  display: inline-block;
  position: relative;
}

/* sublinhado solto, decorativo, na base do número */
.nota-numero::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0.18em;
  height: 0.08em;
  background: linear-gradient(90deg, var(--laranja-quente), transparent);
  border-radius: 2px;
  opacity: 0.55;
}

/* === Campos =================================================== */

.field { margin-bottom: var(--space-4); }

.label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--grafite-2);
  margin-bottom: var(--space-1);
}

textarea {
  width: 100%;
  min-height: 9rem;
  resize: vertical;
  font: inherit;
  color: var(--grafite);
  background: var(--bege-suave);
  border: 1.5px solid transparent;
  border-radius: var(--radius-m);
  padding: var(--space-3);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

textarea::placeholder { color: rgba(14, 14, 16, 0.4); }

textarea:hover { background: #efeae3; }

textarea:focus-visible {
  outline: none;
  border-color: var(--laranja);
  background: var(--osso);
  box-shadow: 0 0 0 4px rgba(255, 97, 1, 0.18);
}

.contador {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--bruma);
  margin: var(--space-1) 0 0;
}

/* === Ações ==================================================== */

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.btn {
  appearance: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.01em;
  border-radius: var(--radius-m);
  padding: 1rem 1.25rem;
  min-height: 54px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 160ms ease, transform 80ms ease, box-shadow 160ms ease, color 160ms ease;
}

.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-primary {
  background: var(--laranja);
  color: white;
  box-shadow: var(--shadow-cta);
}

.btn-primary:hover:not(:disabled) {
  background: var(--laranja-escuro);
  box-shadow: 0 8px 22px rgba(200, 72, 0, 0.32);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(200, 72, 0, 0.25);
}

.btn-primary:focus-visible {
  outline: 3px solid rgba(255, 97, 1, 0.55);
  outline-offset: 3px;
}

.btn-link {
  background: transparent;
  color: var(--bruma);
  min-height: 48px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.btn-link:hover:not(:disabled) {
  color: var(--grafite);
  text-decoration-color: currentColor;
}

.btn-link:focus-visible {
  outline: 2px solid var(--laranja);
  outline-offset: 4px;
  border-radius: var(--radius-s);
}

/* === Estados auxiliares ======================================== */

.erro {
  margin-top: var(--space-3);
  color: var(--erro);
  font-size: 0.95rem;
  font-weight: 600;
}

.loading-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) 0;
}

.dumbbell {
  color: var(--laranja);
  transform-origin: 50% 50%;
  animation: roll-dumbbell 1.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  filter: drop-shadow(0 6px 14px rgba(255, 97, 1, 0.25));
}

@keyframes roll-dumbbell {
  0%   { transform: rotate(0deg)   translateY(0); }
  50%  { transform: rotate(180deg) translateY(-8px); }
  100% { transform: rotate(360deg) translateY(0); }
}

.loading-text {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--bruma);
  margin: 0;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === Wrappers de ícones de tela =================================== */

.check-wrap,
.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  margin-bottom: var(--space-3);
  position: relative;
}

.check-wrap { background: rgba(255, 97, 1, 0.12); }
.icon-wrap-neutro { background: rgba(107, 107, 115, 0.12); }
.icon-wrap-alerta { background: rgba(232, 147, 36, 0.14); }

/* anel decorativo sutil em torno do wrap (mesmo tom do bg, mais leve) */
.icon-wrap::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px dashed currentColor;
  opacity: 0.18;
}

.icon-wrap-neutro { color: var(--bruma); }
.icon-wrap-alerta { color: var(--ambar); }

.icon-broken-link,
.icon-warning {
  color: inherit;
  filter: drop-shadow(0 4px 10px rgba(14, 14, 16, 0.08));
}

/* leve afastamento dos dois elos quando a tela entra — micro-narrativa de "quebrou" */
.icon-broken-link path:nth-child(1) { animation: link-left 600ms 120ms ease-out both; }
.icon-broken-link path:nth-child(2) { animation: link-right 600ms 120ms ease-out both; }

@keyframes link-left {
  from { transform: translateX(4px); opacity: 0.4; }
  to   { transform: translateX(0);   opacity: 1; }
}
@keyframes link-right {
  from { transform: translateX(-4px); opacity: 0.4; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* triângulo de alerta dá uma "batidinha" curta quando entra */
.icon-warning { animation: warn-bounce 700ms 100ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }

@keyframes warn-bounce {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* halo pulsante no anel do alerta (sutil) */
.icon-wrap-alerta::before {
  animation: halo-pulse 2.4s ease-in-out infinite;
}

@keyframes halo-pulse {
  0%, 100% { opacity: 0.18; transform: scale(1); }
  50%      { opacity: 0.32; transform: scale(1.04); }
}

/* === Tela inválido / expirado (centralizadas, enxutas) =========== */

.tela-invalido,
.tela-expirado {
  min-height: 50dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
}

.tela-invalido .headline,
.tela-expirado .headline {
  margin: 0;
  max-width: 22ch;
}

.icon-hourglass {
  color: inherit;
  filter: drop-shadow(0 4px 10px rgba(14, 14, 16, 0.08));
  animation: hourglass-flip 1200ms 100ms cubic-bezier(0.34, 1.32, 0.64, 1) both;
}

@keyframes hourglass-flip {
  0%   { transform: rotate(-12deg) scale(0.9); opacity: 0; }
  60%  { transform: rotate(4deg) scale(1.03); opacity: 1; }
  100% { transform: rotate(0deg) scale(1); opacity: 1; }
}

/* === Tela erro (centralizada, padronizada) ======================= */

.tela-erro {
  min-height: 50dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-3);
}

.tela-erro .headline {
  margin: 0;
  max-width: 22ch;
}

.tela-erro .subtitle {
  margin: 0;
  max-width: 28ch;
}

/* === Tela loading (centralizada) ================================= */

.tela-loading {
  min-height: 50dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Tela finalizado (centralizada) ============================== */

.tela-finalizado {
  min-height: 50dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-2);
}

.tela-finalizado .headline {
  margin: 0;
  max-width: 22ch;
}

.tela-finalizado .subtitle {
  margin: 0;
  max-width: 28ch;
}

.check {
  color: var(--laranja);
}

.check path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: drawCheck 700ms 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

/* === Breakpoints ============================================== */

@media (min-width: 560px) {
  .page {
    padding: var(--space-7) var(--space-5);
  }
  .actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .btn-primary { min-width: 240px; }
  .btn-link { padding-left: var(--space-3); padding-right: var(--space-3); }
}

@media (min-width: 900px) {
  .banner {
    height: clamp(240px, 24vw, 360px);
  }
  .banner-img {
    object-position: center 40%;
  }
}

/* === Acessibilidade ============================================ */

:focus-visible {
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .check path {
    stroke-dashoffset: 0;
  }
  .tela {
    animation: none;
  }
}
