/* Nicecard demo — invitation editor (NC.views.editor). Prefix: nce-.
   Values from the editor in "Web Platform.dc.html": sub-header, 76px tool rail, warm canvas,
   208px Selection column beside the tool column. */

.nce {
  --nce-line: rgba(58, 49, 40, 0.1);
  --nce-line-2: rgba(58, 49, 40, 0.16);
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nce-top, 73px));
  height: calc(100dvh - var(--nce-top, 73px));
  min-height: 560px;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--f-sans);
}

.nce--loading {
  background: var(--canvas-ground);
}

/* ───── Sub-header ───── */

.nce-bar {
  position: relative;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--nce-line);
  background: var(--cream);
}

.nce-bar-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.nce-bar-name {
  font-family: var(--f-serif);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  color: var(--brand);
  white-space: nowrap;
}

.nce-bar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.nce-status {
  margin-right: 4px;
  font-size: 12px;
  color: var(--mute);
  white-space: nowrap;
}

.nce-status.is-dirty {
  color: var(--action);
}

.nce-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nce-icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--nce-line-2);
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms var(--ease), border-color 160ms;
}

.nce-icon-btn:hover:not(:disabled) {
  border-color: rgba(58, 49, 40, 0.3);
  background: var(--panel);
}

.nce-icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.nce-icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  z-index: 60;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--cream);
  font-size: 11.5px;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -3px);
  transition: opacity 140ms, transform 140ms var(--ease);
}

.nce-icon-btn[data-tip]:hover::after,
.nce-icon-btn[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.nce-bar-btn {
  padding: 9px 16px;
  font-size: 13px;
}

.nce-bar-btn--action {
  padding: 10px 18px;
  border: 0;
}

/* ───── Publishing: status chip, Publish / Share, save state, conflict ───── */

.nce-chip {
  align-self: center;
  padding: 3px 10px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
}

.nce-chip--local {
  border: 1px dashed var(--nce-line-2);
  background: transparent;
  color: var(--mute-2);
}

.nce-publish svg {
  margin-right: -2px;
}

/* Local mode: Publish stays clickable so it can say why it cannot publish. */
.nce-publish.is-off {
  opacity: 0.55;
  cursor: help;
}

.nce-publish[aria-busy='true'] {
  cursor: progress;
}

.nce-conflict {
  position: relative;
  z-index: 29;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--blush-line);
  background: var(--blush);
  color: #6f3a2f;
  font-size: 13px;
  line-height: 1.5;
}

.nce-conflict-text {
  flex: 1 1 320px;
}

.nce-conflict-text strong {
  font-weight: 600;
}

.nce-conflict-actions {
  display: flex;
  gap: 8px;
}

.nce-uploading {
  margin: 0;
  padding: 8px 24px;
  background: var(--panel-2);
  color: var(--mute-2);
  font-size: 12.5px;
}

.nce-nolink {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--mute-2);
  font-size: 12.5px;
  line-height: 1.55;
  letter-spacing: 0;
}

/* ───── Share panel ───── */

.nce-share-scrim {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(24, 19, 15, 0.55);
  animation: nce-share-in 160ms var(--ease);
}

@keyframes nce-share-in {
  from {
    opacity: 0;
  }
}

.nce-share,
.nce-check {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 28px 22px;
  border-radius: var(--r-xl);
  background: var(--cream);
  box-shadow: var(--shadow-pop);
  outline: none;
}

.nce-share-x {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mute-2);
  cursor: pointer;
}

.nce-share-x:hover {
  background: rgba(58, 49, 40, 0.06);
}

.nce-share-chip {
  padding: 3px 10px;
  font-size: 11.5px;
}

.nce-share-title {
  margin-top: 12px;
  font-family: var(--f-serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
  color: var(--brand);
}

.nce-share-lead {
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--mute-2);
}

.nce-share-link {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.nce-share-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 9px 14px;
  border: 1px solid var(--nce-line-2);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  color: var(--ink-2);
  outline: none;
}

.nce-share-input:focus {
  border-color: var(--rose-line);
  box-shadow: 0 0 0 3px rgba(222, 127, 113, 0.18);
}

.nce-share-qr {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--nce-line);
  border-radius: var(--r-lg);
  background: #fff;
}

.nce-qr {
  flex: none;
  display: block;
  width: 132px;
  height: 132px;
}

.nce-share-qr p {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--mute-2);
}

.nce-share-live {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-size: 12.5px;
  line-height: 1.55;
}

.nce-share-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 16px;
}

.nce-share-text {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: rgba(58, 49, 40, 0.25);
  text-underline-offset: 3px;
  cursor: pointer;
}

.nce-share-text--warn {
  color: var(--action);
  text-decoration-color: rgba(166, 68, 58, 0.35);
}

.nce-share-ask {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 100%;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--blush);
  color: #6f3a2f;
  font-size: 12.5px;
  line-height: 1.55;
}

.nce-share-ask-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Before the first publish: the example content still on the page. */
.nce-check-list {
  margin: 14px 0 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

.nce-check-list li + li {
  margin-top: 4px;
}

.nce-check-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.nce-share-qr-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

@media (max-width: 480px) {
  .nce-share,
  .nce-check {
    padding: 24px 18px 18px;
  }

  .nce-share-qr-text {
    align-items: center;
  }

  .nce-share-qr {
    flex-direction: column;
    text-align: center;
  }
}

/* ───── Small-screen notice ───── */

.nce-notice {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--blush-line);
  background: var(--blush);
  color: #8a4e40;
  font-size: 12.5px;
  line-height: 1.5;
}

.nce-notice p {
  flex: 1;
}

.nce-notice button {
  flex: 0 0 auto;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ───── Body: rail · canvas · panel ───── */

.nce-body {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
}

.nce-rail {
  display: flex;
  flex: 0 0 76px;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  border-right: 1px solid var(--nce-line);
  background: var(--panel);
}

.nce-rail-btn {
  width: 100%;
  padding: 12px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--mute-2);
  font-size: 12.5px;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms;
}

.nce-rail-btn:hover {
  background: rgba(251, 237, 233, 0.6);
  color: var(--brand-deep);
}

.nce-rail-btn[aria-pressed='true'] {
  background: var(--blush);
  color: var(--brand-deep);
  font-weight: 600;
}

/* ───── Canvas ───── */

.nce-canvas {
  position: relative;
  flex: 1 1 340px;
  min-width: 0;
  overflow: auto;
  padding: 22px 16px 28px;
  background: var(--canvas-ground);
  overscroll-behavior: contain;
}

.nce-sizer {
  position: relative;
  margin: 0 auto;
}

.nce-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  background: #fff;
  box-shadow: 0 22px 50px -26px rgba(34, 31, 28, 0.45);
  transform-origin: 0 0;
}

.nce-page .nci--edit .nci-el:hover {
  outline: 1px dashed rgba(166, 68, 58, 0.45);
}

.nce-page .nci-el.nci-sel {
  outline: none !important;
}

.nce-page .nci-el-text.nce-inline {
  outline: none;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
  caret-color: var(--action);
}

/* Overlay for the selected free element: drawn outside the scaled page so handles stay a constant size. */
.nce-ov {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.nce-ov-box {
  position: absolute;
  outline: 1.5px dashed var(--action);
  outline-offset: 1px;
  cursor: move;
  pointer-events: auto;
  touch-action: none;
}

.nce-ov-box.is-editing {
  outline-style: solid;
  outline-color: rgba(166, 68, 58, 0.55);
  pointer-events: none;
}

.nce-h,
.nce-rot {
  position: absolute;
  border: 1.5px solid var(--action);
  background: var(--cream);
  box-shadow: 0 1px 3px rgba(58, 49, 40, 0.28);
  pointer-events: auto;
  touch-action: none;
}

.nce-h {
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 3px;
}

.nce-h--nw {
  top: 0;
  left: 0;
  cursor: nwse-resize;
}

.nce-h--ne {
  top: 0;
  left: 100%;
  cursor: nesw-resize;
}

.nce-h--sw {
  top: 100%;
  left: 0;
  cursor: nesw-resize;
}

.nce-h--se {
  top: 100%;
  left: 100%;
  cursor: nwse-resize;
}

.nce-rot-stem {
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 1.5px;
  height: 18px;
  margin-left: -0.75px;
  background: var(--action);
  pointer-events: none;
}

.nce-rot {
  bottom: 100%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: 0 0 17px -7px;
  border-radius: 50%;
  cursor: grab;
}

.nce-rot:active {
  cursor: grabbing;
}

.nce-ov-tip {
  position: absolute;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--cream);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
  pointer-events: none;
}

@media (pointer: coarse) {
  .nce-h {
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
  }

  .nce-rot {
    width: 22px;
    height: 22px;
    margin: 0 0 14px -11px;
  }
}

/* ───── Right panel: Selection column + tool column ───── */

.nce-panel {
  display: flex;
  flex: 0 0 590px;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--nce-line);
  background: var(--cream);
}

.nce-sheet-head {
  display: none;
}

.nce-panel-body {
  display: grid;
  flex: 1;
  grid-template-columns: 208px minmax(0, 1fr);
  min-height: 0;
}

.nce-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.nce-col--tool {
  gap: 24px;
  padding: 16px 14px 28px;
}

.nce-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nce-h3 {
  margin: 0;
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

.nce-h3--inset {
  padding: 0 12px;
}

.nce-copy {
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--mute-2);
}

.nce-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--mute);
}

.nce-err {
  font-size: 12px;
  line-height: 1.5;
  color: var(--action);
}

.nce-sel-title {
  margin: 0;
  font-family: var(--f-serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--brand);
}

.nce-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.nce-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--mute);
}

.nce-wide {
  width: 100%;
  padding: 9px 14px;
}

.nce-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nce-pill {
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.2;
  transition: background 160ms var(--ease), border-color 160ms, color 160ms;
}

.nce-pill:hover:not([aria-pressed='true']) {
  border-color: rgba(58, 49, 40, 0.28);
}

/* Colour dots */
.nce-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.nce-dot,
.nce-color {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(58, 49, 40, 0.2);
  border-radius: 50%;
  cursor: pointer;
}

.nce-dot[aria-pressed='true'],
.nce-color.is-on {
  border: 2px solid var(--action);
  box-shadow: inset 0 0 0 2px var(--cream);
}

.nce-color {
  overflow: hidden;
  background: conic-gradient(#de7f71, #e8c27a, #9fb58a, #7aa0b5, #a58ac2, #de7f71);
}

.nce-color input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.nce-color:focus-within {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

/* Sections list (Pages) */
.nce-secs,
.nce-layers {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nce-sec {
  display: flex;
  align-items: center;
  border-radius: 10px;
  transition: background 160ms;
}

.nce-sec:hover {
  background: var(--panel);
}

.nce-sec-go {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nce-sec-go:disabled {
  cursor: default;
}

.nce-sec--sub .nce-sec-go {
  padding-left: 26px;
  font-size: 12.5px;
  color: var(--mute-2);
}

.nce-sec.is-off .nce-sec-go {
  color: #a89a8a;
}

.nce-eye,
.nce-mini {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--mute-2);
  cursor: pointer;
}

.nce-eye {
  margin-right: 4px;
}

.nce-eye[aria-pressed='false'] {
  color: #b3a595;
}

.nce-eye:hover,
.nce-mini:hover:not(:disabled) {
  background: rgba(58, 49, 40, 0.07);
  color: var(--ink);
}

.nce-mini:disabled {
  opacity: 0.32;
  cursor: default;
}

.nce-mini--danger:hover:not(:disabled) {
  color: var(--action);
}

/* Layers */
.nce-layer {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 11px;
}

.nce-layer.is-selected {
  border-color: var(--blush-line);
  background: var(--blush);
}

.nce-layer.is-off {
  opacity: 0.55;
}

.nce-layer-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nce-layer-thumb {
  display: grid;
  flex: 0 0 32px;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--panel);
  color: var(--brand);
  font-family: var(--f-serif);
  font-size: 17px;
  font-weight: 600;
}

.nce-layer-thumb img {
  width: 100%;
  height: 100%;
  padding: 2px;
  object-fit: contain;
}

.nce-layer-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.nce-layer-name {
  overflow: hidden;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nce-layer-meta {
  font-size: 11px;
  color: var(--mute);
}

/* Photo tray */
.nce-tray {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.nce-tray-item {
  position: relative;
  height: 62px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(58, 49, 40, 0.12);
  border-radius: 10px;
  background: #f7f0e1;
  cursor: pointer;
  transition: border-color 160ms, transform 160ms var(--ease);
}

.nce-tray-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 26%;
}

.nce-tray-item:hover {
  border-color: var(--rose-line);
}

.nce-tray-item:active {
  transform: scale(0.98);
}

.nce-tray-item[aria-pressed='true'] {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.nce-tray--compact {
  gap: 6px;
}

.nce-tray--compact .nce-tray-item {
  height: 48px;
}

.nce-slot-prev {
  display: grid;
  place-items: center;
  height: 132px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--panel);
}

.nce-slot-prev img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
}

.nce-slot-prev.is-empty {
  border: 1px dashed rgba(58, 49, 40, 0.24);
  background-image: repeating-linear-gradient(135deg, #f1e9dc 0 10px, #fbf6ec 10px 20px);
  font-size: 12px;
  color: var(--mute);
}

.nce-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px;
  border: 1px dashed rgba(58, 49, 40, 0.26);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--mute);
  text-align: center;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}

.nce-upload strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.nce-upload:hover,
.nce-upload.is-drag {
  border-color: var(--rose-line);
  background: var(--blush);
}

.nce-upload:focus-within {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

/* Illustrations */
.nce-ill {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: 318px;
  overflow-y: auto;
  padding: 2px 6px 2px 2px;
}

.nce-ill-group {
  grid-column: 1 / -1;
  padding: 6px 0 2px;
  font-size: 11.5px;
  color: var(--mute);
}

.nce-ill-item {
  aspect-ratio: 1;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}

.nce-ill-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nce-ill-item:hover {
  border-color: var(--rose-line);
  background: var(--blush);
}

/* Text presets */
.nce-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nce-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(58, 49, 40, 0.12);
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}

.nce-preset:hover {
  border-color: var(--rose-line);
  background: var(--blush);
}

.nce-preset-sample {
  line-height: 1.2;
}

.nce-preset-sample--heading {
  font-family: var(--f-serif);
  font-size: 23px;
  font-weight: 500;
}

.nce-preset-sample--script {
  font-family: var(--f-hand);
  font-size: 25px;
}

.nce-preset-sample--label {
  padding: 4px 0;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.nce-preset-sample--paragraph {
  font-size: 13.5px;
}

.nce-preset-meta {
  font-size: 11.5px;
  color: var(--mute);
}

/* Modules */
.nce-mods {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nce-mod {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(58, 49, 40, 0.12);
  border-radius: 12px;
  background: transparent;
  color: var(--mute-2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 160ms, border-color 160ms, color 160ms;
}

.nce-mod[aria-pressed='true'] {
  border-color: var(--rose-line);
  background: var(--blush);
  color: var(--brand-deep);
}

.nce-mod:hover {
  border-color: var(--rose-line);
}

/* Music */
.nce-now {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--nce-line);
  border-radius: 14px;
  background: var(--panel);
}

.nce-now-name {
  margin-bottom: 8px;
  font-family: var(--f-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--brand);
}

.nce-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 0 0;
  border: 0;
  border-top: 1px solid var(--nce-line);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nce-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: 22px;
  background: rgba(58, 49, 40, 0.2);
  transition: background 160ms;
}

.nce-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 160ms var(--ease);
}

.nce-switch[aria-pressed='true'] .nce-switch-track {
  background: var(--action);
}

.nce-switch[aria-pressed='true'] .nce-switch-track::after {
  transform: translateX(16px);
}

.nce-tracks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nce-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}

.nce-track:hover {
  border-color: var(--blush-line);
}

.nce-track[aria-pressed='true'] {
  background: var(--blush);
  color: var(--brand-deep);
}

/* A track and its listen button */
.nce-track-row {
  display: flex;
  gap: 6px;
}

.nce-track-row .nce-track {
  flex: 1;
  min-width: 0;
  width: auto;
}

.nce-track-hear {
  display: grid;
  flex: none;
  place-items: center;
  width: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 160ms, border-color 160ms;
}

.nce-track-hear:hover {
  border-color: var(--blush-line);
}

.nce-track-hear[aria-pressed='true'] {
  background: var(--blush);
  color: var(--brand-deep);
}

.nce-soon {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cream);
  font-size: 11px;
  color: var(--mute);
}

/* Music and video uploads: the drop zone as a button, then the upload's progress */
.nce-upload--media {
  width: 100%;
  background: transparent;
  font: inherit;
  font-size: 12px;
}

.nce-upload--media strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nce-upload--media:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
}

.nce-upload.is-off {
  opacity: 0.62;
  cursor: default;
}

.nce-upload.is-off:hover {
  border-color: rgba(58, 49, 40, 0.26);
  background: transparent;
}

.nce-progress-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--nce-line);
  border-radius: 12px;
  background: var(--panel);
}

.nce-progress-name {
  overflow: hidden;
  font-size: 13px;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nce-progress {
  position: relative;
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(58, 49, 40, 0.12);
}

.nce-progress > span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  background: var(--action);
  transition: width 200ms linear;
}

.nce-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--mute);
}

.nce-textbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.nce-note--warn {
  color: var(--action);
}

/* The couple's own tracks, and the name guests see */
.nce-track--own {
  justify-content: flex-start;
}

.nce-track-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nce-now-rename {
  margin: 0 0 10px;
}

.nce-track-input {
  padding: 9px 12px;
  background: var(--cream);
  font-size: 13.5px;
}

/* Effects (Modules): the falling effect, a live sample of it, the wishes barrage */
.nce-fx {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--nce-line);
  border-radius: 14px;
  background: var(--panel);
}

.nce-fx-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nce-fx-sample {
  position: relative;
  display: grid;
  place-items: center;
  height: 104px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(58, 49, 40, 0.1);
}

.nce-fx-sample canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.nce-fx-names {
  padding: 0 12px;
  font-family: var(--f-serif);
  font-size: 19px;
  font-style: italic;
  text-align: center;
  opacity: 0.78;
}

/* Element properties */
.nce-textarea {
  min-height: 72px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}

.nce-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nce-range {
  flex: 1;
  min-width: 0;
  margin: 0;
  accent-color: var(--action);
}

.nce-range-val {
  min-width: 40px;
  font-size: 12px;
  color: var(--ink-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.nce-nums {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.nce-num {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding-left: 9px;
  border: 1px solid rgba(58, 49, 40, 0.1);
  border-radius: 9px;
  background: var(--panel);
}

.nce-num span {
  min-width: 12px;
  font-size: 11px;
  color: var(--mute);
}

.nce-num input {
  width: 100%;
  min-width: 0;
  padding: 7px 4px 7px 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.nce-num:focus-within {
  border-color: var(--rose-line);
  box-shadow: 0 0 0 3px rgba(222, 127, 113, 0.18);
}

.nce-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.nce-actions .nc-btn {
  padding: 8px 6px;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
}

.nce-danger {
  border-color: rgba(166, 68, 58, 0.35);
  color: var(--action);
}

.nce-danger:hover {
  background: var(--blush);
}

/* ───── Under 1280px: Selection stacks above the tool column ───── */

@media (max-width: 1279px) {
  .nce-panel {
    flex-basis: 304px;
  }

  .nce-panel-body {
    display: block;
    overflow-y: auto;
  }

  .nce-col {
    overflow: visible;
  }

  .nce-col--sel {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--nce-line);
  }
}

/* ───── Under 1100px: the panel becomes a bottom sheet over the canvas ───── */

@media (max-width: 1099px) {
  .nce-canvas {
    padding-bottom: 96px;
  }

  .nce-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 76px;
    z-index: 40;
    max-height: 62%;
    border-top: 1px solid var(--nce-line-2);
    border-left: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 40px -22px rgba(58, 49, 40, 0.38);
  }

  .nce-sheet-head {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 16px 18px 12px;
    border: 0;
    border-radius: 18px 18px 0 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .nce-sheet-grip {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 4px;
    background: rgba(58, 49, 40, 0.18);
  }

  .nce-sheet-title {
    font-family: var(--f-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--brand);
  }

  .nce-sheet-meta {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    color: var(--mute);
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .nce-sheet-chev {
    display: grid;
    color: var(--mute-2);
    transition: transform 160ms var(--ease);
  }

  .nce-panel.is-open .nce-sheet-chev {
    transform: rotate(180deg);
  }

  .nce-panel-body {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    height: min(46vh, 440px);
    overflow: hidden;
    border-top: 1px solid var(--nce-line);
  }

  .nce-panel:not(.is-open) .nce-panel-body {
    display: none;
  }

  .nce-col {
    overflow-y: auto;
  }

  .nce-col--sel {
    border-right: 1px solid var(--nce-line);
    border-bottom: 0;
  }
}

/* ───── Under 760px: phone layout ───── */

@media (max-width: 759px) {
  .nce-notice {
    display: flex;
  }

  .nce-bar {
    gap: 8px;
    padding: 8px 12px;
  }

  .nce-status {
    display: none;
  }

  /* A save that did not reach the server stays visible on a phone: the line under the title, in brief. */
  .nce-status.is-problem {
    display: block;
    flex: 1 0 100%;
    order: 9;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
  }

  /* Row one: name, undo/redo. Row two: save, preview, exit. */
  .nce-bar-tools {
    display: contents;
  }

  .nce-bar-title {
    flex: 1 1 0;
    overflow: hidden;
  }

  .nce-bar-name {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nce-group--main {
    flex: 1 0 100%;
  }

  .nce-group--main .nce-bar-btn {
    flex: 1 1 auto;
  }

  .nce-bar-btn {
    padding: 8px 12px;
    font-size: 12.5px;
  }

  .nce-bar-btn--action {
    padding: 9px 13px;
  }

  .nce-icon-btn {
    width: 32px;
    height: 32px;
  }

  .nce-body {
    flex-direction: column;
  }

  .nce-rail {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 2px;
    padding: 6px 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--nce-line);
    scrollbar-width: none;
  }

  .nce-rail-btn {
    flex: 1 0 auto;
    width: auto;
    padding: 8px 12px;
  }

  .nce-canvas {
    padding: 14px 8px 96px;
  }

  .nce-panel {
    left: 0;
  }

  .nce-panel-body {
    display: block;
    height: min(52vh, 460px);
    overflow-y: auto;
  }

  .nce-col {
    overflow: visible;
  }

  .nce-col--sel {
    border-right: 0;
    border-bottom: 1px solid var(--nce-line);
  }
}

/* 基本信息: the wedding's names, date and place, in the panel while nothing is selected */
.nce-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.nce-info .nce-copy,
.nce-info .nce-note {
  margin: 0;
}
