:root {
  --ystp-blue: #153f8f;
  --ystp-blue-2: #0f2f73;
  --ystp-gold: #c69b45;
  --ystp-dark: #101827;
  --ystp-muted: #64748b;
  --ystp-line: #d9e2ef;
  --ystp-soft: #f8fafc;
  --ystp-card: #ffffff;
  --ystp-radius: 22px;
  --ystp-shadow: 0 18px 50px rgba(15, 23, 42, .10);
}

.ystp-tool-wrap,
.ystp-tool-wrap * {
  box-sizing: border-box;
}

.ystp-tool-wrap {
  width: 100%;
  max-width: 1180px;
  margin: 18px auto 28px;
  padding: 0 14px;
  color: var(--ystp-dark);
  font-family: inherit;
  overflow-x: clip;
}

.ystp-tool-card {
  width: 100%;
  background:
    radial-gradient(circle at 8% 0%, rgba(198, 155, 69, .16), transparent 27%),
    radial-gradient(circle at 100% 10%, rgba(21, 63, 143, .12), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid rgba(148, 163, 184, .30);
  border-radius: var(--ystp-radius);
  box-shadow: var(--ystp-shadow);
  padding: 18px;
  overflow: hidden;
  position: relative;
}

.ystp-tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(120deg, rgba(255,255,255,.55), transparent 22%, transparent 78%, rgba(255,255,255,.45));
}

.ystp-tool-card > * {
  position: relative;
}

.ystp-tool-head {
  max-width: 940px;
  margin-bottom: 14px;
}

.ystp-kicker {
  margin: 0 0 4px;
  color: var(--ystp-blue);
  font-weight: 800;
  letter-spacing: .02em;
  font-size: 13px;
}

.ystp-tool-head h2,
.ystp-style-modal__head h3 {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -.03em;
}

.ystp-tool-intro {
  margin: 8px 0 0;
  color: var(--ystp-muted);
  font-size: 15px;
  line-height: 1.55;
}

.ystp-workspace {
  display: grid;
  grid-template-columns: minmax(250px, .74fr) minmax(360px, 1.26fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

.ystp-control-stack,
.ystp-preview-panel,
.ystp-name-control {
  background: rgba(255, 255, 255, .86);
  border: 1px solid var(--ystp-line);
  border-radius: 18px;
  padding: 14px;
  min-width: 0;
  backdrop-filter: blur(12px);
}

.ystp-control-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ystp-name-control {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  backdrop-filter: none;
}

.ystp-name-control label,
.ystp-control-stack label,
.ystp-selected-label {
  display: block;
  color: #334155;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 8px;
}

.ystp-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.ystp-input-row input,
.ystp-mini-controls select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  background: #fff;
  color: var(--ystp-dark);
  min-height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  outline: none;
}

.ystp-input-row input:focus,
.ystp-mini-controls select:focus {
  border-color: var(--ystp-blue);
  box-shadow: 0 0 0 3px rgba(21, 63, 143, .12);
}

.ystp-mini-controls {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.ystp-mini-controls label {
  margin: 0;
}

.ystp-preview-panel {
  min-height: 232px;
}

.ystp-selected-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ystp-selected-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.ystp-selected-label {
  margin-bottom: 2px;
  color: var(--ystp-muted);
  font-size: 12px;
}

.ystp-style-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff7e6;
  color: #8a5a00;
  border: 1px solid rgba(198, 155, 69, .30);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

#ystp-main-canvas {
  width: 100%;
  height: min(222px, 26vw);
  min-height: 150px;
  display: block;
  border-radius: 16px;
  background:
    linear-gradient(0deg, rgba(15, 23, 42, .025), rgba(15, 23, 42, .025)),
    #fff;
  border: 1px dashed rgba(100, 116, 139, .22);
  touch-action: manipulation;
}

.ystp-btn {
  appearance: none;
  border: 0;
  border-radius: 13px;
  min-height: 44px;
  padding: 10px 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  white-space: nowrap;
  max-width: 100%;
}

.ystp-btn:hover {
  transform: translateY(-1px);
}

.ystp-btn:active {
  transform: translateY(0);
}

.ystp-btn-primary {
  background: linear-gradient(135deg, var(--ystp-blue), var(--ystp-blue-2));
  color: #fff;
  box-shadow: 0 10px 20px rgba(21, 63, 143, .20);
}

.ystp-btn-secondary {
  color: var(--ystp-dark);
  background: #eaf1fb;
}

.ystp-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.ystp-all-styles-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ystp-blue);
  font-weight: 900;
  padding: 10px 0 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ystp-all-styles-link::after {
  content: "→";
}

.ystp-category-row,
.ystp-modal-category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 4px;
}

.ystp-category-pill {
  appearance: none;
  border: 1px solid var(--ystp-line);
  background: #fff;
  color: #334155;
  border-radius: 999px;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.ystp-category-pill[aria-pressed="true"] {
  border-color: rgba(21, 63, 143, .32);
  background: #eff6ff;
  color: var(--ystp-blue);
}

.ystp-style-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  overflow-x: auto;
  overflow-y: hidden;
  gap: 10px;
  padding: 10px 2px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.ystp-style-option {
  background: #fff;
  border: 1px solid var(--ystp-line);
  border-radius: 16px;
  padding: 8px;
  scroll-snap-align: start;
  cursor: pointer;
  min-height: 102px;
  text-align: left;
  min-width: 0;
}

.ystp-style-option[aria-selected="true"] {
  border-color: var(--ystp-blue);
  box-shadow: 0 0 0 3px rgba(21, 63, 143, .10);
}

.ystp-style-option canvas {
  width: 100%;
  height: 60px;
  display: block;
}

.ystp-style-option span {
  display: block;
  font-size: 12px;
  font-weight: 900;
  color: #475569;
  padding: 4px 2px 0;
}

.ystp-style-option small {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ystp-muted);
  padding: 1px 2px 0;
}

.ystp-trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ystp-trust-row span {
  background: #eff6ff;
  color: #1e3a8a;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.ystp-style-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
}

.ystp-style-modal.is-open {
  display: block;
}

.ystp-style-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .56);
}

.ystp-style-modal__sheet {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(940px, calc(100vw - 24px));
  max-height: min(84vh, 740px);
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(2, 6, 23, .30);
  border: 1px solid rgba(255,255,255,.55);
  padding: 16px;
}

.ystp-style-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 4px;
}

.ystp-style-modal__head h3 {
  font-size: clamp(21px, 4vw, 30px);
}

.ystp-icon-btn {
  appearance: none;
  border: 0;
  background: #f1f5f9;
  color: var(--ystp-dark);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.ystp-modal-style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

body.ystp-modal-open {
  overflow: hidden;
}

@media (max-width: 782px) {
  .ystp-tool-wrap {
    margin: 6px auto 18px;
    padding: 0 8px;
  }

  .ystp-tool-card {
    padding: 10px;
    border-radius: 16px;
  }

  .ystp-kicker {
    font-size: 11px;
    margin-bottom: 3px;
  }

  .ystp-tool-head {
    margin-bottom: 8px;
  }

  .ystp-tool-head h2 {
    font-size: clamp(20px, 6vw, 25px);
    line-height: 1.12;
  }

  .ystp-tool-intro {
    margin-top: 5px;
    font-size: 12.5px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .ystp-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .ystp-control-stack {
    display: contents;
  }

  .ystp-name-control,
  .ystp-preview-panel,
  .ystp-mini-controls {
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--ystp-line);
    border-radius: 14px;
    padding: 9px;
    min-width: 0;
  }

  .ystp-name-control {
    order: 1;
  }

  .ystp-preview-panel {
    order: 2;
    min-height: 0;
  }

  .ystp-mini-controls {
    order: 3;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin: 0;
  }

  .ystp-mini-controls label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .ystp-name-control label,
  .ystp-selected-label {
    font-size: 12px;
    margin-bottom: 5px;
  }

  .ystp-input-row {
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 6px;
  }

  .ystp-input-row input,
  .ystp-mini-controls select {
    min-height: 40px;
    font-size: 14px;
    padding: 8px 9px;
    border-radius: 11px;
  }

  .ystp-selected-row {
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }

  .ystp-selected-row strong {
    font-size: 13px;
  }

  .ystp-style-badge {
    min-height: 24px;
    padding: 4px 8px;
    font-size: 10.5px;
  }

  #ystp-main-canvas {
    height: clamp(112px, 31vw, 138px);
    min-height: 112px;
    border-radius: 12px;
  }

  .ystp-action-row {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 7px;
  }

  .ystp-btn {
    min-height: 40px;
    padding: 8px 8px;
    font-size: 12.5px;
    border-radius: 11px;
    white-space: normal;
  }

  .ystp-all-styles-link {
    padding-top: 7px;
    font-size: 12px;
  }

  .ystp-category-row,
  .ystp-style-strip {
    display: none;
  }

  .ystp-trust-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-top: 8px;
  }

  .ystp-trust-row span {
    text-align: center;
    font-size: 10.5px;
    padding: 5px 6px;
  }

  .ystp-style-modal__sheet {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100vw;
    max-height: 82vh;
    border-radius: 20px 20px 0 0;
    padding: 12px;
  }

  .ystp-modal-style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ystp-modal-category-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
  }

  .ystp-modal-category-row .ystp-category-pill {
    flex: 0 0 auto;
  }
}

@media (max-width: 430px) {
  .ystp-tool-wrap {
    padding: 0 6px;
  }

  .ystp-tool-card {
    padding: 8px;
  }

  .ystp-tool-head h2 {
    font-size: 20px;
  }

  .ystp-input-row {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .ystp-name-control,
  .ystp-preview-panel,
  .ystp-mini-controls {
    padding: 8px;
  }

  #ystp-main-canvas {
    height: 106px;
    min-height: 106px;
  }

  .ystp-action-row {
    grid-template-columns: 1fr 1fr;
  }

  .ystp-btn {
    font-size: 12px;
  }

  .ystp-tool-intro {
    display: none;
  }
}

@media (max-width: 360px) {
  .ystp-tool-head h2 {
    font-size: 19px;
  }

  .ystp-input-row {
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .ystp-btn {
    font-size: 11.2px;
  }

  .ystp-mini-controls {
    grid-template-columns: 1fr;
  }

  .ystp-trust-row {
    display: none;
  }

  .ystp-modal-style-grid {
    grid-template-columns: 1fr;
  }
}

/* Signature Cleaner & Transparent Signature PNG Maker */
.ystp-cleaner-card {
  background:
    radial-gradient(circle at 8% 0%, rgba(21, 63, 143, .14), transparent 26%),
    radial-gradient(circle at 100% 8%, rgba(14, 165, 233, .12), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.ystp-cleaner-mobile-note {
  display: none;
  color: var(--ystp-blue);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  margin: 4px 0 8px;
}

.ystp-cleaner-workspace {
  display: grid;
  grid-template-columns: minmax(250px, .72fr) minmax(360px, 1.28fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.ystp-cleaner-upload-card,
.ystp-cleaner-preview-card,
.ystp-cleaner-advanced {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--ystp-line);
  border-radius: 18px;
  padding: 14px;
  min-width: 0;
  backdrop-filter: blur(12px);
}

.ystp-cleaner-upload-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ystp-cleaner-dropzone {
  min-height: 180px;
  border: 2px dashed rgba(21, 63, 143, .28);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(234,241,251,.58));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease, background .18s ease;
  position: relative;
}

.ystp-cleaner-dropzone:hover,
.ystp-cleaner-dropzone.ystp-is-dragover {
  border-color: var(--ystp-blue);
  box-shadow: 0 12px 28px rgba(21, 63, 143, .13);
  transform: translateY(-1px);
}

.ystp-cleaner-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ystp-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ystp-blue), var(--ystp-blue-2));
  color: #fff;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
  box-shadow: 0 12px 24px rgba(21, 63, 143, .20);
}

.ystp-cleaner-dropzone strong {
  display: block;
  color: var(--ystp-dark);
  font-size: 17px;
  line-height: 1.2;
}

.ystp-cleaner-dropzone em {
  display: block;
  margin-top: 6px;
  color: var(--ystp-muted);
  font-style: normal;
  font-size: 12px;
  line-height: 1.35;
}

.ystp-cleaner-quick-actions,
.ystp-cleaner-actions-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.ystp-cleaner-canvas-frame {
  width: 100%;
  border-radius: 16px;
  border: 1px dashed rgba(100, 116, 139, .24);
  background:
    linear-gradient(45deg, rgba(148,163,184,.10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148,163,184,.10) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148,163,184,.10) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148,163,184,.10) 75%),
    #fff;
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
  overflow: hidden;
}

#ystp-cleaner-canvas {
  display: block;
  width: 100%;
  height: min(245px, 25vw);
  min-height: 172px;
  touch-action: manipulation;
}

.ystp-cleaner-actions-row {
  margin-top: 12px;
}

.ystp-cleaner-advanced {
  margin-top: 12px;
  padding: 0;
  overflow: hidden;
}

.ystp-cleaner-advanced summary {
  min-height: 46px;
  padding: 13px 14px;
  cursor: pointer;
  color: var(--ystp-dark);
  font-weight: 900;
  list-style-position: inside;
}

.ystp-cleaner-controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.ystp-cleaner-controls-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
}

.ystp-cleaner-controls-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: var(--ystp-dark);
  padding: 8px 10px;
  font-size: 14px;
}

.ystp-cleaner-controls-grid .ystp-check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #fff;
}

.ystp-check-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--ystp-blue);
}

.ystp-cleaner-wrap .ystp-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 900px) {
  .ystp-cleaner-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .ystp-cleaner-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .ystp-cleaner-head {
    margin-bottom: 6px;
  }

  .ystp-cleaner-head .ystp-kicker,
  .ystp-cleaner-head .ystp-tool-intro {
    display: none;
  }

  .ystp-cleaner-head h2 {
    text-align: center;
    font-size: clamp(19px, 5.4vw, 24px);
  }

  .ystp-cleaner-mobile-note {
    display: block;
  }

  .ystp-cleaner-upload-card,
  .ystp-cleaner-preview-card {
    padding: 8px;
    border-radius: 14px;
  }

  .ystp-cleaner-dropzone {
    min-height: 78px;
    padding: 9px;
    flex-direction: row;
    gap: 10px;
    justify-content: flex-start;
    text-align: left;
  }

  .ystp-upload-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    font-size: 23px;
    margin: 0;
  }

  .ystp-cleaner-dropzone strong {
    font-size: 14px;
  }

  .ystp-cleaner-dropzone em {
    font-size: 11px;
    margin-top: 3px;
  }

  .ystp-cleaner-quick-actions,
  .ystp-cleaner-actions-row {
    gap: 7px;
  }

  #ystp-cleaner-canvas {
    height: clamp(118px, 31vw, 150px);
    min-height: 118px;
  }

  .ystp-cleaner-status-row {
    margin-bottom: 5px;
  }

  .ystp-cleaner-advanced summary {
    min-height: 38px;
    padding: 10px;
    font-size: 13px;
  }

  .ystp-cleaner-controls-grid {
    padding: 0 10px 10px;
    gap: 7px;
  }

  .ystp-cleaner-controls-grid select {
    min-height: 38px;
    font-size: 12.5px;
    padding: 7px;
  }

  .ystp-cleaner-controls-grid label span {
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  .ystp-cleaner-wrap {
    margin-top: 8px;
  }

  .ystp-cleaner-card {
    padding: 7px;
  }

  .ystp-cleaner-dropzone {
    min-height: 70px;
  }

  #ystp-cleaner-canvas {
    height: 112px;
    min-height: 112px;
  }

  .ystp-cleaner-controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ystp-cleaner-controls-grid .ystp-check-label {
    min-height: 36px;
    padding: 7px;
  }
}

@media (max-width: 360px) {
  .ystp-cleaner-head h2 {
    font-size: 18px;
  }

  .ystp-cleaner-mobile-note {
    display: none;
  }

  .ystp-cleaner-controls-grid {
    grid-template-columns: 1fr;
  }
}

/* Draw Signature Online */
.ystp-draw-card {
  background:
    radial-gradient(circle at 8% 0%, rgba(21, 63, 143, .14), transparent 28%),
    radial-gradient(circle at 100% 12%, rgba(198, 155, 69, .14), transparent 31%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.ystp-draw-mobile-note {
  display: none;
  color: var(--ystp-blue);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  margin: 4px 0 8px;
}

.ystp-draw-workspace {
  display: grid;
  grid-template-columns: minmax(430px, 1.28fr) minmax(250px, .72fr);
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.ystp-draw-pad-card,
.ystp-draw-controls-card {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--ystp-line);
  border-radius: 18px;
  padding: 14px;
  min-width: 0;
  backdrop-filter: blur(12px);
}

.ystp-draw-canvas-frame {
  width: 100%;
  border-radius: 16px;
  border: 1px dashed rgba(100, 116, 139, .24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(248,250,252,.88)),
    linear-gradient(45deg, rgba(148,163,184,.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148,163,184,.08) 25%, transparent 25%),
    #fff;
  overflow: hidden;
}

#ystp-draw-canvas {
  display: block;
  width: 100%;
  height: min(250px, 25vw);
  min-height: 176px;
  touch-action: none;
  cursor: crosshair;
}

.ystp-draw-action-grid {
  display: grid;
  grid-template-columns: .72fr .72fr .72fr 1.34fr;
  gap: 9px;
  margin-top: 12px;
}

.ystp-draw-action-grid .ystp-btn:disabled,
.ystp-cleaner-quick-actions .ystp-btn:disabled,
.ystp-cleaner-actions-row .ystp-btn:disabled {
  opacity: .48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ystp-draw-controls-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ystp-draw-quick-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.ystp-draw-quick-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  font-weight: 900;
}

.ystp-draw-quick-controls select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: var(--ystp-dark);
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
}

.ystp-draw-quick-controls select:focus {
  border-color: var(--ystp-blue);
  box-shadow: 0 0 0 3px rgba(21, 63, 143, .12);
}

.ystp-draw-advanced {
  border: 1px solid var(--ystp-line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(248,250,252,.78);
}

.ystp-draw-advanced summary {
  min-height: 42px;
  padding: 12px;
  cursor: pointer;
  font-weight: 900;
  color: var(--ystp-dark);
  list-style-position: inside;
}

.ystp-draw-advanced-grid {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.ystp-draw-privacy-box {
  display: grid;
  gap: 4px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.35;
}

.ystp-draw-privacy-box strong {
  font-size: 13px;
}

.ystp-draw-trust {
  margin-top: 12px;
}

@media (max-width: 782px) {
  .ystp-draw-head h2 {
    text-align: center;
    font-size: clamp(20px, 5.7vw, 25px);
  }

  .ystp-draw-mobile-note {
    display: block;
  }

  .ystp-draw-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ystp-draw-pad-card,
  .ystp-draw-controls-card {
    padding: 8px;
    border-radius: 14px;
  }

  .ystp-draw-status-row {
    margin-bottom: 5px;
  }

  #ystp-draw-canvas {
    height: clamp(130px, 34vw, 156px);
    min-height: 130px;
  }

  .ystp-draw-action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 7px;
  }

  .ystp-draw-action-grid #ystp-draw-download {
    grid-column: 1 / -1;
    order: -1;
  }

  .ystp-draw-controls-card {
    gap: 8px;
  }

  .ystp-draw-quick-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .ystp-draw-quick-controls label span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .ystp-draw-quick-controls select {
    min-height: 38px;
    font-size: 12px;
    padding: 7px;
    border-radius: 10px;
  }

  .ystp-draw-advanced summary {
    min-height: 36px;
    padding: 9px;
    font-size: 12.5px;
  }

  .ystp-draw-advanced-grid {
    padding: 0 9px 9px;
    gap: 6px;
  }

  .ystp-draw-privacy-box {
    display: none;
  }
}

@media (max-width: 430px) {
  .ystp-draw-card {
    padding: 7px;
  }

  #ystp-draw-canvas {
    height: 124px;
    min-height: 124px;
  }

  .ystp-draw-action-grid {
    gap: 5px;
  }

  .ystp-draw-quick-controls {
    grid-template-columns: 1fr 1fr;
  }

  .ystp-draw-quick-controls label:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .ystp-draw-mobile-note {
    display: none;
  }

  #ystp-draw-canvas {
    height: 112px;
    min-height: 112px;
  }

  .ystp-draw-quick-controls {
    grid-template-columns: 1fr;
  }
}


/* Signature Practice Sheet Generator */
.ystp-practice-wrap .ystp-tool-card {
    overflow: hidden;
}

.ystp-practice-mobile-note {
    display: none;
    margin: -6px 0 14px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.ystp-practice-workspace {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
    gap: 18px;
    align-items: start;
}

.ystp-practice-controls-card,
.ystp-practice-preview-card {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    padding: 18px;
}

.ystp-practice-name-control label,
.ystp-practice-quick-controls label,
.ystp-practice-advanced-grid label {
    display: grid;
    gap: 6px;
    font-weight: 700;
    color: #0f172a;
    font-size: 13px;
}

.ystp-practice-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.ystp-practice-input-row input,
.ystp-practice-quick-controls select,
.ystp-practice-advanced-grid select {
    width: 100%;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 14px;
    background: #fff;
    min-height: 44px;
    padding: 10px 12px;
    color: #0f172a;
    font: inherit;
}

.ystp-practice-quick-controls,
.ystp-practice-advanced-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.ystp-practice-advanced {
    margin-top: 14px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    padding: 10px 12px;
}

.ystp-practice-advanced summary {
    cursor: pointer;
    font-weight: 800;
    color: #153f8f;
}

.ystp-practice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.ystp-practice-privacy-box {
    display: grid;
    gap: 3px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(21, 63, 143, 0.08);
    color: #334155;
    font-size: 13px;
}

.ystp-practice-privacy-box strong {
    color: #153f8f;
}

.ystp-practice-canvas-shell {
    width: 100%;
    max-height: 550px;
    overflow: auto;
    border-radius: 18px;
    background: #eef4ff;
    border: 1px solid rgba(15, 23, 42, 0.10);
    padding: 12px;
}

#ystp-practice-canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

@media (max-width: 760px) {
    .ystp-practice-mobile-note {
        display: block;
    }

    .ystp-practice-workspace {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ystp-practice-controls-card {
        padding: 12px;
        border-radius: 18px;
        order: 1;
    }

    .ystp-practice-preview-card {
        padding: 12px;
        border-radius: 18px;
        order: 2;
    }

    .ystp-practice-input-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ystp-practice-quick-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .ystp-practice-quick-controls label:nth-child(1) {
        grid-column: 1 / -1;
    }

    .ystp-practice-advanced-grid {
        grid-template-columns: 1fr;
    }

    .ystp-practice-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .ystp-practice-actions .ystp-btn {
        min-height: 42px;
        padding: 10px 8px;
    }

    .ystp-practice-privacy-box,
    .ystp-practice-trust {
        display: none;
    }

    .ystp-practice-canvas-shell {
        max-height: 360px;
        padding: 8px;
    }

    .ystp-practice-head .ystp-tool-intro {
        display: none;
    }
}

@media (max-width: 430px) {
    .ystp-practice-quick-controls {
        grid-template-columns: 1fr 1fr;
    }

    .ystp-practice-quick-controls label span,
    .ystp-practice-advanced summary {
        font-size: 12px;
    }
}

/* Initials Signature Generator */
.ystp-initials-card {
    overflow: hidden;
}

.ystp-initials-mobile-note {
    display: none;
    margin: -4px 0 12px;
    padding: 8px 10px;
    border-radius: 999px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #153f8f;
    background: rgba(21, 63, 143, 0.08);
}

.ystp-initials-workspace {
    display: grid;
    grid-template-columns: minmax(260px, 0.88fr) minmax(320px, 1.12fr);
    gap: 18px;
    align-items: stretch;
}

.ystp-initials-control-card,
.ystp-initials-preview-card {
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 16px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.ystp-initials-name-control label,
.ystp-initials-quick-controls span {
    display: block;
    font-weight: 800;
    color: #172033;
    margin-bottom: 6px;
}

.ystp-small-help {
    margin: 7px 0 0;
    font-size: 12px;
    color: #64748b;
}

.ystp-initials-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.ystp-initials-input-row input {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
}

.ystp-initials-mobile-actions {
    display: none;
}

.ystp-initials-quick-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.ystp-initials-quick-controls select {
    width: 100%;
}

.ystp-initials-advanced {
    margin-top: 14px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 16px;
    padding: 10px 12px;
    background: #fff;
}

.ystp-initials-advanced summary {
    cursor: pointer;
    font-weight: 800;
    color: #153f8f;
}

.ystp-initials-advanced-grid {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.ystp-initials-open-styles {
    margin-top: 12px;
}

.ystp-initials-privacy-box {
    display: grid;
    gap: 3px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(21, 63, 143, 0.08);
    color: #334155;
    font-size: 13px;
}

.ystp-initials-privacy-box strong {
    color: #153f8f;
}

#ystp-initials-canvas {
    display: block;
    width: 100%;
    height: auto;
    min-height: 230px;
    border-radius: 18px;
    background-image: radial-gradient(circle at 20% 20%, rgba(21, 63, 143, 0.05), transparent 34%), linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 16px 32px rgba(15, 23, 42, 0.08);
}

.ystp-initials-category-row,
.ystp-initials-style-strip {
    margin-top: 14px;
}

.ystp-initials-style-strip .ystp-style-preview,
.ystp-initials-modal .ystp-style-preview {
    display: block;
    font-size: 34px;
    line-height: 1;
    color: #153f8f;
    min-height: 36px;
}

.ystp-initials-modal .ystp-style-modal__sheet {
    max-width: 740px;
}

@media (max-width: 760px) {
    .ystp-initials-mobile-note {
        display: block;
    }

    .ystp-initials-head .ystp-tool-intro {
        display: none;
    }

    .ystp-initials-workspace {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ystp-initials-preview-card {
        order: 1;
        padding: 12px;
        border-radius: 18px;
    }

    .ystp-initials-control-card {
        order: 2;
        padding: 12px;
        border-radius: 18px;
    }

    .ystp-initials-input-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ystp-initials-input-row .ystp-btn,
    .ystp-initials-action-row {
        display: none;
    }

    .ystp-initials-mobile-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .ystp-initials-mobile-actions .ystp-btn {
        min-height: 42px;
        padding: 10px 8px;
    }

    .ystp-initials-quick-controls {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .ystp-initials-quick-controls span {
        font-size: 12px;
        margin-bottom: 4px;
    }

    #ystp-initials-canvas {
        min-height: 190px;
    }

    .ystp-initials-category-row,
    .ystp-initials-style-strip,
    .ystp-initials-privacy-box,
    .ystp-initials-trust {
        display: none;
    }

    .ystp-initials-advanced {
        margin-top: 10px;
        padding: 9px 10px;
    }
}

@media (max-width: 430px) {
    .ystp-initials-mobile-actions,
    .ystp-initials-quick-controls {
        grid-template-columns: 1fr 1fr;
    }

    .ystp-initials-control-card,
    .ystp-initials-preview-card {
        padding: 10px;
    }

    #ystp-initials-canvas {
        min-height: 170px;
    }
}
