.psf-open { overflow: hidden; }
.psf-modal[hidden], .psf-panel[hidden] { display: none !important; }
.psf-modal { position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; padding: 18px; color: #1f2937; }
.psf-backdrop { position: absolute; inset: 0; background: rgba(10, 18, 28, .72); backdrop-filter: blur(4px); }
.psf-dialog { position: relative; display: flex; flex-direction: column; width: min(1120px, 100%); max-height: min(92vh, 900px); overflow: hidden; background: #fbfaf7; border: 1px solid rgba(255,255,255,.55); border-radius: 20px; box-shadow: 0 24px 80px rgba(0,0,0,.38); }
.psf-head, .psf-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; background: #fff; }
.psf-head { border-bottom: 1px solid #e5e0d7; }
.psf-head h2 { margin: 0; color: #172b3f; font-size: clamp(1.18rem, 2vw, 1.55rem); }
.psf-head p, .psf-foot { margin: 3px 0 0; color: #66717c; font-size: .82rem; }
.psf-close { width: 40px; height: 40px; border: 1px solid #d8d2c8; border-radius: 50%; background: #fff; color: #23384d; font-size: 1.75rem; line-height: 1; cursor: pointer; }
.psf-tabs { display: flex; flex: 0 0 auto; min-height: 50px; gap: 5px; padding: 8px 20px 0; background: #fff; overflow-x: auto; }
.psf-tabs button { min-height: 40px; padding: 8px 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #526273; font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer; }
.psf-tabs button[aria-selected="true"] { color: #16344e; border-color: #b58a48; }
.psf-body { min-height: 0; flex: 1; overflow: auto; }
.psf-panel { padding: 18px 20px 22px; }
.psf-choose-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 20px; }
.psf-kicker { margin: 0 0 12px; color: #5c6875; font-size: .84rem; }
.psf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.psf-card { min-width: 0; padding: 0 0 9px; overflow: hidden; border: 2px solid transparent; border-radius: 12px; background: #fff; color: #243649; text-align: left; box-shadow: 0 1px 5px rgba(25,35,45,.12); cursor: pointer; }
.psf-card canvas { display: block; width: 100%; height: 92px; object-fit: cover; background: #171717; }
.psf-card span, .psf-card small { display: block; padding: 0 9px; }
.psf-card span { margin-top: 8px; font-size: .82rem; font-weight: 750; line-height: 1.2; }
.psf-card small { margin-top: 3px; color: #6a7178; font-size: .68rem; line-height: 1.25; }
.psf-card:hover { border-color: #ccb17c; }
.psf-card[aria-checked="true"] { border-color: #b58a48; box-shadow: 0 0 0 2px rgba(181,138,72,.18); }
.psf-preview { position: sticky; top: 0; align-self: start; display: grid; justify-items: center; gap: 10px; min-height: 380px; padding: 18px; border-radius: 16px; background: linear-gradient(145deg,#eef1f2,#ddd8ce); overflow: hidden; }
.psf-selected-name { justify-self: stretch; color: #1e3449; font-size: 1rem; }
.psf-main-canvas { display: block; max-width: 100%; max-height: 340px; filter: drop-shadow(0 14px 16px rgba(0,0,0,.24)); }
.psf-advice { min-height: 1.25em; margin: 0; color: #674c24; font-size: .8rem; font-weight: 700; }
.psf-sample-detail { justify-self: stretch; border-top: 1px solid rgba(34,50,64,.15); padding-top: 8px; }
.psf-sample-detail summary { cursor: pointer; color: #344c62; font-size: .78rem; font-weight: 700; }
.psf-actual { display: block; width: 100%; max-height: 160px; margin-top: 8px; object-fit: cover; border-radius: 8px; background: #161616; }
.psf-example-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; margin-top: 8px; }
.psf-example-grid figure { position: relative; margin: 0; overflow: hidden; border-radius: 8px; background: #d9d5cd; }
.psf-example-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.psf-example-grid figcaption { position: absolute; inset: auto 0 0; padding: 12px 7px 5px; background: linear-gradient(transparent,rgba(0,0,0,.72)); color: #fff; font-size: .68rem; font-weight: 700; }
.psf-fine { margin: 0; color: #68737d; font-size: .72rem; line-height: 1.35; }
.psf-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.psf-compare article { display: grid; justify-items: center; gap: 14px; min-width: 0; padding: 15px; border-radius: 14px; background: #ece8e0; }
.psf-compare select { width: min(100%, 360px); min-height: 42px; padding: 8px 34px 8px 10px; border: 1px solid #c9c1b3; border-radius: 9px; background: #fff; color: #26394c; font: inherit; }
.psf-compare-canvas { display: block; max-width: 100%; max-height: 430px; filter: drop-shadow(0 12px 13px rgba(0,0,0,.22)); }
.psf-room-upload { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: #66717b; font-size: .8rem; }
.psf-room-upload input { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); overflow: hidden; }
.psf-room-stage { --psf-room-aspect: 1.55; position: relative; width: min(100%, calc(58vh * var(--psf-room-aspect)), 980px); height: auto; aspect-ratio: var(--psf-room-aspect); margin: auto; overflow: hidden; border-radius: 14px; background: linear-gradient(#dce4e8,#c9d1d4); box-shadow: inset 0 0 0 1px rgba(30,50,65,.12); touch-action: none; }
.psf-room-photo { width: 100%; height: 100%; object-fit: contain; background: #d9dee0; }
.psf-room-photo:not([src]) { display: none; }
.psf-room-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 30px; color: #4f6170; text-align: center; }
.psf-room-empty[hidden] { display: none; }
.psf-room-empty span { max-width: 520px; font-size: .86rem; }
.psf-room-overlay { position: absolute; cursor: move; filter: drop-shadow(0 12px 11px rgba(0,0,0,.38)); touch-action: none; }
.psf-room-art { display: block; width: 100%; height: 100%; }
.psf-room-handle { position: absolute; right: -8px; bottom: -8px; width: 22px; height: 22px; border: 2px solid #fff; border-radius: 50%; background: #b58a48; box-shadow: 0 2px 5px rgba(0,0,0,.3); cursor: nwse-resize; }
.psf-room-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 12px 0 9px; }
.psf-foot { border-top: 1px solid #e5e0d7; }
.ps-stage, .ps-rthumb-pic { position: relative; }
.ps-stage > canvas:not([data-ps-frame-shell]), .ps-editor-stage > canvas:not([data-ps-frame-shell]), .ps-rthumb-pic > canvas:not([data-ps-frame-shell]) { position: relative; z-index: 2; }
canvas[data-ps-frame-shell] { position: absolute; z-index: 3; pointer-events: none; background: transparent !important; outline: 0 !important; max-width: none !important; max-height: none !important; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 6px 14px -4px rgba(0,0,0,.28), 0 18px 30px -16px rgba(0,0,0,.30); border-radius: 0 !important; }
.ps-ed-hint { z-index: 4; }
.ps-stage.has-real-frame > canvas:not([data-ps-frame-shell]), .ps-editor-stage.has-real-frame > canvas:not([data-ps-frame-shell]), .ps-rthumb-pic.has-real-frame > canvas:not([data-ps-frame-shell]) { outline: 0 !important; }
.ps-frame-profile-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ps-frame-profile-row .ps-frame-profile-name { min-width: 0; flex: 1; overflow: hidden; color: #5a6672; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.ps-frame-profile-row .ps-btn { flex: none; }

@media (max-width: 820px) {
  .psf-modal { padding: 0; }
  .psf-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .psf-choose-layout { grid-template-columns: 1fr; }
  .psf-preview { position: static; order: -1; min-height: 300px; }
  .psf-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .psf-main-canvas { max-height: 270px; }
  .psf-foot span { display: none; }
}
@media (max-width: 520px) {
  .psf-head, .psf-foot, .psf-panel { padding-left: 12px; padding-right: 12px; }
  .psf-tabs { padding-left: 12px; padding-right: 12px; }
  .psf-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .psf-card canvas { height: 80px; }
  .psf-compare { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .psf-compare article { gap: 8px; padding: 8px; }
  .psf-compare select { min-height: 38px; padding: 6px 24px 6px 7px; font-size: .72rem; }
  .psf-compare .ps-btn { width: 100%; min-height: 38px; padding: 6px; white-space: normal; font-size: .74rem; }
  .psf-compare-canvas { max-height: 230px; }
  .psf-room-stage { width: min(100%, calc(62vh * var(--psf-room-aspect))); }
}

/* The chooser lives outside .ps, so give it the studio tokens (buttons were unstyled). */
.psf-modal { --ps-navy: #183247; --ps-navy-ink: #fff; --ps-ink: #23201d; --ps-sunk: #f1ebe2; --ps-line-strong: #cdbfa9; --ps-gold: #a77c3b; font-family: Inter, "Noto Sans SC", "Helvetica Neue", Arial, sans-serif; }
.psf-modal *, .psf-modal *::before, .psf-modal *::after { box-sizing: border-box; }
.psf-modal .ps-btn { color: var(--ps-navy-ink); background: var(--ps-navy); border: 1px solid var(--ps-navy); cursor: pointer; }
.psf-modal .ps-btn.ps-btn-ghost { color: var(--ps-ink); background: #fff; border-color: var(--ps-line-strong); }
.psf-card canvas { background: #efe9df; }
.psf-main-canvas, .psf-compare-canvas { filter: none; box-shadow: 0 2px 4px rgba(0,0,0,.18), 0 16px 30px -12px rgba(0,0,0,.35); }
.psf-room-overlay { filter: none; box-shadow: 0 2px 4px rgba(0,0,0,.25), 0 18px 28px -14px rgba(0,0,0,.45); }
/* Print card: frame chip (corner swatch + name + Change). */
.ps .ps-frame-profile-row { width: 100%; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border: 1px solid var(--ps-line-strong, #cdbfa9); border-radius: 10px; background: var(--ps-surface, #fffdf9); text-align: left; cursor: pointer; }
.ps .ps-frame-profile-row:hover { border-color: var(--ps-gold, #a77c3b); }
.ps-frame-profile-sw { flex: none; width: 44px; height: 30px; border-radius: 6px; background: #efe9df; }
.ps .ps-frame-profile-row .ps-frame-profile-name { flex: 1; min-width: 0; color: var(--ps-ink, #23201d); font-size: 12.5px; font-weight: 650; line-height: 1.2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ps-frame-profile-go { flex: none; color: var(--ps-gold, #a77c3b); font-size: 12px; font-weight: 700; }
