/* === 99 — Caça-Palavras === */

/* DiDi Sans Pro — arquivos em /didi-font */
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Thin.woff") format("woff");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Thin-Italic.woff") format("woff");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Italic.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Medium-Italic.woff") format("woff");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-Bold-Italic.woff") format("woff");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DiDi Sans Pro";
  src: url("didi-font/DiDiSans-Pro-ExtraBold.woff") format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --yellow: #ffdd04;
  --orange: #e85623;
  --orange-dark: #c44619;
  --black: #000000;
  --white: #ffffff;
  --ink: #1a1a1a;
  --font: "DiDi Sans Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: var(--yellow);
  font-family: var(--font);
  color: var(--black);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

#root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Background letter grid pattern ---------- */
.bg-pattern {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.20;
}
.bg-cell {
  display: grid;
  place-items: center;
  border-right: 1px solid #ffffff;
  border-bottom: 1px solid #ffffff;
}
.bg-cell:nth-last-child(-n + 16) { border-bottom: none; }
.bg-cell:nth-child(16n) { border-right: none; }
.bg-cell > span {
  font-weight: 700;
  font-size: clamp(28px, 3.4vw, 56px);
  color: #ffffff;
  letter-spacing: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  background: var(--orange);
  color: white;
  font-family: inherit;
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.04em;
  padding: 22px 80px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--orange-dark), 0 14px 30px rgba(0,0,0,0.15);
  transition: transform 120ms ease, box-shadow 120ms ease;
  text-transform: uppercase;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--orange-dark), 0 6px 14px rgba(0,0,0,0.15);
}
.btn.ghost {
  background: transparent;
  color: var(--orange);
  border: 3px solid var(--orange);
  box-shadow: none;
}
.btn.ghost:active { transform: translateY(2px); }

/* ---------- Logo ---------- */
.logo-99 {
  display: inline-block;
}
.logo-99 svg { display: block; }

/* ---------- Splash screen ---------- */
.splash {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px;
  max-width: 1400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}
.splash .logo-99 svg { height: 77px; width: auto; }
.splash .eyebrow {
  color: var(--orange);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}
.splash h1 {
  font-size: 110px;
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: uppercase;
  white-space: pre-line;
}
.splash .lede {
  font-size: 24px;
  line-height: 1.35;
  font-weight: 500;
  max-width: 880px;
  margin: 0;
  text-wrap: pretty;
}
.splash .lede em {
  color: var(--orange);
  font-style: normal;
  font-weight: 800;
}
.splash .btn {
  font-size: 22.4px;
  padding: 17.6px 64px;
  box-shadow: 0 4.8px 0 var(--orange-dark), 0 11.2px 24px rgba(0,0,0,0.15);
}
.splash .btn:active {
  box-shadow: 0 1.6px 0 var(--orange-dark), 0 4.8px 11.2px rgba(0,0,0,0.15);
}

/* ---------- Game layout ---------- */
.game {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 40px;
  padding: 64px 80px;
  align-items: center;
}

.game-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-self: stretch;
  justify-content: flex-start;
  padding: 20px 0 0;
  min-height: 0;
}
.game-left-lower {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 24px;
  min-height: 0;
}
.game-intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.game-find {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.game-title {
  font-size: clamp(48px, 5.27vw, 82px);
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: uppercase;
  white-space: pre-line;
}
.game-sub {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}
.game-sub em {
  color: var(--orange);
  font-style: normal;
  font-weight: 800;
}

/* Word list (beaded pills) */
.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 19px;
  margin-top: 2px;
}
.word-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.word-pill .bead {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: white;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  color: transparent;
  transition: background 280ms ease, color 280ms ease, transform 280ms ease;
}
.word-pill.found .bead {
  background: var(--orange);
  color: white;
}
.word-pill.found .bead.flip {
  animation: beadPop 420ms ease-out;
}
@keyframes beadPop {
  0% { transform: scale(0.6); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Hint card */
.game-left-lower .hint-card {
  margin-top: auto;
  margin-bottom: auto;
}
.hint-card {
  flex-shrink: 0;
  border: 2px solid var(--orange);
  border-radius: 24px;
  padding: 18px 24px 18px 64px;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 500;
  position: relative;
  background: transparent;
  min-height: 82px;
  display: flex;
  align-items: center;
}
.hint-card em {
  color: var(--orange);
  font-style: normal;
  font-weight: 800;
}
.hint-card .badge {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: white;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  z-index: 1;
}
.hint-card__text {
  display: block;
  transition: opacity 320ms ease;
}
.hint-card__text.is-fading {
  opacity: 0;
}
.shield-icon {
  display: block;
  width: 24px;
  height: 24px;
}

.game .brand-99 {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 28px;
}
.game .brand-99 svg { height: 41px; width: auto; }

/* ---------- Grid ---------- */
.grid-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  align-self: stretch;
  justify-content: center;
}
.game-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.grid-card {
  background: white;
  border-radius: 36px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
  width: min(100%, 828px);
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
}
.grid {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-template-rows: repeat(var(--rows), 1fr);
  gap: 0;
}
.cell {
  position: relative;
  display: grid;
  place-items: center;
  font-size: clamp(18px, 3.13vw, 38.6px);
  font-weight: 500;
  color: var(--black);
  border-right: 1px solid rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  touch-action: none;
  user-select: none;
  z-index: 1;
}
.cell.no-r { border-right: none; }
.cell.no-b { border-bottom: none; }

/* Selection overlay sits behind letters */
.sel-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.sel-stroke {
  position: absolute;
  background: var(--orange);
  transform-origin: 0 50%;
  opacity: 0.95;
}
.sel-stroke.found { opacity: 1; }
.sel-stroke.active {
  background: var(--orange);
  opacity: 0.75;
}

/* lift letters on found stroke */
.cell.on-stroke {
  color: white;
  font-weight: 900;
  z-index: 2;
}
.cell.hint-flash {
  animation: hintFlash 1100ms ease-out 2;
}
@keyframes hintFlash {
  0%, 100% { background: transparent; color: var(--black); }
  50% { background: var(--yellow); color: var(--black); transform: scale(1.05); }
}

/* ---------- Win screen ---------- */
.win {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  padding: 64px 80px;
  align-items: center;
  max-width: 1440px;
}
.win-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  text-align: left;
}
.win-title {
  font-size: clamp(52px, 6.8vw, 108px);
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: uppercase;
  white-space: pre-line;
}
.win-lede {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  line-height: 1.35;
  max-width: 560px;
  margin: 0;
}
.win-lede em {
  color: var(--orange);
  font-style: normal;
  font-weight: 800;
}
.win-cta {
  margin-top: 8px;
  text-transform: uppercase;
}
.win-phone-wrap {
  position: relative;
  width: min(100%, clamp(280px, 30vw, 380px));
  aspect-ratio: 85 / 150;
  justify-self: center;
}
.win-phone__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  user-select: none;
}
.win-phone {
  position: absolute;
  inset: 7% 9.5% 6.5% 9.5%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: transparent;
  padding: 10% 2% 8%;
  box-sizing: border-box;
  overflow: hidden;
  container-type: inline-size;
}
.win-phone__heading {
  font-size: clamp(25.5px, 10.54cqw, 37.4px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  text-align: left;
  flex-shrink: 0;
}
.win-phone__steps-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}
.win-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3.5cqw, 14px);
  width: 100%;
}
.win-step {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3.5cqw, 14px);
  width: 100%;
  background: var(--white);
  border-radius: 999px;
  padding: clamp(10px, 3.4cqw, 14px) clamp(16px, 5.4cqw, 22px) clamp(10px, 3.4cqw, 14px) clamp(10px, 3.4cqw, 14px);
  font-size: clamp(18px, 6.9cqw, 25.5px);
  font-weight: 500;
  line-height: 1.2;
  box-sizing: border-box;
}
.win-step__num {
  flex-shrink: 0;
  width: clamp(36px, 12.5cqw, 46px);
  height: clamp(36px, 12.5cqw, 46px);
  border-radius: 999px;
  background: var(--orange);
  color: var(--white);
  font-weight: 800;
  font-size: clamp(16px, 5.6cqw, 22px);
  display: grid;
  place-items: center;
}
.win-step__text {
  flex: 1;
  min-width: 0;
}
.win-step__text strong {
  font-weight: 800;
}
.win-phone__logo {
  margin-top: 0;
  padding-top: clamp(8px, 4cqw, 20px);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}
.win-phone__logo svg {
  height: clamp(44px, 16cqw, 60px);
  width: auto;
}

/* ---------- Confetti ---------- */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.confetti span {
  position: absolute;
  width: 14px;
  height: 22px;
  top: -40px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

/* ---------- Word found popup ---------- */
.word-found-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: wordFoundOverlayIn 200ms ease-out;
}
.word-found-popup {
  position: relative;
  margin-top: 20px;
  background: var(--white);
  border-radius: 28px;
  padding: 36px 40px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  animation: wordFoundPopupIn 280ms cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}
.word-found-popup__badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--orange);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(232, 86, 35, 0.35);
}
.like-icon {
  width: 32px;
  height: auto;
  display: block;
  filter: brightness(0) invert(1);
}
.word-found-popup__text {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(28px, 4.2vw, 42px);
  font-weight: 800;
  line-height: 1;
  color: var(--black);
  white-space: nowrap;
}
.word-found-popup__logo {
  height: clamp(40px, 5.5vw, 52px);
  width: auto;
  display: block;
  border-radius: 10px;
}
@keyframes wordFoundOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wordFoundPopupIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* page transitions */
.fade-in {
  opacity: 1;
}
