/* ============================================================
   PERROMÁTICAS · base.css
   Sticker-book toy-box: cream paper, chunky ink outlines,
   hard offset shadows, bouncy rounded everything.
   ============================================================ */

:root {
  --paper:      #FFF4DE;
  --paper-dot:  #F3E1BD;
  --card:       #FFFDF6;
  --ink:        #4A2C17;
  --ink-soft:   #8A6A4A;
  --mango:      #FF9F2E;
  --mango-deep: #F2832A;
  --teal:       #23BCAB;
  --teal-deep:  #14998B;
  --sun:        #FFD24A;
  --coral:      #FF5D73;
  --coral-deep: #E63E56;
  --grass:      #8CCF52;
  --grass-deep: #6FB23A;
  --sky:        #A8E4F2;
  --pink:       #FF8FA8;

  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --font: "Baloo 2", "Comic Sans MS", "Chalkboard SE", ui-rounded, system-ui, sans-serif;
}

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

html, body { margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--paper-dot) 2.2px, transparent 2.6px);
  background-size: 28px 28px;
  -webkit-tap-highlight-color: transparent;
}

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

button { font-family: inherit; }

:focus-visible {
  outline: 3px dashed var(--teal-deep);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Sticker buttons ---------- */

.btn {
  --btn: var(--sun);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  background: var(--btn);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: .6em 1.3em;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn:disabled {
  filter: grayscale(.8) opacity(.55);
  cursor: not-allowed;
}
.btn--teal   { --btn: var(--teal);   color: #fff; }
.btn--mango  { --btn: var(--mango);  color: #fff; }
.btn--coral  { --btn: var(--coral);  color: #fff; }
.btn--grass  { --btn: var(--grass); }
.btn--card   { --btn: var(--card); }
.btn--big    { font-size: 1.35rem; padding: .65em 1.5em; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  font-size: 22px;
  line-height: 1;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  text-decoration: none;
  transition: transform .08s ease, box-shadow .08s ease;
}
.iconbtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

/* ---------- Pills & badges ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  font-weight: 800;
  font-size: 1rem;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: .3em .8em;
  box-shadow: 0 4px 0 var(--ink);
  white-space: nowrap;
}
.pill.bump { animation: pillBump .4s ease; }
@keyframes pillBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18) rotate(-3deg); }
  100% { transform: scale(1); }
}

.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  background: var(--coral);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: .15em .7em;
  transform: rotate(-4deg);
  box-shadow: 0 3px 0 var(--ink);
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar .spacer { flex: 1; }

/* ---------- Sheets & modals ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 44, 23, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 90;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: var(--card);
  border: 3px solid var(--ink);
  border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform .3s cubic-bezier(.3, 1.3, .6, 1);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sheet.open { transform: translateY(0); }
.sheet h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
  text-align: center;
}
.sheet .grab {
  width: 52px; height: 6px;
  border-radius: 99px;
  background: var(--ink-soft);
  opacity: .4;
  margin: 0 auto 12px;
}

@media (min-width: 700px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(560px, 94vw);
    transform: translate(-50%, calc(100% + 40px));
    border-bottom: 3px solid var(--ink);
    border-radius: var(--r-xl);
    box-shadow: 0 8px 0 var(--ink);
  }
  .sheet.open { transform: translate(-50%, 0); }
}

/* ---------- Music dock ---------- */

.pm-music {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.pm-music .iconbtn { width: 42px; height: 42px; font-size: 19px; }

.pm-toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  z-index: 200;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  font-size: .95rem;
  padding: .45em 1.1em;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Floating notes & particles ---------- */

.float-note {
  position: absolute;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
  text-shadow: 0 2px 0 var(--card);
  pointer-events: none;
  animation: floatNote 1.4s ease-out forwards;
  z-index: 30;
  white-space: nowrap;
}
@keyframes floatNote {
  0%   { opacity: 0; transform: translateY(8px) scale(.7); }
  18%  { opacity: 1; transform: translateY(0) scale(1.05); }
  100% { opacity: 0; transform: translateY(-70px) scale(1); }
}

.heart-pop {
  position: absolute;
  font-size: 1.3rem;
  pointer-events: none;
  animation: heartPop 1.1s ease-out forwards;
  z-index: 30;
}
@keyframes heartPop {
  0%   { opacity: 0; transform: translateY(6px) scale(.5); }
  25%  { opacity: 1; transform: translateY(-14px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-64px) scale(.9) rotate(12deg); }
}

.confetti-bit {
  position: absolute;
  width: 10px; height: 14px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  pointer-events: none;
  animation: confettiFall 1.6s ease-in forwards;
  z-index: 300;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-10px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(46vh) rotate(560deg); }
}

/* ---------- Helpers ---------- */

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
}
