/* public-mode.css — layered on top of mojiprint-ui.html when served at /public.
   Only applies when documentElement carries class="public-mode".
   Changes:
   - PiP defaults to a portrait (vertical) box.
   - A top bar shows the bit balance + countdown to Cascadia midnight.
   - Dramatic deduction: a huge red "-N BITS" flies up and fades on send. */

/* ── Blue-tinged theme override (replaces warm brown) ── */
html.public-mode {
  --bg:         #eef3fa;
  --surface:    #ffffff;
  --border:     #c7d4e4;
  --border-dark:#8aa0b8;
  --text:       #0d1a2b;
  --text-muted: #5b6b7e;
  --accent:     #0d1a2b;
  --accent-inv: #eef3fa;
}
html.public-mode body { background: var(--bg); color: var(--text); }

html.public-mode #pip {
  /* Vertical-by-default, a bit bigger than base. Resize/drag still work and
     whatever the user sets via the grip overrides this via inline style. */
  width: 280px;
  height: 500px;
}
@media (max-width:700px) {
  html.public-mode #pip { width:220px; height:400px; }
}

/* ── Public status bar (balance + countdown) ─── */
html.public-mode .public-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: linear-gradient(180deg, #0b0b0bee 0%, #0b0b0bcc 100%);
  border-bottom: 1px solid #222;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e6e6e6;
  backdrop-filter: blur(8px);
}
html.public-mode .public-bar .pb-label { color:#8a8a8a; margin-right:6px; }
html.public-mode .public-bar .pb-balance {
  color: #6ad6ff;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 10px #6ad6ffaa,
    0 0 28px #6ad6ff66,
    0 0 56px #6ad6ff33;
  animation: pbBreathe 2.6s ease-in-out infinite;
}
@keyframes pbBreathe {
  0%,100% { text-shadow: 0 0 10px #6ad6ffaa, 0 0 28px #6ad6ff66, 0 0 56px #6ad6ff33; }
  50%     { text-shadow: 0 0 18px #6ad6ffee, 0 0 48px #6ad6ff99, 0 0 96px #6ad6ff55; }
}
html.public-mode .public-bar .pb-balance.low  {
  color:#ffb84a;
  text-shadow:0 0 14px #ffb84acc, 0 0 36px #ffb84a77;
  animation: pbPulse 1s ease-in-out infinite;
}
html.public-mode .public-bar .pb-balance.dead {
  color:#ff3b3b;
  text-shadow:0 0 18px #ff3b3bee, 0 0 48px #ff3b3baa;
  animation: pbPulse .7s ease-in-out infinite;
}
@keyframes pbPulse { 0%,100% {opacity:1; transform:scale(1);} 50% {opacity:0.55; transform:scale(1.08);} }
html.public-mode .public-bar .pb-count {
  color: #9ad8ff;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
}

/* ── Dramatic deduction animation ─── */
html.public-mode .bit-burst {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.6);
  z-index: 10000;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 900;
  font-size: clamp(110px, 22vw, 320px);
  letter-spacing: -0.05em;
  color: #ff2a2a;
  text-shadow:
    0 0 24px #ff2a2aee,
    0 0 72px #ff2a2a99,
    0 0 140px #ff2a2a55,
    0 8px 0 #5a0000,
    0 14px 0 #3a0000,
    0 18px 40px #000000cc;
  pointer-events: none;
  opacity: 0;
  animation: bitBurst 1800ms cubic-bezier(.18,.9,.32,1.25) forwards;
  user-select: none;
  white-space: nowrap;
  -webkit-text-stroke: 2px #ffffffaa;
}
html.public-mode .bit-burst::before {
  /* shockwave ring */
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 6px solid #ff3b3b;
  transform: translate(-50%, -50%) scale(0);
  animation: bitShock 1400ms ease-out forwards;
  opacity: 0.9;
  z-index: -1;
}
html.public-mode .bit-burst::after {
  content: '';
  position: absolute; inset: -60px;
  border-radius: 24px;
  background: radial-gradient(closest-side, #ff3b3b55, #ff3b3b18 40%, transparent 72%);
  z-index: -2;
  animation: bitGlow 1800ms ease-out forwards;
}
@keyframes bitBurst {
  0%   { opacity:0; transform: translate(-50%, -30%) scale(0.3) rotate(-10deg); filter: blur(12px); }
  8%   { opacity:1; transform: translate(-50%, -50%) scale(1.35) rotate(-3deg); filter: blur(0);   }
  14%  { transform: translate(-54%, -50%) scale(1.18) rotate(4deg); }
  20%  { transform: translate(-46%, -50%) scale(1.18) rotate(-5deg); }
  26%  { transform: translate(-53%, -50%) scale(1.08) rotate(3deg); }
  32%  { transform: translate(-47%, -50%) scale(1.08) rotate(-2deg); }
  40%  { transform: translate(-50%, -50%) scale(1.0)  rotate(0deg); }
  100% { opacity:0; transform: translate(-50%, -190%) scale(0.7) rotate(0deg); filter: blur(3px); }
}
@keyframes bitShock {
  0%   { width:40px; height:40px; opacity:0.95; border-width:8px; }
  100% { width:120vw; height:120vw; opacity:0;   border-width:1px; }
}
@keyframes bitGlow {
  0%,30% { opacity:1; }
  100%   { opacity:0; }
}
/* Subtle screen shake when a deduction fires */
html.public-mode.bit-shaking > body { animation: bitScreenShake 400ms ease-in-out; }
@keyframes bitScreenShake {
  0%,100% { transform: translate(0,0); }
  20%     { transform: translate(-4px, 2px); }
  40%     { transform: translate(5px, -3px); }
  60%     { transform: translate(-3px, 4px); }
  80%     { transform: translate(2px, -2px); }
}

/* Button shake when a send is rejected for insufficient bits. */
html.public-mode .insuff-shake { animation: insuffShake 380ms ease-in-out; }
@keyframes insuffShake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}

/* Toast for the "wait until reset" message. */
html.public-mode .insuff-toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 28px;
  z-index: 9999;
  background: #1a0505;
  color: #ff8a8a;
  border: 1px solid #ff3b3b88;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
  box-shadow: 0 8px 28px #0008;
  animation: toastIn 200ms ease-out;
}
@keyframes toastIn { from { opacity:0; transform:translate(-50%, 8px); } to { opacity:1; transform:translate(-50%, 0); } }
