/* ==========================================================================
   Responsive layer — loaded AFTER every other stylesheet on every site page.
   Breakpoints
     desktop        >= 1101px
     small desktop / tablet landscape   961 - 1100px
     tablet portrait                    601 - 960px
     phone                              <= 600px
     small phone                        <= 380px
     phone landscape (short screens)    max-height 520px + landscape
   ========================================================================== */

/* --- base ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 320px; overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
img, video, canvas, svg { max-width: 100%; }
table { max-width: 100%; }
.container { padding-left: max(48px, env(safe-area-inset-left)); padding-right: max(48px, env(safe-area-inset-right)); }
@media (max-width: 1100px) { .container { padding-left: max(32px, env(safe-area-inset-left)); padding-right: max(32px, env(safe-area-inset-right)); } }
@media (max-width: 760px)  { .container { padding-left: max(22px, env(safe-area-inset-left)); padding-right: max(22px, env(safe-area-inset-right)); } }
@media (max-width: 520px)  { .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); } }

/* touch screens: comfortable tap targets, no sticky hover */
@media (pointer: coarse) {
  .btn, .btn-order-now, .btn-pay { min-height: 46px; }
  .mini-btn, .seg button, .occasion-tabs button { min-height: 40px; }
  .choice-list label, .pay-options label { min-height: 46px; }
  .swatches button { width: 32px; height: 32px; }
}
@media (hover: none) {
  .btn-order-now:hover { color: var(--color-primary); background-color: transparent; }
  .btn-order-now:active { color: var(--color-white); background-color: var(--color-primary); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* --- navigation (the menu button is added by api.js) ---------------------------------- */
.nav-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; font-size: 20px; color: var(--color-text); background: var(--color-white); border: 1px solid var(--color-border); border-radius: 12px; cursor: pointer; }
@media (max-width: 980px) {
  .navbar { position: relative; gap: 10px; height: 72px; }
  .nav-actions { margin-left: auto; }
  .nav-toggle { display: inline-flex; }
  .nav-menu { display: none; position: absolute; z-index: 80; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; padding: 6px 22px 14px; background: var(--color-white); border-bottom: 1px solid var(--color-border); box-shadow: 0 18px 30px rgba(22, 59, 74, 0.14); }
  .navbar.is-open .nav-menu { display: flex; }
  .nav-menu li { list-style: none; border-bottom: 1px solid var(--color-border); }
  .nav-menu li:last-child { border-bottom: none; }
  .nav-menu a { display: block; padding: 15px 4px; font-size: 16px; }
}
@media (max-width: 520px) {
  .navbar { height: 66px; gap: 6px; }
  .logo { gap: 7px; min-width: 0; flex: 0 1 auto; }
  .logo-mark { width: 38px; height: 38px; }
  .logo-name { font-size: 14px; white-space: nowrap; }
  .logo-tagline { display: none; }
  .nav-actions { gap: 6px; margin-left: auto; flex: 0 0 auto; }
  .nav-actions .btn {
    padding: 7px 9px;
    font-size: 11.5px;
    line-height: 1.1;
    min-height: 36px;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .nav-toggle { width: 40px; height: 40px; flex: 0 0 40px; }
  .nav-menu { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 380px) {
  .logo { gap: 5px; }
  .logo-mark { width: 34px; height: 34px; }
  .logo-name { font-size: 12.5px; }
  .nav-actions { gap: 4px; }
  .nav-actions .btn { padding: 6px 7px; font-size: 10.5px; min-height: 34px; }
  .nav-toggle { width: 38px; height: 38px; flex-basis: 38px; }
  .account-trigger { padding: 3px 9px 3px 5px; }
}
.account-dropdown { max-width: calc(100vw - 24px); }
/* phones held sideways: the bar is short, so don't pin it to the screen */
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { position: relative; }
  .navbar { height: 60px; }
  .nav-menu { max-height: calc(100vh - 20px); }
}

/* --- page banners ----------------------------------------------------------------------- */
@media (max-width: 760px) {
  .page-banner { padding: 40px 0 34px; }
  .page-banner h1 { font-size: 34px; }
  .page-banner p { font-size: 15px; }
}
@media (max-width: 480px) {
  .page-banner { padding: 30px 0 26px; }
  .page-banner h1 { margin-top: 10px; font-size: 28px; }
  .page-banner p { margin-top: 10px; font-size: 14.5px; line-height: 1.55; }
  .section-label { font-size: 12px; margin-bottom: 6px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .page-banner { padding: 24px 0 20px; }
  .page-banner h1 { margin-top: 6px; font-size: 28px; }
  .page-banner p { margin-top: 8px; }
}

/* ==========================================================================
   OUR SERVICES
   ========================================================================== */
.services-overview { padding-top: 56px; padding-bottom: 24px; }
.services-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.service-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
@media (hover: hover) { .service-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(22, 59, 74, 0.12); } }
.service-card h3, .service-card p { overflow-wrap: anywhere; }
.service-image { max-width: 100%; }
.btn-order-now { min-height: 42px; }

@media (max-width: 1280px) { .services-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1080px) { .services-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
/* tablet portrait */
@media (max-width: 900px) {
  .services-overview { padding-top: 44px; padding-bottom: 16px; }
  .service-card-body { padding: 16px 14px 18px; }
  .service-card h3 { font-size: 16px; }
}
/* phones: two compact cards per row, like a store app */
@media (max-width: 760px) {
  .services-overview { padding-top: 28px; padding-bottom: 12px; }
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .service-card { border-radius: 16px; }
  .service-image-wrap { aspect-ratio: 1 / 1; }
  .service-card-body { padding: 12px 11px 13px; }
  .service-card h3 { font-size: 14.5px; line-height: 1.25; margin-bottom: 4px; }
  .service-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.5; }
  .service-price { margin: 6px 0 10px; font-size: 12.5px; }
  .btn-order-now { padding: 9px 0; font-size: 13px; }
}
@media (max-width: 340px) { .services-grid { grid-template-columns: 1fr; } .service-image-wrap { aspect-ratio: 4 / 3; } }
/* phones held sideways: use the width */
@media (max-height: 520px) and (orientation: landscape) and (min-width: 600px) {
  .services-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .service-image-wrap { aspect-ratio: 4 / 3; }
}

/* ==========================================================================
   ORDER PAGE
   ========================================================================== */
.order-section { padding-top: 36px; padding-bottom: 28px; }
.order-layout { align-items: start; }
.order-layout > * { min-width: 0; }
.order-form-col { min-width: 0; }
.order-block h3 { overflow-wrap: anywhere; }
.price-table-wrap, #priceTable { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.choice-list label { max-width: 100%; }
.upload-name { min-width: 0; overflow-wrap: anywhere; }
.preview-stage { max-width: 100%; }
.preview-stage canvas.flat-canvas { max-width: 100%; max-height: 100%; }

/* small desktop / tablet landscape: keep two columns, give the form more room */
@media (max-width: 1100px) {
  .order-layout { grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.05fr); gap: 22px; }
  .order-preview-card { top: 88px; }
  .preview-stage { height: min(460px, calc(100vh - 260px)); min-height: 300px; }
}

/* tablet portrait + phones: one column; the preview first, centred and not too wide */
@media (max-width: 960px) {
  .order-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 760px; margin: 0 auto; }
  .order-preview-card { position: static; padding: 16px; }
  .preview-stage { height: min(62vh, 520px); height: min(62svh, 520px); min-height: 300px; }
  .preview-toolbar { justify-content: space-between; }
  .order-block { padding: 20px; margin-bottom: 16px; }
  .template-picker { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .pay-options { grid-template-columns: 1fr 1fr; }
  .pay-options label { height: 100%; }
}
@media (max-width: 760px) {
  .pay-options { grid-template-columns: 1fr; }
}

/* phones */
@media (max-width: 600px) {
  .order-section { padding-top: 18px; padding-bottom: 96px; }
  .order-layout { gap: 14px; }
  .order-preview-card { padding: 12px; border-radius: 16px; }
  .order-block { padding: 16px 14px; margin-bottom: 12px; border-radius: 16px; }
  .order-block h3 { margin-bottom: 12px; font-size: 17px; }
  .order-block .block-sub { margin-top: -6px; font-size: 12.5px; line-height: 1.5; }

  /* toolbar: one tidy swipe-able row instead of 3-4 wrapped rows */
  .preview-toolbar { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  .preview-title { font-size: 16px; }
  .preview-actions { flex-wrap: nowrap; width: 100%; margin: 0 -2px; padding: 2px 2px 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; scrollbar-width: none; justify-content: flex-start; }
  .preview-actions::-webkit-scrollbar { display: none; }
  .preview-actions > * { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
  .seg button { padding: 7px 13px; }
  .preview-stage { height: clamp(280px, 50vh, 400px); height: clamp(280px, 50svh, 400px); border-radius: 12px; }
  .size-label { font-size: 12.5px; }
  .bg-row { flex-wrap: wrap; row-gap: 8px; }
  .preview-hint { font-size: 12px; }

  /* forms: 16px text so iPhones never zoom, bigger fields */
  .field input[type="text"], .field input[type="date"], .field input[type="time"], .field input[type="number"], .field select, .field textarea,
  .ai-bar input, .fld-style select { font-size: 16px; }
  .field input[type="text"], .field input[type="number"], .field select { min-height: 46px; }
  .field textarea { min-height: 96px; }
  .choice-group > strong { font-size: 13px; }
  .choice-list { gap: 8px; }
  .choice-list label { flex: 1 1 calc(50% - 8px); justify-content: flex-start; padding: 10px 12px; font-size: 13px; }
  .choice-list label:only-child { flex-basis: 100%; }
  .side-style .choice-list label, #cutOptions label { flex-basis: 100%; }

  /* design picker */
  .occasion-tabs { flex-wrap: nowrap; margin-left: -2px; margin-right: -2px; padding: 2px 2px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .occasion-tabs::-webkit-scrollbar { display: none; }
  .occasion-tabs button { flex: 0 0 auto; padding: 8px 16px; font-size: 13px; }
  .template-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .template-tile { border-radius: 10px; }
  .ai-bar { flex-direction: column; }
  .ai-bar input { width: 100%; min-height: 48px; }
  .ai-bar button { width: 100%; min-height: 48px; padding: 0 18px; }
  .upload-row { gap: 8px; }
  .upload-row > .mini-btn:first-child { flex: 1 1 100%; justify-content: center; padding: 11px 14px; font-size: 13.5px; }
  .photo-thumb { width: 64px; height: 64px; }
  .fld-style { gap: 8px 12px; }
  .fld-style input[type="range"] { width: min(100%, 220px); flex: 1 1 140px; }
  .range-row { flex-wrap: wrap; row-gap: 6px; }
  .range-row input[type="range"] { flex: 1 1 100%; }

  /* price table */
  .price-table { font-size: 12.5px; }
  .price-table th, .price-table td { padding: 7px 9px; }

  /* payment */
  .pay-options label { padding: 12px; }
  .summary { padding: 14px; }
  .summary-row { font-size: 13.5px; }
  .summary-row.is-due { font-size: 15.5px; }
  .btn-pay { min-height: 52px; font-size: 16px; }
  .pay-note { font-size: 12px; line-height: 1.5; }
  .form-two { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .choice-list label { flex-basis: 100%; }
  .template-picker { gap: 6px; }
}

/* editors (move/zoom picture, move text) open as a full-screen sheet on small screens */
@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) {
  .crop-editor { position: fixed; inset: 0; z-index: 3500; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); background: var(--color-bg-soft); }
  .crop-editor canvas { max-height: 100%; }
  .crop-bar { gap: 8px; }
  .crop-bar .mini-btn { min-height: 42px; padding-left: 16px; padding-right: 16px; }
  .crop-bar input[type="range"] { width: min(46vw, 220px); }
  .crop-hint { max-width: 90%; font-size: 12.5px; line-height: 1.45; }
}

/* full-screen preview */
.order-preview-card.is-fullscreen { height: 100vh; height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
.order-preview-card.is-fullscreen .preview-stage { height: auto; min-height: 0; }

/* phones held sideways: preview on the left and always visible, form scrolls on the right */
@media (max-height: 520px) and (orientation: landscape) and (min-width: 640px) {
  .order-section { padding-top: 14px; padding-bottom: 28px; }
  .order-layout { grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr); gap: 16px; max-width: none; }
  .order-preview-card { position: sticky; top: 10px; padding: 10px; max-height: calc(100vh - 20px); overflow-y: auto; }
  .preview-toolbar { margin-bottom: 8px; }
  .preview-actions { flex-wrap: wrap; }
  .preview-stage { height: calc(100vh - 150px); min-height: 170px; }
  .size-label, .bg-row, .preview-hint { margin-top: 6px; }
  .order-block { padding: 16px; }
  .pay-options { grid-template-columns: 1fr; }
}

/* "Back to preview" pill (added by responsive.js on the order page, phones only) */
.preview-fab { position: fixed; z-index: 900; right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: none; align-items: center; gap: 8px; padding: 12px 18px; font: inherit; font-size: 13.5px; font-weight: 700; color: #fff; background: var(--color-accent); border: none; border-radius: 999px; box-shadow: 0 10px 26px rgba(18, 51, 57, 0.35); cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
.preview-fab.is-visible { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 960px) { .preview-fab { display: inline-flex; } }
@media (max-height: 520px) and (orientation: landscape) and (min-width: 640px) { .preview-fab { display: none; } }

/* --- order complete / payment result ------------------------------------------------------ */
@media (max-width: 560px) {
  .complete-card { padding: 28px 18px; border-radius: 18px; }
  .complete-card h1 { font-size: 22px; }
}

/* ==========================================================================
   VIEW ORDERS / PROFILE / SETTINGS
   ========================================================================== */
@media (max-width: 700px) {
  .my-order { padding: 14px; gap: 14px; }
  .my-order-top { flex-wrap: wrap; }
  .my-order-actions .btn { flex: 1 1 calc(50% - 8px); min-height: 44px; }
}
@media (max-width: 560px) {
  .my-order { flex-direction: column; }
  .my-order-thumb { width: 100%; height: 170px; flex-basis: auto; }
  .my-order-actions .btn { flex-basis: 100%; }
  .profile-stats { gap: 18px; }
}
@media (max-width: 860px) {
  .account-layout { max-width: 620px; }
}

/* ==========================================================================
   TRACK ORDER  (the progress bar is ALWAYS horizontal / landscape)
   ========================================================================== */
.trk { padding-top: 40px; padding-bottom: 60px; }
.trk-card, .trk-select { width: 100%; }
.trk-steps { --dot: 44px; --dot-fs: 16px; align-items: flex-start; }
.trk-steps li { flex: 1 1 0; min-width: 0; }
.trk-steps li::before { top: calc(var(--dot) / 2 - 1.5px); }
.trk-steps .trk-dot { width: var(--dot); height: var(--dot); font-size: var(--dot-fs); flex: none; }
.trk-steps .trk-label { overflow-wrap: break-word; hyphens: auto; }
.trk-row > span:last-child { overflow-wrap: break-word; min-width: 0; }
.trk-row > span:first-child { min-width: 0; }
.trk-row.is-total > span:last-child { flex: none; white-space: nowrap; }
.trk-code { overflow-wrap: anywhere; }

/* tablet */
@media (max-width: 900px) {
  .trk { padding-top: 32px; padding-bottom: 48px; }
  .trk-card { padding: 26px 22px; border-radius: 20px; }
  .trk-steps { --dot: 40px; --dot-fs: 15px; }
  .trk-steps .trk-label { font-size: 12.5px; }
}
/* phones: still one row, just smaller */
@media (max-width: 700px) {
  .trk { padding-top: 22px; padding-bottom: 40px; }
  .trk-select { margin-bottom: 20px; padding: 18px 16px; border-radius: 16px; }
  .trk-select-row { flex-direction: column; gap: 10px; }
  .trk-select select { flex: none; width: 100%; min-width: 0; min-height: 48px; font-size: 16px; }
  .trk-select .btn { width: 100%; min-height: 48px; }
  .trk-card { padding: 18px 14px; border-radius: 18px; }
  .trk-head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 16px; margin-bottom: 20px; }
  .trk-code { font-size: 24px; }
  .trk-meta { font-size: 13px; }

  .trk-steps { display: flex; flex-direction: row; gap: 0; --dot: 32px; --dot-fs: 12px; }
  .trk-steps li { display: block; padding: 0; text-align: center; }
  .trk-steps li::before { display: block; height: 2px; top: calc(var(--dot) / 2 - 1px); }
  .trk-steps li:first-child::before { display: none; }
  .trk-steps .trk-dot { margin: 0 auto 7px; border-width: 2px; }
  .trk-steps li.is-current .trk-dot { box-shadow: 0 0 0 4px rgba(30, 87, 97, 0.14); }
  .trk-steps .trk-label { padding: 0 1px; font-size: 11px; line-height: 1.25; }

  .trk-now, .trk-cancelled { gap: 12px; margin-top: 20px; padding: 14px; }
  .trk-now > i, .trk-cancelled > i { font-size: 19px; }
  .trk-now b, .trk-cancelled b { font-size: 14px; }
  .trk-now p, .trk-cancelled p { font-size: 13px; }
  .trk-grid { gap: 14px; margin-top: 20px; }
  .trk-panel { padding: 16px 14px; border-radius: 14px; }
  .trk-row { gap: 12px; padding: 9px 0; font-size: 13.5px; }
  .trk-designs figure { min-width: 100px; }
  .trk-actions { margin-top: 20px; padding-top: 18px; }
  .trk-actions .btn { flex: 1 1 100%; min-height: 46px; }
  .pay-reminder { padding: 12px 13px; font-size: 13px; }
}
@media (max-width: 400px) {
  .trk-steps { --dot: 28px; --dot-fs: 11px; }
  .trk-steps .trk-label { font-size: 10px; }
  .trk-code { font-size: 21px; }
}
/* very narrow screens (320px): still one horizontal row, just tighter */
@media (max-width: 340px) {
  .trk.container { padding-left: 12px; padding-right: 12px; }
  .trk-card { padding: 16px 10px; }
  .trk-steps { --dot: 26px; --dot-fs: 10px; }
  .trk-steps .trk-label { font-size: 9px; letter-spacing: -0.1px; padding: 0; }
  .trk-steps li.is-current .trk-dot { box-shadow: 0 0 0 3px rgba(30, 87, 97, 0.14); }
}
/* phones held sideways: the bar has lots of room, so go back to the bigger look */
@media (max-height: 520px) and (orientation: landscape) and (min-width: 560px) {
  .trk { padding-top: 18px; padding-bottom: 32px; }
  .trk-steps { --dot: 40px; --dot-fs: 15px; }
  .trk-steps .trk-dot { margin-bottom: 8px; }
  .trk-steps .trk-label { font-size: 12.5px; }
  .trk-steps li::before { height: 3px; top: calc(var(--dot) / 2 - 1.5px); }
  .trk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trk-select-row { flex-direction: row; }
  .trk-select .btn { width: auto; }
  .trk-actions .btn { flex: 0 0 auto; }
}

/* track order page for visitors without an account */
@media (max-width: 900px) { .trk-section { margin-bottom: 40px; } .trk-features, .trk-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .trk-section-head h2 { font-size: 23px; }
  .trk-features, .trk-guide, .trk-defs { grid-template-columns: 1fr; }
  .trk-policy { padding: 20px 18px; }
  .trk-cta { padding: 28px 18px; border-radius: 18px; }
  .trk-cta .btn { display: block; margin: 8px 0 0; }
}

/* ==========================================================================
   LOGIN / REGISTER / MODALS / ABOUT / CONTACT
   ========================================================================== */
.modal-overlay { padding: 12px; }
.modal-overlay > div, .modal-overlay .auth-card { max-width: 94vw; max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
@media (max-width: 560px) {
  .pg-hero { padding: 52px 0 84px; }
  .pg-hero p { font-size: 15.5px; }
  .pg-tiles { margin-top: -44px; }
  .pg-tiles-grid { grid-template-columns: 1fr; }
  .pg-section { padding: 44px 0; }
  .pg-panel-body, .pg-form { padding: 22px 18px; }
  .pg-cta { padding: 38px 20px; border-radius: 22px; }
  .pg-btn-row { flex-direction: column; }
  .pg-btn-row .pg-btn { width: 100%; justify-content: center; }
  .pg-map-foot { flex-direction: column; align-items: stretch; text-align: center; }
  .pg-map-foot .pg-btn { justify-content: center; }
  .pg-field input, .pg-field select, .pg-field textarea { font-size: 16px; }
}



/* ==========================================================================
   Responsive completion pass — remaining client pages and interactive order UI
   Keep desktop (>=1101px) layout unchanged. All overrides below are tablet/phone.
   ========================================================================== */
@media (max-width: 1100px) {
  .hero, .hero-content, .hero-image, .hero-image-frame,
  .order-layout, .order-preview-card, .order-block, .account-layout,
  .pg-split, .pg-grid, .pg-panel, .pg-form-wrap { min-width: 0; }
  .hero { gap: 28px; }
  .hero-content { flex: 1 1 48%; }
  .hero-image { flex: 1 1 42%; }
  .order-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
  .account-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
  .pg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  /* shared content safety */
  main, section, article, aside, .container, .content, .section-inner,
  .order-layout, .order-block, .account-layout, .profile-card, .pg-panel,
  .pg-form, .pg-split, .pg-grid, .hero-content, .hero-image {
    min-width: 0;
    max-width: 100%;
  }
  h1, h2, h3, p, label, small, strong, a, button, span {
    overflow-wrap: anywhere;
  }
  input, select, textarea { max-width: 100%; min-width: 0; }
  button, .btn, .pg-btn { max-width: 100%; }
  .hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; text-align: center; }
  .hero-content { width: 100%; }
  .hero-image { width: min(100%, 480px); margin: 0 auto; }
  .hero-cta, .pg-btn-row, .complete-actions { flex-wrap: wrap; }
  .hero-cta .btn, .pg-btn-row .pg-btn, .complete-actions .btn { flex: 1 1 100%; }
  .order-layout, .account-layout, .pg-split { grid-template-columns: minmax(0, 1fr); }
  .order-preview-card { position: relative; top: auto; width: 100%; }
  .preview-stage { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; }
  .preview-stage canvas, .preview-stage img, .flat-canvas canvas { max-width: 100%; }
  .preview-toolbar, .preview-actions { flex-wrap: wrap; }
  .preview-toolbar > *, .preview-actions > * { min-width: 0; }
  .order-section, .order-block { padding: 16px 14px; }
  .form-two, .bg-row, .range-row { grid-template-columns: minmax(0, 1fr); }
  .choice-list, .pay-options { grid-template-columns: minmax(0, 1fr); }
  .choice-list label, .pay-options label { min-width: 0; }
  .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
  .price-table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .price-table table { min-width: 0; width: 100%; }
  .upload-row, .side-uploads { flex-wrap: wrap; }
  .upload-row > *, .side-uploads > * { min-width: 0; max-width: 100%; }
  .photo-thumbs { display: flex; flex-wrap: wrap; }
  .summary-row { gap: 10px; }
  .summary-row > * { min-width: 0; overflow-wrap: anywhere; }
  .my-orders { grid-template-columns: minmax(0, 1fr); }
  .my-order { min-width: 0; }
  .my-order-top, .my-order-body, .my-order-actions { flex-wrap: wrap; }
  .my-order-actions .btn, .my-order-actions button { flex: 1 1 100%; width: 100%; }
  .profile-card, .pg-panel { padding: 20px 16px; }
  .profile-line { flex-wrap: wrap; }
  .profile-line > * { min-width: 0; overflow-wrap: anywhere; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-grid, .pg-tiles-grid, .features, .pg-features { grid-template-columns: minmax(0, 1fr); }
  .pg-panel-body, .pg-form { min-width: 0; }
  .pg-field input, .pg-field select, .pg-field textarea,
  .form-field input, .form-field select, .form-field textarea { width: 100%; min-width: 0; font-size: 16px; }
  .otp-inputs { gap: 6px; }
  .otp-inputs input { min-width: 0; width: 100%; }
  .auth-card, .auth-card-center { width: 100%; max-width: 100%; }
  .btn-auth-google, .btn-auth-primary, .btn-auth-link { width: 100%; justify-content: center; }
  .footer-content { grid-template-columns: minmax(0, 1fr); }
  .site-footer { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .container { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .hero-title { font-size: clamp(28px, 8vw, 40px); line-height: 1.12; }
  .hero-description { font-size: 14px; line-height: 1.6; }
  .hero-cta { display: grid; grid-template-columns: minmax(0, 1fr); }
  .hero-cta .btn { width: 100%; justify-content: center; }
  .order-section, .order-block { padding: 14px 11px; border-radius: 14px; }
  .order-section h2, .order-block h2 { font-size: 17px; }
  .order-preview-card { padding: 10px; }
  .preview-stage { min-height: 240px; }
  .preview-title { font-size: 14px; }
  .preview-toolbar { gap: 6px; }
  .preview-toolbar button, .preview-actions button, .mini-btn { min-height: 38px; }
  .btn-order-now, .btn-pay, .btn-filled, .btn-outline { min-height: 42px; }
  .complete-card { padding: 24px 16px; }
  .complete-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .complete-actions .btn { width: 100%; }
  .my-order { padding: 14px; }
  .my-order-money { width: 100%; }
  .my-order-refund, .my-order-note, .pay-note, .pay-reminder { overflow-wrap: anywhere; }
  .pg-hero { padding-left: 0; padding-right: 0; }
  .pg-hero h1 { font-size: clamp(26px, 7vw, 34px); }
  .pg-panel-body, .pg-form { padding: 18px 14px; }
  .pg-cta { padding: 28px 15px; }
  .otp-inputs { max-width: 100%; }
  .otp-inputs input { height: 48px; padding: 4px; font-size: 18px; }
  .auth-card { padding: 22px 16px; }
  .btn-auth-google { gap: 8px; padding: 12px 10px; font-size: 13px; }
}
@media (max-width: 360px) {
  .container { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .hero-title { font-size: 27px; }
  .hero-badge { max-width: 100%; }
  .profile-stats { grid-template-columns: minmax(0, 1fr); }
  .summary-row { flex-direction: column; align-items: flex-start; }
  .summary-row > * { width: 100%; text-align: left; }
  .btn-auth-google { font-size: 12px; }
  .otp-inputs { gap: 4px; }
  .otp-inputs input { min-width: 0; }
  .order-preview-card { padding: 8px; }
  .preview-stage { min-height: 210px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .site-header { position: relative; }
  .navbar { height: 58px; }
  .nav-menu { max-height: calc(100dvh - 64px); }
  .hero { padding-top: 22px; padding-bottom: 22px; }
  .hero-title { font-size: 28px; }
  .order-layout { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; }
  .order-preview-card { position: relative; top: auto; }
  .preview-stage { min-height: 190px; }
  .modal-overlay { align-items: flex-start; overflow-y: auto; }
  .modal-overlay > div, .modal-overlay .auth-card { max-height: 88dvh; }
}
/* Keep 3D canvases and generated previews inside their containing cards. */
.viewer3d-wrap, .viewer3d-container, .preview-stage, .flat-canvas,
#viewer3d, #preview3d, canvas { max-width: 100%; }


/* Keep the final progress label "Completed" on one line on small screens. */
@media (max-width: 700px) {
  .trk-steps li:last-child { flex-grow: 1.18; }
  .trk-steps li:last-child .trk-label { white-space: nowrap; font-size: 9.5px; letter-spacing: -0.2px; }
}
@media (max-width: 340px) {
  .trk-steps li:last-child .trk-label { font-size: 8.5px; letter-spacing: -0.3px; }
}
