@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Lilita+One&display=swap");

/* Tiny Parade: one full-bleed canvas (the town), a cream paper card for the question, a lower-third for the announcer. */
:root {
  --font: "Geist", system-ui, -apple-system, sans-serif;
  --display: "Lilita One", "Arial Black", sans-serif;
  --paper: #fbf1d4; --ink: #2a1d2e; --red: #b3261e; --navy: #1f3f8f;
  --panel: rgba(42, 29, 46, 0.72); --line: rgba(255, 236, 200, 0.22);
}
*,*::before,*::after { box-sizing: border-box; }
html, body { -webkit-tap-highlight-color: transparent; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); background: #2a1d2e; touch-action: none; }
canvas { display: block; position: fixed; inset: 0; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

.entry {
  position: fixed; z-index: 8; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 46px); transform: translateX(-50%);
  width: min(92vw, 430px); transition: transform .6s cubic-bezier(.5,0,.2,1), opacity .4s ease; margin: 0;
}
.entry.is-away { transform: translate(-50%, -140%); opacity: 0; pointer-events: none; }
.entry__form {
  background: var(--paper); border-radius: 16px; padding: 14px 16px 12px; position: relative;
  border: 2px solid var(--red); box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px rgba(179,38,30,.55), 0 14px 30px rgba(20,8,30,.45);
}
.entry__eyebrow { margin: 0 0 2px; font-size: .62rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--red); }
.entry__q { display: block; font-family: var(--display); font-size: clamp(1.35rem, 5.4vw, 1.7rem); line-height: 1.1; color: var(--navy); margin-bottom: 10px; }
.entry__row { display: flex; gap: 8px; align-items: stretch; }
.field { position: relative; flex: 1 1 auto; min-width: 0; }
.field input {
  width: 100%; height: 44px; font: 500 16px var(--font); color: var(--ink); background: #fffaf0; border: 1.5px solid rgba(42,29,46,.28);
  border-radius: 10px; padding: 0 12px; outline: none; touch-action: manipulation; -webkit-user-select: text; user-select: text;
}
.field input:focus-visible { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,63,143,.25); }
.field__ph { position: absolute; left: 13px; top: 0; height: 44px; display: flex; align-items: center; font-size: 16px; color: rgba(42,29,46,.42); pointer-events: none; transition: opacity .35s, transform .35s; white-space: nowrap; overflow: hidden; max-width: calc(100% - 20px); }
.field__ph.is-out { opacity: 0; transform: translateY(6px); }
.go, .btn, .bar .opt-share.opt-share {
  appearance: none; cursor: pointer; font: 600 .86rem var(--font); height: 44px; padding: 0 16px; border-radius: 10px; border: 0; white-space: nowrap; touch-action: manipulation;
  color: #fff6e6; background: linear-gradient(180deg, #cf3a2e, #a61f19); box-shadow: 0 2px 0 #7a130f, 0 6px 14px rgba(120,20,14,.4); transition: transform .1s ease, filter .15s;
}
.go:active, .btn:active { transform: translateY(1px) scale(.98); }
.go:hover, .btn:hover { filter: brightness(1.07); }
.go:focus-visible, .btn:focus-visible, .sound-btn:focus-visible, .end .opt-share.opt-share:focus-visible { outline: 2px dashed #fff3c4; outline-offset: 2px; }
.entry__sub { margin: 8px 0 0; font-size: .72rem; color: rgba(42,29,46,.6); }

.cap {
  position: fixed; z-index: 7; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px); transform: translate(-50%, 14px); opacity: 0; pointer-events: none;
  width: min(92vw, 520px); background: var(--panel); color: #fff1d6; border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px 10px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: opacity .35s, transform .35s; box-shadow: 0 8px 22px rgba(10,4,20,.4);
}
.cap.is-on { opacity: 1; transform: translate(-50%, 0); }
.cap small { display: block; font-size: .58rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #f2c63a; margin-bottom: 2px; }
.cap span { font-size: .92rem; line-height: 1.35; font-weight: 500; }

.end {
  position: fixed; z-index: 9; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 46px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  width: min(92vw, 460px); text-align: center; background: var(--paper); border: 2px solid var(--red); border-radius: 16px; padding: 14px 14px 10px;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px rgba(179,38,30,.55), 0 14px 30px rgba(20,8,30,.45); transition: opacity .45s, transform .45s;
}
.end.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.end__line { margin: 0 0 10px; font-family: var(--display); font-size: 1.2rem; line-height: 1.2; color: var(--navy); }
.end__row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.btn { background: linear-gradient(180deg, #4a5aa0, #2d3a78); box-shadow: 0 2px 0 #1a2358, 0 6px 14px rgba(20,30,90,.35); }
.btn--main { background: linear-gradient(180deg, #cf3a2e, #a61f19); box-shadow: 0 2px 0 #7a130f, 0 6px 14px rgba(120,20,14,.4); }
.end .opt-share.opt-share { height: 44px; margin: 0; opacity: 1; padding: 0 16px; border-radius: 10px; font: 600 .86rem var(--font); color: #fff6e6; background: linear-gradient(180deg, #2f9a6a, #1f7a50); border: 0; box-shadow: 0 2px 0 #14583a; text-decoration: none; display: inline-flex; align-items: center; }
.share-host { display: inline-flex; } .share-host:empty { display: none; }
.end__count { display: block; margin-top: 8px; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(42,29,46,.55); }

.sound-btn {
  appearance: none; position: fixed; z-index: 12; cursor: pointer; padding: 0; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff1d6; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(0,0,0,.4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: transform .12s, opacity .15s;
}
.sound-btn:active { transform: scale(.94); } .sound-btn[aria-pressed="false"] { opacity: .55; } .sound-btn[aria-pressed="false"] .sound-btn__wave { opacity: 0; }

.frame { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.frame__corner { position: absolute; font-size: clamp(.58rem, 1.2vw, .7rem); font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: rgba(255,244,222,.78); white-space: nowrap; text-shadow: 0 1px 6px rgba(20,8,30,.9); }
.frame__corner--tl { top: calc(max(12px, env(safe-area-inset-top)) + 13px); left: max(18px, env(safe-area-inset-left)); }
.frame__corner--tr { top: calc(max(12px, env(safe-area-inset-top)) + 13px); right: calc(max(12px, env(safe-area-inset-right)) + 54px); }
.frame__corner--bl { bottom: max(18px, env(safe-area-inset-bottom)); left: max(18px, env(safe-area-inset-left)); }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; border-bottom: 1px solid transparent; }
.frame__corner a:hover { border-bottom-color: rgba(255,244,222,.6); }

.hint { position: fixed; z-index: 9; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 48px); transform: translateX(-50%); width: min(calc(100vw - 40px), 560px); padding: 0 6px; margin: 0; text-align: center; pointer-events: none; text-wrap: balance;
  font-size: .62rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; line-height: 1.6; color: #fff3d6; text-shadow: 0 1px 8px rgba(20,8,30,.95); transition: opacity .8s; }
.hint.is-hidden { opacity: 0; }

.opt-tipjar.opt-tipjar { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); transform: none; }
.opt-fs.opt-fs { top: auto; bottom: max(14px, env(safe-area-inset-bottom)); right: calc(max(14px, env(safe-area-inset-right)) + 54px); transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge { animation: none; }

/* a phone on its side: everything tightens and the card goes to one row */
@media (orientation: landscape) and (max-height: 500px) {
  .entry { top: max(8px, env(safe-area-inset-top)); width: min(70vw, 520px); }
  .entry__form { padding: 8px 12px 8px; } .entry__eyebrow { display: none; } .entry__q { font-size: 1.1rem; margin-bottom: 6px; } .entry__sub { display: none; }
  .go, .btn { height: 40px; } .field input, .field__ph { height: 40px; }
  .cap { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 2px); width: min(52vw, 460px); left: 50%; padding: 6px 12px 7px; } .cap span { font-size: .8rem; }
  .end { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 2px); padding: 8px 12px 6px; width: min(70vw, 520px); } .end__line { font-size: 1rem; margin-bottom: 6px; } .end__count { margin-top: 4px; }
  .hint { top: max(10px, env(safe-area-inset-top)); }
  .frame__corner--tl, .frame__corner--tr { display: none; }
}
@media (max-width: 380px) { .go { padding: 0 11px; font-size: .8rem; } .entry__q { font-size: 1.25rem; } }
@media (prefers-reduced-motion: reduce) { .entry, .cap, .end, .field__ph, .hint { transition: none; } }
