/* Nicecard Studio: the editor after the reference layout — a quiet top bar, the page on a light grey
   ground with a dashed edge, a floating tool strip, a layers drawer, selection handles on any element and
   the photo filmstrip — plus the cinematic template preview. */
.nce-studio { --nce-top:0px!important; --nce-ground:#eeedeb; --nce-sel:#a96854; min-height:0; height:100dvh; background:#f3f1ed; }

/* ───── Top bar: name and save state left; undo / redo, 保存, 预览分享, 退出 right ───── */
.nce-studio .nce-bar {min-height:64px;background:#fffdf9;padding:10px 20px;}
.nce-studio .nce-bar-title {align-items:center;gap:14px;}
.nce-studio .nce-bar-name {font-size:18px;}
.nce-studio .nce-status {margin:0;font-size:12px;}
.nce-studio .nce-bar-tools {gap:14px;}
.nce-studio .nce-icon-btn {width:32px;height:32px;border-color:transparent;background:transparent;color:var(--mute-2);}
.nce-studio .nce-icon-btn:hover:not(:disabled) {border-color:var(--nce-line-2);background:#f6f1ea;}
.nce-studio .nce-group--main {gap:10px;}
.nce-studio .nce-bar-btn {padding:8px 18px;font-size:13px;border-radius:9px;}
.nce-studio .nce-bar-btn--action {padding:9px 20px;}
.nce-studio .nce-bar-exit {border-color:rgba(166,68,58,.45);color:var(--action);}
.nce-save {gap:7px;}
.nce-save-ic {position:relative;display:inline-grid;place-items:center;}
.nce-save-tick {position:absolute;right:-5px;bottom:-4px;display:grid;place-items:center;width:11px;height:11px;border-radius:50%;background:#4f8a52;color:#fff;box-shadow:0 0 0 1.5px #fffdf9;}
.nce-save-tick svg {width:8px;height:8px;stroke-width:3.2;}
.nce-save.is-saved {color:var(--mute-2);}
.nce-save-warn {position:absolute;right:-6px;bottom:-5px;display:grid;place-items:center;width:12px;height:12px;border-radius:50%;background:var(--action);color:#fff;font-size:9px;font-weight:700;line-height:1;box-shadow:0 0 0 1.5px #fffdf9;}
.nce-save.is-problem {color:var(--action);}
/* Background music: one switch in the bar, so the draft plays what the preview played or stays quiet. */
.nce-music {display:inline-flex;align-items:center;gap:5px;height:32px;margin-left:6px;padding:0 10px 0 8px;border:1px solid var(--nce-line-2);border-radius:9px;background:transparent;color:var(--mute-2);font:inherit;font-size:12.5px;white-space:nowrap;cursor:pointer;transition:background 140ms,color 140ms,border-color 140ms;}
.nce-music:hover {background:#f6f1ea;}
.nce-music[aria-pressed='true'] {border-color:#e6cfc4;background:#f7ebe5;color:var(--brand);}
.nce-music-state {padding:0 5px;border-radius:5px;background:rgba(58,49,40,.07);font-size:11px;}
.nce-music[aria-pressed='true'] .nce-music-state {background:rgba(169,104,84,.14);}
.nce-music:focus-visible {outline:2px solid var(--action);outline-offset:1px;}

/* ───── Body: quiet rail · stage (canvas, tool strip, layers) over the filmstrip · inspector ───── */
.nce-studio .nce-body {min-height:0;}
.nce-studio .nce-rail {flex:0 0 64px;gap:2px;padding:12px 6px;background:#fffdf9;}
.nce-studio .nce-rail-btn {padding:10px 2px;border-radius:10px;font-size:12px;color:var(--mute);}
.nce-studio .nce-rail-btn[aria-pressed='true'] {background:#f5ede7;color:var(--brand);font-weight:500;}
.nce-main {display:flex;flex:1 1 auto;flex-direction:column;min-width:0;min-height:0;}
.nce-stage {position:relative;display:flex;flex:1 1 auto;min-height:0;}
.nce-studio .nce-canvas {flex:1 1 auto;padding:48px 24px 40px;background:var(--nce-ground);}
.nce-studio .nce-page {box-shadow:0 14px 34px -22px rgba(34,31,28,.4);}
/* The page edge: dashed, drawn outside the scaled page so it stays one pixel at any zoom. */
.nce-studio .nce-sizer::before {content:'';position:absolute;inset:-1px;border:1px dashed rgba(58,49,40,.3);pointer-events:none;}
.nce-studio .nce-panel {flex:0 0 340px;width:340px;min-width:0;background:#fffdf9;}
.nce-studio .nce-panel-body {display:block;height:100%;overflow:auto;}
.nce-studio .nce-col {width:100%;max-height:none;overflow:visible;}
.nce-studio .nce-col--sel {gap:8px;padding:20px 18px 4px;}
.nce-studio.has-selection .nce-col--sel {padding:0;border:0;}
.nce-studio.has-selection .nce-col--tool {display:none;}

/* The template's own edit outlines give way to the selection box and the hover frame. */
.nce-studio .nce-page .nci-f--edit:hover,
.nce-studio .nce-page .nci-photo--edit:hover,
.nce-studio .nce-page .nci-f--edit:focus,
.nce-studio .nce-page .nci-sel:not(.nci-el) {outline-color:transparent!important;}
.nce-studio .nce-page .nci-f--edit:focus {background:rgba(169,104,84,.07);}
/* The page reads as guests will see it: every element is found by hovering (the dashed frame), so the
   fields' own dashed underline would only mark some of them. A border the couple set still shows. */
.nce-studio .nce-page .nci-f--hint:not([style*='border']) {border-bottom-color:transparent!important;}
.nce-canvas[data-cursor='pointer'] .nce-page,.nce-canvas[data-cursor='pointer'] .nce-page * {cursor:pointer!important;}
.nce-canvas[data-cursor='move'] .nce-page,.nce-canvas[data-cursor='move'] .nce-page * {cursor:move!important;}
.nce-canvas[data-cursor='text'] .nce-page,.nce-canvas[data-cursor='text'] .nce-page * {cursor:text!important;}
.nci--edit .nci-photo img {pointer-events:none;}
/* Preview and guest page: an element with a click action takes the click even when it is decoration. */
.ncs-has-action {pointer-events:auto!important;cursor:pointer;}

/* ───── Selection box and hover frame for template elements (sizer pixels, so they follow zoom) ───── */
.nce-selbox {position:absolute;z-index:6;box-sizing:border-box;border:1.5px solid var(--nce-sel);pointer-events:none;transform-origin:50% 50%;}
.nce-sh,.nce-sh-rot,.nce-sh-move {position:absolute;box-sizing:border-box;border:1.5px solid var(--nce-sel);background:#fff;box-shadow:0 1px 3px rgba(58,49,40,.28);pointer-events:auto;touch-action:none;}
.nce-sh {width:10px;height:10px;margin:-5px 0 0 -5px;border-radius:50%;}
.nce-sh--nw {left:0;top:0;cursor:nwse-resize;}
.nce-sh--ne {left:100%;top:0;cursor:nesw-resize;}
.nce-sh--se {left:100%;top:100%;cursor:nwse-resize;}
.nce-sh--sw {left:0;top:100%;cursor:nesw-resize;}
.nce-sh--n,.nce-sh--s {left:50%;width:18px;height:6px;margin:-3px 0 0 -9px;border-radius:3px;cursor:ns-resize;}
.nce-sh--n {top:0;}
.nce-sh--s {top:100%;}
.nce-sh--e,.nce-sh--w {top:50%;width:6px;height:18px;margin:-9px 0 0 -3px;border-radius:3px;cursor:ew-resize;}
.nce-sh--e {left:100%;}
.nce-sh--w {left:0;}
.nce-sh-stem {position:absolute;left:50%;bottom:100%;width:1.5px;height:14px;margin-left:-.75px;background:var(--nce-sel);}
.nce-sh-rot,.nce-sh-move {display:grid;place-items:center;width:22px;height:22px;border-radius:50%;color:var(--nce-sel);}
.nce-sh-rot {left:50%;bottom:100%;margin:0 0 13px -11px;cursor:grab;}
.nce-sh-rot:active {cursor:grabbing;}
.nce-sh-move {display:none;left:50%;top:100%;margin:10px 0 0 -11px;cursor:move;}
.nce-selbox.is-small .nce-sh-move {display:grid;}
.nce-selbox.is-small .nce-sh--n,.nce-selbox.is-small .nce-sh--s,.nce-selbox.is-small .nce-sh--e,.nce-selbox.is-small .nce-sh--w {display:none;}
/* A line of type: side handles only (it scales from its ends); a mouse moves it by the text itself. */
.nce-selbox.is-text .nce-sh--n,.nce-selbox.is-text .nce-sh--s {display:none;}
@media (hover:hover) and (pointer:fine) {
  .nce-selbox.is-text:not(.is-small) .nce-sh--e,.nce-selbox.is-text:not(.is-small) .nce-sh--w {display:block;}
  .nce-selbox.is-text .nce-sh-move {display:none;}
}
.nce-hoverbox {position:absolute;z-index:5;box-sizing:border-box;border:1px dashed rgba(169,104,84,.8);border-radius:2px;pointer-events:none;transform-origin:50% 50%;}
.nce-ov-tip--node {z-index:7;}
@media (pointer:coarse) {
  .nce-sh {width:18px;height:18px;margin:-9px 0 0 -9px;}
  .nce-sh--n,.nce-sh--s,.nce-sh--e,.nce-sh--w {display:none;}
  .nce-sh-rot,.nce-sh-move {width:30px;height:30px;margin-left:-15px;}
  .nce-sh-move {display:grid;}
}

/* ───── Floating tool strip: 适应屏幕 · 图层 | 放大 · % · 缩小 ───── */
.nce-tools {position:absolute;right:16px;bottom:20px;z-index:12;display:flex;flex-direction:column;gap:10px;}
.nce-tools-group {display:flex;flex-direction:column;align-items:center;gap:2px;padding:5px;border-radius:12px;background:#fff;box-shadow:0 8px 20px -12px rgba(58,49,40,.4),0 0 0 1px rgba(58,49,40,.07);}
.nce-tool {position:relative;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:9px;background:transparent;color:var(--ink-2);cursor:pointer;transition:background 140ms,color 140ms;}
.nce-tool:hover:not(:disabled) {background:#f5eee8;color:var(--brand);}
.nce-tool[aria-pressed='true'] {background:#f5e6df;color:var(--brand-deep);}
.nce-tool:disabled {opacity:.35;cursor:default;}
.nce-tool:focus-visible {outline:2px solid var(--action);outline-offset:1px;}
.nce-tools-val {padding:3px 0;font-size:12.5px;color:var(--ink-2);font-variant-numeric:tabular-nums;}
.nce-tool[data-tip]::after {content:attr(data-tip);position:absolute;right:calc(100% + 10px);top:50%;padding:5px 9px;border-radius:7px;background:var(--ink);color:var(--cream);font-size:11.5px;line-height:1.3;white-space:nowrap;opacity:0;pointer-events:none;transform:translate(3px,-50%);transition:opacity 140ms,transform 140ms var(--ease);}
.nce-tool[data-tip]:hover::after,.nce-tool[data-tip]:focus-visible::after {opacity:1;transform:translate(0,-50%);}

/* ───── Layers drawer ───── */
.nce-layers-drawer {position:absolute;top:16px;right:72px;bottom:16px;z-index:13;display:flex;flex-direction:column;width:260px;max-width:calc(100% - 88px);overflow:hidden;border-radius:14px;background:#fffdf9;box-shadow:0 18px 40px -18px rgba(58,49,40,.42),0 0 0 1px rgba(58,49,40,.08);}
.nce-layers-head {display:flex;align-items:center;gap:8px;padding:10px 8px 10px 16px;border-bottom:1px solid var(--nce-line);}
.nce-layers-head h2 {margin:0;font-size:14px;font-weight:600;color:var(--ink);}
.nce-layers-head span {flex:1;font-size:11.5px;color:var(--mute);}
.nce-layers-scroll {flex:1;min-height:0;overflow-y:auto;padding:0 8px 14px;}
.nce-lgroup-title {position:sticky;top:0;z-index:1;margin:0;padding:12px 8px 6px;background:#fffdf9;font-size:11px;font-weight:400;letter-spacing:.14em;color:var(--mute);}
.nce-lrows {display:flex;flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;}
.nce-lrow {display:flex;align-items:center;border:1px solid transparent;border-radius:9px;}
.nce-lrow:hover {background:#f7f2ec;}
.nce-lrow.is-selected {border-color:var(--blush-line);background:var(--blush);}
.nce-lrow.is-hidden .nce-lrow-main {opacity:.45;}
.nce-lrow-main {display:flex;flex:1;align-items:center;gap:10px;min-width:0;padding:5px 6px;border:0;border-radius:8px;background:transparent;font:inherit;text-align:left;cursor:pointer;}
.nce-lrow-thumb {display:grid;flex:0 0 30px;place-items:center;width:30px;height:30px;overflow:hidden;border-radius:6px;background:#f3eee7;color:var(--brand);font-family:var(--f-serif);font-size:15px;font-weight:600;}
.nce-lrow-thumb img {width:100%;height:100%;object-fit:cover;}
.nce-lrow-ink {width:24px;height:24px;background:var(--brand);-webkit-mask:center/contain no-repeat;mask:center/contain no-repeat;}
.nce-lrow-name {flex:1;min-width:0;overflow:hidden;font-size:12.5px;color:var(--ink);white-space:nowrap;text-overflow:ellipsis;}

/* ───── Filmstrip: every photo of the invitation ───── */
.studio-upload-error {margin:0;padding:10px 24px;background:#ffe6df;color:#8a342e;}
.studio-film {flex:none;min-width:0;padding:8px 16px 12px;border-top:1px solid #e3ddd4;background:#fffdf9;z-index:20;}
.studio-film-heading {display:flex;align-items:center;gap:14px;min-width:0;margin-bottom:8px;}
.studio-film-toggle {display:inline-flex;align-items:center;gap:6px;padding:4px 0;border:0;background:transparent;color:#705143;font:inherit;font-size:13px;font-weight:600;white-space:nowrap;cursor:pointer;}
.studio-film-chev {display:inline-grid;transition:transform 160ms var(--ease);}
.studio-film-toggle[aria-expanded='true'] .studio-film-chev {transform:rotate(180deg);}
.studio-film-hint {min-width:0;overflow:hidden;font-size:11.5px;color:#998c7d;white-space:nowrap;text-overflow:ellipsis;}
.studio-film-track {position:relative;min-width:0;}
.studio-film-list {display:flex;gap:10px;margin:0;padding:3px;overflow-x:auto;list-style:none;scrollbar-width:thin;}
/* The end that runs on out of sight gets an arrow over a fade; a mouse wheel scrolls the strip too. */
.studio-film-arrow {position:absolute;top:0;bottom:0;z-index:2;display:grid;place-items:center;width:44px;padding:0;border:0;background:linear-gradient(90deg,#fffdf9 30%,rgba(255,253,249,0));color:var(--ink-2);cursor:pointer;}
.studio-film-arrow--prev {left:0;justify-content:start;padding-left:2px;}
.studio-film-arrow--next {right:0;justify-content:end;padding-right:2px;background:linear-gradient(270deg,#fffdf9 30%,rgba(255,253,249,0));}
.studio-film-arrow svg {width:28px;height:28px;padding:5px;border-radius:50%;background:#fff;box-shadow:0 2px 8px rgba(58,49,40,.22);}
.studio-film-arrow:hover svg {color:var(--brand);}
.studio-film-arrow:focus-visible {outline:none;}
.studio-film-arrow:focus-visible svg {outline:2px solid var(--action);outline-offset:1px;}
.studio-film-item {position:relative;flex:0 0 84px;height:84px;border-radius:8px;background:#ece5dc;}
.studio-film-pick {display:grid;place-items:center;width:100%;height:100%;padding:0;overflow:hidden;border:2px solid transparent;border-radius:8px;background:transparent;cursor:pointer;}
.studio-film-pick img {display:block;width:100%;height:100%;object-fit:cover;}
.studio-film-pick:focus-visible {outline:2px solid var(--action);outline-offset:2px;}
.studio-film-item.is-selected .studio-film-pick {border-color:var(--nce-sel);box-shadow:0 0 0 2px #ead5cb;}
.studio-film-item.is-empty .studio-film-pick {border:1.5px dashed #c9b9a8;background:repeating-linear-gradient(135deg,#f4efe8 0 8px,#ece5dc 8px 16px);}
.studio-film-item.is-drop .studio-film-pick {border-color:var(--action);box-shadow:0 0 0 3px rgba(166,68,58,.22);}
.studio-film-item.is-hidden img {opacity:.4;}
.studio-film-empty {margin-top:26px;font-size:11px;color:#8d7e6d;}
.studio-film-index {position:absolute;left:5px;top:4px;min-width:16px;padding:1px 5px;border-radius:4px;background:rgba(40,30,25,.55);color:#fff;font:10px/1.4 var(--f-sans);text-align:center;pointer-events:none;}
.studio-film-tag {position:absolute;right:5px;top:4px;padding:1px 5px;border-radius:4px;background:rgba(255,253,249,.9);color:var(--mute-2);font-size:10px;line-height:1.4;pointer-events:none;}
.studio-film-swap {position:absolute;left:50%;top:50%;display:grid;place-items:center;width:30px;height:30px;margin:-15px 0 0 -15px;padding:0;border:0;border-radius:8px;background:rgba(40,30,25,.42);color:#fff;cursor:pointer;transition:background 140ms;}
.studio-film-item.is-empty .studio-film-swap {top:38%;background:rgba(112,81,67,.55);}
.studio-film-swap:hover,.studio-film-swap:focus-visible {background:rgba(40,30,25,.72);}
.studio-film.is-collapsed {padding-bottom:6px;}
.studio-film.is-collapsed .studio-film-heading {margin-bottom:0;}

/* ───── Template preview ───── */
.studio-preview {max-width:1500px;margin:auto;}
.studio-preview-top {display:flex;align-items:center;justify-content:space-between;margin-bottom:22px;font-size:13px;color:#8b7c6d;}
.studio-preview-layout {display:grid;grid-template-columns:minmax(420px,1fr) 300px;gap:28px;}
.studio-preview-stage {min-width:0;background:#eeeae4;border:1px solid #e5ddd2;border-radius:18px;padding:24px;display:flex;flex-direction:column;align-items:center;}
.studio-preview-phone {position:relative;width:390px;max-width:100%;background:white;box-shadow:0 16px 50px #55412d20;overflow:hidden;border-radius:5px;}
.studio-preview-screen {height:calc(100dvh - 270px);min-height:380px;max-height:780px;overflow:auto;overscroll-behavior:contain;scrollbar-width:none;}
.studio-preview-playback {display:flex;align-items:center;gap:10px;margin-top:18px;flex-wrap:wrap;justify-content:center;}
.studio-preview-playback .nc-btn {font-size:12px;min-height:34px;padding:7px 12px;}
.studio-preview-playback>span {font-size:11px;color:#8d7e6d;}
.studio-preview-progress {width:180px;height:2px;background:#dcd1c3;margin-top:14px;}
.studio-preview-progress>div {height:100%;background:#a96854;}
.studio-preview-info {border:1px solid #e4dace;background:#fffdf8;border-radius:18px;padding:30px 25px;align-self:stretch;}
.studio-eyebrow {font:10px/1.5 sans-serif;letter-spacing:2px;color:#a58f78;}
.studio-preview-info h1 {font-family:var(--f-serif);font-size:34px;line-height:1.2;margin:20px 0 12px;color:#704936;font-weight:500;}
.studio-preview-info>p:not(.studio-eyebrow) {font-size:13px;line-height:1.9;color:#93816f;}
.studio-preview-divider {height:1px;background:#e9dfd2;margin:28px 0;}
.studio-preview-info .studio-make {width:100%;margin:24px 0 12px;justify-content:center;}
.studio-preview-notes {margin-top:50px;font-size:11px;line-height:2;color:#9b8a77;}
.studio-music button {border:1px solid #ffffff80;border-radius:30px;background:#49362ba0;color:white;backdrop-filter:blur(10px);padding:8px 12px;font:12px/1.4 sans-serif;cursor:pointer;}
.studio-preview-phone>.studio-music {position:absolute;top:14px;right:14px;z-index:5;}
.studio-preview-phone>.studio-music span {font-size:10px;}

/* Toasts sit under the top bar while editing, clear of the filmstrip and the bottom sheet. */
body:has(.nce-studio) .nc-toaster {top:80px;bottom:auto;}

/* ───── Narrower screens ───── */
@media(max-width:1279px) {.nce-studio .nce-panel {flex-basis:300px;width:300px;}}
@media(max-width:1100px) {.studio-preview-layout {grid-template-columns:minmax(350px,1fr) 245px;gap:18px;}.studio-preview-info {padding:22px 18px;}.studio-preview-stage {padding:18px 10px;}}
/* Under 1100px the inspector is a bottom sheet (editor.css); keep its folded head clear of the filmstrip. */
@media(max-width:1099px) {
  .nce-studio .nce-panel {left:64px;width:auto;}
  .nce-studio .nce-main {padding-bottom:54px;}
  .nce-studio .nce-canvas {padding-bottom:28px;}
  /* With the sheet open there is room to scroll the page's last element up above it. */
  .nce-studio.is-sheet-open .nce-canvas {padding-bottom:62vh;}
}
@media(max-width:900px) {.studio-preview-layout {display:flex;flex-direction:column;}.studio-preview-info {width:100%;box-sizing:border-box;}.studio-preview-notes {margin-top:20px;}.nce-studio .studio-inspector-body {padding-bottom:30px;}}
@media(max-width:759px) {
  .nce-studio .nce-bar {padding:8px 12px;}
  .nce-studio .nce-bar-btn {padding:8px 12px;}
  .nce-studio .nce-icon-btn[data-tip]::after {display:none;}
  .nce-studio .nce-rail {flex:0 0 auto;padding:6px 8px;}
  .nce-studio .nce-rail-btn {padding:7px 12px;}
  .nce-studio .nce-panel {left:0;}
  .nce-studio .nce-canvas {padding:48px 12px 64px;}
  /* On a phone the tool strip leaves the page alone: it sits in the filmstrip's heading row. */
  .studio-film .nce-tools {position:static;flex:none;flex-direction:row;gap:4px;margin-left:auto;}
  .studio-film .nce-tools-group {flex-direction:row;padding:2px;border-radius:9px;box-shadow:0 0 0 1px rgba(58,49,40,.1);}
  .studio-film .nce-tool {width:30px;height:30px;}
  .studio-film-hint {display:none;}
  body:has(.nce-studio) .nc-toaster {top:108px;}
  .nce-tools-val {padding:0 3px;font-size:11.5px;}
  .nce-tool[data-tip]::after {display:none;}
  .nce-layers-drawer {left:8px;right:8px;top:8px;bottom:58px;width:auto;max-width:none;}
  .studio-film {padding:6px 10px 8px;}
  .studio-film-hint {font-size:10.5px;}
  .studio-film-item {flex-basis:60px;height:60px;}
  .studio-film-empty {margin-top:18px;}
  .studio-film-swap {width:24px;height:24px;margin:-12px 0 0 -12px;}
}
@media(prefers-reduced-motion:reduce) {.studio-preview-progress>div {transition:none;}}
