:root {
  --blue: #3532e8; --blue-dark: #2524bc; --mint: #5ee0c2; --white: #fff;
  --paper: #f4f1e8; --line: #ffffff42; --soft: #ffffff1f;
  --sans: 'Google Sans Flex', 'Google Sans', Arial, sans-serif;
  --mono: 'Google Sans Flex', 'Google Sans', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--blue); scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--white); font: 16px/1.5 var(--sans); letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible + span { outline: 3px solid var(--mint); outline-offset: 5px; }
button, a { touch-action: manipulation; }
h1, h2, h3, p, figure { margin: 0; }
h2 { font-size: clamp(2.3rem, 4.3vw, 4rem); line-height: .98; letter-spacing: 0; font-weight: 700; }
h3 { font-size: 19px; letter-spacing: 0; }
p + p { margin-top: 14px; }
canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.wrap { max-width: 1280px; margin-inline: auto; padding-left: max(clamp(22px, 5vw, 72px), env(safe-area-inset-left)); padding-right: max(clamp(22px, 5vw, 72px), env(safe-area-inset-right)); }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: max(30px, env(safe-area-inset-top)); padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 700; letter-spacing: 0; font-size: 22px; }
.wordmark span { color: var(--mint); }
.masthead nav, .footer nav { display: flex; gap: 28px; font-size: 13px; }
nav a:hover, .contract-line a:hover { text-decoration: underline; text-underline-offset: 4px; }
.hero { display: grid; grid-template-columns: 1fr 240px; gap: 24px; align-items: center; padding-block: 48px 50px; }
.eyebrow, .micro { font-family: var(--mono); font-size: 12px; letter-spacing: 0; line-height: 1.6; }
.eyebrow { letter-spacing: 0; font-weight: 600; }
.micro { color: #ffffffe0; }
.live-dot { width: 7px; height: 7px; background: var(--mint); display: inline-block; margin-right: 7px; border-radius: 50%; }
h1 { font-size: clamp(3rem, 6.5vw, 5.8rem); line-height: .9; letter-spacing: 0; margin-top: 20px; }
h1 em { font-style: normal; color: var(--mint); white-space: nowrap; }
.intro { max-width: 520px; font-size: 20px; line-height: 1.35; margin-top: 22px; }
.hero .micro { margin-top: 15px; }
.hero-mark { transform: rotate(7deg); position: relative; width: 215px; justify-self: end; }
.hero-mark canvas { width: 190px; height: 190px; margin: 0 auto 9px; }
.hero-mark span { display: block; font: 700 17px/.95 var(--mono); color: var(--mint); text-align: center; letter-spacing: 0; }
.section-top { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 22px 0; border-top: 1px solid var(--line); }
.section-top .eyebrow { color: var(--mint); }
.studio-grid { display: grid; grid-template-columns: 1.13fr 1fr; border: 1px solid var(--line); }
.portrait { min-width: 0; padding: 22px; position: relative; display: flex; flex-direction: column; justify-content: space-between; background-color: var(--blue-dark); }
.portrait-meta, .portrait-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 12px var(--mono); letter-spacing: 0; }
.portrait-meta { color: var(--mint); }
.portrait canvas { width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.corner-mark { font-size: 36px; line-height: 1; color: var(--mint); }
.studio-controls { padding: clamp(24px, 3.3vw, 48px); align-self: center; }
.studio-controls > p, .desk-controls > p { max-width: 33ch; margin-top: 18px; color: #ffffffe8; font-size: 15px; }
fieldset { border: 0; padding: 0; margin: 28px 0 24px; min-width: 0; }
legend { padding: 0; margin-bottom: 10px; font: 12px/1.5 var(--mono); letter-spacing: 0; color: var(--mint); }
.trait-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; background: transparent; color: white; border: 0; border-top: 1px solid var(--line); padding: 14px 2px; font-size: 15px; text-align: left; }
.trait-btn:last-child { border-bottom: 1px solid var(--line); }
.trait-btn:hover { color: var(--mint); }
.trait-icon { font: 16px var(--mono); margin-right: 18px; display: inline-block; width: 34px; color: var(--mint); }
.action-grid { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.btn { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 12px 18px; border: 1px solid var(--line); background: transparent; color: white; font: 13px/1.4 var(--mono); letter-spacing: 0; border-radius: 2px; text-align: center; transition: background 120ms, color 120ms; }
.btn:hover { background: #ffffff12; border-color: white; }
.btn.primary { background: var(--mint); border-color: var(--mint); color: #15146c; font-weight: 700; }
.btn.primary:hover { background: white; border-color: white; }
.text-btn { border: 0; padding: 10px 0; background: transparent; color: inherit; font: 12px/1.5 var(--mono); text-decoration: underline; text-underline-offset: 4px; }
.text-btn:hover { color: var(--mint); }
#remixStatus { font: 10px/1.5 var(--mono); min-height: 30px; }
.family-section { padding: 26px 0 48px; }
.family-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 16px; }
.family-row { display: flex; align-items: center; gap: 12px; min-height: 103px; overflow-x: auto; padding: 5px 5px 10px; }
.family-member { flex: 0 0 98px; border: 1px solid var(--line); background: transparent; color: white; padding: 8px; position: relative; text-align: center; }
button.family-member:hover { border-color: var(--mint); background: #ffffff10; }
.family-member.is-current { border-color: var(--mint); background: #5ee0c213; }
.family-member canvas { width: 72px; height: 72px; margin-inline: auto; image-rendering: pixelated; }
.family-member span { display: block; font: 9px/1.5 var(--mono); margin-top: 5px; }
.family-arrow { color: var(--mint); font-size: 17px; flex-shrink: 0; }
.family-empty { font: 12px/1.6 var(--mono); max-width: 26ch; color: #ffffffc9; }
.desk { padding-bottom: 66px; }
.desk-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: clamp(30px, 6vw, 90px); align-items: start; padding-top: 14px; }
.mint { color: var(--mint); }
.desk-controls h2 { font-size: clamp(2.4rem, 4.7vw, 4.2rem); }
.complaints { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 17px; }
.complaint-option { position: relative; min-width: 0; cursor: pointer; }
.complaint-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.complaint-option span { display: flex; align-items: center; min-height: 49px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 2px; font: 12px/1.4 var(--mono); }
.complaint-option input:checked + span { background: var(--paper); color: var(--blue); border-color: var(--paper); }
.complaint-option:hover span { border-color: white; }
.desk-controls .desk-aside { font: 11px/1.6 var(--mono); max-width: 32ch; color: #ffffffc9; margin: 0 0 23px; }
.receipt-wrap { padding: 8px 0 0; min-width: 0; }
#receiptCanvas { width: 100%; height: auto; box-shadow: none; transform: none; }
.receipt-caption { display: block; text-align: center; margin-top: 24px; letter-spacing: 0; }
.saved-section { padding: 26px 0 45px; border-top: 1px solid var(--line); }
.saved-section h2 { font-size: 30px; margin-top: 9px; }
.saved-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 20px; }
.saved-row:empty { display: none; }
.saved-card { padding: 10px 8px; text-align: center; color: white; background: transparent; border: 1px solid var(--line); min-width: 0; }
.saved-card:hover { background: var(--soft); border-color: var(--mint); }
.saved-card canvas { width: 78px; height: 78px; margin: auto; image-rendering: pixelated; }
.saved-card span { display: block; font: 11px/1.45 var(--mono); overflow-wrap: anywhere; margin-top: 6px; }
.token-section { border-top: 1px solid var(--line); padding: 30px 0 55px; }
.token-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 60px; margin-top: 23px; }
.token-grid h2 { font-size: 32px; line-height: 1.1; }
.token-grid p { font-size: 14px; max-width: 52ch; }
.token-grid .risk { color: #ffffffd1; font-size: 12px; }
.token-actions { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin-block: 22px; }
.token-actions .text-btn { min-height: 44px; display: inline-flex; align-items: center; }
.miniapp-status { min-height: 20px; }
.token-grid .contract-line { font: 11px/1.7 var(--mono); overflow-wrap: anywhere; }
.contract-line a { text-decoration: underline; text-underline-offset: 3px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 22px; border-top: 1px solid var(--line); padding-top: 27px; padding-bottom: max(27px, env(safe-area-inset-bottom)); }
.footer-verdict { flex-basis: 100%; max-width: 18ch; margin-bottom: 28px; font-size: clamp(2.7rem, 7vw, 6.8rem); font-weight: 700; letter-spacing: 0; line-height: .84; text-transform: none; }
.footer > p:first-child { font: 700 12px var(--mono); color: var(--mint); }
.footer > .micro { flex-basis: 100%; font-size: 11px; margin: 0; }
.notice { border: 1px solid var(--mint); padding: 17px; margin-bottom: 24px; font: 13px/1.5 var(--mono); }
.notice a { text-decoration: underline; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 15px); background: var(--paper); color: var(--blue-dark); font: 12px/1.5 var(--mono); padding: 13px 20px; max-width: calc(100% - 32px); width: max-content; border: 1px solid var(--blue-dark); opacity: 0; pointer-events: none; z-index: 10; transition: opacity 140ms, transform 140ms; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
dialog { background: var(--paper); color: var(--blue-dark); border: 0; max-width: min(540px, calc(100% - 32px)); padding: 30px; }
dialog::backdrop { background: #10104ac9; }
dialog h2 { font-size: 26px; }
dialog textarea { width: 100%; padding: 14px; margin: 18px 0; border: 1px solid var(--blue); background: white; color: var(--blue); font: 12px/1.5 var(--mono); resize: vertical; }
dialog .text-btn:hover { color: var(--blue); }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 16px; background: var(--paper); color: var(--blue); }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr 130px; }
  .hero-mark { width: 125px; }
  .hero-mark canvas { width: 125px; height: 125px; }
  .hero-mark span { font-size: 12px; }
  .hero .eyebrow { font-size: 11px; max-width: 40ch; }
  h1 { font-size: clamp(3.1rem, 7.5vw, 5rem); }
  .studio-grid { grid-template-columns: 1fr 1fr; }
  .studio-controls { padding: 26px; }
  .portrait { padding: 16px; }
  .portrait canvas { margin-block: auto; }
  .desk-grid { gap: 35px; }
  .token-grid { gap: 35px; }
  .saved-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  .masthead { padding-top: max(22px, env(safe-area-inset-top)); padding-bottom: 22px; }
  .wordmark { font-size: 19px; }
  .masthead nav a:first-child { display: none; }
  .masthead nav { gap: 0; font-size: 10px; }
  .hero { grid-template-columns: 1fr; padding-block: 32px 28px; }
  .hero-mark { display: none; }
  h1 { font-size: clamp(2rem, 9vw, 4.3rem); }
  .hero .intro { font-size: 17px; max-width: 30ch; }
  .section-top { gap: 12px; }
  .section-top > .micro { display: none; }
  .studio-grid, .desk-grid, .token-grid { grid-template-columns: 1fr; }
  .portrait { padding: 17px; }
  .portrait canvas { max-height: 310px; object-fit: contain; }
  .studio-controls { padding: 18px 23px 27px; }
  .studio-intro { display: none; }
  .studio-controls fieldset { margin-top: 0; }
  .family-heading { flex-wrap: wrap; gap: 8px; }
  .family-heading .micro { max-width: 38ch; }
  .family-row { gap: 8px; }
  .family-member { flex-basis: 85px; }
  .family-member canvas { width: 60px; height: 60px; }
  .family-section { padding-bottom: 30px; }
  .desk-grid { padding-top: 8px; gap: 32px; }
  .desk-controls h2 { font-size: 45px; }
  .desk-controls .action-grid { max-width: none; }
  .receipt-wrap { padding: 0 8px; }
  .desk { padding-bottom: 38px; }
  .saved-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .saved-card canvas { width: 60px; height: 60px; }
  .saved-card span { font-size: 10px; }
  .token-grid { gap: 22px; }
  .token-grid h2 { font-size: 31px; }
  .footer nav { gap: 22px; }
  .contract-line { word-break: break-all; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Toy portraits use smooth sampling; receipts retain their original pixel stamp. */
canvas[data-renderer="toy"] { image-rendering: auto; }
canvas[data-renderer="pixel"] { image-rendering: pixelated; }
.portrait-stage { width: 100%; margin-block: auto; padding-block: 16px; }
.portrait-viewport { position: relative; }
.portrait-viewport[data-mode="loading"] canvas { opacity: .25; }
.portrait-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: max-content; max-width: 92%; padding: 14px 18px; border: 1px solid var(--line); background: var(--blue-dark); color: white; text-align: center; font-size: 13px; pointer-events: none; }
.portrait-loading span { display: block; margin-top: 4px; color: var(--mint); font-size: 11px; }
#invaderCanvas { touch-action: pan-y pinch-zoom; user-select: none; }
#invaderCanvas.is-rotatable { cursor: grab; }
#invaderCanvas.is-dragging { cursor: grabbing; }
.rotation-tools { text-align: center; padding-block: 6px 12px; }
.rotation-tools .micro { font-size: 11px; letter-spacing: 0; }
.rotation-controls { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 8px; }
.rotation-controls button { min-width: 44px; min-height: 44px; background: transparent; color: white; border: 0; font-size: 14px; }
.rotation-controls button[data-turn="reset"] { font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
.rotation-controls button:hover:enabled { color: var(--mint); }
.rotation-controls button:disabled { cursor: default; opacity: .35; }

/* Native radio choices keep material and personality changes keyboard accessible. */
.studio-intro h2 { font-size: clamp(2rem, 3.3vw, 3rem); }
.studio-intro p { font-size: 15px; line-height: 1.45; margin-top: 14px; max-width: 34ch; }
.appearance-controls { margin-top: 28px; }
.appearance-field { margin: 0 0 19px; }
.appearance-field legend { font-size: 11px; margin-bottom: 8px; text-transform: none; }
.appearance-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.appearance-option { display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 3px; font-size: 12px; line-height: 1.4; gap: 6px; }
.appearance-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.appearance-option:has(input:checked) { background: var(--paper); border-color: var(--paper); color: var(--blue-dark); }
.appearance-option:hover { border-color: var(--mint); }
.appearance-option:has(input:focus-visible) { outline: 3px solid var(--mint); outline-offset: 3px; }
.appearance-option input:focus-visible + span { outline: none; }
.appearance-option:has(input:disabled) { cursor: default; opacity: .55; }
.color-swatch { display: block; width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px #00000018; }
.appearance-body .appearance-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appearance-body .appearance-option { justify-content: flex-start; padding-inline: 7px; min-width: 0; font-size: 11px; }
.studio-controls .trait-controls { margin-top: 26px; }
.trait-controls .trait-btn { padding-block: 10px; font-size: 13px; }
.portrait-bottom { overflow-wrap: anywhere; }
@media (min-width: 641px) {
  .portrait { justify-content: flex-start; }
  .portrait-stage { position: sticky; top: 18px; margin-block: 24px; }
  .portrait-bottom { margin-top: auto; }
}
@media (max-width: 900px) and (min-width: 641px) {
  .studio-controls { padding: 22px; }
  .appearance-option { padding-inline: 8px; }
  .appearance-body .appearance-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .appearance-controls { margin-top: 9px; }
  .appearance-option { min-height: 44px; }
  .appearance-field { margin-bottom: 18px; }
}
@media (max-width: 380px) {
  .appearance-body .appearance-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.customizer-section { border-top: 1px solid var(--line); padding-bottom: 4px; }
.customizer-section:last-child { border-bottom: 1px solid var(--line); }
.customizer-section summary { display: grid; grid-template-columns: 1fr 18px; align-items: center; gap: 2px 12px; cursor: pointer; padding: 16px 0; list-style: none; }
.customizer-section summary::-webkit-details-marker { display: none; }
.customizer-section summary::after { content: '+'; grid-column: 2; grid-row: 1 / 3; font-size: 25px; color: var(--mint); font-weight: 400; }
.customizer-section[open] summary::after { content: '−'; }
.customizer-title { font-size: 19px; font-weight: 650; letter-spacing: 0; }
.customizer-selection { font-size: 10px; line-height: 1.5; color: #ffffffe0; min-width: 0; overflow-wrap: anywhere; }
.customizer-section summary:focus-visible { outline: 3px solid var(--mint); outline-offset: 4px; }
.customizer-note { font-size: 12px; color: #ffffffcc; margin: -5px 0 17px; }
.customizer-section .appearance-field { margin: 0 0 18px; }
.customizer-section .appearance-choices { gap: 5px; }
.customizer-section .appearance-option { min-height: 37px; padding: 7px 9px; }
.customizer-section .appearance-body .appearance-option { padding-inline: 6px; }
.appearance-accent .appearance-option { font-size: 11px; }
.name-form { margin-top: 23px; }
.name-form > label { display: block; color: var(--mint); font-size: 11px; letter-spacing: 0; margin-bottom: 9px; }
.name-form > div { display: flex; gap: 7px; }
.name-form input { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 2px; background: #ffffff09; color: white; padding: 9px 11px; font: 14px var(--sans); }
.name-form input::placeholder { color: #ffffff99; }
.name-form input:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
.name-form .btn { white-space: nowrap; padding-inline: 12px; font-size: 11px; min-height: 42px; }
.name-form .micro { font-size: 10px; margin-top: 7px; color: #ffffffc9; }
.portrait-signature h3 { font-size: 18px; font-weight: 650; line-height: 1.3; margin-bottom: 7px; letter-spacing: 0; }
.portrait-signature .micro { font-size: 10px; }
.portrait-stage .portrait-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.mini-portrait { display: none; }
@media (max-width: 640px) {
  .customizer-section .appearance-option { min-height: 44px; }
  .mini-portrait { display: block; position: fixed; right: 10px; bottom: 12px; width: 108px; background: var(--blue-dark); border: 1px solid var(--mint); z-index: 4; box-shadow: 0 6px 24px #18146b55; }
  .mini-portrait canvas { width: 106px; height: 106px; }
  .mini-portrait button { min-height: 38px; display: block; width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); color: white; font-size: 10px; }
}
