.avatar-art { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.avatar-profile { display: flex; align-items: center; gap: 16px; }
.loop-presets .fit-tile { background: #ddcef1; }
.loop-presets button:nth-child(3n+2) .fit-tile { background: #dce9cd; }
.loop-presets button:nth-child(3n) .fit-tile { background: #f8d4bc; }
.loop-hat { margin: 14px 0; }
.hat-preview { display:block; width:62px; height:62px; flex:none; border-radius:50%; background:#e6d8f3; }
.hat-summary,.hat-memory,.hat-person { display:flex; align-items:center; gap:12px; }
.hat-person { display:inline-flex; background:transparent; color:inherit; border:0; padding:0; font:inherit; text-align:start; }
.hat-person .avatar { width:34px; height:34px; }
.hat-person:hover { text-decoration:underline; }
.hat-stack-list { list-style:none; padding:0; margin:0; }
.hat-stack-heading { display:flex; align-items:center; gap:12px; }
.hat-pile { display:flex; flex-direction:column-reverse; align-items:center; width:68px; padding:5px; background:#e6d8f3; border-radius:12px; }
.hat-pile svg { width:58px; height:36px; }
.hat-pile svg + svg { margin-bottom:-22px; transform:rotate(-5deg); }
.hat-memory { padding:10px 0; flex-wrap:wrap; border-top:1px solid var(--line); }
.hat-memory strong,.hat-memory small { display:block; overflow-wrap:anywhere; }
.hat-memory .actions { margin-left:auto; }
.hat-claim { max-width:500px; }
.claim-print { width:min(170px,100%); margin:auto; border-radius:16px; background:#e6d8f3; }
.avatar-profile .avatar { width: 64px; height: 64px; font-size: 1.25rem; }
.avatar-profile strong { display: block; margin-bottom: 7px; overflow-wrap: anywhere; }
#sheet:has(.avatar-editor) { width: min(750px, calc(100% - 24px)); }
.avatar-editor { display: grid; gap: 16px; }
.avatar-studio { max-width: 800px; }
.avatar-studio h1 { margin-bottom: 20px; }
.avatar-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.avatar-stage {
  display: grid; justify-items: center; align-content: center; gap: 16px; min-height: 284px; padding: 22px 12px;
  border: 1px solid var(--rule); border-radius: var(--radius-card); background-color: var(--gallery);
  background-image: repeating-linear-gradient(0deg, transparent 0 17px, #30203912 17px 18px),
    repeating-linear-gradient(90deg, transparent 0 17px, #30203912 17px 18px);
}
.portrait-medallion { width: min(85%, 184px); aspect-ratio: 1; border: 5px solid var(--paper);
  border-radius: 50%; box-shadow: 0 0 0 1px #95846b, 0 4px 0 #536c4624; }
.avatar-stage strong { max-width: 100%; font: italic 1.4rem/1.2 var(--serif); text-align: center; overflow-wrap: anywhere; }
.wardrobe-nav { display: flex; gap: 3px; padding: 4px; border-radius: var(--radius-pill); background: #e8e4dd; }
.wardrobe-nav button { flex: 1; padding: 7px 3px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--muted); font-weight: 650; font-size: .9rem; }
.wardrobe-nav [aria-pressed=true] { background: var(--paper); color: var(--espresso); box-shadow: 0 1px 3px #49260c2b; }
.wardrobe-options fieldset { padding: 0; margin: 14px 0 0; border: 0; }
.wardrobe-options legend { padding: 0; margin-bottom: 7px; font-size: .92rem; }
.wardrobe-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.wardrobe-choices label { position: relative; cursor: pointer; }
.wardrobe-choices input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.wardrobe-choices span {
  display: flex; align-items: center; gap: 6px; height: 100%; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: var(--radius-control); background: var(--paper); font-size: .84rem; font-weight: 600;
}
.wardrobe-choices input:checked + span { border-color: var(--clay); box-shadow: inset 0 0 0 1px var(--clay); background: var(--lilac); }
.wardrobe-choices input:focus-visible + span { outline: 2px solid var(--espresso); outline-offset: 2px; }
.wardrobe-choices i { width: 17px; height: 17px; border-radius: 50%; border: 1px solid #402b2440; }
.wardrobe-choices .eye-sample { width: 38px; height: 22px; flex: none; }
.hat-rack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hat-rack span { flex-direction: column; justify-content: center; gap: 4px; padding: 8px 3px; text-align: center; line-height: 1.2; }
.hat-rack svg { display: block; width: min(100%, 72px); height: 46px; }
.avatar-sharing { font-size: .9rem; }
.avatar-editor > .actions { padding-top: 12px; border-top: 1px solid var(--line); }
.roundup-hats { margin-block: 20px; }
.souvenir { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.souvenir svg { width: 64px; height: 44px; }
.souvenir strong { overflow-wrap: anywhere; flex: 1 1 100px; }
.souvenir-title { flex: 1 1 120px; min-width: 0; }
.souvenir-title small { display: block; }
.avatar-editor .avatar-stage { position: sticky; top: 0; z-index: 1; }
@media (max-height: 540px) { .avatar-editor .avatar-stage { position: static; } }
.hat-rack label { min-width: 0; overflow-wrap: anywhere; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 16rem; overflow-y: auto; padding: 3px; scrollbar-gutter: stable; }
.catalog-grid label { min-width: 0; }
.catalog-grid span { flex-direction: column; justify-content: center; text-align: center; gap: 2px; line-height: 1.2; padding: 6px 3px; }
.catalog-grid .part-sample { display: block; width: 47px; height: 25px; }
.catalog-grid .hair-sample { width: 54px; height: 43px; }
.catalog-grid .top-sample { width: 62px; height: 29px; }
@media (max-width: 590px) {
  #sheet:has(.avatar-editor) .sheet-inner { padding: 16px; }
  .avatar-layout { grid-template-columns: 1fr; gap: 12px; }
  .avatar-stage { min-height: 0; grid-template-columns: auto minmax(0, auto); justify-content: center; align-items: center; padding: 10px 14px; }
  .portrait-medallion { width: 92px; }
  .avatar-stage strong { font-size: 1.2rem; }
}

/* The portrait and the guest list share the same artwork. Only the print loses its circular mat. */
#sheet:has(.fit-check) {
  width: min(830px, calc(100% - 32px)); border: 0; background: #fffaf1; border-radius: var(--radius-dialog);
}
#sheet:has(.fit-check)::backdrop { background: #161519ad; }
#sheet:has(.fit-check) .sheet-inner { padding: 0; position: relative; }
#sheet:has(.fit-check) .sheet-head { margin: 0; }
#sheet:has(.fit-check) #sheet-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#sheet:has(.fit-check) .sheet-head button {
  position: absolute; right: 8px; top: 7px; z-index: 3; width: 44px; height: 44px;
  color: #252229; background: #fffaf1; border: 0; border-radius: 50%;
}
.fit-check {
  --coal: #161519; --chalk: #fffaf1; --lilac: #d6c2ff; --lime: #dcff61;
  display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1fr); gap: 0;
  align-items: start; color: var(--coal); background: var(--chalk); border-radius: inherit;
}
.avatar-studio .fit-check { border-radius: var(--radius-card); box-shadow: 0 0 0 1px #29233026; }
.fit-stage { position: sticky; top: 0; align-self: start; color: var(--chalk); background: var(--coal); border-radius: inherit; }
.fit-booth { padding: 18px 20px 12px; }
.fit-brand { width: 102px; height: auto; }
.fit-title {
  text-align: center; margin: 16px 0 11px; color: var(--chalk);
  font: 800 clamp(3.1rem, 6.5vw, 4.5rem)/.94 Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
  text-transform: uppercase; font-synthesis: none; letter-spacing: .012em; word-spacing: .05em;
}
.fit-photo {
  width: min(79%, 224px); margin: 0 auto 7px; padding: 9px 9px 6px; transform: rotate(-5deg);
  background: var(--chalk); border-radius: 3px; box-shadow: 2px 4px 0 #0005; color: var(--coal);
}
.fit-print { aspect-ratio: 1; background: var(--lilac); overflow: hidden; }
.fit-print .avatar-art, .fit-tile .avatar-art { border-radius: 0; }
.fit-print .avatar-art > circle, .fit-tile .avatar-art > circle { fill: transparent; }
.fit-caption { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding-top: 4px; }
.fit-caption span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: italic 700 1.48rem/1.3 'Segoe Print', Georgia, serif; }
.fit-caption b { flex: none; padding: 2px 7px; background: var(--lilac); border-radius: 5px; font: 700 .83rem/1.5 var(--font); transform: rotate(2deg); }
.fit-guest { display: flex; align-items: center; gap: 9px; padding: 10px 18px 13px; background: var(--coal); color: var(--chalk); }
.fit-guest [data-guest-portrait] { width: 34px; height: 34px; border: 2px solid var(--chalk); border-radius: 50%; flex: none; }
.fit-guest strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 1rem var(--font); }
.fit-guest small { margin-left: auto; color: var(--chalk); white-space: nowrap; font: .8rem var(--font); }
.fit-controls { min-width: 0; padding: 34px 20px 16px; }
.fit-controls h3 { margin: 0 36px 15px 0; font: 700 1.7rem/1.15 var(--font); letter-spacing: -.035em; }
.fit-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fit-presets button {
  display: grid; align-content: start; gap: 6px; min-width: 0; padding: 0 0 4px; border: 0; border-radius: var(--radius-control);
  background: transparent; color: var(--coal); font: 600 .9rem/1.16 var(--font); text-align: center;
}
.fit-tile { display: block; position: relative; overflow: hidden; aspect-ratio: 1; background: var(--backdrop); border-radius: 11px; }
.fit-presets [aria-pressed=true] .fit-tile { outline: 3px solid var(--coal); outline-offset: -3px; }
.fit-presets [aria-pressed=true] .fit-tile::after {
  content: '✓'; position: absolute; top: 5px; right: 5px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--coal); color: white; font: bold 14px/21px var(--font);
}
.fit-details { margin-top: 16px; border-block: 1px solid #c9c3bb; }
.fit-details summary {
  display: flex; align-items: center; justify-content: space-between; padding-block: 13px;
  list-style: none; font: 700 1.15rem/1.3 var(--font);
}
.fit-details summary::-webkit-details-marker { display: none; }
.fit-details summary::after { content: ''; width: 9px; height: 9px; margin-right: 5px; border: solid currentColor; border-width: 2px 2px 0 0; transform: rotate(45deg); }
.fit-details[open] summary::after { transform: rotate(135deg); }
.fit-details[open] { padding-bottom: 14px; }
.fit-details .wardrobe-nav { background: #eee9e1; flex-wrap: wrap; }
.fit-details .wardrobe-nav button { color: var(--coal); min-height: 38px; }
.fit-details .wardrobe-nav [aria-pressed=true] { background: var(--lilac); }
.fit-details .wardrobe-choices input:checked + span { border-color: var(--coal); box-shadow: inset 0 0 0 1px var(--coal); background: #ece2ff; }
.fit-check :focus-visible { outline-color: #8851bc; }
.fit-footer { position: sticky; bottom: 0; z-index: 1; padding: 12px 0 2px; background: var(--chalk); }
.fit-footer .field-error:not(:empty) { margin-bottom: 8px; }
.fit-save { width: 100%; min-height: 48px; border: 0; border-radius: 999px; color: var(--coal); background: var(--lime); font: 700 1.05rem var(--font); }
.fit-save:hover { background: #cef442; }
@media (max-width: 620px) {
  #sheet:has(.fit-check) { width: min(440px, 100%); max-width: 100%; max-height: 100dvh; border-radius: 0; }
  #sheet:has(.fit-check) .sheet-head button { color: var(--chalk, #fffaf1); background: #161519; }
  .fit-check { grid-template-columns: minmax(0, 1fr); }
  .fit-stage { display: contents; }
  .fit-booth { background: var(--coal); border-radius: inherit; padding: 16px 18px 9px; }
  .fit-title { font-size: clamp(3.1rem, 13vw, 4rem); margin: 9px 0 12px; }
  .fit-photo { width: clamp(148px, 24dvh, 218px); max-width: 80%; }
  .fit-guest { position: sticky; top: 0; z-index: 2; padding-block: 8px; box-shadow: 0 1px 0 #605b62; }
  .fit-controls { padding: 15px 16px 12px; }
  .fit-controls h3 { margin-bottom: 10px; font-size: 1.5rem; }
  .fit-details { margin-top: 12px; }
  .fit-details summary { padding-block: 11px; }
}
