/* Pocket Party: Cloud Carnival — the toy UI kit. Cream panels, plum ink outlines, candy buttons that press down.
   One family (Fredoka), one ink colour, one radius scale (12 / 18 / 28 / pill), one press depth (6px → 1px).
   Motion: 90–120 ms presses, 280 ms pops; everything collapses under reduced motion (setting or OS). */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');

:root {
  --ink: #2a2140;
  --ink-soft: #5b4f7a;
  --paper: #fff8f2;
  --paper-2: #f6ecff;
  --sky-1: #7cc8ff;
  --sky-2: #ffd9ec;
  --coin: #ffc93c;
  --coin-dark: #d99a00;
  --crown: #ffb000;
  --good: #27c46b;
  --bad: #ff5a5f;
  --accent: #ff7ab6;
  --blue: #3d9bff;
  --r-s: 12px;
  --r-m: 18px;
  --r-l: 28px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-pop: cubic-bezier(.2, 1.3, .4, 1);
  --shadow: 0 5px 0 var(--ink);
  /* the toy sheen: a light top edge and a soft shade along the bottom, inside the outline */
  --gloss: inset 0 3px 0 rgba(255, 255, 255, .4), inset 0 -4px 0 rgba(42, 33, 64, .13);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font: 600 16px/1.3 Fredoka, 'Rubik', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(60% 40% at 15% 8%, rgba(255, 255, 255, .45), transparent 70%),
    radial-gradient(50% 35% at 90% 85%, rgba(255, 255, 255, .35), transparent 70%),
    linear-gradient(180deg, var(--sky-1), var(--sky-2));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.hide { display: none !important; }

/* ── panels and buttons ─────────────────────────────────────────────── */
.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--r-l);
  box-shadow: var(--shadow), inset 0 3px 0 #fff;
}
.btn {
  --c: var(--accent);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 22px;
  border: 3px solid var(--ink); border-radius: var(--r-m);
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 52%), var(--c);
  color: #fff;
  font-weight: 700; font-size: 20px; letter-spacing: .01em;
  text-shadow: 0 2px 0 rgba(42, 33, 64, .35);
  box-shadow: 0 6px 0 var(--ink), var(--gloss);
  transition: transform 110ms var(--ease-out), box-shadow 110ms var(--ease-out), filter 150ms;
  cursor: pointer;
  touch-action: manipulation;
}
.btn .ico { filter: drop-shadow(0 1.5px 0 rgba(42, 33, 64, .25)); }
.btn.light { --c: var(--paper); color: var(--ink); text-shadow: none; box-shadow: 0 6px 0 var(--ink), inset 0 -4px 0 rgba(42, 33, 64, .08); }
.btn.good { --c: var(--good); }
.btn.bad { --c: var(--bad); }
.btn.gold { --c: var(--coin); color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.btn.blue { --c: var(--blue); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink), var(--gloss); filter: brightness(1.05) saturate(1.05); }
  .btn.light:hover { box-shadow: 0 8px 0 var(--ink), inset 0 -4px 0 rgba(42, 33, 64, .08); }
}
.btn:active, .btn.down {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--ink), inset 0 3px 0 rgba(42, 33, 64, .14);
  filter: brightness(.97);
  transition-duration: 50ms;
}
.btn:disabled, .btn.off { filter: grayscale(.7) brightness(.95); opacity: .6; pointer-events: none; box-shadow: 0 4px 0 var(--ink); }
.btn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.btn.sent { animation: sent .45s var(--ease-pop); }
@keyframes sent { 0% { transform: translateY(5px); } 45% { transform: translateY(-2px) scale(1.04); } 100% { transform: none; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--paper); border: 2.5px solid var(--ink);
  box-shadow: inset 0 -3px 0 rgba(42, 33, 64, .07);
  font-size: 15px;
}

/* ── icons, portraits, symbols ───────────────────────────────────────── */
.ico { width: 1.2em; height: 1.2em; display: inline-block; vertical-align: -0.22em; flex: none; }
img.portrait { display: block; object-fit: cover; border-radius: 50%; flex: none; }
.sym { --c: var(--blue); width: 28px; height: 28px; border-radius: 50%; background: var(--c); border: 2.5px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(42, 33, 64, .18);
  display: inline-grid; place-items: center; flex: none; }
.sym svg { width: 62%; height: 62%; fill: #fff; stroke: var(--ink); stroke-width: 1.2; }

/* ── timer ring ──────────────────────────────────────────────────────── */
.timer { --p: 1; width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), rgba(42, 33, 64, .12) 0);
  display: grid; place-items: center; border: 2.5px solid var(--ink); }
.timer b { width: 32px; height: 32px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-size: 14px; }

/* ── toasts and banners ──────────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column;
  gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 999px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink), inset 0 2px 0 #fff;
  font-weight: 700; animation: toast-in .3s var(--ease-pop) both; }
.toast.out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

.banner { position: fixed; left: 50%; top: 42%; z-index: 70; transform: translate(-50%, -50%);
  padding: 14px 34px; border-radius: var(--r-l); background: var(--paper); border: 4px solid var(--ink); box-shadow: 0 8px 0 var(--ink), inset 0 4px 0 #fff;
  font-size: clamp(28px, 5vw, 64px); font-weight: 700; white-space: nowrap; pointer-events: none;
  animation: banner 1.4s var(--ease-pop) forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(-4deg); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(1deg); }
  24% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.98); }
}

/* ── reduced motion: the setting or the OS preference ───────────────── */
html.rm *, html.rm *::before, html.rm *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
