/* apps/animate/public/app.css — Playful Jackbox components */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  overscroll-behavior: none;
  /* App has no scrollable content by design — locking position:fixed kills
     iOS/Android rubber-band bounce and any residual page scroll that a
     drag-to-draw gesture could otherwise trigger. */
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: var(--sp-4);
  padding-top: calc(var(--sp-4) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
}
.screen.active { display: flex; }

/* topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  min-height: var(--tap-min);
}
.step-pill {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-title);
  color: var(--c-ink);
  background: var(--c-bg-elevated);
  border: var(--bw-thick) solid var(--c-ink);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.title-row {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-title);
  flex: 1;
  text-align: center;
}
.icon-btn {
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--r-pill);
  border: var(--bw-thick) solid var(--c-ink);
  background: var(--c-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--c-ink);
  flex: none;
  padding: 0;
  cursor: pointer;
}
.icon-btn.spacer { visibility: hidden; }

/* canvas */
.canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-4);
  min-height: 0;
}
.canvas-frame {
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  background: #fffdf7;
  border: var(--bw-thick) solid var(--c-ink);
  border-radius: var(--r-card);
  position: relative;
  overflow: hidden;
  touch-action: none;
}
.canvas-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#onion-canvas { opacity: .28; pointer-events: none; }
.onion-note {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  color: var(--c-text-muted);
  background: var(--c-bg-elevated);
  border-radius: var(--r-sm);
  padding: var(--sp-1) var(--sp-2);
  z-index: 3;
  pointer-events: none;
}
.loop-badge {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-3);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-caption);
  background: var(--c-ink);
  color: var(--c-bg);
  border-radius: var(--r-pill);
  padding: var(--sp-1) var(--sp-3);
  z-index: 3;
}

/* toolbar */
.toolbar { display: flex; flex-direction: column; gap: var(--sp-3); }
.palette-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1); }
.palette { display: flex; gap: var(--sp-1); }
.swatch {
  width: var(--sz-swatch);
  height: var(--sz-swatch);
  border-radius: var(--r-pill);
  border: var(--bw-thick) solid var(--c-ink);
  padding: 0;
  cursor: pointer;
}
.swatch.active { outline: 3px solid var(--c-accent); outline-offset: 2px; }

.brushes {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--c-bg-elevated);
  border-radius: var(--r-pill);
  padding: var(--sp-1) var(--sp-2);
  border: var(--bw-thick) solid var(--c-ink);
  flex: none;
}
.brush-btn { background: none; border: none; padding: var(--sp-1); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.brush-dot { border-radius: 50%; background: var(--c-ink); opacity: .35; }
.brush-btn.active .brush-dot { opacity: 1; background: var(--c-accent); }

.actions-row { display: flex; align-items: center; gap: var(--sp-3); }
.btn {
  height: var(--tap-min);
  border-radius: var(--r-pill);
  border: var(--bw-thick) solid var(--c-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  cursor: pointer;
  background: var(--c-bg);
  color: var(--c-text);
}
.btn-ghost { flex: 0 0 auto; padding: 0 var(--sp-4); color: var(--c-text-muted); }
.btn-ghost:disabled { opacity: .4; cursor: default; }
.btn-primary { flex: 1; background: var(--c-accent); color: var(--c-accent-fg); border-color: var(--c-ink); }

/* Inside real Telegram, tg.MainButton is the primary CTA (native, sticky) —
   showing our own page-level primary button too duplicates it visually.
   The .page-cta buttons only exist as a fallback for local/browser testing,
   where MainButton renders no visible UI at all. See app.js `inTG`. */
.in-tg .page-cta { display: none; }
.in-tg .actions-row { justify-content: center; }

/* start screen */
.start-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-5);
}
.mascot { width: 140px; height: 140px; margin-bottom: var(--sp-2); }
.app-title { font-family: var(--font-display); font-weight: 700; font-size: 34px; color: var(--c-ink); }
.app-tagline { font-size: var(--fs-body); color: var(--c-text-muted); max-width: 260px; line-height: 1.5; }
.start-cta { flex: none; margin-top: var(--sp-5); width: 100%; max-width: 320px; }

/* send-status sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  z-index: 20;
}
.sheet-backdrop.active { display: flex; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(23,20,16,.35); }
.sheet {
  position: relative;
  width: 100%;
  background: var(--c-bg);
  border: var(--bw-thick) solid var(--c-ink);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-2);
  box-shadow: 0 -12px 32px rgba(23,20,16,0.15);
}
.sheet-icon {
  width: var(--sz-icon);
  height: var(--sz-icon);
  border-radius: 50%;
  border: var(--bw-thick) solid var(--c-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: var(--sp-1);
}
.sheet-icon.success { background: var(--palette-4); }
.sheet-icon.error { background: var(--c-accent); }
.sheet-icon.loading { background: var(--c-bg-elevated); animation: spin 1.1s linear infinite; border-style: dashed; }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet-title { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-title); }
.sheet-caption { font-size: var(--fs-caption); color: var(--c-text-muted); max-width: 280px; }
.sheet .actions-row { width: 100%; margin-top: var(--sp-3); }
.hidden { display: none !important; }
