.parea {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  transition: background .2s;
}

.pstage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: background .15s;
}

/* Checkerboard shown when transparent background is active */
.pstage.transparent-bg {
  background:
    repeating-conic-gradient(#aaa 0% 25%, #eee 0% 50%)
    0 0 / 20px 20px !important;
}

/* ── Zoom wrapper ─────────────────────────────────────────────────────────
   Absolutely fills pStage so transform: scale() always originates from the
   exact center. The overlay, badge and progress bar live outside this wrapper
   and are unaffected by zoom. */
.pstage-zoom {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
  transition: transform .15s cubic-bezier(.25,.46,.45,.94);
}

.ptxt {
  user-select: none;
  text-align: center;
  line-height: 1.1;
  /* opacity transition is set dynamically in JS to stay in sync with speed */
  white-space: nowrap;
  position: relative;
  z-index: 1;
  opacity: 0; /* hidden until JS sizes & fades it in on first showFont() call */
}

.pbadge {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .12em;
  opacity: .3;
  white-space: nowrap;
  pointer-events: none;
  transition: color .15s;
  z-index: 12;
}

.pbar-wrap { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; z-index: 12; }
.pbar      { height: 100%; background: var(--accent); opacity: .25; transition: width .08s linear; }

/* ── Zoom controls (floating top-right of pStage) ────────────────────── */
.zoom-ctrl {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 2px;
  opacity: .55;
  transition: opacity .15s, background .2s, border-color .2s;
}
.zoom-ctrl:hover { opacity: 1; }

.zoom-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.zoom-btn:hover { background: var(--hover-bg); }
.zoom-fit       { font-size: 11px; }

.zoom-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: .05em;
  min-width: 30px;
  text-align: center;
  user-select: none;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .pstage { min-height: 240px; }
  .pbadge { font-size: 9px; }
  .zoom-ctrl { top: 6px; right: 6px; }
}
