/* Stamp Studio — warm paper, crisp ink, touch-first controls. */
#kd-studio {
  --kd-ink:#302524; --kd-muted:#756862; --kd-brand:#9e2535;
  --kd-border:#e8ddd5; --kd-paper:#faf7f2; --kd-wash:#f3ebe4;
  max-width:1180px; margin:auto; padding:42px 24px 80px;
  color:var(--kd-ink); font-family:"KD UI Sans",Arial,sans-serif; line-height:1.6;
}
#kd-studio *,#kd-studio *::before,#kd-studio *::after {box-sizing:border-box}
#kd-studio [hidden] {display:none!important}
#kd-studio .kd-heading {max-width:760px;margin:0 0 30px}
#kd-studio .kd-eyebrow {font-size:11px;letter-spacing:1.8px;font-weight:800;color:var(--kd-brand)}
#kd-studio h1 {font:400 clamp(30px,3.8vw,46px)/1.2 "KD UI Serif",Georgia,"Times New Roman",serif;letter-spacing:-1.3px;margin:12px 0 14px;color:var(--kd-ink);text-wrap:balance}
#kd-studio h1 em {font-style:normal;color:var(--kd-brand)}
#kd-studio .kd-heading p {max-width:590px;margin:0;color:var(--kd-muted);font-size:15px;line-height:1.7}
#kd-studio .kd-layout {display:grid;grid-template-columns:1fr 1fr;gap:42px;align-items:start}
#kd-studio form {margin:0;min-width:0}
#kd-studio fieldset {min-width:0;margin:0 0 26px;padding:0 0 26px;border:0;border-bottom:1px solid var(--kd-border)}
#kd-studio legend {border:0;padding:0;margin:0 0 15px;color:var(--kd-ink);font-size:16px;font-weight:800;text-transform:none;letter-spacing:0}
#kd-studio legend>span {display:inline-flex;align-items:center;justify-content:center;width:25px;height:25px;margin-right:8px;border:1px solid #dcc9c0;border-radius:50%;color:var(--kd-brand);font-size:10px;font-weight:700}
#kd-studio .kd-templates {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#kd-studio button {min-height:46px;margin:0;font:inherit;letter-spacing:0;text-transform:none;white-space:normal;cursor:pointer;box-shadow:none;border-radius:9px;touch-action:manipulation;transition:background .18s,border-color .18s,color .18s}
#kd-studio .kd-template {position:relative;display:grid;grid-template-columns:44px 1fr;grid-template-rows:auto auto;align-items:center;gap:0 8px;padding:14px 12px;text-align:left;line-height:1.4;color:var(--kd-ink);background:#fff;border:1px solid var(--kd-border)}
#kd-studio .kd-template strong {font-size:13px;font-weight:800}
#kd-studio .kd-template small {grid-column:2;margin-top:3px;font-size:11px;color:var(--kd-muted)}
#kd-studio .kd-template-shape {grid-row:1/3;position:relative;display:flex;align-items:center;justify-content:center;width:38px;height:23px;border:2px solid #b7a69c;border-radius:3px;font-size:0;color:var(--kd-brand)}
#kd-studio .kd-template-shape::after {content:"";width:21px;height:9px;border-top:2px solid currentColor;border-bottom:2px solid currentColor;opacity:.7}
#kd-studio .kd-template-shape.is-round {width:32px;height:32px;border-radius:50%;margin:auto}
#kd-studio .kd-template-shape.is-round::after {width:20px;height:20px;border:1px solid currentColor;border-radius:50%}
#kd-studio .kd-template:hover {border-color:#ba8c8b;background:#fdf9f6}
#kd-studio .kd-template.is-selected {background:#fbf1ee;border-color:var(--kd-brand);box-shadow:inset 0 0 0 1px var(--kd-brand)}
#kd-studio .kd-template.is-selected .kd-template-shape {border-color:var(--kd-brand)}
#kd-studio .kd-fields {display:grid;gap:14px}
#kd-studio label {display:block;margin:0;color:var(--kd-ink);font-size:13px;font-weight:700;line-height:1.5}
#kd-studio input:not([type=radio]),#kd-studio #kd-font {display:block;width:100%;height:49px;margin:7px 0 0;padding:11px 13px;border:1px solid #d9cbc2;border-radius:8px;background:#fff;color:var(--kd-ink);font:400 16px/1.4 "KD UI Sans",Arial,sans-serif;box-shadow:none}
#kd-studio input::placeholder {color:#988980;font-size:15px}
#kd-studio input:focus,#kd-studio select:focus {outline:3px solid #9e25351b;outline-offset:1px;border-color:var(--kd-brand)}
#kd-studio p.kd-help {margin:11px 0 0;color:var(--kd-muted);font-size:12px;line-height:1.65}
#kd-studio .kd-font-label {margin-bottom:7px}
#kd-studio .kd-font-help {margin-bottom:17px}
#kd-studio .kd-colors {display:flex;gap:10px;flex-wrap:wrap}
#kd-studio .kd-colors label {display:flex;align-items:center;gap:8px;min-height:44px;padding:8px 14px;border:1px solid var(--kd-border);border-radius:7px;background:#fff;font-size:13px;font-weight:400;cursor:pointer}
#kd-studio .kd-colors label:has(input:checked) {border-color:var(--kd-brand);background:#fbf2ee}
#kd-studio .kd-colors input {margin:0;accent-color:var(--kd-brand)}
#kd-studio .kd-colors span {width:13px;height:13px;border-radius:50%;background:var(--kd-swatch)}
#kd-studio .kd-contact {border:0;padding-bottom:0;margin-bottom:22px}
#kd-studio .kd-contact label+label {margin-top:14px}
#kd-studio .kd-trap {position:absolute!important;left:-10000px;width:1px;height:1px;overflow:hidden}
#kd-studio .kd-submit {width:100%;padding:14px 20px;border:1px solid var(--kd-brand);background:var(--kd-brand);color:#fff;font-size:15px;font-weight:800;box-shadow:0 5px 14px #6e17261a}
#kd-studio .kd-submit:hover {background:#7d192a}
#kd-studio button:disabled {opacity:.55;cursor:wait}
#kd-studio button:focus-visible,#kd-studio a:focus-visible,#kd-studio summary:focus-visible {outline:3px solid #9e253580;outline-offset:3px}
#kd-studio p.kd-status {min-height:20px;margin:12px 0 0;color:var(--kd-brand);font-size:13px;line-height:1.65}
#kd-studio .kd-preview-panel {position:sticky;top:24px;overflow:hidden;padding:22px;border:1px solid var(--kd-border);border-radius:14px;background:var(--kd-paper)}
#kd-studio .kd-preview-top {display:flex;justify-content:space-between;gap:10px;align-items:center;color:var(--kd-muted);font-size:10px;font-weight:700;letter-spacing:1px}
#kd-studio .kd-live {color:#416e51;font-size:11px;font-weight:400;letter-spacing:0;white-space:nowrap}
#kd-studio .kd-preview-canvas {display:flex;align-items:center;justify-content:center;height:280px;margin:18px 0 13px;padding:25px;border:1px solid #e6ddd5;border-radius:7px;background:#fff;box-shadow:0 3px 0 #eee7df}
#kd-studio .kd-preview-art {display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:13px;color:var(--kd-muted)}
#kd-studio .kd-preview-art svg {display:block;width:100%;height:auto;max-width:100%;max-height:100%}
#kd-studio .kd-preview-art svg[width="40mm"] {max-width:210px}
#kd-studio .kd-dimension {text-align:center;color:var(--kd-ink);font-size:12px;font-weight:800;letter-spacing:.5px;font-variant-numeric:tabular-nums}
#kd-studio p.kd-preview-note {max-width:290px;margin:7px auto 20px;text-align:center;color:var(--kd-muted);font-size:11px;line-height:1.6}
#kd-studio .kd-saved {margin:18px 0;padding:18px;border:1px solid #ceb8a5;border-radius:8px;background:#fff}
#kd-studio .kd-saved>span {display:block;color:var(--kd-muted);font-size:10px;letter-spacing:1px}
#kd-studio .kd-code {display:block;margin:8px 0;color:var(--kd-brand);font:700 clamp(18px,2.4vw,24px)/1.4 monospace;overflow-wrap:anywhere}
#kd-studio .kd-saved p {margin:0 0 14px;color:var(--kd-muted);font-size:12px;line-height:1.6}
#kd-studio .kd-actions {display:grid;grid-template-columns:1fr 1fr;gap:8px}
#kd-studio .kd-actions button,#kd-studio .kd-actions a {display:flex;align-items:center;justify-content:center;min-height:44px;padding:10px 8px;border:1px solid #dcc5c1;border-radius:7px;background:#fff;color:var(--kd-brand);font-size:12px;line-height:1.4;text-align:center;text-decoration:none}
#kd-studio .kd-actions .kd-download {border-color:var(--kd-brand);background:var(--kd-brand);color:#fff}
#kd-studio .kd-actions a {grid-column:1/-1;border-color:var(--kd-border);background:var(--kd-paper);color:var(--kd-ink)}
#kd-studio .kd-steps {padding-top:17px;border-top:1px solid var(--kd-border);font-size:12px}
#kd-studio .kd-steps b {font-size:13px}
#kd-studio .kd-steps p {margin:7px 0;color:var(--kd-muted);font-size:12px;line-height:1.65}
#kd-studio .kd-steps small {color:var(--kd-muted);font-size:10px}
/* Font library can be rendered by the enhanced picker without changing the editor. */
#kd-studio .kd-font-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0;max-height:260px;overflow:auto;padding:2px}
#kd-studio .kd-font-option {min-width:0;text-align:left;padding:10px 12px;border:1px solid var(--kd-border);background:#fff;color:var(--kd-ink);overflow:hidden}
#kd-studio .kd-font-option[aria-pressed=true],#kd-studio .kd-font-option.is-selected {border-color:var(--kd-brand);background:#fbf1ee}
#kd-studio .kd-font-option small {display:block;color:var(--kd-muted);font:11px/1.5 "KD UI Sans",Arial,sans-serif}
@media(max-width:800px) {
  #kd-studio {padding:23px 16px 110px}
  #kd-studio .kd-heading {margin-bottom:19px}
  #kd-studio h1 {margin:9px 0 10px;font-size:30px;letter-spacing:-.9px;line-height:1.16}
  #kd-studio h1 br {display:none}
  #kd-studio h1 em::before {content:" "}
  #kd-studio .kd-eyebrow {font-size:10px;letter-spacing:1.5px}
  #kd-studio .kd-heading p {font-size:13px;line-height:1.6;max-width:38ch}
  #kd-studio .kd-layout {display:flex;flex-direction:column;gap:22px;position:relative;isolation:isolate}
  #kd-studio .kd-editor {width:100%}
  #kd-studio .kd-preview-panel {order:-1;width:100%;flex-shrink:0;position:sticky;top:0;z-index:12;padding:10px 12px 8px;border-radius:10px;box-shadow:0 5px 14px #4e322513}
  #kd-studio .kd-preview-top {font-size:9px;letter-spacing:.8px}
  #kd-studio .kd-live {font-size:10px}
  #kd-studio .kd-preview-canvas {height:103px;margin:7px 0 6px;padding:12px 20px;border-radius:4px;box-shadow:none}
  #kd-studio .kd-preview-art svg[width="40mm"] {max-width:90px}
  #kd-studio .kd-dimension {font-size:10px}
  #kd-studio p.kd-preview-note {margin:2px 0 0;max-width:none;font-size:9px;line-height:1.35}
  #kd-studio .kd-steps {display:none}
  #kd-studio .kd-preview-panel:has(.kd-saved:not([hidden])) {position:static;z-index:auto;padding:15px}
  #kd-studio .kd-preview-panel:has(.kd-saved:not([hidden])) .kd-preview-canvas {height:175px}
  #kd-studio .kd-preview-panel:has(.kd-saved:not([hidden])) .kd-preview-art svg[width="40mm"] {max-width:150px}
  #kd-studio fieldset {margin-bottom:22px;padding-bottom:22px;scroll-margin-top:200px}
  #kd-studio legend {font-size:15px;margin-bottom:12px}
  #kd-studio .kd-template {grid-template-columns:34px 1fr;gap:0 5px;padding:12px 9px;min-height:70px}
  #kd-studio .kd-template strong {font-size:12px}
  #kd-studio .kd-template small {font-size:10px}
  #kd-studio .kd-template-shape {width:29px;height:20px}
  #kd-studio .kd-template-shape::after {width:16px;height:7px}
  #kd-studio .kd-template-shape.is-round {width:27px;height:27px}
  #kd-studio .kd-template-shape.is-round::after {width:17px;height:17px}
  #kd-studio .kd-submit {position:fixed;left:16px;right:16px;bottom:max(12px,env(safe-area-inset-bottom));z-index:30;width:calc(100% - 32px);min-height:50px;border-radius:9px;box-shadow:0 0 0 12px #faf7f2f5,0 -8px 24px #48251a12}
  #kd-studio input:not([type=radio]),#kd-studio #kd-font {font-size:16px;scroll-margin-top:210px}
  #kd-studio .kd-contact {padding-bottom:0}
  #kd-studio .kd-code {font-size:20px}
  #kd-studio .kd-saved {margin-bottom:0}
  #kd-studio .kd-font-grid {max-height:210px}
}
@media(max-width:350px) {
  #kd-studio {padding-left:12px;padding-right:12px}
  #kd-studio h1 {font-size:27px}
  #kd-studio .kd-template {padding:10px 7px;grid-template-columns:28px 1fr}
  #kd-studio .kd-template strong {font-size:11px}
}
@media(prefers-reduced-motion:reduce) {#kd-studio * {transition:none!important;scroll-behavior:auto!important}}
#kd-studio .kd-template-shape.is-oval{width:37px;height:26px;border-radius:50%;border:1.5px solid currentColor;position:relative;font-size:0}#kd-studio .kd-template-shape.is-oval:after{content:'';position:absolute;inset:3px;border:1px solid currentColor;border-radius:50%}
/* Dense curved layouts need enough pixels to inspect their extra text lines. */
@media(max-width:800px) {
  #kd-studio:has(.kd-template[data-template="oval"].is-selected) .kd-preview-canvas {height:170px;padding:12px 18px}
  #kd-studio:has(.kd-template[data-template="round-company"].is-selected) .kd-preview-canvas {height:185px;padding:10px 18px}
  #kd-studio:has(.kd-template[data-template="round-company"].is-selected) .kd-preview-art svg[width="40mm"] {max-width:165px}
}
@media(max-width:800px) {
  #kd-studio:has(.kd-template[data-template="oval"].is-selected) :is(input,select,fieldset),
  #kd-studio:has(.kd-template[data-template="round-company"].is-selected) :is(input,select,fieldset) {scroll-margin-top:285px}
}
/* Native zoom dialog keeps small-format curved text inspectable on a phone. */
#kd-studio .kd-preview-zoom {flex-shrink:0;min-height:32px;padding:4px 9px;border:1px solid #c9aea5;border-radius:5px;background:#fff;color:var(--kd-brand);font-size:11px;font-weight:700;line-height:1.3}
#kd-studio .kd-preview-zoom:hover {background:#f9eee9}
.kd-preview-dialog {width:min(92vw,760px);max-width:none;max-height:92dvh;margin:auto;padding:22px;border:1px solid #e6dcd3;border-radius:14px;background:#faf7f2;color:#332725;box-shadow:0 20px 70px #2d121b40;font-family:"KD UI Sans",Arial,sans-serif}
.kd-preview-dialog::backdrop {background:#29171f9e;backdrop-filter:blur(3px)}
.kd-preview-dialog .kd-preview-close {display:block;min-width:70px;min-height:44px;margin:0 0 14px auto;padding:9px 15px;border:1px solid #cfb9ae;border-radius:7px;background:#fff;color:#731b2b;font:700 13px/1.4 "KD UI Sans",Arial,sans-serif;cursor:pointer}
.kd-preview-dialog .kd-preview-close:focus-visible {outline:3px solid #9e253580;outline-offset:3px}
.kd-preview-dialog-art {display:flex;align-items:center;justify-content:center;min-height:140px;padding:18px;border:1px solid #e8ddd5;border-radius:7px;background:#fff}
.kd-preview-dialog-art svg {display:block;width:100%;height:auto;max-width:100%;max-height:65dvh}
.kd-preview-dialog p,.kd-preview-dialog figcaption {margin:14px 0 0;color:#756862;font-size:12px;line-height:1.6;text-align:center}
@media(max-width:800px) {
  #kd-studio .kd-preview-top {gap:7px}
  #kd-studio .kd-preview-zoom {min-height:30px;padding:4px 7px;font-size:10px}
  .kd-preview-dialog {padding:14px;border-radius:11px}
  .kd-preview-dialog-art {padding:12px}
}
