/* Calhou.me! retro console theme. Mobile first. */

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/press-start-2p-latin.woff2") format("woff2");
}

:root {
  --bg: #121830;
  --stage: #1d2440;
  --stage-2: #262f52;
  --edge: #3a4572;
  --deep: #0e1328;
  --text: #ffffff;
  --muted: #c9d1dc;
  --accent: #f7d046;
  --accent-dark: #b8941f;
  --error: #ffb4ab;
  --error-bg: #3d1a24;
  --error-edge: #ff6b6b;
  --ok: #7fd36a;
  --pixel-font: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --body-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --px: 4px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* Faint pixel starfield. */
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1.5px),
    radial-gradient(rgba(247, 208, 70, 0.06) 1px, transparent 1.5px);
  background-size: 48px 48px, 72px 72px;
  background-position: 0 0, 24px 36px;
  color: var(--text);
  font-family: var(--body-font);
  font-size: 1.125rem; /* 18px */
  line-height: 1.6;
  overflow-wrap: break-word;
}

img,
svg {
  max-width: 100%;
}

/* ---------- Links and focus ---------- */

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: #fff3b0;
}

:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--stage);
  font-weight: 700;
}

.skip:focus {
  top: 16px;
}

/* ---------- Page frame ---------- */

.wrap {
  flex: 1;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

.site-header {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 16px 16px 0;
}

.logo-small {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 4px;
  font-family: var(--pixel-font);
  font-size: 1.125rem;
  color: var(--accent);
  text-decoration: none;
  text-shadow: 3px 3px 0 var(--deep);
}

/* ".me" in the wordmark: a little smaller, in the pink accent. */
.logo-tld {
  font-size: 0.75em;
  color: var(--pink, #ff6fae);
}

/*
 * Pixel section heading (home "Como funciona", "Perguntas frequentes", "Sharing is caring"
 * and the footer "Mais sobre o Calhou.me"): pixel font between two pairs of little squares.
 */
.pixel-h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 20px;
  font-family: var(--pixel-font);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pixel-h2::before,
.pixel-h2::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--accent);
  box-shadow: 12px 0 0 0 var(--accent-dark);
  /* The darker square is a box-shadow (no layout space): reserve room so it doesn't touch the text. */
  margin-right: 12px;
}

.pixel-h2::after {
  box-shadow: -12px 0 0 0 var(--accent-dark);
  margin-right: 0;
  margin-left: 12px;
}

/* Footer variant: a touch smaller, tighter to the links below. */
.site-footer .pixel-h2 {
  margin: 8px 0 4px;
  font-size: 0.75rem;
}

.site-footer {
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 16px 16px 32px;
  text-align: center;
  font-size: 1rem;
}

.site-footer p {
  margin: 4px 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
}

/* Phones: the footer links in a tidy 2x2 grid (each link stays a 48px tap target). */
@media (max-width: 34rem) {
  .footer-links {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    justify-items: start;
    gap: 0 8px;
  }
}

/*
 * Footer items: a row of little game items. Each has its own colour (--fc) for the
 * icon tile ring, the pixel underline and the focus ring; the text stays neutral.
 */
.site-footer .footer-link {
  --fc: var(--accent);
  gap: 10px;
  padding: 0 8px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
}

.site-footer .footer-link--green {
  --fc: #7fd36a;
}

.site-footer .footer-link--blue {
  --fc: #9fd0f5;
}

.site-footer .footer-link--gold {
  --fc: #f7d046;
}

.site-footer .footer-link--lilac {
  --fc: #c3a6ff;
}

/* Footer icons sit directly next to the label, coloured per item, without a tile box. */
.footer-tile {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  transition: transform 0.12s steps(2);
}

.footer-tile .icon {
  margin-top: -2px;
}

.footer-label {
  padding-bottom: 3px;
  background: linear-gradient(var(--fc), var(--fc)) left bottom / 100% 2px no-repeat;
  background-size: 100% 2px;
  transition: background-size 0.12s steps(2), color 0.12s;
}

.site-footer .footer-link:hover,
.site-footer .footer-link:focus-visible {
  color: #ffffff;
}

.site-footer .footer-link:hover .footer-label,
.site-footer .footer-link:focus-visible .footer-label {
  background-size: 100% 4px;
}

.site-footer .footer-link:focus-visible {
  outline: 3px solid var(--fc);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .site-footer .footer-link:hover .footer-tile {
    transform: translateY(-2px);
  }
}

/* ---------- "Sobre este site" modal (src/views/about.tsx) ---------- */

.about {
  --about-bubble-bg: #fff8e7;
}

/* Portrait on the left, speech bubble on the right with its tail pointing at the portrait. */
.about-hero {
  display: flex;
  align-items: flex-start;
  gap: 50px;
  margin: 4px 4px 0;
}

.about-portrait {
  flex: none;
  width: 176px;
  margin: 4px 0 10px;
  box-shadow:
    4px 0 0 0 var(--edge),
    -4px 0 0 0 var(--edge),
    0 4px 0 0 var(--edge),
    0 -4px 0 0 var(--edge),
    0 10px 0 0 var(--deep);
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

/* Easter egg: the winking pose sits on top of the portrait and blinks in (2 pixel steps)
   on hover, keyboard focus, or when a tap sets aria-pressed (public/js/modal.js). */
.about-wink {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.about-wink:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 7px;
}

.about-wink-alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 120ms steps(2, end);
}

.about-wink:focus-visible .about-wink-alt,
.about-wink[aria-pressed="true"] .about-wink-alt {
  opacity: 1;
}

@media (hover: hover) {
  .about-wink:hover .about-wink-alt {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .about-wink-alt {
    transition: none;
  }
}

/* Pixel bubble: a 4 px dark border drawn with box-shadows (notched pixel corners). */
.about-bubble {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin-top: 8px;
  padding: 12px 16px;
  background: var(--about-bubble-bg);
  color: var(--deep);
  font-size: 1rem;
  line-height: 1.4;
  box-shadow:
    4px 0 0 0 var(--deep),
    -4px 0 0 0 var(--deep),
    0 4px 0 0 var(--deep),
    0 -4px 0 0 var(--deep),
    6px 10px 0 0 rgba(8, 11, 26, 0.55);
  transform-origin: -44px 84px;
}

.about-bubble p {
  margin: 0 0 8px;
}

.about-bubble p:last-child {
  margin-bottom: 0;
}

.about-hello {
  font-family: var(--pixel-font);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #b8326f;
}

/* The tail: 4 px pixel cells drawn as box-shadows of one cell, pointing left at the portrait. */
.about-bubble::before {
  content: "";
  position: absolute;
  left: 0;
  top: 52px;
  width: 4px;
  height: 4px;
  background: var(--about-bubble-bg);
  box-shadow:
    -4px 0 0 0 var(--deep),
    -12px 4px 0 0 var(--deep),
    -8px 4px 0 0 var(--deep),
    -4px 4px 0 0 var(--deep),
    -20px 8px 0 0 var(--deep),
    -16px 8px 0 0 var(--deep),
    -12px 8px 0 0 var(--deep),
    -8px 8px 0 0 var(--about-bubble-bg),
    -4px 8px 0 0 var(--about-bubble-bg),
    -24px 12px 0 0 var(--deep),
    -20px 12px 0 0 var(--deep),
    -16px 12px 0 0 var(--about-bubble-bg),
    -12px 12px 0 0 var(--about-bubble-bg),
    -8px 12px 0 0 var(--about-bubble-bg),
    -4px 12px 0 0 var(--about-bubble-bg),
    -32px 16px 0 0 var(--deep),
    -28px 16px 0 0 var(--deep),
    -24px 16px 0 0 var(--deep),
    -20px 16px 0 0 var(--about-bubble-bg),
    -16px 16px 0 0 var(--about-bubble-bg),
    -12px 16px 0 0 var(--about-bubble-bg),
    -8px 16px 0 0 var(--about-bubble-bg),
    -4px 16px 0 0 var(--about-bubble-bg),
    -40px 20px 0 0 var(--deep),
    -36px 20px 0 0 var(--deep),
    -32px 20px 0 0 var(--deep),
    -28px 20px 0 0 var(--about-bubble-bg),
    -24px 20px 0 0 var(--about-bubble-bg),
    -20px 20px 0 0 var(--about-bubble-bg),
    -16px 20px 0 0 var(--about-bubble-bg),
    -12px 20px 0 0 var(--about-bubble-bg),
    -8px 20px 0 0 var(--about-bubble-bg),
    -4px 20px 0 0 var(--about-bubble-bg),
    -44px 24px 0 0 var(--deep),
    -40px 24px 0 0 var(--deep),
    -36px 24px 0 0 var(--deep),
    -32px 24px 0 0 var(--deep),
    -28px 24px 0 0 var(--deep),
    -24px 24px 0 0 var(--deep),
    -20px 24px 0 0 var(--about-bubble-bg),
    -16px 24px 0 0 var(--about-bubble-bg),
    -12px 24px 0 0 var(--about-bubble-bg),
    -8px 24px 0 0 var(--about-bubble-bg),
    -4px 24px 0 0 var(--about-bubble-bg),
    -24px 28px 0 0 var(--deep),
    -20px 28px 0 0 var(--deep),
    -16px 28px 0 0 var(--deep),
    -12px 28px 0 0 var(--deep),
    -8px 28px 0 0 var(--deep),
    -4px 28px 0 0 var(--deep);
}

.about-section {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 4px solid var(--edge);
}

.about-section p {
  margin: 0;
}

.modal-body .about-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

/* The PayPal button and the thanks side by side; they stack on narrow screens. */
.donate-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 28px;
  margin-top: 14px;
}

.donate-btn {
  flex: 1 1 14rem;
  max-width: 18rem;
  flex-direction: row;
}

.donate-soon {
  padding: 2px 6px;
  font-family: var(--pixel-font);
  font-size: 0.5625rem;
  font-weight: 400;
  color: var(--stage);
  background: var(--muted);
  border-radius: 2px;
}

.donate-thanks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-weight: 800;
  font-size: 1.125rem;
}

/* The email is a plain inline link; vertical padding grows its tap target to 48 px. */
.about-contact a {
  padding: 12px 0;
  font-weight: 700;
  white-space: nowrap;
}

/* Narrow: bubble under the portrait, tail pointing up at it. */
@media (max-width: 560px) {
  .about-hero {
    flex-direction: column;
    align-items: center;
    gap: 36px;
  }
  .about-portrait {
    width: 136px;
  }
  .about-bubble {
    align-self: stretch;
    margin-top: 0;
    transform-origin: 50% -32px;
  }
  .about-bubble::before {
    left: calc(50% - 22px);
    top: 0;
    box-shadow:
    0 -4px 0 0 var(--deep),
    4px -8px 0 0 var(--deep),
    4px -4px 0 0 var(--deep),
    8px -12px 0 0 var(--deep),
    8px -8px 0 0 var(--deep),
    8px -4px 0 0 var(--about-bubble-bg),
    12px -20px 0 0 var(--deep),
    12px -16px 0 0 var(--deep),
    12px -12px 0 0 var(--deep),
    12px -8px 0 0 var(--about-bubble-bg),
    12px -4px 0 0 var(--about-bubble-bg),
    16px -24px 0 0 var(--deep),
    16px -20px 0 0 var(--deep),
    16px -16px 0 0 var(--about-bubble-bg),
    16px -12px 0 0 var(--about-bubble-bg),
    16px -8px 0 0 var(--about-bubble-bg),
    16px -4px 0 0 var(--about-bubble-bg),
    20px -28px 0 0 var(--deep),
    20px -24px 0 0 var(--deep),
    20px -20px 0 0 var(--about-bubble-bg),
    20px -16px 0 0 var(--about-bubble-bg),
    20px -12px 0 0 var(--about-bubble-bg),
    20px -8px 0 0 var(--about-bubble-bg),
    20px -4px 0 0 var(--about-bubble-bg),
    24px -24px 0 0 var(--deep),
    24px -20px 0 0 var(--deep),
    24px -16px 0 0 var(--about-bubble-bg),
    24px -12px 0 0 var(--about-bubble-bg),
    24px -8px 0 0 var(--about-bubble-bg),
    24px -4px 0 0 var(--about-bubble-bg),
    28px -20px 0 0 var(--deep),
    28px -16px 0 0 var(--deep),
    28px -12px 0 0 var(--deep),
    28px -8px 0 0 var(--about-bubble-bg),
    28px -4px 0 0 var(--about-bubble-bg),
    32px -12px 0 0 var(--deep),
    32px -8px 0 0 var(--deep),
    32px -4px 0 0 var(--about-bubble-bg),
    36px -8px 0 0 var(--deep),
    36px -4px 0 0 var(--deep),
    40px -4px 0 0 var(--deep);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .modal[open] .about-bubble {
    animation: about-bubble-in 360ms steps(6, end) 180ms both;
  }
}

@keyframes about-bubble-in {
  0% { opacity: 0; transform: scale(0.3); }
  70% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: none; }
}

.muted {
  color: var(--muted);
}

/* ---------- Headings ---------- */

h1,
h2,
h3 {
  line-height: 1.3;
  margin: 0 0 16px;
}

h1 {
  font-family: var(--pixel-font);
  font-weight: 400;
  font-size: clamp(1.125rem, 5vw, 1.75rem);
  line-height: 1.5;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--deep);
}

h2 {
  font-size: 1.375rem;
  color: var(--accent);
}

/* Long headings stay in the readable font. */
.title-plain {
  font-family: var(--body-font);
  font-weight: 800;
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.25;
  text-shadow: none;
}

/* ---------- Retro panels ---------- */

/* Dark console screen with a notched pixel border. */
.screen {
  position: relative;
  margin: var(--px) var(--px) 32px;
  padding: 28px 20px;
  background: var(--stage);
  box-shadow:
    var(--px) 0 0 0 var(--edge),
    calc(-1 * var(--px)) 0 0 0 var(--edge),
    0 var(--px) 0 0 var(--edge),
    0 calc(-1 * var(--px)) 0 0 var(--edge),
    0 calc(3 * var(--px)) 0 0 var(--deep);
}

.screen.center,
.center {
  text-align: center;
}

.card {
  margin: 0 0 20px;
  padding: 20px;
  background: var(--stage);
  border: 3px solid var(--edge);
  border-radius: 4px;
}

.card > :last-child {
  margin-bottom: 0;
}

.notice {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: var(--stage-2);
  color: var(--text);
}

.error {
  margin: 8px 0 16px;
  padding: 12px 16px;
  background: var(--error-bg);
  border-left: 6px solid var(--error-edge);
  color: var(--error);
  font-weight: 600;
}

.error:empty {
  display: none;
}

/* ---------- Sprites ---------- */

.pixel {
  display: inline-block;
  line-height: 0;
}

.pixel svg {
  display: block;
  image-rendering: pixelated;
}

/* ---------- Buttons ---------- */

.btn-big {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  width: 100%;
  max-width: 22rem;
  padding: 16px 24px;
  margin-bottom: 8px; /* room for the 3D edge */
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: var(--stage);
  font-family: var(--pixel-font);
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 6px 0 0 var(--accent-dark),
    0 10px 0 0 var(--deep);
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}

.btn-big:hover {
  color: var(--stage);
  background: #ffdc5c;
}

.btn-big:active {
  transform: translateY(6px);
  box-shadow:
    0 0 0 0 var(--accent-dark),
    0 4px 0 0 var(--deep);
}

.btn-big[disabled],
.btn-big[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
}

.btn-link:hover {
  color: var(--accent);
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

/* ---------- Forms ---------- */

.field {
  margin: 0 0 20px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.field .hint {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 3px solid var(--edge);
  border-radius: 4px;
  background: #ffffff;
  color: var(--deep);
  font: inherit;
  /* White fields on a dark page: native widgets (date picker icon, spinners) must use light colours. */
  color-scheme: light;
}

/* Native date input: keep the browser's own format and picker, just make the whole field clickable. */
.field input[type="date"] {
  cursor: pointer;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--error-edge);
}

.field .error {
  margin: 6px 0 0;
  padding: 6px 12px;
  font-size: 1rem;
}

/* ---------- Home ---------- */

.hero {
  text-align: center;
  padding-top: 36px;
}

.logo {
  margin: 0;
  /*
   * "Calhou.me!" is ~9.25em wide (".me" at 0.75em). The hero card's inner width is
   * 100vw - 80px on phones, so this keeps it on one line from 320px up, with room
   * for the shadow; 4rem caps it inside the 46rem column.
   */
  font-size: clamp(1.25rem, calc((100vw - 80px) / 9.6), 4rem);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--accent);
  text-shadow:
    4px 4px 0 var(--deep),
    6px 6px 0 #e23b3b;
}

.tagline {
  margin: 16px 0 0;
  font-family: var(--pixel-font);
  font-size: clamp(0.625rem, 2.6vw, 0.875rem);
  line-height: 1.8;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}

.cast {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 16px 20px;
  margin: 28px 0 8px;
}

.cast .pixel svg {
  width: 72px;
  height: 72px;
}

.pitch {
  margin: 24px auto 0;
  max-width: 26rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

.steps h2 {
  font-family: var(--pixel-font);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--stage);
  border: 3px solid var(--edge);
  border-radius: 4px;
}

.step-n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: var(--stage);
  font-family: var(--pixel-font);
  font-size: 1rem;
}

/* ---------- FAQ (home) ---------- */

.faq {
  margin: 36px 0 8px;
}

.faq h2 {
  font-family: var(--pixel-font);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.faq-item {
  margin: 0 0 10px;
  background: var(--stage);
  border: 3px solid var(--edge);
  border-radius: 4px;
}

.faq-item > summary {
  position: relative;
  padding: 14px 44px 14px 16px;
  font-weight: 700;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}

.faq-item > summary::-webkit-details-marker {
  display: none;
}

.faq-item > summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--pixel-font);
  font-size: 1rem;
  color: var(--accent);
}

.faq-item[open] > summary::after {
  content: "-";
}

.faq-item > summary:hover {
  color: var(--accent);
}

.faq-item > p {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Prose pages ---------- */

.prose .lead {
  font-size: 1.25rem;
  margin: 0 0 24px;
}

.prose ul {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

.prose li {
  margin-bottom: 8px;
}

.prose li::marker {
  color: var(--accent);
}

.prose p {
  margin: 0 0 12px;
}

/* ---------- Create draw ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 14px 6px 10px;
  background: var(--stage);
  border: 2px solid var(--edge);
  border-radius: 2px;
  cursor: pointer;
}

.check input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}

.check:has(input:checked) {
  border-color: var(--accent);
}

/* ---------- Wider screens ---------- */

@media (min-width: 40rem) {
  .wrap {
    padding-top: 40px;
  }

  .screen {
    padding: 40px 36px;
  }

  .cast {
    grid-template-columns: repeat(6, auto);
    gap: 20px;
  }

  .cast .pixel svg {
    width: 80px;
    height: 80px;
  }

  .steps ol {
    grid-template-columns: repeat(3, 1fr);
  }

  .steps li {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Motion (only when welcome) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .bob {
    animation: bob 1.2s steps(2, jump-none) infinite alternate;
  }

  .cast .bob:nth-child(2n) {
    animation-delay: 0.6s;
  }

  .cast .bob:nth-child(3n) {
    animation-delay: 0.3s;
  }

  @keyframes bob {
    from {
      transform: translateY(0);
    }
    to {
      transform: translateY(-6px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-big {
    transition: none;
  }
}

/* ---------- Result page (recipient) ---------- */

.result-page .me {
  margin-bottom: 8px;
}

.me-hello {
  margin: 12px 0 20px;
  font-size: clamp(1.375rem, 5.5vw, 1.75rem);
  color: var(--text);
}

.me-role {
  display: inline-block;
}

/* "Vamos descobrir quem te calhou?": only before the reveal. */
.me-hello:has(+ .me-sub) {
  margin-bottom: 6px;
}

.me-sub {
  margin: 0 0 20px;
  font-size: 1.125rem;
  color: var(--muted);
}

.result-page:has(.reveal[open]) .me-sub {
  display: none;
}

.result-page:has(.reveal[open]) .me-hello {
  margin-bottom: 20px;
}

.lead-big {
  font-size: 1.25rem;
  line-height: 1.5;
}

/* The whole summary (gift/slot + button) is one tap target. */
.reveal-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.reveal-trigger::-webkit-details-marker {
  display: none;
}

.reveal-trigger::marker {
  content: "";
}

.reveal-trigger:focus-visible {
  outline: none;
}

.reveal-trigger:focus-visible .btn-big {
  outline: 4px solid #ffffff;
  outline-offset: 4px;
}

.reveal-trigger:hover .btn-big {
  background: #ffdc5c;
}

.reveal-trigger:active .btn-big {
  transform: translateY(6px);
  box-shadow:
    0 0 0 0 var(--accent-dark),
    0 4px 0 0 var(--deep);
}

.reveal-trigger .btn-big {
  transition: opacity 200ms linear;
}

.reveal.playing .reveal-trigger {
  cursor: default;
}

.reveal.playing .btn-big {
  opacity: 0;
}

/* Once open, only the result remains (also the no-JS path). */
.reveal[open] > .reveal-trigger {
  display: none;
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 168px;
}

.gift {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gift .pixel svg {
  width: 128px;
  height: auto;
}

.slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--deep);
}

.slot .pixel svg {
  width: 96px;
  height: 96px;
}

.slot.hit {
  border-color: var(--ok);
}

.slot-q {
  font-family: var(--pixel-font);
  font-size: 3rem;
  line-height: 1;
  color: var(--accent);
}

.result {
  padding-top: 4px;
}

.result:focus {
  outline: none;
}

.result-lead {
  margin: 0 0 12px;
  font-family: var(--pixel-font);
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--text);
}

.result-sprite svg {
  width: 128px;
  height: 128px;
  margin: 0 auto;
}

/* The recipient: the most important text on the whole site (at least 32px). */
.result-name {
  margin: 12px 0;
  font-family: var(--body-font);
  font-weight: 800;
  font-size: clamp(2rem, 8vw, 2.75rem);
  line-height: 1.2;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--deep);
}

.result-sub {
  margin: 0 auto 20px;
  max-width: 24rem;
  font-size: 1.25rem;
  line-height: 1.5;
}

.result-details {
  list-style: none;
  margin: 0 auto;
  padding: 14px 16px;
  max-width: 28rem;
  text-align: left;
  background: var(--stage-2);
}

.result-details li + li {
  margin-top: 8px;
}

/* Confetti never blocks taps nor widens the page. */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 8px;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal:not(.playing) .gift {
    animation: shake 0.5s infinite;
  }

  .reveal.shaking .gift {
    animation: shake 0.16s infinite;
  }

  .gift-lid.fly {
    animation: lidfly 0.6s ease-in forwards;
  }

  .reveal:not(.playing) .slot-q {
    animation: blink 1s steps(2, jump-none) infinite;
  }

  .pop {
    animation: popup 0.6s ease-out both;
  }

  .confetti {
    animation-name: fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
  }

  @keyframes shake {
    0%,
    100% {
      transform: rotate(0);
    }
    25% {
      transform: rotate(-8deg);
    }
    75% {
      transform: rotate(8deg);
    }
  }

  @keyframes lidfly {
    to {
      transform: translateY(-160px) rotate(-40deg);
      opacity: 0;
    }
  }

  @keyframes popup {
    0% {
      transform: translateY(40px) scale(0.2);
      opacity: 0;
    }
    70% {
      transform: translateY(-10px) scale(1.1);
      opacity: 1;
    }
    100% {
      transform: translateY(0) scale(1);
    }
  }

  @keyframes fall {
    to {
      transform: translateY(110vh) rotate(360deg);
    }
  }

  /* Soft pulse: the "?" never fully disappears, so the slot never looks empty. */
  @keyframes blink {
    50% {
      opacity: 0.4;
    }
  }
}

@media (min-width: 40rem) {
  .stage {
    height: 200px;
  }

  .gift .pixel svg {
    width: 160px;
  }

  .result-sprite svg {
    width: 160px;
    height: 160px;
  }
}

/* ---------- Management page ---------- */

.banner-new {
  border-color: var(--accent);
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.copy-row input {
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 48px;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  background: var(--deep);
  border: 2px solid var(--edge);
  border-radius: 2px;
}

.mp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.mp {
  padding: 12px 14px;
  background: var(--stage-2);
}

/* Needs manual sharing: same calm card, only the left edge turns a muted amber. */
.mp-share {
  border-left-color: var(--accent-dark);
}

.mp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.mp-name {
  font-size: 1.125rem;
}

.mp-contact {
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
}

.p-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.9375rem;
  background: var(--deep);
  border: 2px solid var(--edge);
  border-radius: 2px;
}

.badge-ok {
  border-color: var(--ok);
}

.badge-warn {
  border-color: var(--accent);
  color: var(--accent);
}

.share-box {
  margin: 8px 0;
}

.share-warn {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.share-btns,
.mp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.mp-actions {
  margin-top: 8px;
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  background: var(--stage);
  border: 2px solid var(--edge);
  border-radius: 2px;
  cursor: pointer;
  list-style: none;
}

.btn-sm::-webkit-details-marker {
  display: none;
}

.btn-sm:hover {
  border-color: var(--accent);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--deep);
}

.btn-primary:hover {
  background: #ffdc5c;
  color: var(--deep);
}

.btn-danger {
  color: var(--error);
}

.btn-danger:hover {
  border-color: var(--error-edge);
  color: var(--error);
}

.mp-more {
  flex: 0 1 auto;
}

.mp-more[open] {
  flex: 1 1 100%;
}

.mp-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--stage);
}

/* ---------- Public character page (/p/:id) ---------- */

.char-sprite svg {
  width: 176px;
  height: 176px;
  margin: 0 auto;
}

.char-title {
  margin: 20px 0 12px;
  font-size: clamp(1.5rem, 6.5vw, 2.25rem);
  line-height: 1.25;
}

.char-title strong {
  color: var(--accent);
}
