:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #142d50;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 240px; min-height: 100%; }
body { background: #0d3158; }
button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { padding: 0; border: none; color: inherit; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #ffc85e; outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); }
#experience {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center;
  background: linear-gradient(125deg,#183f67,#102e50 42%,#0e2c4b 68%,#22486c);
  isolation: isolate;
}
.portrait {
  position: relative; width: min(100%, 56.222vh); width: min(100%, 56.222svh);
  height: 100vh; height: 100svh; overflow: hidden; display: grid; align-items: center;
  background: #086cc7;
}
.design { position: relative; width: 100%; aspect-ratio: 750 / 1334; z-index: 1; }
.edge { position: absolute; width: 100%; height: max(0px, calc((100% - (100vw * 1334 / 750)) / 2 + 2px)); background-size: 100% 100%; pointer-events: none; }
.edge-top { top: 0; } .edge-bottom { bottom: 0; }
.page, .artboard { position: absolute; width: 100%; height: 100%; inset: 0; }
.artboard { object-fit: fill; pointer-events: none; -webkit-user-drag: none; user-select: none; }
#home { isolation: isolate; overflow: hidden; }
#home-motion { position: absolute; inset: 0; overflow: hidden; pointer-events: none; user-select: none; background: #0a69bb; }
#home[data-entry="playing"] #home-still { opacity: 0; }
#home[data-entry="handoff"] #home-still { animation: final-art-in 250ms ease-out both; }
#home[data-entry="waiting"] #home-motion, #home[data-entry="done"] #home-motion { display: none; }
.entry-person { opacity: 0; transform-origin: var(--anchor) 57%; }
#entry-left { --side: -1; --anchor: 79%; }
#entry-right { --side: 1; --anchor: 21%; }
[data-entry="playing"] .entry-person { will-change: transform; animation: hero-arrival 1120ms both; }
[data-entry="playing"] #entry-left { animation-delay: 65ms; }
[data-entry="playing"] #entry-right { animation-delay: 155ms; }
[data-entry="handoff"] .entry-person, [data-entry="assembled"] .entry-person { opacity: 1; }
@keyframes hero-arrival {
  0% { opacity: 1; transform: translate3d(calc(var(--side) * 146%), 18%, 0) rotate(calc(var(--side) * 11deg)) scale(.83); animation-timing-function: cubic-bezier(.46,.06,.8,.52); }
  24% { opacity: 1; transform: translate3d(calc(var(--side) * 76%), 8%, 0) rotate(calc(var(--side) * 7deg)) scale(.95); animation-timing-function: cubic-bezier(.1,.68,.26,1); }
  52% { opacity: 1; transform: translate3d(calc(var(--side) * -4.5%), -1.8%, 0) rotate(calc(var(--side) * -1.5deg)) scale(1.105); animation-timing-function: cubic-bezier(.4,0,.23,1); }
  73% { opacity: 1; transform: translate3d(calc(var(--side) * 2.4%), 1.1%, 0) rotate(calc(var(--side) * .8deg)) scale(.992); animation-timing-function: ease-out; }
  87% { opacity: 1; transform: translate3d(calc(var(--side) * -.6%), -.25%, 0) rotate(calc(var(--side) * -.18deg)) scale(1.013); animation-timing-function: ease-out; }
  100% { opacity: 1; transform: translate3d(0,0,0) rotate(0) scale(1); }
}
@keyframes final-art-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #home #home-motion { display: none; }
  #home[data-entry] #home-still { opacity: 1; animation: none; }
}
.hit { position: absolute; display: block; }
.hit > img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.art-action { border-radius: 50%; }
.art-action:active, .music:active { transform: scale(.97); }
.arrow-hit { border-radius: 45%; }
.arrow-hit:active { background-color: #ffffff18; }
.music { display: grid; place-items: center; border-radius: 50%; }
.music > img { width: 63%; height: auto; }
.heat-badge { display: flex; align-items: flex-start; justify-content: center; user-select: none; -webkit-touch-callout: none; }
#music[hidden] ~ .heat-badge { display: none; }
.heat-disc { position: relative; display: block; width: 63%; aspect-ratio: 1; pointer-events: none; }
.heat-disc img, .heat-disc svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.heat-disc text { font: 700 17px Arial, sans-serif; font-variant-numeric: tabular-nums; fill: #fff; paint-order: stroke; stroke: #0e4f9b; stroke-width: .8px; stroke-linejoin: round; }
.avatar-well { isolation: isolate; }
.avatar-well.has-photo #art { cursor: grab; }
.avatar-well.has-photo #art:active { cursor: grabbing; }
#art { width: 100%; height: 100%; display: block; }
.preview-hit { position: absolute; inset: 0; width: 100%; display: grid; place-items: center; }
.avatar-well.has-photo .preview-hit { inset: auto auto 0 calc(100% + 3px); width: min(28%,48px); height: 42px; }
/* This point is inside the clear opening shared by all eight frame masks. */
#add-mark { position: absolute; left: 50%; top: 40%; width: 15%; transform: translate(-50%, -50%); color: #fff; pointer-events: none; }
#add-mark svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 1px 2px #075598); }
#crop-mark { white-space: nowrap; font-size: .8125rem; font-weight: 550; line-height: 1; padding: 7px; background: #123a64dd; border: 1px solid #ffffff8f; border-radius: 4px; color: #fff; }
.frame-name { display: flex; justify-content: center; align-items: center; gap: 8px; border-radius: 4px; color: #0a3a69; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.frame-name i { height: .9em; width: 1px; background: #21558875; }
.frame-name svg { width: 15px; height: 15px; }
#frame-count { font-variant-numeric: tabular-nums; font-size: .8125rem; }
.result { background: #04182abb; }
.show-result .edge::after { content: ""; position: absolute; inset: 0; background: #04182abb; }
.finished-avatar { object-fit: contain; -webkit-touch-callout: default; user-select: auto; }
.sheet { padding: 16px; border: 1px solid #d9e5ed; border-radius: 8px; background: #fbfdff; color: #122f50; width: min(364px, calc(100vw - 28px)); max-width: calc(100vw - 18px); max-height: 94vh; max-height: 94dvh; overflow: auto; box-shadow: 0 15px 60px #08294b4d; }
.sheet::backdrop { background: #061a36b8; }
.sheet[open] { display: block; }
.sheet.fallback[open] { position: fixed; z-index: 8; top: 50%; left: 50%; margin: 0; transform: translate(-50%,-50%); box-shadow: 0 0 0 150vmax #071f3bb8; }
.sheet-head, .sheet-actions, .zoom-row { display: flex; align-items: center; gap: 12px; }
.sheet-head { justify-content: space-between; margin: 0 0 12px; min-height: 34px; }
.sheet-head h2 { font-size: 1.125rem; margin: 0; font-weight: 650; }
.link-btn { color: #075da7; font-size: .9375rem; padding: 7px 3px 7px 12px; }
.close { width: 34px; height: 34px; border-radius: 50%; font: 26px/1 Arial,sans-serif; color: #365675; background: #edf3f8; }
.crop-well { width: min(100%,55vh); width: min(100%,52dvh); aspect-ratio: 1; position: relative; margin: 0 auto; background: #d5e7f1; }
.crop-well #art { cursor: grab; }
.crop-well #art:active { cursor: grabbing; }
.gridlines { position: absolute; z-index: 2; inset: 0; pointer-events: none; outline: 1px dashed #ffffffc9; outline-offset: -2px; background-image: linear-gradient(to right,transparent calc(33.333% - .5px),#ffffffab 33.333%,transparent calc(33.333% + .7px),transparent calc(66.667% - .5px),#ffffffab 66.667%,transparent calc(66.667% + .7px)),linear-gradient(to bottom,transparent calc(33.333% - .5px),#ffffffab 33.333%,transparent calc(33.333% + .7px),transparent calc(66.667% - .5px),#ffffffab 66.667%,transparent calc(66.667% + .7px)); }
.zoom-row { margin: 12px 0; }
.zoom-row input { flex: 1; min-width: 0; accent-color: #0969b8; }
.step { width: 38px; height: 38px; border-radius: 50%; background: #eaf3f9; font-size: 1.375rem; line-height: 1; color: #154775; }
.step:disabled { opacity: .4; }
.sheet-actions { margin-top: 10px; }
.sheet-actions > * { flex: 1 1 0; text-align: center; border-radius: 5px; padding: 11px 4px; font-weight: 600; font-size: 1rem; line-height: 1.35; }
.primary { color: white; background: #075ea8; }
.secondary { color: #164976; background: #e6f0f9; }
.frame-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px 5px; }
.frame-option { display: grid; gap: 4px; padding: 3px 2px 5px; justify-items: center; border: 2px solid transparent; border-radius: 5px; color: #344f67; font-size: .8125rem; }
.frame-option[aria-pressed="true"] { border-color: #0a69b4; color: #075493; background: #e4f4ff; }
.frame-option img { width: 100%; height: auto; display: block; aspect-ratio: 1; }
.poster-sheet {
  --viewer-height: 100vh;
  --side: max(10px, env(safe-area-inset-left), env(safe-area-inset-right));
  --end: max(10px, env(safe-area-inset-top), env(safe-area-inset-bottom));
  inset: 0; margin: auto; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  width: min(540px, calc(100% - 2 * var(--side))); max-width: none;
  height: min(calc(var(--viewer-height) - 2 * var(--end)), calc(177.87vw + 70px), 1090px);
  max-height: none; overflow: visible; color: #fff; background: transparent;
}
@supports (height: 100dvh) { .poster-sheet { --viewer-height: 100dvh; } }
.poster-sheet::backdrop { background: #041427e8; }
.poster-sheet[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 6px; }
.poster-sheet .close {
  justify-self: end; width: 40px; height: 40px; color: #fff;
  background: #183650; border: 1px solid #ffffff70;
}
.poster-wrap { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.poster-wrap img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; -webkit-touch-callout: default; }
.poster-footer { justify-self: center; max-width: 100%; }
.share-note { font-size: .875rem; color: #f2f7ff; text-align: center; line-height: 1.45; margin: 0; }
.poster-footer .sheet-actions { justify-content: center; margin-top: 6px; }
.poster-footer .sheet-actions > * { flex: 0 1 auto; padding: 9px 24px; }
#toast { position: fixed; bottom: max(7vh,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); max-width: min(90vw, 400px); z-index: 12; color: white; background: #102d49ef; border-radius: 6px; font-size: .9375rem; text-align: center; line-height: 1.4; pointer-events: none; }
#toast:not(:empty) { padding: 10px 16px; }
.history-link { border: 1px solid #ffffffc9; border-radius: 999px; background: #073d79; color: white; font-size: clamp(.75rem, 3.4vw, 1rem); font-weight: 600; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.history-list button { overflow: hidden; border-radius: 6px; background: #e6f0f9; }
.history-list img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
#history-status:empty { display: none; }
@media (max-height: 450px) and (orientation: landscape) { .portrait { width: min(300px,100vw); } #experience,.portrait { min-height: 534px; } .portrait { height: auto; } .frame-name { font-size: .75rem; } }
@media (max-width: 340px) { .frame-name { font-size: .78rem; gap: 5px; } #frame-count { font-size: .73rem; } }
