/* Built cartoon characters */
.character { display: block; overflow: visible; }

/* On posters the character fills the art area */
.poster-art { position: relative; }
.poster-art .character { position: absolute; inset: 2% 0 0; margin: 0 auto; width: 100%; height: 98%; filter: drop-shadow(3px 5px 0 rgba(20, 33, 61, 0.45)); }

/* Mascot badge pinned to the poster */
.poster-badge {
  position: absolute; z-index: 1; top: 4%; right: 2%;
  display: grid; place-items: center; width: 2.6em; height: 2.6em; font-size: 1em;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink); transform: rotate(10deg);
}

/* On the live stage */
.figure-3d .character { width: 1.68em; height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.32)) drop-shadow(0 0 14px rgba(79, 195, 255, 0.25)); }
.figure-3d .fig-crown { top: -0.32em; }
.slot-1 .figure-3d .character { width: 1.68em; }
/* Stage heights live in results.css (winners' podium section). */

/* Emoji mascots stand as tall as the built characters */
.figure:not(.figure-3d) { font-size: clamp(48px, 5.6vw, 76px); }
.slot-1 .figure:not(.figure-3d) { font-size: clamp(56px, 6.6vw, 90px); }

/* Long standings scroll inside their panel */
#res-list { max-height: 470px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gold) transparent; padding-right: 2px; }

/* Round avatars show the face */
.res-avatar, .board-avatar { overflow: hidden; }
.res-avatar .character, .board-avatar .character { width: 112%; height: 112%; }

/* ---------- Builder ---------- */
.builder legend { align-items: center; }
.builder legend .btn-text { text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
.builder .hint { margin: 0 0 0.6rem; font-size: 0.82rem; }
/* Ready-made characters: tap a 3D figure to start */
.preset-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 0.55rem; margin-bottom: 0.6rem; }
.preset-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.45rem 0.3rem 0.4rem;
  background: radial-gradient(ellipse at 50% 35%, #2a3f7a 0%, #14213d 100%); color: var(--paper);
  border: 3px solid var(--ink); border-radius: 10px; cursor: pointer; font: inherit;
  box-shadow: 3px 3px 0 var(--ink); transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.preset-card:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.preset-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.preset-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.preset-card[aria-pressed='true'] { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold), 3px 3px 0 var(--ink); }
.preset-art { display: block; width: 100%; height: 96px; }
.preset-art .character { width: 100%; height: 100%; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); }
.preset-name { font-weight: 800; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.preset-card[aria-pressed='true'] .preset-name { color: var(--gold); }

/* Hair / face / extras: each option previews the current character */
.face-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.45rem; }
.face-option { position: relative; cursor: pointer; margin: 0 !important; }
.face-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.face-card { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.35rem 0.2rem 0.3rem; background: #fff; border: 2px solid var(--line); border-radius: 10px; transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease); }
.face-option:hover .face-card { border-color: var(--ink); transform: translateY(-2px); }
.face-art { display: block; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: var(--paper-2); }
.face-art .character { width: 112%; height: 112%; margin: -6%; }
.face-name { font-size: 0.64rem; font-weight: 700; text-align: center; line-height: 1.15; max-width: 100%; letter-spacing: -0.01em; }
.face-card { min-width: 0; }
.face-option input:checked + .face-card { border: 3px solid var(--ink); background: #fff4d6; }
.face-option input:checked + .face-card .face-name { color: var(--red); }
.face-option input:focus-visible + .face-card { outline: 3px solid var(--gold); outline-offset: 2px; }
.builder-group { margin-top: 0.75rem; }
.builder-label { display: block; font-weight: 800; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.3rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { position: relative; cursor: pointer; margin: 0 !important; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-block; padding: 0.4rem 0.7rem; border: 2px solid var(--line); border-radius: 99px; background: #fff; font-size: 0.8rem; font-weight: 600; transition: background var(--fast), color var(--fast); }
.chip input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.builder .color-dot { width: 32px; height: 32px; }

@media (max-width: 420px) {
  .figure:not(.figure-3d) { font-size: 44px; }
  .slot-1 .figure:not(.figure-3d) { font-size: 54px; }
}
/* Poster text always sits above the artwork */
.poster-name, .poster-slogan, .poster-paid { position: relative; z-index: 2; }
.poster-slogan { background: color-mix(in srgb, var(--poster-bg) 82%, transparent); padding: 0.1em 0.35em; border-radius: 3px; }

/* Ready-made characters as name-only buttons */
.preset-row { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.45rem; }
.preset-card { flex-direction: row; justify-content: center; padding: 0.65rem 0.5rem; border-radius: 99px; min-height: 44px; }
.preset-card .preset-name { font-size: 0.78rem; }

/* Under the live poster: download + X post link */
#preview-download { margin-top: 1rem; }
.preview-link { margin-top: 1rem; }
.preview-link input { width: 100%; font: 1rem var(--font-body); padding: 0.7rem 0.85rem; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; }
.preview-link label { display: block; }
.preview-link label .hint { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }
@media (max-width: 640px) {
  .create-preview { max-width: 100%; }
  #create-preview { max-width: 200px; margin: 0 auto; }
}
.preview-link .post-link-row input { flex: 1 1 200px; width: auto; }
.preview-link .post-link-row .btn { padding: 0.7rem 1.1rem; }
