/* Catalogue try-on is a focused sheet; source photos always retain their shape. */
.piece-tryon {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  padding: 24px; background: rgb(25 29 25 / 58%); overscroll-behavior: contain;
  color: var(--c-ink, #292d29); font-family: var(--c-font, sans-serif); line-height: 1.6;
}
.piece-tryon *, .piece-tryon *::before, .piece-tryon *::after { box-sizing: border-box; }
.pt-dialog {
  width: min(100%, 650px); max-height: calc(100dvh - 48px); overflow-y: auto;
  background: var(--c-paper, #faf9f5); border-radius: 20px; overscroll-behavior: contain;
  box-shadow: 0 24px 90px rgb(0 0 0 / 20%); scrollbar-gutter: stable;
}
.pt-header { position: sticky; inset-block-start: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 26px 16px; background: var(--c-paper, #faf9f5); border-bottom: 1px solid var(--c-line, #d6d6cd); }
.pt-header h2 { margin: 0; font-size: clamp(24px, 4vw, 30px); font-weight: 750; line-height: 1.35; letter-spacing: -.03em; }
.pt-kicker { margin: 0 0 3px; color: var(--c-green, #3a584a); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.pt-close { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--c-line, #d6d6cd); border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font: 300 30px/1 sans-serif; }
.pt-content { padding: 20px 26px 26px; }
.pt-intro { margin: 0 0 20px; color: var(--c-muted, #6c7168); font-size: 15px; }
.pt-piece { display: grid; grid-template-columns: 148px minmax(0, 1fr); align-items: start; gap: 20px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--c-line, #d6d6cd); }
.pt-product-photo { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; padding: 8px; overflow: hidden; border: 1px solid var(--c-line, #d6d6cd); border-radius: 10px; background: #fff; }
.pt-product-photo img { display: block; width: 100%; height: 100%; max-height: 180px; object-fit: contain; }
.pt-product-photo span { padding: 12px; text-align: center; color: var(--c-muted, #6c7168); font-size: 12px; }
.pt-brand { margin: 0 0 4px; font-size: 12px; color: var(--c-muted, #6c7168); }
.pt-piece h3 { margin: 0 0 12px; font-size: 17px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.pt-label { display: block; margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.pt-piece select { display: block; width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid var(--c-line, #d6d6cd); border-radius: 7px; background: var(--c-white, #fff); color: inherit; font: inherit; font-size: 15px; }
.pt-caption, .pt-privacy { margin: 10px 0 0; color: var(--c-muted, #6c7168); font-size: 12px; line-height: 1.7; }
.pt-color-single { margin: 0; font-size: 14px; }
.pt-form-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pt-form-heading h3 { margin: 0; font-size: 18px; font-weight: 650; }
.pt-form-heading > span { color: var(--c-muted, #6c7168); font-size: 12px; }
.pt-upload { display: flex; align-items: center; gap: 16px; min-height: 132px; padding: 18px; border: 1px dashed var(--c-green, #3a584a); border-radius: 10px; cursor: pointer; background: var(--c-surface, #f1f0e8); }
.pt-upload > svg { flex: 0 0 32px; width: 32px; height: 32px; color: var(--c-green, #3a584a); }
.pt-upload > img { display: block; flex: 0 0 76px; width: 76px; height: 108px; object-fit: contain; border-radius: 4px; background: white; }
.pt-upload strong { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 650; }
.pt-upload small { display: block; color: var(--c-muted, #6c7168); font-size: 12px; line-height: 1.65; }
.pt-upload small + small { margin-top: 6px; }
.pt-upload input { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); }
.pt-upload:focus-within { outline: 2px solid var(--c-green, #3a584a); outline-offset: 3px; }
.pt-text-button { padding: 10px 0; min-height: 44px; border: 0; background: transparent; color: var(--c-muted, #6c7168); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: 13px; cursor: pointer; }
.pt-consent { display: flex; gap: 10px; align-items: flex-start; padding: 18px 0 0; font-size: 14px; cursor: pointer; }
.pt-consent input { flex: 0 0 19px; width: 19px; height: 19px; margin: 3px 0 0; accent-color: var(--c-green, #3a584a); }
.pt-privacy a { color: inherit; text-underline-offset: 3px; }
.pt-button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 10px; padding: 11px 18px; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 650; font-size: 15px; line-height: 1.5; text-decoration: none; cursor: pointer; }
.pt-button svg { flex: 0 0 22px; width: 22px; height: 22px; }
.pt-primary { background: var(--c-accent, #efd063); color: var(--c-ink, #292d29); }
.pt-secondary { background: transparent; color: inherit; border-color: var(--c-line, #d6d6cd); }
.pt-button:disabled { opacity: .5; cursor: not-allowed; }
.pt-form > .pt-button { width: 100%; margin-top: 20px; }
.pt-center { text-align: center; }
.pt-message { padding: 8px 0; }
.pt-message h3 { margin: 0 0 8px; font-size: 18px; }
.pt-message p { margin: 0 0 18px; color: var(--c-muted, #6c7168); font-size: 14px; }
.pt-message .pt-button { width: 100%; }
.pt-error { padding: 12px 14px; border-inline-start: 3px solid var(--c-danger, #a13931); background: rgb(160 57 49 / 6%); color: var(--c-danger, #a13931); margin: 0 0 20px; font-size: 14px; border-radius: 4px; }
.pt-progress { padding: 24px 12px 38px; text-align: center; }
.pt-progress h3 { margin: 18px 0 8px; font-size: 20px; }
.pt-progress p { max-width: 330px; margin: 0 auto; color: var(--c-muted, #6c7168); font-size: 14px; }
.pt-spinner { display: block; width: 38px; height: 38px; margin: 0 auto; border: 3px solid var(--c-line, #d6d6cd); border-top-color: var(--c-green, #3a584a); border-radius: 50%; animation: pt-spin 1.1s linear infinite; }
.pt-result > img { display: block; width: 100%; max-height: 65dvh; object-fit: contain; background: var(--c-surface, #f1f0e8); border-radius: 8px; }
.pt-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pt-result-actions > * { flex: 1 1 160px; }
.piece-tryon :is(button, a, select, input):focus-visible { outline: 2px solid var(--c-green, #3a584a); outline-offset: 3px; }
@keyframes pt-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
  .piece-tryon { padding: 0; align-items: end; }
  .pt-dialog { width: 100%; max-height: 100dvh; min-height: min(700px, 100dvh); border-radius: 18px 18px 0 0; scrollbar-gutter: auto; }
  .pt-header { padding: 16px 18px 14px; }
  .pt-content { padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); }
  .pt-piece { grid-template-columns: 106px minmax(0, 1fr); gap: 14px; padding-bottom: 20px; margin-bottom: 20px; }
  .pt-piece h3 { font-size: 15px; }
  .pt-product-photo { padding: 5px; }
  .pt-product-photo img { max-height: 132px; }
  .pt-caption { font-size: 12px; }
  .pt-upload { gap: 12px; padding: 14px; }
}
@media (max-width: 359px) {
  .pt-piece { grid-template-columns: 82px minmax(0, 1fr); gap: 12px; }
  .pt-product-photo img { max-height: 102px; }
}
@media (prefers-reduced-motion: reduce) { .pt-spinner { animation: none; } }

.pt-account-check { display: none; padding: 12px 0; color: var(--c-muted, #6c7168); font-size: 14px; }
.piece-tryon[data-account-checking] .pt-account-check { display: block; }
.piece-tryon[data-account-checking] .pt-upload > img,
.piece-tryon[data-account-checking] .pt-result { visibility: hidden; }
