/* ========================================================
   BASE UI — Reset, Fundo Zine, Topbar, Ransom Title, Fitas,
   Botões, Formulários, Avatares, Modal & Toast
   ======================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  background: var(--bg-asphalt);
  color: var(--ink-light);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: #0b0b0e;
  transition: background-color 0.4s ease;
}

#bg-paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-color: #0b0b0e;
  background-image:
    radial-gradient(ellipse at 50% 45%, rgba(11, 11, 14, 0.14) 0%, rgba(11, 11, 14, 0.48) 100%),
    url('../assets/bg-zine.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

#bg-doodles {
  display: none;
}

#app-shell {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  transition: max-width 0.3s ease;
}

body.is-wide-view #app-shell {
  max-width: 920px;
}

/* Camadas fixas de FX */
#fx-confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 900;
}

#fx-reactions-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 850;
}

.floating-reaction {
  position: absolute;
  bottom: 84px;
  font-size: 2.4rem;
  user-select: none;
  will-change: transform, opacity;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55));
  animation: floatReaction 2.3s ease-out forwards;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 8px;
  z-index: 20;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-poster);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--ink-light);
}

.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: var(--zine-pink);
  color: var(--zine-yellow);
  border: 2px solid #ffffff;
  font-family: var(--font-poster);
  font-size: 0.95rem;
  transform: rotate(-6deg);
  box-shadow: 3px 3px 0 #000;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid rgba(250, 247, 240, 0.22);
  background: rgba(23, 23, 29, 0.85);
  color: var(--ink-light);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.16s var(--ease-spring), border-color 0.16s ease;
}

.icon-btn:hover { border-color: var(--zine-yellow); }
.icon-btn:active { transform: scale(0.92); }

.mode-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 6px;
  border: 2px solid rgba(250, 247, 240, 0.26);
  background: rgba(20, 20, 26, 0.88);
  color: var(--ink-light);
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mode-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--zine-green);
}

.mode-pill.is-demo .dot {
  background: var(--zine-yellow);
}

/* Container de cada tela */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 18px 28px;
  gap: 18px;
}

.screen.has-reaction-bar {
  padding-bottom: 104px;
}

/* Ransom Note Title */
.ransom-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px 6px;
  line-height: 1;
  margin: 2px 0;
}

.ransom-title.align-left { justify-content: flex-start; }

.ransom-tile {
  display: inline-block;
  font-family: var(--font-poster);
  font-size: clamp(1.55rem, 6.2vw, 2.35rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 4px 10px 3px;
  color: #111115;
  background: #f8f5ee;
  transform: rotate(var(--r, -1.5deg));
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.75);
  border: 1.5px solid rgba(0, 0, 0, 0.25);
  line-height: 1.02;
}

.ransom-tile.sm {
  font-size: clamp(1.25rem, 4.6vw, 1.65rem);
  padding: 3px 8px 2px;
}

.ransom-tile.c-white { background: #f9f6ee; color: #111115; }
.ransom-tile.c-pink { background: var(--zine-pink); color: #111115; }
.ransom-tile.c-yellow { background: var(--zine-yellow); color: #111115; }
.ransom-tile.c-green { background: #4be396; color: #111115; }
.ransom-tile.c-peach { background: #ff9c63; color: #111115; }
.ransom-tile.c-cyan { background: #3ad7f4; color: #111115; }
.ransom-tile.c-dark { background: #191920; color: #f9f6ee; border-color: #f9f6ee; }

.zine-subline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e6e2d8;
  text-align: center;
}

.paper-strip-sub {
  display: inline-block;
  margin: 2px auto 0;
  background: #ece5d5;
  color: #111115;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 18px;
  transform: rotate(-1.2deg);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.55);
  clip-path: polygon(1% 4%, 99% 0%, 100% 96%, 97% 100%, 91% 92%, 86% 100%, 14% 98%, 8% 100%, 2% 93%, 0% 98%);
}

.section-heading {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-top: 6px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Fitas adesivas */
.tape-strip {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%) rotate(-2.5deg);
  width: 96px;
  height: 24px;
  background: var(--tape-beige);
  border-left: 2px dashed rgba(0, 0, 0, 0.22);
  border-right: 2px dashed rgba(0, 0, 0, 0.22);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 6;
}

.tape-strip.silver { background: var(--tape-silver); }
.tape-strip.tl { top: -10px; left: -14px; transform: rotate(-34deg); width: 78px; height: 22px; }
.tape-strip.tr { top: -8px; left: auto; right: -16px; transform: rotate(32deg); width: 82px; height: 22px; }
.tape-strip.bl { top: auto; bottom: -8px; left: -14px; transform: rotate(36deg); width: 72px; height: 20px; }
.tape-strip.br { top: auto; bottom: -10px; left: auto; right: -14px; transform: rotate(-35deg); width: 74px; height: 20px; }

/* Superfície Papel + Stickers */
.paper-sheet {
  position: relative;
  background: var(--bg-paper);
  color: var(--ink-dark);
  border-radius: 10px;
  padding: 24px 20px;
  box-shadow: var(--shadow-paper);
  border: 2.5px solid #111115;
}

.paper-sheet.torn-bottom {
  clip-path: polygon(
    0 0, 100% 0, 100% calc(100% - 9px),
    96% 100%, 91% calc(100% - 6px), 85% 100%, 79% calc(100% - 8px),
    72% 100%, 65% calc(100% - 6px), 58% 100%, 51% calc(100% - 8px),
    44% 100%, 37% calc(100% - 6px), 30% 100%, 23% calc(100% - 8px),
    16% 100%, 9% calc(100% - 6px), 3% 100%, 0 calc(100% - 8px)
  );
  padding-bottom: 30px;
}

.pill-sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #111115;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.96rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 5px 13px;
  border-radius: 999px;
  border: 2.5px solid #111115;
  box-shadow: 0 0 0 3px #ffffff, 3px 5px 0 rgba(0, 0, 0, 0.55);
  transform: rotate(-5deg);
  white-space: nowrap;
}

.mini-sticker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  background: #111115;
  color: #ffffff;
  border: 1.5px solid #111115;
}

.mini-sticker.yellow { background: var(--zine-yellow); color: #111115; }
.mini-sticker.pink { background: var(--zine-pink); color: #ffffff; }
.mini-sticker.cyan { background: var(--zine-teal); color: #111115; }
.mini-sticker.green { background: var(--zine-mint); color: #111115; }

.stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-marker);
  font-size: 0.96rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 6px;
  border: 3px solid currentColor;
  transform: rotate(-5deg);
  line-height: 1.1;
  user-select: none;
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.45);
}

.stamp-pink { color: var(--zine-pink); background: #ffffff; }
.stamp-green { color: #0a7d43; background: #e8fff2; }
.stamp-yellow { color: #111115; background: var(--zine-yellow); border-color: #111115; }
.stamp-cyan { color: #006f7d; background: #e6fcff; }
.stamp-red-dark { color: #ffffff; background: var(--zine-pink); border-color: #ffffff; }

/* Botões & Inputs */
.btn {
  appearance: none;
  border: 2.5px solid #111115;
  font-family: var(--font-poster);
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  transition: transform 0.16s var(--ease-spring), filter 0.16s ease;
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.78);
  text-decoration: none;
}

.btn:active:not(:disabled) { transform: scale(0.96) translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--zine-pink); color: #ffffff; border-color: #ffffff; }
.btn-yellow { background: var(--zine-yellow); color: #111115; border-color: #111115; }
.btn-green { background: var(--zine-mint); color: #111115; border-color: #111115; }
.btn-ghost {
  background: rgba(23, 23, 29, 0.9);
  color: var(--ink-light);
  border: 2px solid rgba(250, 247, 240, 0.24);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.98rem;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.6);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--zine-yellow); }
.btn-paper-outline { background: transparent; color: #111115; border: 2.5px solid #111115; box-shadow: none; }
.btn-sm { min-height: 42px; padding: 8px 13px; font-size: 0.94rem; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.96rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-dark);
}

.input-zine {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 2.5px solid #111115;
  background: #ffffff;
  color: #111115;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
}

.input-zine:focus { outline: none; border-color: var(--zine-pink); box-shadow: 0 0 0 3px rgba(255, 30, 122, 0.24); }
.input-zine.on-dark { background: rgba(23, 23, 29, 0.92); border-color: rgba(250, 247, 240, 0.34); color: var(--ink-light); }
.input-zine.code-input { font-family: var(--font-mono); font-weight: 800; font-size: 1.25rem; letter-spacing: 0.22em; text-transform: uppercase; text-align: center; }

/* Avatares Sticker */
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.avatar-option {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2.5px solid transparent;
  background: rgba(17, 17, 21, 0.08);
  padding: 4px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.18s var(--ease-spring), border-color 0.16s ease, background 0.16s ease;
}
.avatar-option.is-selected {
  border-color: #111115;
  background: var(--zine-yellow);
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 3px 3px 0 #111115;
}

.avatar-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), 0 0 0 1.5px #111115;
}
.avatar-circle.sm { width: 40px; height: 40px; border-radius: 50%; }
.avatar-option .avatar-circle.sm { width: 44px; height: 44px; }

.divider-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-muted);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider-or::before, .divider-or::after {
  content: '';
  flex: 1;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(250, 247, 240, 0.25) 0 6px, transparent 6px 12px);
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 700;
}

.modal-sheet {
  width: 100%;
  max-width: 420px;
  background: var(--bg-paper);
  color: #111115;
  border-radius: 10px;
  border: 3px solid #111115;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 6px 8px 0 rgba(0, 0, 0, 0.75);
  position: relative;
}

.toast-stack {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 950;
  pointer-events: none;
}

.toast-item {
  background: #111115;
  color: #faf7f0;
  border: 2.5px solid var(--zine-yellow);
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.7);
  animation: stickerPop 0.3s var(--ease-spring) both;
}

.toast-item.is-danger { border-color: var(--zine-pink); background: #2b0b18; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.muted-note { font-size: 0.8rem; color: var(--ink-muted); }

.qr-box {
  background: #ffffff;
  padding: 10px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  margin: 0 auto;
  border: 2.5px solid #111115;
}
