/* Card studio: the card sits in a recessed dark well like a print on a light table; controls on a plate. */
.card-cta { background: var(--cx-surface-2); }
.card-cta svg { color: var(--cx-accent); }

.card-studio { width: min(1240px, calc(100vw - 24px)); height: min(880px, calc(100dvh - 24px)); max-height: none; margin: auto; }
.cs-shell { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; border-radius: 18px; background: var(--cx-surface-1); box-shadow: var(--cx-catch), var(--cx-shadow-float); overflow: hidden; }
.cs-head { display: flex; align-items: center; gap: 14px; padding: 14px 14px 10px 18px; }
.cs-env { width: 52px; height: auto; flex: none; filter: drop-shadow(0 4px 10px oklch(0 0 0 / 0.18)); }
.cs-title { flex: 1; min-width: 0; }
.cs-title h2 { font-family: var(--cx-font-editorial); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin: 0; }
.cs-title p { margin: 2px 0 0; }

.cs-body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 12px; padding: 0 12px; min-height: 0; }
.cs-stage { margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; min-height: 0; }
.cs-well { min-height: 0; display: grid; place-items: center; padding: 24px; border-radius: 14px; background: radial-gradient(120% 90% at 50% 0%, oklch(0.2 0.008 250), var(--cx-well) 70%); box-shadow: var(--cx-well-shadow); overflow: hidden; }
#card-canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 3px; box-shadow: 0 1px 0 oklch(1 0 0 / 0.5) inset, 0 30px 60px oklch(0 0 0 / 0.45), 0 4px 12px oklch(0 0 0 / 0.3); outline: none; transition: transform var(--cx-dur-slow) var(--cx-spring-snap); }
#card-canvas:focus-visible { box-shadow: 0 0 0 3px var(--cx-accent), 0 30px 60px oklch(0 0 0 / 0.45); }

/* Tear-off spec chip: colour swatch + white band with exact readouts */
.cs-chip { display: flex; align-items: stretch; align-self: center; justify-self: center; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--cx-spec-band); box-shadow: 0 1px 2px oklch(0 0 0 / 0.12), 0 8px 24px oklch(0 0 0 / 0.1); }
.cs-swatch { width: 44px; flex: none; transition: background-color var(--cx-dur) ease; }
.cs-chip-band { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; padding: 8px 14px; color: var(--cx-spec-ink); font-size: 12px; min-width: 0; }
.cs-hex { color: var(--cx-spec-muted); }

.cs-controls { min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 14px; padding: 4px 6px 16px 4px; }
.cs-controls fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 0; }
.cs-controls legend, .field > span { padding: 0; font-size: 12px; font-weight: 500; color: var(--cx-ink-2); display: flex; justify-content: space-between; width: 100%; }
.field { display: grid; gap: 6px; min-width: 0; }
.field output { font-size: 11px; color: var(--cx-ink-3); }
.field input, .field textarea { width: 100%; font-size: 14px; }
.field textarea { resize: vertical; min-height: 104px; line-height: 1.5; }
#card-headline { font-family: var(--cx-font-editorial); font-weight: 500; font-size: 17px; }
#card-signoff { font-family: var(--cx-font-script); font-size: 20px; }
.cs-occasions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cs-occasions .pill { min-height: 44px; border-radius: 12px; justify-content: flex-start; padding: 0 12px; font-size: 13px; }
.cs-occasions .sw { width: 18px; height: 18px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px oklch(0 0 0 / 0.12); }
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--cx-input-bg); box-shadow: var(--cx-well-shadow); }
.seg .pill { flex: 1; justify-content: center; min-height: 36px; background: transparent; border-radius: 9px; font-family: var(--cx-font-mono); font-variant-numeric: tabular-nums; }
.seg .pill[aria-checked="true"] { background: var(--cx-surface-1); color: var(--cx-ink-1); box-shadow: var(--cx-catch), var(--cx-shadow-plate); }
.cs-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cs-check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin-left: 6px; font-size: 13px; color: var(--cx-ink-2); cursor: pointer; }
.cs-check input { width: 18px; height: 18px; accent-color: var(--cx-accent); }
.cs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cs-reset { justify-self: start; }
.cs-frames { margin: 0; }

.cs-actions { display: flex; align-items: center; gap: 8px; padding: 12px; box-shadow: 0 -1px 0 var(--cx-hairline); flex-wrap: wrap; }
.cs-actions .btn { min-height: 44px; text-decoration: none; }
.cs-actions #card-copy { min-width: 168px; }
.cs-sep { flex: 1; }
.card-studio[data-copied="true"] .cs-gmail { background: var(--cx-accent-soft); color: var(--cx-accent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--cx-accent) 45%, transparent); animation: nudge var(--cx-dur-slow) var(--cx-spring-bounce); }
@keyframes nudge { 50% { transform: translateY(-2px); } }

/* Guide section */
.man-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 28px; border-radius: var(--cx-radius-shell); background: var(--cx-surface-1); box-shadow: var(--cx-catch), var(--cx-shadow-plate); }
.man-cards h2 { font-family: var(--cx-font-editorial); font-weight: 600; font-size: 28px; }
.man-cards p { color: var(--cx-ink-2); margin: 0 0 14px; }
.man-list { margin: 0 0 18px; padding-left: 18px; display: grid; gap: 6px; color: var(--cx-ink-2); font-size: 13px; }
.man-list strong { color: var(--cx-ink-1); }
.man-cards-art { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.man-cards-art img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 12px; box-shadow: var(--cx-shadow-plate); }
.man-cards-art img:last-child { margin-top: 32px; }

@media (max-width: 980px) {
  .cs-body { grid-template-columns: minmax(0, 1fr) 320px; }
  .man-cards { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .card-studio { width: 100vw; height: 100dvh; max-width: 100vw; margin: 0; }
  .cs-shell { border-radius: 0; }
  .cs-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .cs-env { display: none; }
  .cs-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; align-content: start; padding-bottom: 12px; }
  .cs-stage { grid-template-rows: auto auto; }
  .cs-well { height: 54svh; padding: 14px; }
  .cs-controls { overflow: visible; padding: 0 2px; }
  .cs-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--cx-glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .cs-actions #card-copy, .cs-actions .cs-gmail { grid-column: span 2; min-width: 0; }
  .cs-actions .btn.ghost .lbl, #card-share .lbl { display: none; }
  .cs-actions .btn { min-width: 0; padding: 0 10px; }
  .cs-actions .btn .lbl { overflow: hidden; text-overflow: ellipsis; }
  .cs-sep { display: none; }
  .cs-two { grid-template-columns: 1fr; }
  .card-cta .lbl { display: none; }
  .card-cta { width: 44px; padding: 0; }
  .man-cards { padding: 18px; }
}
html[data-cx-embed] #btn-card, html[data-cx-embed] #btn-theme { display: none; }
@media (max-width: 400px) { #btn-theme { display: none; } }
