/* Gag-O-Meter (gag-o-meter.php): a violet sky full of Tom balloons. The page is his face: no headline block, the name runs up
   the meter. Bagel Fat One (fat, round = blown up) for the few big words, the system font for the rest. */
.gm { --v1: #b07bff; --v2: #7a3cff; --v3: #5216d6; --ink: #2a0b6b; --mint: #3dffc0; --sun: #ffe14a; --hot: #ff2d55;
  margin: 0; background: var(--v3); color: #fff; }
.gm :focus-visible { outline-color: #fff; }
.gm .tpt-top { position: relative; z-index: 3; color: #fff; }
.gm-stage { position: relative; display: flex; flex-direction: column; align-items: center;
  min-height: calc(100svh - 52px); padding: 0 16px; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 50% 46%, var(--v1) 0, var(--v2) 42%, var(--v3) 100%); }
.gm-stage > :not(.gm-sky) { position: relative; z-index: 1; }

/* balloons drifting up behind him, each a real Tom head on a string; they sway harder when you're loud (gag.js) */
.gm-sky { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.gm-b { position: absolute; bottom: -24%; width: calc(120px * var(--s, .7)); aspect-ratio: 1; opacity: .5; animation: gm-float 20s linear infinite; }
.gm-b i { display: block; width: 100%; height: 100%; background-repeat: no-repeat; transform-origin: 50% 120%; filter: saturate(.85); }
.gm-b::after { content: ""; position: absolute; left: 50%; top: 96%; width: 2px; height: 130%; background: rgba(255, 255, 255, .45); }
@keyframes gm-float { from { translate: 0 0; } to { translate: 0 -150vh; } }

/* the meter = the sign */
.gm-gauge { position: absolute !important; right: max(112px, 9vw); top: 50%; display: flex; gap: 14px; height: min(60vh, 520px); transform: translateY(-54%); }
.gm-name { margin: 0; writing-mode: vertical-rl; transform: rotate(180deg); font: 400 50px/1 "Bagel Fat One", Impact, sans-serif; color: var(--sun);
  text-shadow: 0 4px 0 rgba(42, 11, 107, .45); white-space: nowrap; text-align: center; }
.gm-meter { position: relative; width: 46px; border-radius: 23px; background: rgba(42, 11, 107, .4); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .6); }
.gm-meter i { --a: 0; position: absolute; inset: 5px; border-radius: 18px; background: linear-gradient(to top, var(--mint), var(--sun) 46%, #ff8a3d 72%, var(--hot));
  clip-path: inset(calc((1 - var(--a)) * 100%) 0 0 0 round 18px); }
.gm-meter ol { position: absolute; left: calc(100% + 12px); top: 0; bottom: 0; display: grid; grid-template-rows: repeat(4, 1fr); margin: 0; padding: 0;
  list-style: none; font: 800 14px/1.1 system-ui, sans-serif; white-space: nowrap; }
.gm-meter li { padding-top: 6px; opacity: .85; }
.gm-meter li:first-child { color: var(--sun); opacity: 1; }

.gm-clock { z-index: 3 !important; margin: 14px 0 0; font: 400 64px/1 "Bagel Fat One", Impact, sans-serif; text-shadow: 0 5px 0 rgba(42, 11, 107, .4); font-variant-numeric: tabular-nums; }
[data-state="idle"] .gm-clock { visibility: hidden; }
[data-state="ready"] .gm-clock { color: var(--sun); }
.gm-tom { flex: none; margin-top: auto; width: min(56vh, 80vw); aspect-ratio: 1; }
.gm-tom { position: relative; z-index: 2 !important; pointer-events: none; }
.gm-tom canvas { display: block; width: 130%; height: 130%; margin: -30% -15% 0; }   /* room to swell past the box (gag.js paint) */
[data-state="idle"] .gm-tom { animation: gm-bob 3.2s ease-in-out infinite; }
@keyframes gm-bob { 50% { translate: 0 -8px; } }
[data-state="pop"] .gm-tom canvas { animation: gm-burst .18s ease-out forwards; }
@keyframes gm-burst { to { transform: scale(1.4); opacity: 0; filter: brightness(2); } }
.gm-string { width: 3px; height: clamp(16px, 5vh, 54px); margin-top: -3px; border-radius: 2px; background: rgba(255, 255, 255, .85); }
.gm-dare { margin: 4px 0 12px; padding: 9px 18px; border-radius: 14px; background: var(--sun); color: var(--ink); font: 700 17px/1.3 system-ui, sans-serif;
  rotate: -2deg; box-shadow: 0 5px 0 rgba(42, 11, 107, .35); text-align: center; }
.gm-dare b { font-weight: 900; }
.gm-mic { display: inline-flex; align-items: center; gap: 12px; padding: 14px 32px 14px 22px; border: 0; border-radius: 999px; background: var(--sun); color: var(--ink);
  font: 400 30px/1 "Bagel Fat One", Impact, sans-serif; box-shadow: 0 7px 0 var(--ink); transition: transform .1s; }
.gm-mic svg { width: 34px; height: 34px; fill: currentColor; }
.gm-mic:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--ink); }
[data-state="go"] .gm-mic { animation: gm-pulse .55s ease-in-out infinite; }
[data-state="ready"] .gm-mic, [data-state="pop"] .gm-mic { opacity: .7; }
@keyframes gm-pulse { 50% { transform: scale(1.06); } }
.gm-say { margin: 12px 0 calc(22px + env(safe-area-inset-bottom)); font: 700 17px/1.3 system-ui, sans-serif; text-align: center; text-shadow: 0 2px 0 rgba(42, 11, 107, .35); }
[data-state="go"] .gm-say { font: 400 30px/1 "Bagel Fat One", Impact, sans-serif; color: var(--sun); }

/* he blows: his real gags, then the score under them */
body.gm-open { overflow: hidden; }
.gm-pop { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px;
  background: radial-gradient(circle at 50% 40%, var(--v1) 0, var(--v2) 45%, var(--v3) 100%); overflow: auto; }
.gm-film { position: relative; flex: none; width: min(92vw, 80vh); aspect-ratio: 1; transition: width .3s; animation: gm-in .3s cubic-bezier(.3, 1.6, .5, 1); }
.gm-pop:has(.gm-res:not([hidden])) .gm-film { width: min(92vw, 44vh); }
.gm-film video { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 26px; background: var(--ink); box-shadow: 0 0 0 6px #fff, 0 16px 0 rgba(42, 11, 107, .4); }
@keyframes gm-in { from { transform: scale(.5) rotate(-6deg); } }
.gm-bit { position: absolute; left: 50%; top: 50%; width: 14px; height: 22px; margin: -11px 0 0 -7px; border-radius: 3px; animation: gm-bit 1.3s cubic-bezier(.15, .8, .3, 1) forwards; }
@keyframes gm-bit { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
.gm-res { flex: none; width: min(520px, 100%); text-align: center; }
.gm-big { margin: 0; font: 400 clamp(72px, 13vh, 112px)/.9 "Bagel Fat One", Impact, sans-serif; color: var(--sun); text-shadow: 0 6px 0 var(--ink); }
.gm-line { margin: 8px 0 0; font: 700 18px/1.3 system-ui, sans-serif; }
.gm-vs { display: inline-block; margin: 12px 0 0; padding: 7px 16px; border-radius: 12px; background: #fff; color: var(--ink); font: 800 17px/1.3 system-ui, sans-serif; rotate: -1.5deg; }
.gm-vs[data-win="1"] { background: var(--mint); }
.gm-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.gm-acts input { grid-column: 1 / -1; min-height: 50px; padding: 0 18px; border: 3px solid #fff; border-radius: 14px; background: rgba(42, 11, 107, .45); color: #fff; font: 700 18px system-ui, sans-serif; }
.gm-acts input::placeholder { color: rgba(255, 255, 255, .7); }
.gm-btn { min-height: 52px; padding: 0 18px; border: 3px solid #fff; border-radius: 999px; background: transparent; color: #fff; font: 800 17px system-ui, sans-serif; }
.gm-btn--go { grid-column: 1 / -1; border-color: var(--sun); background: var(--sun); color: var(--ink); font: 400 26px/1 "Bagel Fat One", Impact, sans-serif; box-shadow: 0 6px 0 var(--ink); }
.gm-acts:has(#send[hidden]) #again { grid-column: 1 / -1; }

@media (max-width: 720px) {
  .gm-gauge { position: relative !important; right: auto; top: auto; flex-direction: column; align-items: center; gap: 6px; height: auto; width: min(100%, 380px); margin-top: 6px; transform: none; }
  .gm-name { writing-mode: horizontal-tb; transform: none; font-size: 34px; }
  .gm-meter { width: 100%; height: 24px; border-radius: 12px; }
  .gm-meter i { inset: 4px; border-radius: 8px; clip-path: inset(0 calc((1 - var(--a)) * 100%) 0 0 round 8px); background: linear-gradient(to right, var(--mint), var(--sun) 46%, #ff8a3d 72%, var(--hot)); }
  .gm-meter ol { display: none; }
  .gm-clock { margin-top: 8px; font-size: 52px; }
  .gm-tom { width: min(48vh, 88vw); }
  .gm-mic { font-size: 26px; padding: 13px 28px 13px 20px; }
  .gm-say { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .gm-b, [data-state="idle"] .gm-tom, [data-state="go"] .gm-mic, .gm-film { animation: none; } }
