/* PetBricks flow pages (new pet, pet, my pets). Tokens come from brand.css. */
*{box-sizing:border-box}
html,body{margin:0}
body.flow{min-height:100vh;min-height:100dvh}
body.flow{font:500 17px/1.4 var(--pb-font);color:var(--pb-ink);background:var(--pb-white)}
body.flow.night{background-color:var(--pb-night);background-image:var(--pb-stud-grid);background-size:24px 24px;color:var(--pb-on-night)}
[hidden]{display:none!important}
a{color:inherit}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
button:disabled{opacity:.45;cursor:not-allowed}
:focus-visible{outline:3px solid var(--pb-blue);outline-offset:3px}
.night :focus-visible{outline-color:var(--pb-yellow)}
[tabindex="-1"]:focus{outline:none}

.flow-top{display:flex;align-items:center;gap:12px;max-width:1180px;margin:0 auto;padding:18px clamp(16px,4vw,40px)}
.flow-top .brand{flex:1;display:flex;align-items:center;gap:10px;font-size:23px;font-weight:800;letter-spacing:-.03em;text-decoration:none}
.flow-top .brand>img{width:38px;height:auto}
.flow-top nav{display:flex;align-items:center}
.flow-top nav{gap:clamp(4px,1.6vw,18px)}
/* Header links, as on the homepage; a small yellow brick sits under the page you're on. */
.top-link{position:relative;padding:11px 8px;font-weight:700;font-size:15px;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:5px;transition:text-decoration-color .2s}
.top-link:hover{text-decoration-color:currentColor}
.top-link[aria-current]::after{content:"";position:absolute;left:50%;bottom:2px;width:22px;height:6px;margin-left:-11px;border-radius:2px;background:var(--site-accent,#FFCE55);box-shadow:inset 0 -2px 0 var(--site-action-lip,#BE8D19)}
.round svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}

/* Room to breathe, and tall enough that the footer starts below the fold. */
.flow-main{max-width:1180px;min-height:calc(100svh - 90px);margin:0 auto;padding:clamp(24px,7vh,80px) clamp(16px,4vw,40px) 96px;box-sizing:border-box}
/* New pet steps: one centred column (the photo step keeps its two columns). */
body[data-flow-page="capture"] .flow-main>#loading,body[data-flow-page="capture"] .flow-main>section:not(.capture){display:grid;justify-items:center;text-align:center}
body[data-flow-page="capture"] .flow-main>section:not(.capture)>.card{width:min(600px,100%);max-width:none!important;text-align:left}
body[data-flow-page="capture"] .flow-main>section>.capture{width:100%;text-align:left}
body[data-flow-page="capture"] .flow-main .flow-title{margin:0 0 34px}
/* Each step of a flow rises into place. */
.flow-main>section:not(.moment){animation:flow-step-in .5s var(--pb-ease) backwards}
@keyframes flow-step-in{from{opacity:0;transform:translateY(16px)}}
.flow-title{margin:6px 0 10px;font-size:clamp(34px,5vw,58px);font-weight:800;letter-spacing:-.04em;line-height:1}
.flow-lead{margin:0 0 20px;font-size:clamp(17px,1.6vw,20px);color:var(--pb-ink-muted);max-width:40ch}
.night .flow-lead{color:var(--pb-on-night-muted)}
.actions{display:flex;flex-wrap:wrap;gap:12px;align-items:center;margin-top:18px}
#retry:not([hidden]){margin-top:16px}

.card{background:var(--pb-white);color:var(--pb-ink);border-radius:28px;padding:clamp(20px,3vw,28px)}
.card:not(.pb-card){box-shadow:var(--pb-shadow-card)}
.pill{display:inline-flex;align-items:center;gap:10px;background:rgba(255,255,255,.94);color:var(--pb-ink);border-radius:999px;padding:9px 14px;font-size:14px;font-weight:800}
.dots{display:inline-flex;gap:5px}
.dots i{width:16px;height:10px;border-radius:3px;background:#DDE2F0;box-shadow:inset 0 -3px 0 rgba(23,40,120,.14);transition:width .3s var(--pb-click),background-color .2s}
.dots i.on{width:30px;background:var(--pb-blue)}
.dots i.done{background:var(--pb-green);animation:dot-click .4s var(--pb-click)}
@keyframes dot-click{from{transform:translateY(-7px)}}
/* The optional fourth photo: an outlined dot until it is reached or done. */
.dots i.opt{background:none;box-shadow:inset 0 0 0 2px #DDE2F0}
.dots i.opt.on{background:var(--pb-blue);box-shadow:none}
.dots i.opt.done{background:var(--pb-green);box-shadow:none}

/* Capture */
.capture{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:clamp(18px,4vw,48px);align-items:start}
.viewfinder{position:relative;box-sizing:border-box;border:6px solid #fff;border-radius:34px;overflow:hidden;background:#0B0E24;box-shadow:0 6px 0 var(--pb-card-lip),0 22px 44px rgba(5,14,66,.3);aspect-ratio:4/5;max-height:calc(100dvh - 130px);width:100%;display:grid;place-items:center}
.viewfinder img{width:100%;height:100%;object-fit:cover;display:block}
.viewfinder img.whole{object-fit:contain}
.viewfinder.cropped-example{max-height:none}
.viewfinder .guide{position:absolute;inset:14% 18%;border:3px dashed rgba(255,255,255,.85);border-radius:50%;pointer-events:none}
.viewfinder .guide.body{inset:30% 6% 18%;border-radius:40px}
.viewfinder .guide.free{display:none}
.viewfinder .example-tag{position:absolute;left:14px;top:14px}
.viewfinder .scrim{position:absolute;inset:0;display:grid;place-items:center;background:rgba(11,14,36,.45);color:var(--pb-white);font-weight:800;font-size:18px;gap:12px;align-content:center}
.viewfinder .scrim.checking{background:rgba(11,14,36,.38);align-content:end;padding:0 18px 22px;text-align:center}
.viewfinder .scrim.checking #scrim-text{display:inline-block;justify-self:center;padding:10px 16px;border-radius:999px;background:rgba(255,255,255,.95);color:var(--pb-ink);font-size:17px}
.viewfinder .scrim-meta{font-size:14px;font-weight:700;color:rgba(255,255,255,.9);font-variant-numeric:tabular-nums;text-shadow:0 1px 3px rgba(0,0,0,.4)}
.viewfinder .scrim-meta:empty{display:none}
.step-card h2{margin:12px 0 6px;font-size:clamp(26px,3vw,34px);font-weight:800;letter-spacing:-.03em;line-height:1.08}
.step-card p{margin:0;color:var(--pb-ink-muted);font-size:17px}
.verdict{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.03em;border-radius:999px;padding:6px 12px}
.verdict.ok{background:var(--pb-green-soft);color:var(--pb-green-text)}
.verdict.retake{background:var(--pb-yellow-soft);color:#6A5200}
.verdict.error{background:var(--pb-red-soft);color:#9B1D10}
.step-card .photo-feedback{margin-top:20px}
.step-card .photo-feedback-message{color:var(--pb-ink);font-weight:800}
.step-card .photo-feedback-tip{margin-top:6px}
.thumbs{display:flex;gap:10px;margin-top:18px}
.thumbs figure{margin:0;width:76px}
.thumbs img,.thumbs .empty{box-sizing:border-box;width:76px;height:76px;border-radius:16px;object-fit:cover;display:block;background:var(--pb-paper)}
.thumbs img{border:4px solid #fff;box-shadow:0 4px 12px rgba(21,22,30,.18);transition:transform .3s var(--pb-click)}
.thumbs .empty{box-shadow:inset 0 0 0 2px var(--pb-paper-line)}
.thumbs figcaption{font-size:12px;font-weight:800;margin-top:5px;color:var(--pb-ink-muted)}
.country-choice{display:grid;gap:10px;margin:0 0 18px}
.country-title{font-family:var(--pb-font);font-size:20px;font-weight:800;letter-spacing:-.02em}
.country-select{width:100%;min-height:50px;padding:0 44px 0 16px;border:2px solid var(--pb-paper-line);border-radius:16px;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%2315161e' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 16px center;font:inherit;font-size:17px;font-weight:700;color:inherit;appearance:none;-webkit-appearance:none;cursor:pointer;transition:border-color .15s}
.country-select:hover{border-color:var(--pb-blue,#3a5cf5)}
.country-select:focus-visible{outline:3px solid var(--pb-blue,#3a5cf5);outline-offset:2px}
.country-select:disabled{opacity:.6;cursor:default}
.country-help,.country-hint{margin:0;font-size:14px;line-height:1.45;color:var(--pb-ink-muted)}
.country-hint{color:var(--pb-ink)}
.price{display:flex;flex-direction:column;gap:12px;margin:18px 0;padding:16px 18px;border-radius:18px;background:var(--pb-surface-muted)}
.price-row{display:flex;align-items:baseline;gap:12px}
.price-row b{flex:1;font-size:17px}
.price-row strong{font-size:24px;font-weight:800}
.price small{font-size:13px;color:var(--pb-ink-muted)}
.note{padding:14px 16px;border-radius:18px;background:var(--pb-yellow-soft);font-size:15px;line-height:1.45}
.error-text{color:#9B1D10;font-weight:700;margin-top:12px}
.field{display:flex;flex-direction:column;gap:8px;margin:8px 0 18px}
.field span{font-weight:800}

/* Pet page */
.pet-head{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap;margin-bottom:clamp(28px,4vw,40px)}
.pet-head h1{flex:1;margin:0;font-size:clamp(36px,5vw,58px);font-weight:800;letter-spacing:-.04em;line-height:1}
.stage-card{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:clamp(18px,3vw,36px);align-items:stretch}
.model-stage{position:relative;min-height:min(60vh,560px);border-radius:34px;background:#F1F3FA;box-shadow:0 6px 0 var(--pb-card-lip),0 22px 44px rgba(5,14,66,.24);overflow:hidden}
.model-stage canvas{display:block;width:100%;height:100%}
.stages{list-style:none;margin:24px 0 0;padding:0;display:flex;flex-direction:column;gap:14px}
/* The pet page's status card: room under its title. */
#panel>h2{margin-bottom:14px}
.stages li{display:flex;align-items:center;gap:12px;font-weight:700;color:var(--pb-ink-muted)}
.stages li i{width:24px;height:24px;border-radius:50%;box-shadow:inset 0 0 0 2px #D5DBEC;flex:none}
.stages li.done{color:var(--pb-ink)}.stages li.done i{background:var(--pb-green);box-shadow:none}
.stages li.now{color:var(--pb-ink);font-weight:800}.stages li.now i{box-shadow:inset 0 0 0 5px var(--pb-blue)}
.history{margin-top:clamp(48px,7vw,72px)}
.history h2{font-size:22px;font-weight:800;margin:0 0 20px}
.badge{font-size:12px;font-weight:800;border-radius:999px;padding:5px 10px;background:var(--pb-white)}
.badge.ready{background:var(--pb-green-soft);color:var(--pb-green-text)}
.badge.review{background:var(--pb-yellow-soft);color:#6A5200}

.making-visual{position:absolute;inset:0;border-radius:inherit;overflow:hidden}
.making-visual{background:var(--pb-night)}
.making-visual img{width:100%;height:100%;object-fit:cover;opacity:.8;display:block}
.making-visual img:not([src]){display:none}

/* My pets */
.pet-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px}
.pet-tile{display:flex;flex-direction:column;gap:10px;padding:20px;border-radius:26px;background:var(--pb-paper);text-decoration:none}
.pet-tile b{font-size:24px;font-weight:800;letter-spacing:-.02em}
.pet-tile span{font-size:14px;font-weight:700;color:var(--pb-ink-muted)}
.empty-state{padding:clamp(24px,5vw,56px);border-radius:34px;background:var(--pb-cobalt);color:var(--pb-white);box-shadow:0 8px 0 var(--pb-cobalt-lip);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:center}
.empty-state img{width:100%;max-width:420px;justify-self:center}
.empty-state h2{margin:0 0 14px;font-size:clamp(32px,4vw,48px);font-weight:800;letter-spacing:-.04em;line-height:1}

@media(max-width:820px){
  .capture,.stage-card,.empty-state{grid-template-columns:1fr}
  .viewfinder{aspect-ratio:3/4}
  .model-stage{min-height:46vh}
  .flow-top .brand{font-size:20px}.flow-top .brand>img{width:32px}
}
@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
#ready-step .thumbs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
#ready-step .thumbs figure{width:auto}
#ready-step .thumbs img{width:100%;height:auto;aspect-ratio:1}

/* Animal choice keeps the native radio keyboard and screen-reader behaviour. */
.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.animal-form{max-width:720px;margin-top:24px}
.animal-form .animal-choices{margin-bottom:28px}
.animal-choices{border:0;padding:0;margin:0 0 20px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;min-width:0}
.animal-choice{position:relative;cursor:pointer;min-width:0}
.animal-choice input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.animal-option{--lip:7px;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:168px;padding:18px 12px 22px;border-radius:22px;background:#EDF0F9;box-shadow:inset 0 2px 0 #fff,0 var(--lip) 0 #C3CBE3;font-size:22px;font-weight:800;transition:transform .18s var(--pb-click),box-shadow .14s,background-color .14s}
.animal-icon{font-size:52px;line-height:1.15;transition:transform .35s var(--pb-click)}
.animal-selected{position:absolute;right:10px;top:10px;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--pb-ink);color:var(--pb-yellow);font-size:16px;transform:scale(0);transition:transform .3s var(--pb-click)}
@media(hover:hover){.animal-choice:hover input:not(:checked):not(:disabled)+.animal-option{transform:translateY(-2px);background:#F6F8FD;box-shadow:inset 0 2px 0 #fff,0 calc(var(--lip) + 2px) 0 #C3CBE3}.animal-choice:hover .animal-icon{transform:scale(1.12) rotate(-6deg)}}
.animal-choice input:active+.animal-option{transform:translateY(4px);box-shadow:inset 0 2px 0 #fff,0 3px 0 #C3CBE3}
.animal-choice input:checked+.animal-option{transform:translateY(3px);background:var(--pb-action);box-shadow:inset 0 2px 0 rgba(255,255,255,.45),0 4px 0 var(--pb-action-edge)}
.animal-choice input:checked+.animal-option .animal-selected{transform:scale(1)}
.animal-choice input:checked+.animal-option .animal-icon{transform:scale(1.12)}
.animal-choice input:focus-visible+.animal-option{outline:3px solid var(--pb-blue);outline-offset:4px}
.animal-choice input:disabled+.animal-option{cursor:default}
.animal-warning{margin:0 0 20px;font-weight:800}
@media(max-width:480px){.animal-choices{gap:10px}.animal-option{min-height:132px;padding:14px 6px 18px;font-size:19px;border-radius:18px}.animal-icon{font-size:40px}.animal-selected{right:6px;top:6px;width:24px;height:24px;font-size:14px}}

/* Focused capture and pet recovery fixes from the customer UX review. */
body[data-flow-page="capture"] #photo-error{margin-top:18px}
body[data-flow-page="capture"] #photo-check-paused{margin-top:18px}
body[data-flow-page="pet"] .stage-card{align-items:start}
body[data-flow-page="pet"] .model-stage{width:100%}
body[data-flow-page="pet"] #visual:not([data-state="queued"]):not([data-state="submitting"]):not([data-state="generating"]):not([data-state="preparing"]):not([data-state="photo-preparing"]):not([data-state="checking"]):not([data-state="check-queued"]) .scanline{display:none}

@media(max-width:560px){body[data-flow-page="capture"] #photo-step .actions>.pb-button,body[data-flow-page="capture"] #resume-step .pb-button{width:100%;min-height:44px}body[data-flow-page="pet"] .pet-head .pb-button{width:100%}}

/* Notes beside the waiting panel (the panel styles itself in ui/waiting.mjs). */

.viewfinder .scrim .pb-inline-wait small{display:none}
.viewfinder .scrim:not(.checking){background:rgba(11,14,36,.55)}
/* Accepted photo: a big green tick over the photo, then the next photo. */
.photo-tick{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;z-index:3}
.photo-tick[hidden]{display:none}
.photo-tick svg{width:min(34%,150px);aspect-ratio:1;padding:6%;border-radius:50%;background:#1E9E58;box-shadow:0 10px 30px #0b3d2266;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;animation:photo-tick-pop .45s cubic-bezier(.3,1.6,.5,1) both}
@keyframes photo-tick-pop{from{transform:scale(.4);opacity:0}to{transform:none;opacity:1}}
@media(prefers-reduced-motion:reduce){.photo-tick svg{animation:none}}
/* Ready for your 3D scan: tap a photo to change it; short facts above the button. */
.thumb-change{display:block;width:100%;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:16px}
.thumb-change:focus-visible{outline:3px solid var(--pb-blue);outline-offset:3px}
.thumb-change:hover img{filter:brightness(.92)}
.ready-change{margin:14px 0 0}
.ready-card .ready-line{margin:0 0 12px;font-size:17px;line-height:1.5;color:var(--pb-ink)}
.ready-card .ready-wait{margin:0 0 20px;font-size:20px;font-weight:700;line-height:1.4}
/* Pet page: the picture on top, the status card and share card side by side under it. */
.stage-card{display:block}
.pet-cards{position:relative;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:clamp(32px,3vw,40px);margin-top:clamp(32px,3vw,40px);align-items:start}
.pet-cards>[hidden]{display:none}
.pet-cards .referral-card{margin-top:0;max-width:none}
/* A status card on its own: the words on the left, its buttons on the right. */
@media(min-width:900px){
  .pet-cards:has(>#referral[hidden]) #panel:has(.actions>:not([hidden])){display:grid;grid-template-columns:minmax(0,1fr) minmax(280px,380px);column-gap:clamp(24px,4vw,56px);align-items:center}
  .pet-cards:has(>#referral[hidden]) #panel:has(.actions>:not([hidden]))>*{grid-column:1}
  .pet-cards:has(>#referral[hidden]) #panel:has(.actions>:not([hidden]))>.actions{grid-column:2;grid-row:1/span 6;margin-top:0}
}
/* Stage list: finished stages turn green with a tick; a stage that just finished pops. */
.stages li.done i{background:var(--pb-green,#1E9E58) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat;box-shadow:none}
.stages li.fresh i{animation:stage-tick .5s cubic-bezier(.3,1.6,.5,1) both}
.stages li.now i{animation:stage-now 1.4s ease-in-out infinite}
@keyframes stage-tick{from{transform:scale(.3);opacity:0}to{transform:none;opacity:1}}
@keyframes stage-now{50%{box-shadow:inset 0 0 0 9px var(--pb-blue)}}
@media(prefers-reduced-motion:reduce){.stages li.fresh i,.stages li.now i{animation:none}}

/* The brick loader over the 3D model while it loads. */
.preview-loading{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none}
.preview-loading[hidden]{display:none}
.preview-loading pb-loader{margin:0}
/* The 3D model downloading for review: its name line and a slim bar (indeterminate, a sweep, when the size is unknown). */
.unwrap{display:grid;justify-items:center;gap:14px;padding:0 24px;text-align:center}
.unwrap-line{margin:0;font-weight:800;color:var(--pb-ink,#12226e);text-wrap:balance}
.unwrap progress{-webkit-appearance:none;appearance:none;display:block;width:min(260px,60vw);height:10px;border:0;border-radius:999px;overflow:hidden;background:rgba(18,34,110,.12);color:var(--pb-blue,#193BB5)}
.unwrap progress::-webkit-progress-bar{background:rgba(18,34,110,.12);border-radius:999px}
.unwrap progress::-webkit-progress-value{background:var(--pb-blue,#193BB5);border-radius:999px;transition:width .3s ease}
.unwrap progress::-moz-progress-bar{background:var(--pb-blue,#193BB5);border-radius:999px}
.unwrap progress:indeterminate{background:linear-gradient(90deg,rgba(18,34,110,.12) 0 30%,var(--pb-blue,#193BB5) 30% 60%,rgba(18,34,110,.12) 60%) 0 0/250% 100%;animation:pb-unwrap-sweep 1.4s ease-in-out infinite alternate}
.unwrap progress:indeterminate::-webkit-progress-bar{background:transparent}
.unwrap progress:indeterminate::-moz-progress-bar{background:transparent}
@keyframes pb-unwrap-sweep{from{background-position:100% 0}to{background-position:0 0}}
@media (prefers-reduced-motion:reduce){.unwrap progress:indeterminate{animation:none}}
.ready-card .start-now{display:flex;gap:12px;align-items:flex-start;margin:0 0 16px;padding:14px 16px;border-radius:16px;background:var(--pb-paper);font-size:15px;line-height:1.45;cursor:pointer}
.ready-card .start-now input{flex:0 0 auto;width:22px;height:22px;margin:0;accent-color:var(--pb-blue)}
/* While a pet is made, the top stage plays the show of what we are doing
   (ui/making-show.mjs, the main thing to look at) beside the Brick drop game
   (stacked on a phone, the show first). The show and the game are drawn at
   once, and each keeps its room: the drawing by its aspect ratio, the words
   by their reserved lines, the board by its own. */
.model-stage.with-game{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.75fr);min-height:0;background:var(--pb-night)}
.model-stage.with-game .making-visual{position:relative;inset:auto;display:flex;min-height:100%;border-radius:0}
.model-stage.with-game .making-visual>img{display:none}
.model-stage.with-game .making-visual>.waiting{flex:1}
.model-stage.with-game .brick-game{--brick-game-width:min(100%,340px);margin:0;max-width:none;padding:clamp(28px,4vw,40px) clamp(20px,3vw,36px) clamp(36px,4vw,48px);background:#ffffff08;color:#fff}
@media(max-width:860px){.model-stage.with-game{grid-template-columns:1fr}.model-stage.with-game .brick-game{--brick-game-width:min(100%,320px)}}

/* Pet review: a quiet list beneath one large, turnable model. */
body.flow:has(#pet) #loading{min-height:80vh}
body.flow:has(#pet) .pet-head{min-height:64px}
.scan-choice{display:flex;align-items:center;gap:12px;width:100%;min-height:76px;padding:12px 8px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
.scan-choice>span:first-of-type{flex:1;min-width:0}
.scan-choice img{width:48px;height:48px;flex:0 0 48px;border-radius:50%;object-fit:cover}
.scan-choice[aria-pressed="true"]{background:#ffffff20;box-shadow:inset 4px 0 var(--pb-yellow,#ffd43b)}
.scan-choice:hover{background:#ffffff18}
.scan-choice:focus-visible{outline:3px solid var(--pb-yellow,#ffd43b);outline-offset:2px}
#visual{scroll-margin-top:24px}
@media(max-width:700px){.scan-choice{gap:8px;font-size:15px}.scan-choice .badge{font-size:12px}}

.intake-again{min-height:2.6em;margin:16px auto;max-width:640px;text-align:center}
/* Order steps on the pet page line up with the left-aligned pet name above them. */
/* The same place on every order page (Owen, 18 Nov): the title centred, the steps centred under it, as on the photo page. */
.pet-head:has(+.pb-order-steps){justify-content:center;text-align:center;margin-bottom:clamp(24px,4vh,36px)}
.pet-head:has(+.pb-order-steps) h1{flex:0 1 auto}

/* "Is this {name}?" (Owen, 18 Nov): the model and the one decision side by side on a wide screen, both in
   view without scrolling; on a phone the decision sits right under the model. */
@media(min-width:900px){
  #pet[data-state=review]{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,1fr);column-gap:clamp(24px,3vw,40px);align-items:start}
  /* The question sits level with the middle of the model, not stuck to its top edge. */
  #pet[data-state=review]>.pet-cards{align-self:center}
  #pet[data-state=review]>:not(.stage-card,.pet-cards){grid-column:1/-1}
  #pet[data-state=review]>.stage-card{grid-column:1}
  #pet[data-state=review]>.pet-cards{grid-column:2;grid-template-columns:1fr;margin-top:0}
  #pet[data-state=review] .model-stage{min-height:min(62vh,560px)}
  #pet[data-state=review] .pet-cards #panel{display:block!important}
  #pet[data-state=review] .pet-cards #panel>.actions{margin-top:clamp(20px,3vh,28px)}
}

/* The 3D model reveal (Owen, 18 Nov: "the big reveal should be a lot more impressive… show the 3D model
   before we show the text"). The model arrives already loaded, pops in with a settling turn and a burst of
   bricks; the question follows a moment later. Room between every line on the card. */
#pet[data-state=review] #preview{opacity:0;transform:scale(.94)}
#pet[data-state=review][data-revealed] #preview{opacity:1;transform:none;transition:opacity .35s ease,transform .8s cubic-bezier(.2,.9,.25,1.12)}
#pet[data-state=review] .pet-cards #panel{opacity:0;transform:translateY(16px)}
#pet[data-state=review][data-revealed] .pet-cards #panel{opacity:1;transform:none;transition:opacity .5s ease .9s,transform .7s cubic-bezier(.2,.8,.2,1) .9s}
#pet[data-state=review] #panel>h2{margin:0 0 14px}
#pet[data-state=review] #panel-text{margin:0;line-height:1.55;text-wrap:pretty}
#pet[data-state=review] .pet-cards #panel>.actions{margin-top:32px!important;gap:16px}
#pet[data-state=review] #panel-fine{margin-top:28px!important;line-height:1.5;text-wrap:pretty}
.reveal-burst{position:absolute;inset:0;pointer-events:none;overflow:hidden;display:none}
#pet[data-state=review] .reveal-burst{display:block}
.reveal-burst i{position:absolute;left:50%;top:56%;width:16px;height:11px;border-radius:3px;background:var(--c);box-shadow:inset 0 -2px 0 rgba(0,0,0,.18);opacity:0}
#pet[data-state=review][data-revealed] .reveal-burst i{animation:pb-reveal-burst 1.1s cubic-bezier(.15,.75,.3,1) .1s 1 both}
@keyframes pb-reveal-burst{0%{opacity:0;transform:translate(-50%,-50%) scale(.3)}12%{opacity:1}70%{opacity:1}100%{opacity:0;transform:translate(calc(-50% + var(--x)),calc(-50% + var(--y))) rotate(var(--r)) scale(1)}}
.preview-hint{position:absolute;left:50%;bottom:20px;transform:translateX(-50%);display:flex;align-items:center;gap:10px;margin:0;padding:10px 18px;border-radius:999px;background:rgba(18,34,110,.86);color:#fff;font-weight:700;font-size:15px;white-space:nowrap;pointer-events:none;box-shadow:0 6px 18px rgba(5,14,66,.25)}
.preview-hint svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
#pet[data-revealed] .preview-hint:not([hidden]){animation:pb-hint-in .5s ease 1.6s both}
@keyframes pb-hint-in{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translateX(-50%)}}
@media (max-width:520px){.preview-hint{font-size:13px;padding:9px 14px;bottom:14px}}
@media (prefers-reduced-motion:reduce){
  #pet[data-state=review] #preview,#pet[data-state=review] .pet-cards #panel{transform:none;transition:none!important}
  #pet[data-state=review][data-revealed] .reveal-burst i,#pet[data-revealed] .preview-hint{animation:none}
}

/* The pet's 3D scans as cards (Owen, 18 Nov: "make this whole thing well designed… interactive and beautiful").
   Each card: the front photo, the scan's number and date, what it is now and, if it didn't work, why. */
.history h2{font-size:clamp(22px,2.6vw,28px);margin:0 0 10px}
.history-hint{margin:0 0 24px;font-size:16px;line-height:1.5;opacity:.88;max-width:56ch}
.history-hint[hidden]+.scan-cards{margin-top:24px}
.history .scan-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,300px),1fr));gap:18px;list-style:none;margin:0;padding:0}
.history .scan-card{position:relative;display:flex;flex-direction:column;min-height:0;padding:0;border:0;border-radius:24px;background:var(--pb-paper,#fff);color:var(--pb-ink,#17171F);box-shadow:0 5px 0 var(--pb-card-lip,#B4C1EC),0 14px 30px rgba(5,14,66,.18);overflow:hidden;transition:transform .2s ease,box-shadow .2s ease}
.scan-card-body{display:grid;grid-template-columns:72px minmax(0,1fr);align-items:start;column-gap:16px;row-gap:12px;width:100%;padding:18px 18px 20px;border:0;background:transparent;color:inherit;font:inherit;text-align:left}
button.scan-card-body{cursor:pointer}
button.scan-card-body:focus-visible{outline:3px solid var(--pb-yellow,#FFD24D);outline-offset:-3px;border-radius:24px}
.history .scan-card:has(button.scan-card-body:not(:disabled)):hover{transform:translateY(-3px);box-shadow:0 8px 0 var(--pb-card-lip,#B4C1EC),0 20px 36px rgba(5,14,66,.24)}
.history .scan-card[data-viewing]{box-shadow:0 0 0 4px var(--pb-yellow,#FFD24D),0 5px 0 4px #C99A00,0 18px 36px rgba(5,14,66,.26)}
.scan-thumb{display:grid;place-items:center;width:72px;height:72px;border-radius:20px;overflow:hidden;background:#EEF1FA;color:#8A93B8}
.scan-thumb img{width:100%;height:100%;object-fit:cover}
.scan-thumb svg{width:40px;height:40px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linejoin:round}
.scan-text{display:grid;gap:2px;min-width:0}
.scan-name{font-size:18px;font-weight:800;line-height:1.25}
.scan-date{font-size:14px;color:#5A6080;font-weight:600}
.scan-note{margin-top:6px;font-size:14px;line-height:1.45;color:#3A4060;text-wrap:pretty}
.scan-note:empty{display:none}
.scan-free{display:block;margin-top:2px;color:#14794A;font-weight:700}
.scan-chip{grid-column:2;justify-self:start;padding:6px 12px;border-radius:999px;font-size:13px;font-weight:800;white-space:nowrap;background:#EEF1FA;color:#3A4060}
.scan-chip:empty{display:none}
.scan-card[data-status=chosen] .scan-chip{background:var(--pb-yellow,#FFD24D);color:#17171F}
.scan-card[data-status=review] .scan-chip{background:#FFF3C4;color:#6A5200}
.scan-card[data-status=ready] .scan-chip{background:#E3F7EE;color:#0E6B41}
.scan-card[data-status=failed] .scan-chip{background:#FFECE8;color:#A52828}
.scan-card[data-status=failed] .scan-thumb img{filter:grayscale(1);opacity:.6}
.scan-card[data-status=making] .scan-chip::after{content:'…'}
.scan-card[data-viewing] .scan-note{color:#6A5200;font-weight:700}
.scan-open{align-self:stretch;margin:0 18px 18px;padding:12px;border-radius:14px;background:#EEF1FA;color:inherit;font-weight:800;text-align:center;text-decoration:none}
@media(max-width:520px){.scan-card-body{grid-template-columns:56px minmax(0,1fr);column-gap:14px;padding:16px}.scan-thumb{width:56px;height:56px;border-radius:16px}}
@media (prefers-reduced-motion:reduce){.history .scan-card{transition:none}.history .scan-card:hover{transform:none}}
