@font-face {
  font-family: Bangers;
  src: url('./assets/Bangers-Regular.ttf');
  font-display: swap;
}
@font-face {
  font-family: Noto;
  src: url('./assets/NotoSans-Regular.ttf');
  font-display: swap;
}
@font-face {
  font-family: Noto;
  src: url('./assets/NotoSans-Bold.ttf');
  font-weight: 700;
  font-display: swap;
}
:root {
  --paper: #fffdf7;
  --ink: #111820;
  --cyan: #02d1d9;
  --coral: #fc01ca;
  --yellow: #ffe539;
  --pale: #f1eee3;
  --muted: #586a70;
  --line: #d0d5d1;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  background-image: radial-gradient(#11182012 .8px, transparent 1px);
  background-size: 10px 10px;
  color: var(--ink);
  font: 14px/1.6 Noto, system-ui, sans-serif;
}
button, input, select { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
button { border-radius: 0; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
h1, h2, p, figure { margin: 0; }
.skip { position: fixed; top: 10px; left: 20px; z-index: 9; padding: 12px; background: var(--yellow); }
.skip:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 17px clamp(17px, 3vw, 36px);
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-size: 17px; font-weight: 700; line-height: 1.15; }
.brand img { flex: none; object-fit: contain; }
.brand small { display: block; margin-top: 7px; font-size: 8px; letter-spacing: 1.8px; text-transform: uppercase; }
.text-button { flex: none; font-size: 12px; font-weight: 700; }
.studio-page { margin-inline: auto; padding: clamp(20px, 3vw, 44px) clamp(16px, 4vw, 48px) 52px; }
.creator-heading { margin-bottom: 22px; }
.creator-heading h1 { font: 400 clamp(43px, 5vw, 66px)/1.04 Bangers, Impact, sans-serif; letter-spacing: .3px; }
.creator-heading p { margin-top: 5px; }
#visitor-progress { color: var(--muted); font-size: 13px; }
.photograph-surface #main:has(#setup:not([hidden]) > #character-step:not([hidden])) { max-width: 1276px; }
body:has(#setup:not([hidden]) > #character-step:not([hidden])) .studio-header {
  min-height: 78px;
  padding-inline: max(clamp(16px, 4vw, 48px), calc((100% - 1180px) / 2));
  border-bottom-width: 2px;
}
.studio-page:has(#setup:not([hidden]) > #character-step:not([hidden])) .creator-heading { margin-bottom: clamp(26px, 3vw, 44px); }
.studio-page:has(#setup:not([hidden]) > #character-step:not([hidden])) .creator-heading h1 { font-size: clamp(43px, 6.1vw, 88px); }
.studio-page:has(#setup:not([hidden]) > #character-step:not([hidden])) .creator-intro { font-size: clamp(14px, 1.4vw, 20px); }
.character-picker { min-width: 0; }
.character-picker h2 { font: 400 clamp(32px, 3.2vw, 46px)/1.1 Bangers, Impact, sans-serif; letter-spacing: .02em; }
.character-picker h2:focus { outline-offset: 2px; }
.character-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(13px, 1.5vw, 22px);
  margin-top: clamp(13px, 1.5vw, 22px);
}
.character-option {
  --character-plate: var(--cyan);
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  padding: 0;
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 5px 5px 0 var(--character-plate), 7px 7px 0 var(--ink);
  text-align: start;
}
.character-option[data-character='woman'] { --character-plate: var(--coral); }
.character-option[data-character='boy'] { --character-plate: var(--yellow); }
.character-option:focus-visible { outline-color: var(--ink); }
.character-option:is(:hover, [aria-pressed='true']) .character-label { background: color-mix(in srgb, var(--character-plate) 15%, var(--paper)); }
.character-portrait { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--pale); }
.character-portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.character-portrait::before, .character-portrait::after {
  position: absolute;
  width: clamp(11px, 1.3vw, 18px);
  height: clamp(11px, 1.3vw, 18px);
  border: solid var(--character-plate);
  pointer-events: none;
  content: '';
}
.character-portrait::before { top: 7px; left: 7px; border-width: 3px 0 0 3px; }
.character-portrait::after { right: 7px; bottom: 7px; border-width: 0 3px 3px 0; }
.character-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: clamp(44px, 4vw, 57px);
  padding: 6px clamp(9px, 1.1vw, 16px);
  border-top: 2px solid var(--ink);
  font-size: clamp(16px, 1.9vw, 27px);
  font-weight: 700;
  line-height: 1.2;
}
.character-arrow { flex: none; font-size: .92em; font-weight: 400; }
.character-next { margin-top: clamp(18px, 2vw, 26px); color: var(--muted); font-size: clamp(13px, 1.2vw, 16px); }
.fixture-note { margin-bottom: 16px; color: var(--muted); }
.fixture-note p { margin-block: 0 8px; }
.input-workspace { width: min(100%, 720px); }
.panel { min-width: 0; border: 2px solid var(--ink); background: var(--paper); box-shadow: 4px 4px var(--ink); }
.photograph-surface .photograph-caption { display: block; padding: 12px clamp(12px, 2vw, 22px); }
.photograph-surface .photograph-caption > h2 {
  width: fit-content;
  font: 400 clamp(24px, 3vw, 34px)/1.05 Bangers, Noto, sans-serif;
  letter-spacing: .02em;
  text-align: start;
  overflow-wrap: anywhere;
}
.photograph-surface .photograph-caption > h2:focus-visible { outline-color: var(--ink); }
.photograph-surface #portrait-step .photograph-caption { display: flex; flex-wrap: wrap; justify-content: space-between; }
.photograph-surface #portrait-step .character-summary { font: 700 13px/1.3 Noto, system-ui, sans-serif; letter-spacing: 0; text-transform: none; }
.character-summary:empty { display: none; }
.photograph-surface .scene-panel .photograph-caption { background: var(--yellow); }
.photograph-stage { padding: clamp(12px, 2vw, 22px); background: var(--photograph-mat); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 9px 15px;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}
.button.primary { background: var(--coral); box-shadow: 3px 3px var(--ink); }
.button.secondary { background: var(--paper); }
.button:not(:disabled):hover { box-shadow: 3px 3px var(--ink); background: var(--yellow); }
.camera-upload-actions { margin-bottom: 13px; }
.camera-upload-actions button[aria-pressed='true'] { box-shadow: 3px 3px var(--ink); background: var(--cyan); }
.camera-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 300px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #111820;
  box-shadow: 3px 4px #11182035;
}
.camera-frame, #source-preview { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
#camera-input:has(#camera-mirror:checked) #camera-video { transform: scaleX(-1); }
.camera-guide {
  position: absolute;
  z-index: 1;
  inset: 8% 34% 12%;
  border: 3px dashed #ffe057;
  border-radius: 48% 48% 40% 40%;
  pointer-events: none;
  box-shadow: 0 0 0 1px var(--ink);
}
.camera-stage:has(#camera-canvas:not([hidden])) .camera-guide { display: none; }
.camera-stage:has(#camera-video[hidden]) .camera-guide {
  inset: 13% auto auto;
  width: min(33%, 27vh, 132px);
  height: 52%;
}
.camera-example { position: absolute; inset: 8% 16%; display: block; width: 68%; height: 84%; object-fit: contain; }
.camera-stage:has(:is(.camera-frame, #source-preview):not([hidden])) .camera-example { display: none; }
.upload-stage { background: #f7fbfc; }
.camera-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-top: 15px; }
.camera-mirror, .check { display: flex; align-items: flex-start; gap: 9px; }
input[type='checkbox'] { width: 18px; height: 18px; margin: 2px 0 0; flex: 0 0 18px; accent-color: var(--cyan); }
#camera-status, #input-hint { margin-top: 9px; }
#camera-upload-fallback { margin-top: 10px; }
.upload-label { display: block; margin-block: 12px 4px; font-weight: 700; }
input[type='file'] { width: 100%; font-size: 13px; }
input[type='file']::file-selector-button { margin-right: 7px; border: 1px solid var(--ink); padding: 6px 9px; background: var(--paper); font: inherit; cursor: pointer; }
.framing-help { margin-top: 11px; }
.framing-help summary { cursor: pointer; width: fit-content; font-weight: 700; }
.framing-help p { margin-top: 6px; max-width: 50ch; }
.context-help { display: inline-grid; width: 24px; height: 24px; margin: 0 4px 0 0; place-items: center; border: 1px solid var(--ink); background: var(--paper); box-shadow: 2px 2px var(--cyan); }
.world-controls { padding: clamp(12px, 2vw, 22px); }
.world-controls label { display: block; margin-bottom: 5px; font-weight: 700; }
select { width: 100%; min-height: 42px; padding: 7px 10px; border: 1px solid #9da8ab; border-radius: 0; background: #fffefa; }
.scene-preview { overflow: hidden; margin-top: 14px; border: 2px solid var(--ink); background: var(--pale); }
.scene-image-area { display: grid; aspect-ratio: 3 / 2; place-items: center; }
.scene-image-area img { display: block; width: 100%; height: 100%; object-fit: contain; }
#scene-unavailable { padding: 15px; color: var(--muted); text-align: center; }
.scene-preview figcaption { padding: 8px 11px; border-top: 2px solid var(--ink); background: var(--paper); font-weight: 700; }
.scene-preview figcaption:empty { display: none; }
#world-preview-status { margin-top: 8px; color: var(--muted); }
#world-preview-status:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.world-consent { padding: 0 clamp(12px, 2vw, 22px) 14px; }
.world-consent-hint { margin: 10px 0 0; }
#world-step.accepts-consent { cursor: pointer; }
#world-step select, #world-step details, #world-step button:disabled { cursor: auto; }
#world-step:has(#consent:checked) .scene-preview { border-color: var(--cyan); }
#world-step summary, #world-step button:not(:disabled), #world-step label.check { cursor: pointer; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px clamp(12px, 2vw, 22px); border-top: 2px solid var(--ink); }
.step-actions > .primary { margin-inline-start: auto; }
#status { margin-bottom: 14px; font-weight: 700; }
#status:empty { display: none; }
.proof-frame { margin-top: 13px; }
#preview-result-note { margin: 10px clamp(12px, 2vw, 22px) 0; color: var(--muted); }
.proof-media {
  --proof-inset: clamp(10px, 2.4vw, 26px);
  --proof-corner: clamp(8px, 1.3vw, 16px);
  --proof-ink: #586a70;
  position: relative;
  isolation: isolate;
  display: grid;
  width: min(100% - 24px, 820px);
  aspect-ratio: 3 / 2;
  margin: clamp(12px, 2vw, 24px) auto;
  padding: var(--proof-inset);
  border: 1px solid #a4b2b8;
  background:
    linear-gradient(var(--proof-ink) 0 0) left var(--proof-inset) top var(--proof-inset) / var(--proof-corner) 2px,
    linear-gradient(var(--proof-ink) 0 0) left var(--proof-inset) top var(--proof-inset) / 2px var(--proof-corner),
    linear-gradient(var(--proof-ink) 0 0) right var(--proof-inset) top var(--proof-inset) / var(--proof-corner) 2px,
    linear-gradient(var(--proof-ink) 0 0) right var(--proof-inset) top var(--proof-inset) / 2px var(--proof-corner),
    linear-gradient(var(--proof-ink) 0 0) left var(--proof-inset) bottom var(--proof-inset) / var(--proof-corner) 2px,
    linear-gradient(var(--proof-ink) 0 0) left var(--proof-inset) bottom var(--proof-inset) / 2px var(--proof-corner),
    linear-gradient(var(--proof-ink) 0 0) right var(--proof-inset) bottom var(--proof-inset) / var(--proof-corner) 2px,
    linear-gradient(var(--proof-ink) 0 0) right var(--proof-inset) bottom var(--proof-inset) / 2px var(--proof-corner) #fff;
  background-repeat: no-repeat;
}
#pending, #result, #proof-error { position: relative; grid-area: 1 / 1; min-width: 0; min-height: 0; margin: 4px; }
#pending { z-index: 2; background: var(--ink); }
#loading-mark { position: absolute; inset: 0; }
.processing-indicator {
  position: absolute;
  z-index: 3;
  inset: clamp(8px, 2vw, 16px) auto auto clamp(8px, 2vw, 16px);
  max-width: calc(100% - 32px);
  padding: 7px 11px;
  border-inline-start: 3px solid var(--cyan);
  background: var(--ink);
  color: var(--paper);
}
#loading-mark:has(.is-completing) + .processing-indicator { visibility: hidden; }
#processing-stage { font-weight: 700; overflow-wrap: anywhere; }
.processing-elapsed { margin-top: 1px; }
#processing-time { margin-inline-start: 4px; font-variant-numeric: tabular-nums; }
#panel { display: block; width: 100%; height: 100%; object-fit: contain; }
#proof-error { display: grid; place-items: center; padding: 12px; text-align: center; }
#proof-error h3 { margin: 0 0 7px; font: 400 clamp(24px, 4vw, 39px)/1.05 Bangers, Noto, sans-serif; }
#proof-error-message { max-width: 43ch; }
.proof-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px clamp(12px, 2vw, 22px); border-top: 2px solid var(--ink); }
.proof-footer:not(:has(> :not([hidden]))) { display: none; }
.result-downloads { justify-content: flex-end; margin-inline-start: auto; }
dialog { width: min(100% - 2rem, 27rem); padding: 1.5rem; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 5px 5px var(--ink); }
dialog::backdrop { background: #11182099; }
dialog h2 { font: 400 35px/1.1 Bangers, Impact, sans-serif; }
dialog p { margin: 9px 0 14px; }
@media (max-width: 760px) {
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .studio-header { min-height: 70px; }
  .brand { gap: 9px; font-size: 14px; }
  .brand img { width: 34px; height: 34px; }
  .brand small { margin-top: 4px; }
  .camera-stage { max-height: 260px; }
  .camera-footer { align-items: flex-start; }
  .camera-footer .actions { margin-left: auto; }
  body:has(#setup:not([hidden]) > #character-step:not([hidden])) .studio-header { min-height: 70px; }
}
