.stampGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.stampControls {
  min-width: 0;
}
.stampSizeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stampLine {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  margin-top: 9px;
}
.stampLineTop {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  align-items: center;
}
.stampLineTools {
  display: grid;
  grid-template-columns: 1fr 92px 58px;
  gap: 6px;
  margin-top: 7px;
}
.stampLineTools select,
.stampLineTools input {
  min-width: 0;
}
.stampSmallBtn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  color: #655d70;
  font-weight: 800;
}
.stampSmallBtn.active {
  background: #241d2e;
  color: #fff;
}
.stampAdd {
  width: 100%;
  margin-top: 8px;
  border: 1px dashed #cfc6de;
  background: #faf9fc;
  border-radius: 13px;
  padding: 11px;
  color: var(--p);
  font-weight: 850;
}
.stampAuto {
  background: linear-gradient(135deg, #6f3cf4, #9b68ff) !important;
  box-shadow: 0 8px 24px #6f3cf43b;
}
.stampAutoRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  margin-top: 12px;
}
.stampAutoRow .secondary {
  margin: 0;
  white-space: nowrap;
}
.stampStageCard {
  background: #e9e6ed;
  border-radius: 22px;
  padding: 12px;
  min-width: 0;
}
.stampStageHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.stampStageHead span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 750;
}
.stampStageOuter {
  width: 100%;
  min-height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 22px 8px;
  background: #dedbe2;
}
.stampCanvasWrap {
  position: relative;
  box-shadow: 0 10px 28px #20152f35;
  background: #fff;
  touch-action: none;
  user-select: none;
}
.stampCanvasWrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.stampSelected {
  font-size: 11px;
  color: var(--p);
  font-weight: 800;
  min-height: 18px;
  margin-top: 8px;
  text-align: center;
}
.stampLogoTools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
  align-items: center;
}
.stampRangeRow {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 8px;
  align-items: center;
}
.stampRangeRow output {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #62596c;
}
.stampToggleGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 10px;
}
.stampToggle {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #665f70;
}
.stampToggle.active {
  background: #241d2e;
  color: #fff;
  border-color: #241d2e;
}
.stampExportGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.stampStatus {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
  margin-top: 8px;
}
.stampHint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 7px;
}
.stampPresetRow {
  display: flex;
  gap: 6px;
  overflow: auto;
  scrollbar-width: none;
}
.stampPresetRow button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 99px;
  padding: 8px 11px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}
.stampPresetRow button.active {
  background: var(--ink);
  color: #fff;
}
.stampDesignMode {
  display: none;
  grid-template-columns: 1fr 1fr;
  background: var(--soft);
  padding: 3px;
  border-radius: 14px;
  margin-bottom: 10px;
}
.stampDesignMode button {
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 11px;
  font-weight: 800;
  color: #6c6675;
}
.stampDesignMode button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 9px #26174712;
}
.stampLineTools {
  grid-template-columns: minmax(0, 1fr) 70px 48px;
}
.stampFontSizeRow {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 54px 38px;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.stampFontSizeRow input[type="range"] {
  width: 100%;
  min-width: 0;
}
.stampFontSizeRow output {
  text-align: center;
  font-size: 12px;
  font-weight: 850;
  color: var(--p);
}
.stampAlignRow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 8px;
}
.stampAlignRow button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 800;
  color: #655d70;
}
.stampAlignRow button.active {
  background: #eee9ff;
  color: var(--p);
  border-color: #d9cffd;
}
@media (max-width: 600px) {
  .stampGrid {
    display: flex;
    flex-direction: column;
  }
  .stampStageCard {
    order: -1;
    position: relative;
    padding: 9px;
    border: 1px solid #d9d4df;
    box-shadow: 0 10px 28px #24134a2b;
  }
  .stampStageHead {
    margin-bottom: 6px;
  }
  .stampStageOuter {
    min-height: 126px;
    max-height: 142px;
    padding: 8px 5px;
    border-radius: 14px;
  }
  .stampSelected {
    display: none;
  }
}
.stampStagePlaceholder {
  display: none;
}
@media (max-width: 600px) {
  .stampStagePlaceholder.active {
    display: block;
    order: -1;
  }
  .stampStageCard.isFloating {
    position: fixed;
    top: max(54px, calc(env(safe-area-inset-top) + 8px));
    left: 12px;
    right: 12px;
    width: auto;
    z-index: 9;
    margin: 0;
  }
}
@media (max-height: 600px) and (pointer: coarse) and (min-width: 601px) {
  .stampStagePlaceholder.active {
    display: block;
  }
  .stampStageCard.isFloating {
    position: fixed;
    top: 10px;
    left: 10px;
    right: auto;
    width: 55vw;
    z-index: 9;
    margin: 0;
    padding: 9px;
    border: 1px solid #d9d4df;
    box-shadow: 0 10px 28px #24134a2b;
  }
  .stampStageCard.isFloating .stampStageOuter {
    min-height: 120px;
    max-height: calc(100vh - 78px);
    padding: 7px;
    border-radius: 14px;
  }
  .stampStageCard.isFloating .stampSelected {
    display: none;
  }
}
@media (min-width: 860px) {
  #stampgenerator.activeScreen {
    max-width: 1180px;
  }
  .stampGrid {
    grid-template-columns: minmax(350px, 430px) minmax(500px, 1fr);
    align-items: start;
  }
  .stampStageCard {
    position: sticky;
    top: 16px;
  }
  .stampStageCard.isFloating {
    position: fixed;
    top: 10px;
  }
  .stampStageOuter {
    min-height: 440px;
  }
}
