* { box-sizing: border-box }
html, body { margin: 0; min-height: 100%; background: #252720; color: #fbf6eb }
body { font-family: "Diar Thmanyah", system-ui, sans-serif }
main { position: relative; isolation: isolate; display: grid; grid-template-rows: auto minmax(220px,1fr) auto; min-height: min(100svh, 500px); height: 100svh; background: radial-gradient(ellipse at 55% 40%, #3b3b32, #252720 70%) }
header { display: flex; justify-content: space-between; align-items: center; padding: max(18px,env(safe-area-inset-top)) clamp(18px,4vw,48px) 0; z-index: 1 }
h1, p { margin: 0 }
h1 { font-family: "Diar Thmanyah Display", serif; font-size: clamp(24px,4.5vw,40px); font-weight: 500; line-height: 1.4 }
.eyebrow, .scale { font-size: 12px; color: #d9c9af; font-weight: 500 }
.back { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #ffffff0c; border: 1px solid #ffffff30; color: #fcf7ef }
html.embedded .back { display: none }
model-viewer { display: block; position: relative; width: 100%; height: 100%; min-height: 220px; --progress-bar-color: #ebdcbd; --progress-bar-height: 2px; --poster-color: transparent }
footer { margin: 0 auto; padding: 0 20px max(18px,env(safe-area-inset-bottom)); text-align: center; max-width: 52ch }
.scale { display: inline-flex; align-items: baseline; gap: 5px; line-height: 1.8 }
footer p { color: #e8dfd1; font-size: 14px; line-height: 1.65 }
#status { min-height: 0; color: #cdbfae; font-size: 12px }
button { font: inherit; cursor: pointer }
.place, .retry { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); border: 1px solid #f4ede188; background: #f5eee2; color: #2b251f; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; min-height: 44px; border-radius: 32px; box-shadow: 0 3px 22px #0003 }
a:focus-visible, button:focus-visible { outline: 2px solid white; outline-offset: 4px }
model-viewer:not(:defined) .place { display: none }
#recovery { position: relative; min-height: 0; height: 100%; text-align: center }
#recovery img { width: 100%; height: 100%; object-fit: contain }
[hidden] { display: none !important }
@media(max-height:450px) { main { grid-template-rows: auto minmax(120px,1fr) auto } model-viewer { min-height: 120px } header { padding-top: 5px } footer { padding-bottom: 5px } }

#model-stage { position:relative;min-width:0;min-height:0 }
h2 { margin:0;font-family:"Diar Thmanyah Display",serif;font-size:23px;line-height:1.5;font-weight:500 }
html.desktop main {
  grid-template-columns:minmax(0,1fr) minmax(184px,25%);
  grid-template-rows:auto minmax(210px,1fr) auto;
  grid-template-areas:"head head" "model handoff" "foot handoff";
  column-gap:clamp(10px,3vw,48px);padding-inline:clamp(16px,4.5vw,64px);
}
html.desktop header { grid-area:head;padding-inline:0 }
html.desktop #model-stage { grid-area:model }
html.desktop footer { grid-area:foot }
#handoff {
  grid-area:handoff;align-self:center;display:grid;justify-items:start;
  row-gap:14px;padding:10px 0 25px;min-width:0;
}
#qr-paper {
  width:clamp(166px,18vw,224px);max-width:100%;aspect-ratio:1;
  background:#fff;border-radius:12px;box-shadow:0 4px 18px #0003;
}
#phone-code { display:block;width:100%;height:100%;color:#161514 }
.handoff-copy { max-width:30ch }
#handoff-help { font-size:14px;line-height:1.65;color:#ded5c6;margin-top:4px }
#phone-link {display:block;width:fit-content;max-width:100%;overflow-wrap:anywhere;margin-top:9px;color:#f2dfbd;text-decoration:underline;text-underline-offset:3px;font:13px/1.6 system-ui,sans-serif}
#copy-link,#retry-link {
  display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:44px;margin-top:8px;
  padding:0 14px;border:1px solid #eddfc93b;border-radius:24px;
  background:#EEE2CC0B;color:#f4ece1;font-size:12px;
}
#copy-link:hover,#retry-link:hover { background:#eee2cc19;border-color:#eddfc975 }
#copy-field { width:100%;margin-top:5px;padding:8px;border:1px solid #eddfc95a;border-radius:6px;background:#211e1b;color:#fff }
#copy-status { display:block;font-size:11px;line-height:1.7;color:#e5dac7 }
@media(max-width:600px) {
  html.desktop main { grid-template-areas:"head" "model" "foot" "handoff";grid-template-columns:1fr;grid-template-rows:auto minmax(190px,1fr) auto auto;height:auto;min-height:100svh }
  html.desktop #model-stage { min-height:190px }
  html.desktop footer { padding-bottom:8px }
  #handoff { width:100%;border-top:1px solid #ffffff1d;grid-template-columns:auto minmax(0,1fr);column-gap:14px;align-items:center;justify-content:center;padding:12px 0 16px }
  #qr-paper { width:132px }
  #handoff:has(#qr-paper[hidden]) { display:block }
  .handoff-copy { max-width:unset }
  #handoff-help { font-size:12px;line-height:1.55 }
  #handoff h2 { font-size:19px }
  #copy-link,#retry-link {margin-top:4px}
}
@media(max-height:430px) and (min-width:601px) {
  html.desktop main { grid-template-rows:auto minmax(120px,1fr) auto }
  #qr-paper { width:136px }
  #handoff { row-gap:5px;padding:2px 0 }
  #handoff-help {font-size:12px}
}
