:root {
  --relay-accent: #6d4aff;
  --bs-primary: #6d4aff;
  --bs-primary-rgb: 109, 74, 255;
  --bs-link-color: #6d4aff;
  --bs-link-color-rgb: 109, 74, 255;
}
[data-bs-theme="dark"] {
  --relay-accent: #a78bfa;
  --bs-link-color: #a78bfa;
  --bs-link-color-rgb: 167, 139, 250;
}
.btn-primary { --bs-btn-bg: #6d4aff; --bs-btn-border-color: #6d4aff; --bs-btn-hover-bg: #5935f0; --bs-btn-hover-border-color: #5935f0; --bs-btn-active-bg: #4c2bd6; --bs-btn-disabled-bg: #6d4aff; --bs-btn-disabled-border-color: #6d4aff; }
.btn-outline-primary { --bs-btn-color: var(--relay-accent); --bs-btn-border-color: var(--relay-accent); --bs-btn-hover-bg: #6d4aff; --bs-btn-hover-border-color: #6d4aff; --bs-btn-active-bg: #5935f0; }
.text-bg-primary { background-color: #6d4aff !important; }

body { background: var(--bs-tertiary-bg); }
.container-narrow { max-width: 560px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

.brand { font-weight: 700; font-size: 1.5rem; color: var(--bs-body-color); letter-spacing: -.02em; }
.brand .dot { color: var(--relay-accent); }

.rule { font-size: clamp(1.6rem, 6vw, 2.3rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: .5rem; overflow-wrap: anywhere; }

.photo-drop {
  display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 3;
  border: 2px dashed var(--bs-border-color); border-radius: var(--bs-border-radius-lg);
  background: var(--bs-body-bg); cursor: pointer; overflow: hidden;
}
.photo-drop:hover, #photo:focus-visible + * { border-color: var(--relay-accent); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-hint { color: var(--bs-secondary-color); }

.pass-card { border-color: var(--relay-accent); border-width: 2px; }

.chain { display: flex; flex-direction: column; gap: 14px; position: relative; }
.chain .hand { overflow: hidden; }
.chain .hand img { aspect-ratio: 1; object-fit: cover; }
.hand-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.6em; height: 1.6em;
  border-radius: 999px; background: var(--relay-accent); color: #fff; font-size: .8em; margin-right: .2em;
}
.poster { background: #14121f; }

/* Rule idea chips in dark mode: Bootstrap's grey (#6c757d) is only ~3.3:1 on the dark body (emulator round 3). */
[data-bs-theme="dark"] #rule-ideas .btn-outline-secondary:not(.active) { --bs-btn-color: #adb5bd; --bs-btn-border-color: #6c757d; }

/* The poster in progress: what the relay is building. Dark in both themes, like the finished poster. */
.poster-preview { background: #14121f; color: #f5f3ff; border-radius: .75rem; padding: 1rem; }
.poster-title { font-weight: 600; color: #c4b5fd; }
.poster-line { color: #cfcbe6; font-size: .95rem; }
.tiles { display: grid; gap: 6px; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tiles-5 { grid-template-columns: repeat(5, 1fr); }
.tile { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #2a2740;
  display: flex; align-items: center; justify-content: center; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-label { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 6px; font-size: .7rem; font-weight: 600;
  background: rgba(0, 0, 0, .55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-empty { background: transparent; border: 2px dashed #4a4668; color: #8b85a8; font-weight: 600; }
.tile-you { background: #6d4aff; color: #fff; font-weight: 700; border: 2px solid #c4b5fd; }

/* Three steps on the start page */
.how { display: grid; gap: .6rem; }
.how li { display: flex; gap: .75rem; align-items: baseline; }
.how-n { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--bs-primary); color: #fff;
  font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.photo-buttons { grid-template-columns: 1fr 1fr; }
/* The file inputs are visually hidden; show keyboard focus on the button that belongs to them. */
#photo-camera:focus-visible ~ .photo-buttons label[for="photo-camera"],
#photo:focus-visible ~ .photo-buttons label[for="photo"] { outline: 2px solid var(--relay-accent); outline-offset: 2px; }
/* Before you add your own photo, the others are blurred. */
.tile-hidden img { filter: blur(14px) saturate(.8); transform: scale(1.25); }
.tiles-2 { grid-template-columns: repeat(2, 1fr); max-width: 20rem; margin-inline: auto; }

/* Start page: pitch and example poster, then the form. Side by side on wide screens. */
.home-cols { display: grid; gap: 1.5rem; }
.home-pitch { display: grid; gap: 1.25rem; min-width: 0; align-content: start; }
.home-start { min-width: 0; scroll-margin-top: 1rem; }
.example-tag { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #a9a3c2; }
.promise { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.promise li::before { content: "✓ "; color: var(--relay-accent); font-weight: 700; }
/* The empty photo box is short on the start page, so the Start button is in view; it grows once a photo is in. */
#f-start .photo-drop:has(img[hidden]) { aspect-ratio: 16 / 7; }
@supports selector(:has(*)) {
  @media (min-width: 900px) {
    body:has(.home-cols) .container-narrow { max-width: 1040px; padding-left: 24px; padding-right: 24px; }
    .home-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 3rem; align-items: start; }
    .home-cta { display: none; }
  }
}

/* operator page */
.admin-thumb { width: 96px; }
.admin-thumb img { width: 96px; height: 96px; object-fit: cover; display: block; }

/* Characters used / allowed, small, under the right end of a field. */
.field-count { font-size: .7rem; line-height: 1; margin-top: .2rem; text-align: right; color: var(--bs-secondary-color); font-variant-numeric: tabular-nums; }

/* The example poster on the start page, laid out like the finished poster: photos taller than wide in a
   thin light frame, number and name at the top, the line (if any) at the bottom, one strip below. */
.example { padding: .5rem; }
.example .tile { aspect-ratio: 338 / 398; border: 2px solid #f5f3ff; border-radius: 7px; }
.tile-name, .tile-said { position: absolute; left: 0; right: 0; padding: .25rem .4rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-name { top: 0; padding-bottom: 1rem; font-size: .8rem; font-weight: 600; background: linear-gradient(rgba(20, 18, 31, .62), rgba(20, 18, 31, 0)); }
.tile-name sup { font-size: .55em; font-weight: 700; margin-right: .2em; color: #e9e6f7; top: -.7em; }
.tile-said { bottom: 0; padding-top: 1rem; font-size: .7rem; background: linear-gradient(rgba(20, 18, 31, 0), rgba(20, 18, 31, .72)); }
.example-foot { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; padding: .45rem .3rem 0; }
.example-rule { font-weight: 700; color: #f5f3ff; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.example-sign { font-size: .72rem; color: #d6d2ea; white-space: nowrap; }
.example-sign strong { font-size: .9rem; color: #f5f3ff; }
.example .poster-line { padding: 0 .3rem .3rem; }
