/* Oswald (SIL Open Font License), self-hosted. Matches the poster's condensed lettering. */
@font-face { font-family: "Oswald"; src: url("/fm/oswald-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("/fm/oswald-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #0d0f14;
  --fg: #f4f4f2;
  --muted: #a9adb6;
  --blue: #00338d;
  --red: #c60c30;
  --line: #2a2e38;
  --display: "Oswald", "Arial Narrow", Impact, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 480px; margin: 0 auto; padding: 16px; }
[hidden] { display: none !important; }

/* Distressed ink, like the poster's lettering */
.grit {
  -webkit-mask-image: url("/fm/grit.png");
  mask-image: url("/fm/grit.png");
  -webkit-mask-size: 180px 180px;
  mask-size: 180px 180px;
}

/* ---------- Postcard (9:16, fits one portrait screen) ---------- */
.card {
  position: relative;
  overflow: hidden;
  width: min(100%, calc((100svh - 32px) * 9 / 16), 440px);
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 12px;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #fff;
  background: #000;
}
/* Anchored top-left so Tubi's title and episode label in the still stay visible */
.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; z-index: 0; }
.card-bg.is-ph { filter: blur(5px) brightness(0.6); transform: scale(1.08); object-position: center; }
/* Darken only the lower half, where our text and QR sit; the top-left label stays untouched */
.card-shade {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 62%, rgba(0,0,0,0.88) 100%);
}
.card > div:not(.card-shade) { position: relative; z-index: 1; }
.card-pick {
  margin: auto 8cqw; font-family: var(--display); font-weight: 700;
  font-size: 7cqw; letter-spacing: 0.04em; line-height: 1.15;
}
.card-low { margin-top: auto; margin-bottom: 9cqw; display: flex; flex-direction: column; align-items: center; }
.card-ts { font-family: var(--display); font-weight: 700; font-size: 16cqw; line-height: 1; margin-bottom: 2cqw; }
.card-q {
  font-family: var(--display); font-weight: 700; font-size: 11cqw; line-height: 1;
  letter-spacing: 0.02em; margin-bottom: 6cqw;
  text-shadow: 0 2px 10px rgba(0,0,0,0.6);
}
.card-qr { padding: 2cqw; background: #fff; border-radius: 3px; }
.card-qr img { display: block; width: 32cqw; height: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%;
  padding: 13px 12px; margin: 0;
  font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: 0.05em;
  text-align: center; text-decoration: none;
  color: var(--fg); background: #1c2030;
  border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; margin-top: 16px; }

/* ---------- /me ---------- */
.share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.share #native { grid-column: 1 / -1; }
.copy-fallback {
  width: 100%; margin-top: 10px; padding: 12px;
  font: inherit; font-size: 14px; color: var(--fg);
  background: #000; border: 1px solid var(--line); border-radius: 8px;
}
.link-new { display: block; text-align: center; margin: 20px 0 8px; color: var(--muted); }

/* ---------- Error ---------- */
.err { text-align: center; padding-top: 25vh; }
.err h1 { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: 0.02em; }

/* ---------- Creator ---------- */
.creator h1 {
  font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.1;
  letter-spacing: 0.02em; margin: 8px 0 6px; text-align: center;
}
.sub { color: var(--muted); text-align: center; margin: 0 0 16px; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; }
legend { font-family: var(--display); font-weight: 500; font-size: 18px; letter-spacing: 0.03em; margin-bottom: 8px; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile {
  position: relative; overflow: hidden; aspect-ratio: 9 / 16; border-radius: 8px;
  border: 3px solid transparent; cursor: pointer; background: #000;
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile:has(input:checked) { border-color: var(--red); }
.tile:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 2px; }
select, .ts-f input {
  width: 100%; padding: 12px; font: inherit; font-size: 17px;
  color: var(--fg); background: #161a24;
  border: 1px solid var(--line); border-radius: 8px;
}
select:disabled { opacity: 0.5; }
.ts-row { display: flex; align-items: flex-end; gap: 6px; }
.ts-row b { padding-bottom: 12px; font-size: 20px; }
.ts-f { flex: 1; display: block; }
.ts-h { flex: 0.8; }
.ts-f span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ts-f input { text-align: center; font-variant-numeric: tabular-nums; }
.hint { min-height: 1.4em; color: #ff8a8a; margin: 6px 0 0; font-size: 14px; }
.pv-h { font-family: var(--display); font-weight: 500; font-size: 16px; color: var(--muted); letter-spacing: 0.03em; margin: 8px 0; }

/* ---------- Social buttons (brand colors, icon + name) ---------- */
.share .btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ico { width: 20px; height: 20px; flex: none; }
.share #ig { grid-column: 1 / -1; }
.btn-ig { color: #fff; border: 0; background: linear-gradient(45deg, #f58529 0%, #feda77 20%, #dd2a7b 55%, #8134af 80%, #515bd4 100%); }
.btn-fb { color: #fff; background: #0866ff; border-color: #0866ff; }
.btn-x  { color: #fff; background: #000; border-color: #3a3f4b; }
.btn-wa { color: #fff; background: #25d366; border-color: #25d366; }
.ig-tip { margin: 10px 2px 0; font-size: 14px; color: var(--muted); text-align: center; }

/* Small "(choose …)" hints under Instagram and Facebook. Phones only: that's where the share sheet opens. */
.lbl { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.hint-pick { display: none; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 10px; font-weight: 500; letter-spacing: 0.02em; opacity: 0.9; margin-top: 2px; }
@media (pointer: coarse) { .hint-pick { display: block; } }
