    * { margin: 0; padding: 0; box-sizing: border-box; }
      :root {
  --palette-page-width: min(1280px, calc(100% - 48px));
  --palette-section-gap: 64px;
}

.palette-topbar,
.palette-workbench,
.main-grid {
  width: var(--palette-page-width);
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

.palette-workbench {
  display: grid;
  gap: var(--palette-section-gap);
  margin-top: var(--palette-section-gap);
  margin-bottom: var(--palette-section-gap);
}

.palette-history-card {
  width: 100%;
}

.history-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-thumbs {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  max-width: 100%;
  scrollbar-width: none;
  padding: 2px 0;
  min-height: 32px;
}

.history-thumbs::-webkit-scrollbar {
  display: none;
}

.history-empty-hint {
  font-size: 12px;
  color: #cccccc;
  font-weight: 500;
}

    html, body { width: 100%; height: 100%; }
    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: #ffffff;
      color: #1a1a1a;
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      background-attachment: fixed;
    }
    .wrap { max-width: 1400px; margin: 0 auto;}
    .header { margin-top: 32px; margin-bottom: 40px; text-align: center; }
    .header-title {
      font-size: 48px; font-weight: 800; letter-spacing: -1.5px; margin-bottom: 12px;
      background: linear-gradient(135deg, #110623 0%, #4a4a4a 100%);
      -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    }
    .header-subtitle { font-size: 16px; color: #666; font-weight: 400; letter-spacing: .2px; }

    .controls-section, .preview-card {
      background: white; border-radius: 20px; padding: 24px 0;
    }
    .palette-card {
  background: white;
  border-radius: 20px;
  padding: 0;
}
    .controls-section { margin-bottom: 40px; }

.palette-strip-fullwidth + .palette-workbench {
  margin-top: 20px;
}

.palette-topbar {
  margin: 0 auto 10px;
  padding: 24px 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: nowrap;
  background: #ffffff;
  border-radius: 20px;
}

.palette-topbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  margin-left: auto;
}

.palette-topbar__colors {
  height: 46px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid #e8e8e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #1a1a1a;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.palette-topbar__colors-label {
  display: inline-flex;
  align-items: center;
  height: 100%;
}

.palette-topbar__colors-value {
  min-width: 18px;
  text-align: center;
  color: #020817;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.palette-topbar__stepper {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #dcdcdc;
  background: #ffffff;
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.palette-topbar__stepper:hover {
  background: #f7f7f7;
  border-color: #cfcfcf;
}

.palette-topbar__stepper:active {
  transform: translateY(1px);
}

.palette-topbar__range {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.palette-topbar__format {
  height: 46px;
  min-height: 46px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid #e8e8e8;
  background: #fafafa;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.palette-topbar__format-button {
  height: 38px;
  min-width: 74px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #666666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.palette-topbar__format-button.active {
  background: #ffffff;
  color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.palette-topbar__format-button:hover:not(.active) {
  background: rgba(0, 0, 0, 0.02);
  color: #1a1a1a;
}

.palette-topbar__save {
  width: 165px;
  height: 46px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid #e8e8e8;
  background: #ffffff;
  color: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.palette-topbar__save:hover {
  background: #fafafa;
  transform: translateY(-2px);
}

.palette-topbar__save:active {
  transform: translateY(0);
  box-shadow: none;
}

.palette-topbar__save-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 auto;
}
    
    @media (max-width: 900px) {
      .palette-topbar {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
      }

      .palette-topbar .generator-cta--topbar {
        width: 100%;
        justify-content: center;
        padding-bottom: 20px;
      }

      .palette-topbar__actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        margin-left: 0;
      }
    }
    
    @media (max-width: 768px) {
      .palette-topbar { flex-direction: column; align-items: center; justify-content: center; }
      .palette-topbar .generator-cta--topbar { width: 100%; justify-content: center; }
    }
    
    @media (max-width: 640px) {
      .palette-topbar { flex-direction: column; align-items: center; justify-content: center; }
      .palette-topbar .generator-cta--topbar { width: 100%; justify-content: center; }
    }
    
    @media (max-width: 380px) {
      .palette-topbar { flex-direction: column; align-items: center; justify-content: center; }
      .palette-topbar .generator-cta--topbar { width: 100%; justify-content: center; }
    }

    .generator-cta {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 24px 0;
}

.generator-cta--topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
}


.generator-cta--topbar .btn-primary {
  width: 200px;
  height: 46px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: 14px;
  border: 1px solid #e8e8e8;
  background: #ffffff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transform: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.generator-cta--topbar .btn-primary:hover {
  color: #ffffff;
  border-color: transparent;
  background-image: linear-gradient(
    to right,
    #FF8C00,
    #FF8C00 16.65%,
    #FF5B2E 16.65%,
    #FF5B2E 33.3%,
    #FF2F86 33.3%,
    #FF2F86 49.95%,
    #9B42FF 49.95%,
    #9B42FF 66.6%,
    #2563EB 66.6%,
    #2563EB 83.25%,
    #16C7E8 83.25%,
    #16C7E8 100%
  );
  background-size: 260px 100%;
  animation: findPrimaryDance 2s linear infinite;
  transform: scale(1.04) translateY(-1px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.generator-cta--topbar .btn-primary:hover .btn-icon {
  filter: brightness(0) invert(1);
}

@keyframes findPrimaryDance {
  to {
    background-position: 260px 0;
  }
}

.generator-cta--topbar .btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}


.generator-cta--topbar .btn-primary .btn-icon,
.generator-cta--topbar .btn-primary span {
  transform: none;
}

.generator-cta--topbar .btn-icon {
  width: 17px;
  height: 17px;
  display: block;
  flex: 0 0 auto;
}

.generator-cta:not(.generator-cta--topbar) .btn-primary {
  height: 56px;
  padding: 0 28px;
  font-size: 18px;
  font-weight: 600;
}

    .space-hint { display: inline-flex; align-items: center; gap: 10px; color: #777; font-size: 13px; font-weight: 600; margin-top: 4px;}
    .space-key { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; height: 30px; padding: 0 14px; border-radius: 999px; background: #fafafa; border: 1px solid #e8e8e8; color: #666666; font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
    .settings-wrap { display: grid; gap: 24px; justify-items: stretch; margin-bottom: 24px; }
    .settings-wrap .controls-section {
  margin: 0 auto;
}
    .controls-label, .card-label, .extras-title, .editor-field-label, .mini-label {
      display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: #999;
    }
    .controls-label { margin-bottom: 16px; }
    .card-label { margin-bottom: 14px; }
    .controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
    .controls.centered { justify-content: center; }
    .settings-wrap .controls { justify-content: flex-start; }
    .seg {
      display: flex; background: #f5f5f5; border-radius: 10px; padding: 4px; border: 1px solid #e8e8e8; gap: 0;
    }
    .seg button {
      flex: 1; height: 40px; padding: 0 16px; background: transparent; border: none; color: #666; font-size: 13px;
      font-weight: 600; cursor: pointer; border-radius: 8px; transition: all .25s ease; white-space: nowrap;
    }
    .seg button.active { background: white; color: #1a1a1a; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
    .seg button:hover:not(.active) { color: #1a1a1a; background: rgba(0,0,0,.02); }

    .toggle {
      display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; background: #f5f5f5;
      border: 1px solid #e8e8e8; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: #1a1a1a;
      transition: all .25s ease; user-select: none;
    }
    .toggle input {
      position: absolute;
      left: 0;
      top: 0;
      width: 1px;
      height: 1px;
      margin: 0;
      padding: 0;
      opacity: 0;
      pointer-events: none;
    }
    .toggle .track { width: 48px; height: 28px; background: #10b981; border-radius: 999px; position: relative; }
    .toggle .thumb {
      position: absolute; width: 24px; height: 24px; background: white; border-radius: 999px; top: 2px; left: 2px;
      transition: left .3s cubic-bezier(.4,0,.2,1); box-shadow: 0 2px 6px rgba(0,0,0,.12);
    }
    .toggle .track { width: 48px; height: 28px; background: #10b981; border-radius: 999px; position: relative; transition: background .3s ease; }
    .toggle input:checked + .track { background: #7C83D4; }
    .toggle input:checked + .track .thumb { left: 22px; }

    .pill {
      display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 16px; background: #f5f5f5;
      border: 1px solid #e8e8e8; border-radius: 10px; font-size: 13px; font-weight: 600; color: #1a1a1a; white-space: nowrap;
    }
    .pill:hover { background: #fafafa; border-color: #d8d8d8; }
    .pill input[type="range"] { width: 120px; height: 4px; border-radius: 2px; background: #ddd; outline: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
    .pill input[type="range"]::-webkit-slider-thumb, .picker-range::-webkit-slider-thumb, #pickerHue::-webkit-slider-thumb {
      -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: white; cursor: pointer;
      box-shadow: 0 2px 6px rgba(0,0,0,.15); border: 2px solid #1a1a1a;
    }
    .pill input[type="range"]::-moz-range-thumb, .picker-range::-moz-range-thumb, #pickerHue::-moz-range-thumb {
      width: 18px; height: 18px; border-radius: 50%; background: white; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.15); border: 2px solid #1a1a1a;
    }
    .pill .value { font-variant-numeric: tabular-nums; min-width: 28px; font-weight: 700; }
    .stepper-btn { width: 32px; height: 32px; border-radius: 999px; border: 1px solid #dcdcdc; background: #fff; color: #1a1a1a; font-size: 20px; line-height: 1; font-weight: 500; padding: 0; }
    .stepper-btn:hover { background: #f7f7f7; }
    .stepper-btn:active { transform: translateY(1px); }

    .btn-primary, .btn-secondary, .btn-export, .swatch-lock, .seed-preview {
      display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: all .25s ease; cursor: pointer;
    }
.btn-primary {
  position: relative;
  height: 48px;
  padding: 0 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
}
    .btn-primary:hover {
  transform: translateY(-3px);
}
    .btn-secondary, .btn-export {
      height: 44px; padding: 0 18px; background: white; border: 1px solid #e8e8e8; border-radius: 10px; font-size: 13px; font-weight: 600; color: #1a1a1a;
    }
    .btn-secondary:hover, .btn-export:hover:not(:disabled) { background: #f5f5f5; border-color: #d8d8d8; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
    .btn-export:disabled { opacity: .4; cursor: not-allowed; }
    .btn-icon, .btn-export svg { width: 16px; height: 16px; }

    .seed-box {
      position: relative;
      padding-right: 8px;
    }
    .seed-preview {
      width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(0,0,0,.08); background: #8B5CF6; box-shadow: 0 4px 12px rgba(0,0,0,.08);
    }
    .seed-input { width: 92px; border: none; background: transparent; font: inherit; font-weight: 700; color: #1a1a1a; outline: none; text-transform: uppercase; }
    .seed-input::placeholder { color: #999; }
    .seed-box input[type="color"] {
      position: absolute;
      left: 0;
      top: 0;
      width: 1px;
      height: 1px;
      margin: 0;
      padding: 0;
      opacity: 0;
      pointer-events: none;
    }

    .main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
  max-width: none;
  margin: 0 auto;
}
    .main-grid .preview-stack { width: 100%; margin: 0; }
    .codes-card { width: 100%; }
    .preview-stack { display: grid; gap: 24px; }
    .preview-surface {
      position: relative; width: 100%; aspect-ratio: 1 / 1; border-radius: 22px; background: #f4f4f4; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
      isolation: isolate;
    }
    .preview-art,
    .preview-glow,
    .preview-vignette {
      position: absolute; inset: 0; pointer-events: none;
    }
    .preview-art { z-index: 1; }
    .preview-glow {
      z-index: 2; mix-blend-mode: screen; opacity: .82;
      background:
        radial-gradient(circle at 18% 16%, rgba(255,255,255,.30), rgba(255,255,255,0) 26%),
        radial-gradient(circle at 78% 28%, rgba(255,255,255,.18), rgba(255,255,255,0) 30%),
        radial-gradient(circle at 52% 82%, rgba(255,255,255,.10), rgba(255,255,255,0) 28%);
    }
    .preview-vignette {
      z-index: 4;
      background:
        radial-gradient(120% 110% at 50% 50%, rgba(255,255,255,0) 42%, rgba(0,0,0,.08) 100%),
        linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 20%, rgba(0,0,0,.02) 100%);
    }
    .preview-legend {
      display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px;
    }
    .preview-pill {
      display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 999px;
      background: #fafafa; border: 1px solid #ececec; box-shadow: 0 1px 0 rgba(255,255,255,.75) inset;
      color: #1a1a1a; font-size: 12px; font-weight: 760; line-height: 1;
    }
    .preview-pill-dot {
      width: 12px; height: 12px; border-radius: 999px; border: 1px solid rgba(0,0,0,.08); flex: 0 0 auto;
    }
    .preview-pill span {
      color: #747474; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace; font-weight: 700;
    }
    .preview-toolbar { display: grid; gap: 14px; margin-bottom: 18px; }
    .preview-toolbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .preview-seg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .preview-meta { font-size: 14px; font-weight: 700; color: #2a2a2a; margin-bottom: 0; }
    .preview-seg { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 0; }
    .preview-shuffle { min-width: 44px; width: 44px; height: 40px; padding: 0; border-radius: 10px; }
    .preview-chip {
      display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 14px;
      background: #fff; border: 1px solid #e8e8e8; border-radius: 10px; cursor: pointer;
      font-size: 13px; font-weight: 700; color: #1a1a1a; transition: all .22s ease;
    }
    .preview-chip:hover { background: #f6f6f6; border-color: #cfcfcf; }
    .preview-chip.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; box-shadow: 0 6px 16px rgba(0,0,0,.12); }
    .preview-caption { display: grid; gap: 14px; }
    .palette-grid + .preview-caption { margin-top: 30px; }
    .note-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
    .note-item {
      display: grid; gap: 3px; padding: 12px 14px; background: #fafafa; border: 1px solid #ececec; border-radius: 12px;
    }
    .note-item strong { font-size: 13px; }
    .note-item span { color: #777; font-size: 13px; line-height: 1.45; }

    .palette-grid, .export-buttons { display: grid; gap: 24px; }
    .export-section { margin-top: 0; padding-top: 0; }
    .export-buttons { display: flex; flex-wrap: wrap; gap: 12px; }

.palette-strip-fullwidth .color-strip {
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 0;
  background: #ffffff;
}

.swatch-wrap {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(360px, 56vh) 86px;
  gap: 0;
  margin: 0;
  overflow: hidden;
  border-right: none;
}

.swatch-wrap:last-child {
  border-right: none;
}

.color-swatch {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  cursor: pointer;
  background: #ddd;
  transition: filter 0.2s ease;
}

.color-swatch:hover {
  filter: brightness(1.04);
}

.color-swatch::after {
  content: none;
}

.swatch-lock {
  width: 100%;
  height: 86px;
  padding: 14px 10px 12px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.swatch-lock:hover {
  background: #f8fafc;
}

.swatch-lock.active {
  background: #ffffff;
  color: #9aa3b2;
}

.swatch-lock__icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  opacity: 0.9;
}

.swatch-lock.active .swatch-lock__icon {
  opacity: 0.55;
}

.swatch-lock__content {
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: center;
}

.swatch-lock__name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.swatch-lock__hex {
  display: block;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 500;
  color: #475569;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.swatch-lock.active .swatch-lock__name,
.swatch-lock.active .swatch-lock__hex {
  color: #9aa3b2;
}

.swatch-lock {
  width: 100%;
  height: 86px;
  padding: 14px 10px 12px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: default;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.swatch-lock:hover {
  background: #f8fafc;
}

.swatch-lock.active {
  background: #ffffff;
  color: #9aa3b2;
}

.swatch-lock__button,
.swatch-lock__copy {
  border: 0;
  background: transparent;
  font-family: inherit;
}

.swatch-lock__button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.swatch-lock__button:hover {
  background: #f1f5f9;
}

.swatch-lock__icon {
  display: none;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

/* Разблокирован: обычное состояние */
.swatch-lock:not(.active) .icon-unlock {
  display: block;
}

/* Разблокирован: hover показывает серый закрытый замок */
.swatch-lock:not(.active) .swatch-lock__button:hover .icon-unlock {
  display: none;
}

.swatch-lock:not(.active) .swatch-lock__button:hover .icon-lock-on {
  display: block;
}

/* Заблокирован: обычное состояние */
.swatch-lock.active .icon-lock-black {
  display: block;
}

/* Только что заблокировали: даже под мышкой оставляем черный закрытый замок */
.swatch-lock.active.just-locked .swatch-lock__button:hover .icon-lock-black {
  display: block;
}

.swatch-lock.active.just-locked .swatch-lock__button:hover .icon-lock-off {
  display: none;
}

/* Заблокирован и пользователь навелся заново: показываем иконку разблокировки */
.swatch-lock.active:not(.just-locked) .swatch-lock__button:hover .icon-lock-black {
  display: none;
}

.swatch-lock.active:not(.just-locked) .swatch-lock__button:hover .icon-lock-off {
  display: block;
}

.swatch-lock__content {
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: center;
}

.swatch-lock__name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.swatch-lock__hex {
  display: grid;
  gap: 2px;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 500;
  color: #475569;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.swatch-lock.active .swatch-lock__name,
.swatch-lock.active .swatch-lock__hex {
  color: #9aa3b2;
}

.swatch-lock__copy {
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.swatch-lock__copy:hover .swatch-lock__name,
.swatch-lock__copy:hover .swatch-lock__hex {
  color: #020817;
}

.swatch-lock__code-line {
  display: block;
  white-space: nowrap;
}


    .dominance-bar { display: flex; height: 48px; border-radius: 12px; overflow: hidden; border: 1px solid #e8e8e8; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
    .dominance-segment { flex: 1 1 0; height: 100%; position: relative; border-right: 1px solid rgba(255,255,255,.4); }
    .dominance-segment:last-child { border-right: none; }

    .codes-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
    .codes-sort-links { display: flex; align-items: center; margin-left: auto; }
    .codes-sort-link {
      font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: #bbb; text-decoration: none; transition: color .2s ease;
    }
    .codes-sort-link.active { color: #1a1a1a; text-decoration: underline; text-underline-offset: 3px; }
    .codes-sort-sep { font-size: 12px; font-weight: 700; color: #bbb; margin: 0 10px; }
    .details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .rowCard {
      background: #fff; border: 1px solid #e8e8e8; border-radius: 14px; overflow: hidden; cursor: pointer; display: grid; grid-template-columns: 56px 1fr; min-height: 110px; transition: all .25s ease;
    }
    .rowCard:hover { border-color: #d8d8d8; box-shadow: 0 10px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
    .miniChip { border-right: 1px solid #e8e8e8; background: #eee; }
    .rowBody { padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
    .rowTop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
    .idx { font-weight: 700; color: #7a7a7a; font-size: 12px; }
    .hint { font-size: 12px; color: #7a7a7a; text-transform: lowercase; }
    .codeLine { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
    .codeTag {
      display: inline-flex; gap: 8px; align-items: baseline; border: 1px solid #dcdcdc; border-radius: 999px; padding: 7px 10px; background: rgba(0,0,0,.02); cursor: pointer; transition: all .2s ease;
    }
    .codeTag:hover { background: rgba(0,0,0,.04); border-color: #cfcfcf; }
    .label { font-size: 12px; font-weight: 800; color: #7a7a7a; }
    .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 12px; font-weight: 700; color: #7a7a7a; }

    .modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.4); z-index: 9999; backdrop-filter: blur(4px); }
    .modal.show { display: flex; }
    .modal-content {
      background: white; border-radius: 24px; padding: 40px; width: 100%; max-width: 800px; box-shadow: 0 20px 60px rgba(0,0,0,.2); max-height: 90vh; overflow-y: auto;
    }
    .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; padding-bottom: 20px; border-bottom: 1px solid #e8e8e8; }
    .modal-title { font-size: 24px; font-weight: 800; color: #1a1a1a; }
    .modal-close { width: 40px; height: 40px; border: none; background: #f5f5f5; border-radius: 10px; font-size: 20px; cursor: pointer; }
    .modal-body { display: grid; grid-template-columns: 280px 1fr; gap: 40px; }
    .wheel-container, .editor-controls { display: grid; gap: 20px; }
    .inline-picker { width: 260px; display: flex; flex-direction: column; gap: 10px; }
    .picker-sv { width: 260px; height: 260px; border-radius: 10px; overflow: hidden; cursor: crosshair; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.10); }
    #pickerSV { display: block; width: 100%; height: 100%; }
    .picker-sv-cursor {
      position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.3);
      transform: translate(-50%, -50%); pointer-events: none; top: 50%; left: 50%;
    }
    #pickerHue, .picker-range { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; border-radius: 8px; border: none; outline: none; cursor: pointer; }
    #pickerHue { background: linear-gradient(to right,#ff0000,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000); }
    .color-tiles-row { display: flex; gap: 12px; }
    .color-tile { flex: 1; display: flex; flex-direction: column; gap: 8px; }
    .color-tile-swatch { width: 100%; height: 64px; border-radius: 14px; border: 1px solid rgba(0,0,0,.06); background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
    .codes-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .codes-col { display: flex; flex-direction: column; gap: 12px; }
    .editor-field { display: grid; gap: 12px; }
    .editor-field-value {
      font-size: 13px; font-family: 'Courier New', monospace; font-weight: 600; color: #1a1a1a; padding: 10px 12px; background: #f5f5f5; border-radius: 8px; border: 1px solid #e8e8e8;
      cursor: pointer;
    }
    .editor-field-value--static { color: #999; cursor: default; }
    .editor-actions { display: flex; gap: 12px; margin-top: 20px; }
    .btn-modal { flex: 1; height: 44px; background: white; border: 1.5px solid #e8e8e8; border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; color: #1a1a1a; }
    .btn-modal.primary { background: #1a1a1a; color: white; border-color: #1a1a1a; }
    .toast {
      position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1a1a1a; color: white; padding: 14px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
      opacity: 0; pointer-events: none; transition: opacity .3s ease; z-index: 10000; box-shadow: 0 8px 24px rgba(0,0,0,.2);
    }
    .toast.show { opacity: 1; }
    .privacy-note { margin: 22px 0 0; text-align: center; font-size: 12px; color: #8a8a8a; letter-spacing: .2px; padding-bottom: 30px; }


@media (max-width: 900px) {
  .palette-topbar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
  }

  .palette-topbar__actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .palette-topbar__colors,
  .palette-topbar__format,
  .palette-topbar__save {
    height: 46px;
    min-height: 46px;
  }
}

@media (max-width: 640px) {
  .palette-topbar__actions {
    gap: 20px;
  }

  .palette-topbar__colors {
    padding: 0 16px;
  }

  .palette-topbar__format-button {
    min-width: 70px;
    padding: 0 16px;
  }

  .palette-topbar__save {
    padding: 0 20px;
  }
}

@media (max-width: 380px) {
  .palette-topbar__actions {
    gap: 10px;
  }

  .palette-topbar__colors {
    width: 100%;
    max-width: 270px;
  }

  .palette-topbar__format {
    width: 100%;
    max-width: 270px;
  }

  .palette-topbar__format-button {
    flex: 1 1 0;
  }

  .palette-topbar__save {
    width: 100%;
    max-width: 270px;
  }
}


    @media (max-width: 1080px) {
      
        .generator-cta--topbar .space-hint {
            display: none;
          }
      
      .main-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
      .details { grid-template-columns: 1fr; }
    }
    @media (max-width: 860px) {
      .main-grid { grid-template-columns: 1fr; gap: 32px; }
      .main-grid .preview-stack { width: 100%; margin: 0 auto; }
    }
    @media (max-width: 900px) {
      .generator-cta--topbar { width: 100%; justify-content: flex-start; }
      .generator-cta--topbar .btn-primary { width: 340px; min-width: 340px; max-width: 340px; flex: none; }
    }

    @media (max-width: 768px) {
      .wrap { padding: 32px 20px; }
      .header-title { font-size: 36px; }
      .controls-section, .preview-card, .palette-card, .modal-content { padding: 24px; }
      .modal-body, .codes-two-col { grid-template-columns: 1fr; }
      .generator-cta--topbar { flex-wrap: wrap; gap: 10px; }
      .generator-cta--topbar .btn-primary { width: 340px; min-width: 340px; max-width: 340px; }
      .note-list { grid-template-columns: 1fr; }
    }

@media (max-width: 1024px) and (min-width: 641px) {
  .settings-wrap,
  .main-grid {
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }
}

@media (max-width: 640px) {
  .settings-wrap,
  .main-grid {
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }
}

    @media (max-width: 1024px) and (min-width: 641px) {
      .swatch-lock { font-size: 0; }
      .swatch-lock svg { margin: 0; }
      
        #userSvgPreviewSurface {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    overflow: hidden;
  }

  #userSvgPreviewSurface > svg {
    width: 100%;
    height: 100%;
    display: block;
  }
      
      .wrap { max-width: 100%; padding: 0 24px; }
      .header { margin-top: 24px; margin-bottom: 32px; }
      .header-title { font-size: 40px; letter-spacing: -1px; }
      .header-subtitle { font-size: 15px; }
      
      .controls-section, .preview-card, .palette-card { padding: 28px; border-radius: 18px; }
      .controls-section { margin-bottom: 32px; }
      
      .main-grid { grid-template-columns: 1fr; gap: 28px; }
      .preview-surface { aspect-ratio: 1 / 0.9; }
      
      .palette-topbar { padding: 30px 28px 20px 28px; gap: 12px; }
      
      .generator-cta--topbar .btn-primary { width: 100%; max-width: 564px; height: 52px;}
      
      .controls { gap: 14px; }
      .seg button { height: 38px; padding: 0 14px; font-size: 12px; }
      .pill, .seed-box { min-height: 44px; height: 44px; padding: 0 14px; font-size: 12px; }
      .pill input[type="range"] { width: 100px; }
      
      .stepper-btn { width: 30px; height: 30px; font-size: 18px; }
      .btn-primary { height: 44px; padding: 0 20px; font-size: 13px; }
      .btn-secondary, .btn-export { height: 40px; padding: 0 16px; font-size: 12px; }
      
      .preview-legend { gap: 8px; margin-top: 12px; }
      .preview-pill { padding: 6px 10px; font-size: 11px; }
      .preview-pill-dot { width: 10px; height: 10px; }
      
      .note-list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
      .note-item { padding: 10px 12px; }
      
      .export-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
      .btn-export { width: 100%; }
      
      .space-hint { font-size: 12px; line-height: 1.1;}
      .space-key { min-width: 56px; height: 28px; font-size: 11px; }
    }


    @media (max-width: 768px) and (min-width: 641px) {
      
      .swatch-lock { font-size: 0; }
      .swatch-lock svg { margin: 0; }
      
      .wrap { max-width: 100%; padding: 0 18px; }
      .header { margin-top: 20px; margin-bottom: 28px; }
      .header-title { font-size: 32px; letter-spacing: -0.8px; }
      .header-subtitle { font-size: 14px; }
      
      .controls-section, .preview-card, .palette-card { padding: 20px; border-radius: 16px; }
      .controls-section { margin-bottom: 24px; }
      
      .main-grid { grid-template-columns: 1fr; gap: 20px; }
      .preview-surface { aspect-ratio: 1 / 0.85; }
      
       .palette-topbar { 
        padding: 26px 16px 12px 16px; 
        gap: 8px; 
        flex-wrap: wrap;
        flex-direction: column;
        align-items: center;
      }
      
      .generator-cta--topbar { flex-direction: column; width: 100%; }
      .generator-cta--topbar .btn-primary { width: 100%; max-width: 564px; height: 48px; }
      
      .controls { gap: 12px; flex-wrap: wrap; }
      .seg { padding: 3px; }
      .seg button { height: 36px; padding: 0 12px; font-size: 11px; }
      .pill, .seed-box { min-height: 42px; height: 42px; padding: 0 12px; font-size: 11px; }
      .pill input[type="range"] { width: 90px; }
      
      .stepper-btn { width: 28px; height: 28px; font-size: 16px; }
      .btn-primary { height: 42px; padding: 0 18px; font-size: 12px; }
      .btn-secondary, .btn-export { height: 38px; padding: 0 14px; font-size: 11px; }
      
      .preview-legend { gap: 6px; margin-top: 10px; }
      .preview-pill { padding: 5px 9px; font-size: 10px; }
      .preview-pill-dot { width: 9px; height: 9px; }
      
      .note-list { grid-template-columns: repeat(2, 1fr); gap: 10px; }
      .note-item { padding: 8px 10px; }
      
      .export-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
      .btn-export { width: 100%; }
      
      .controls-label { margin-bottom: 12px; font-size: 11px; }
      .card-label { margin-bottom: 10px; font-size: 11px; }
      .space-hint { font-size: 11px; }
      .space-key { min-width: 52px; height: 26px; font-size: 10px; }
    }

    @media (max-width: 640px) {
      
      body { overflow-x: hidden; }
      * { -webkit-tap-highlight-color: rgba(0,0,0,.05); }
      
      html,
      body {
        width: 100%;
        min-height: 100%;
      }
      body { background-attachment: scroll; overflow-x: hidden; }
      
      .wrap { max-width: 100%; padding: 0 16px; margin: 0 auto; }
      
    
      .header { margin-top: 16px; margin-bottom: 20px; text-align: center; }
      .header-title { 
        font-size: 28px; 
        font-weight: 800; 
        letter-spacing: -0.6px; 
        margin-bottom: 8px; 
        line-height: 1.2;
      }
      .header-subtitle { 
        font-size: 13px; 
        color: #666; 
        font-weight: 400; 
        letter-spacing: 0px;
      }
      
      .controls-section, .preview-card, .palette-card, .modal-content { 
        background: white; 
        border-radius: 14px; 
        padding: 16px; 
      }
      .controls-section { margin-bottom: 20px; }
      .palette-card { padding: 16px; }
      
      
.palette-strip-fullwidth {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: 0;
}
      .palette-strip-fullwidth .swatch-wrap {
  padding-bottom: 0;
  border-right: none;
}
      .palette-strip-fullwidth .color-strip { width: 100%; }
      
      
      .main-grid { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 16px; 
        align-items: start; 
        max-width: 100%; 
        margin: 0 auto; 
      }
      .main-grid .preview-stack { width: 100%; margin: 0; }
      .codes-card { width: 100%; }
      
      
      .preview-surface { 
        position: relative; 
        width: 100%; 
        aspect-ratio: 1 / 0.8; 
        border-radius: 16px; 
        background: #f4f4f4; 
        overflow: hidden;
      }
      .preview-legend { 
        display: flex; 
        flex-wrap: wrap; 
        gap: 6px; 
        margin-top: 8px; 
      }
      .preview-pill { 
        display: inline-flex; 
        align-items: center; 
        gap: 6px; 
        padding: 4px 8px; 
        border-radius: 999px; 
        background: #fafafa; 
        border: 1px solid #ececec; 
        color: #1a1a1a; 
        font-size: 9px; 
        font-weight: 700; 
        line-height: 1;
      }
      .preview-pill-dot { 
        width: 8px; 
        height: 8px; 
        border-radius: 999px; 
        flex: 0 0 auto;
      }
      .preview-pill span { font-size: 9px; }
      
      
      .palette-topbar { 
        display: flex; 
        align-items: center; 
        justify-content: space-between; 
        gap: 8px; 
        margin-bottom: 16px; 
        flex-wrap: wrap; 
        width: 100%; 
        padding: 26px 16px 12px 16px; 
        box-sizing: border-box; 
        background: white; 
        border-radius: 14px; 
      }
      
      
      .generator-cta { 
        display: grid; 
        justify-items: center; 
        gap: 8px; 
        margin: 16px 0; 
        text-align: center;
      }
      .generator-cta--topbar { 
        display: flex; 
        flex-direction: column; 
        align-items: stretch; 
        gap: 10px; 
        margin: 0; 
        width: 100%; 
      }
      .generator-cta--topbar .btn-primary { 
        width: 100%; 
        max-width: none; 
        min-width: auto; 
        height: 44px; 
        padding: 0 16px; 
        border-radius: 12px; 
      }
      
      
      .controls { 
        display: flex; 
        flex-wrap: wrap; 
        gap: 10px; 
        align-items: center; 
        width: 100%;
        justify-content: center;
      }
      .controls.centered { 
        justify-content: center; 
      }
      .settings-wrap .controls { 
        justify-content: center; 
      }
      
      
      .palette-topbar { 
        flex-direction: column; 
        align-items: center; 
        gap: 2px;
      }
      
      
      .pill { 
        margin: 0 auto; 
        width: auto;
      }
      
 .swatch-wrap { 
  gap: 0; 
  margin-bottom: 0;
  border-right: none;
}
      
      
      .seg { 
        display: flex; 
        background: #f5f5f5; 
        border-radius: 8px; 
        padding: 3px; 
        border: 1px solid #e8e8e8; 
        gap: 0;
        flex-wrap: wrap;
      }
      .seg button { 
        flex: 1 1 auto;
        min-width: 60px;
        height: 34px; 
        padding: 0 10px; 
        background: transparent; 
        border: none; 
        color: #666; 
        font-size: 11px; 
        font-weight: 600; 
        cursor: pointer; 
        border-radius: 6px; 
        transition: all .25s ease; 
        white-space: nowrap;
      }
      .seg button.active { 
        background: white; 
        color: #1a1a1a; 
        box-shadow: 0 1px 4px rgba(0,0,0,.04); 
      }
      
      
      .seedmode-btn { 
        height: 32px; 
        padding: 0 10px; 
        background: transparent; 
        border: none; 
        color: #888; 
        font-size: 10px; 
        font-weight: 600; 
        cursor: pointer; 
        border-radius: 5px; 
        transition: all .2s ease; 
        white-space: nowrap; 
      }
      .seedmode-btn.active { 
        background: white; 
        color: #1a1a1a; 
        box-shadow: 0 1px 4px rgba(0,0,0,.06); 
      }
      
      
      .toggle { 
        position: relative;
        display: inline-flex; 
        align-items: center; 
        gap: 8px; 
        height: 40px; 
        padding: 0 12px; 
        background: #f5f5f5; 
        border: 1px solid #e8e8e8; 
        border-radius: 8px; 
        cursor: pointer; 
        font-size: 11px; 
        font-weight: 600; 
        color: #1a1a1a; 
        transition: all .25s ease; 
        user-select: none;
      }
      .toggle .track { 
        width: 44px; 
        height: 26px; 
        background: #10b981; 
        border-radius: 999px; 
        position: relative; 
        transition: background .3s ease; 
      }
      .toggle .thumb { 
        position: absolute; 
        width: 22px; 
        height: 22px; 
        background: white; 
        border-radius: 999px; 
        top: 2px; 
        left: 2px; 
        transition: left .3s cubic-bezier(.4,0,.2,1); 
        box-shadow: 0 1px 3px rgba(0,0,0,.1);
      }
      .toggle input:checked + .track { background: #7C83D4; }
      .toggle input:checked + .track .thumb { left: 20px; }
      
      
      .pill, .seed-box { 
        display: flex; 
        align-items: center; 
        gap: 10px; 
        min-height: 40px; 
        height: 40px; 
        padding: 0 12px; 
        background: #f5f5f5; 
        border: 1px solid #e8e8e8; 
        border-radius: 8px; 
        font-size: 11px; 
        font-weight: 600; 
        color: #1a1a1a; 
        white-space: nowrap;
      }
      .pill input[type="range"] { 
        width: 80px; 
        height: 3px; 
        border-radius: 2px; 
        background: #ddd; 
      }
      .pill input[type="range"]::-webkit-slider-thumb,
      .picker-range::-webkit-slider-thumb,
      #pickerHue::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: white;
        cursor: pointer;
        box-shadow: 0 1px 4px rgba(0,0,0,.12);
        border: 2px solid #1a1a1a;
      }
      .pill .value { 
        font-variant-numeric: tabular-nums; 
        min-width: 24px; 
        text-align: right; 
        font-weight: 700; 
      }
      
      
      .stepper-btn { 
        width: 26px; 
        height: 26px; 
        border-radius: 999px; 
        border: 1px solid #dcdcdc; 
        background: #fff; 
        color: #1a1a1a; 
        font-size: 16px; 
        line-height: 1; 
        font-weight: 500; 
        padding: 0; 
        cursor: pointer;
      }
      .stepper-btn:active { transform: translateY(1px); }
      
      
      .btn-primary { 
        position: relative; 
        height: 40px; 
        padding: 0 18px; 
        background: linear-gradient(135deg, #10b981 0%, #059669 100%); 
        color: white; 
        border: none; 
        border-radius: 10px; 
        font-size: 12px; 
        font-weight: 600; 
        box-shadow: 0 2px 8px rgba(16,185,129,.2); 
        overflow: hidden;
      }
      .btn-primary:active { transform: translateY(1px); }
      
      
      .btn-secondary, .btn-export { 
        height: 38px; 
        padding: 0 14px; 
        background: white; 
        border: 1px solid #e8e8e8; 
        border-radius: 8px; 
        font-size: 11px; 
        font-weight: 600; 
        color: #1a1a1a; 
        cursor: pointer;
      }
      .btn-secondary:active, 
      .btn-export:active:not(:disabled) { 
        background: #f5f5f5; 
        border-color: #d8d8d8; 
      }
      
      .btn-icon, .btn-export svg { 
        width: 14px; 
        height: 14px; 
      }
      
      
      .seed-box { padding-right: 6px; }
      .seed-preview { 
        width: 30px; 
        height: 30px; 
        border-radius: 8px; 
        border: 1px solid rgba(0,0,0,.08); 
        background: #8B5CF6; 
        box-shadow: 0 2px 6px rgba(0,0,0,.06);
      }
      .seed-input { 
        width: 80px; 
        border: none; 
        background: transparent; 
        font: inherit; 
        font-weight: 700; 
        color: #1a1a1a; 
        outline: none; 
        text-transform: uppercase; 
        font-size: 11px;
      }
      

      
      
      .controls-label, .card-label, .extras-title, .editor-field-label, .mini-label { 
        display: block; 
        font-size: 10px; 
        font-weight: 700; 
        text-transform: uppercase; 
        letter-spacing: 0.8px; 
        color: #999;
      }
      .controls-label { margin-bottom: 12px; }
      .card-label { margin-bottom: 10px; }
      
      
      .space-hint { 
        display: inline-flex; 
        align-items: center; 
        justify-content: center;
        gap: 8px; 
        color: #777; 
        font-size: 10px; 
        font-weight: 600; 
        width: 100%;
      }
      .space-key { 
        display: inline-flex; 
        align-items: center; 
        justify-content: center; 
        min-width: 48px; 
        height: 24px; 
        padding: 0 10px; 
        border-radius: 999px; 
        background: #f5f5f5; 
        border: 1px solid #e8e8e8; 
        color: #1a1a1a; 
        font-size: 9px; 
        font-weight: 800; 
        letter-spacing: 0.4px; 
        text-transform: uppercase; 
      }
      
      
      .note-list { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 8px; 
      }
      .note-item { 
        display: grid; 
        gap: 2px; 
        padding: 8px 10px; 
        background: #fafafa; 
        border: 1px solid #ececec; 
        border-radius: 10px;
      }
      .note-item strong { 
        font-size: 11px; 
        font-weight: 700; 
        color: #1a1a1a; 
      }
      .note-item span { 
        font-size: 10px; 
        color: #666; 
      }
      
      
      .export-buttons { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 10px; 
        margin-top: 12px; 
      }
      .btn-export { 
        width: 100%; 
        height: 40px; 
        display: flex; 
        align-items: center; 
        justify-content: center; 
        gap: 8px; 
      }
      
      
      .modal-content { padding: 16px; }
      .modal-body { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 16px; 
      }
      .codes-two-col { 
        display: grid; 
        grid-template-columns: 1fr; 
        gap: 12px; 
      }
      .codes-col { 
        display: flex; 
        flex-direction: column; 
        gap: 10px; 
      }
      .editor-field { 
        display: grid; 
        gap: 10px; 
      }
      .editor-field-value { 
        font-size: 11px; 
        font-family: 'Courier New', monospace; 
        font-weight: 600; 
        color: #1a1a1a; 
        padding: 8px 10px; 
        background: #f5f5f5; 
        border-radius: 6px; 
        border: 1px solid #e8e8e8;
      }
      
      
      .editor-actions { 
        display: flex; 
        gap: 10px; 
        margin-top: 16px; 
      }
      .btn-modal { 
        flex: 1; 
        height: 40px; 
        background: white; 
        border: 1.5px solid #e8e8e8; 
        border-radius: 8px; 
        font-size: 12px; 
        font-weight: 700; 
        cursor: pointer; 
        color: #1a1a1a; 
      }
      .btn-modal.primary { 
        background: #1a1a1a; 
        color: white; 
        border-color: #1a1a1a; 
      }
      
      

      .swatch-wrap { padding-bottom: 12px; }
      .palette-grid { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 8px; 
      }
      
      
      .preview-toolbar { 
        display: grid; 
        gap: 10px; 
        margin-bottom: 12px; 
      }
      .preview-toolbar-top { 
        display: flex; 
        align-items: center; 
        justify-content: space-between; 
        gap: 8px; 
        flex-wrap: wrap;
      }
      .preview-meta { 
        font-size: 12px; 
        font-weight: 700; 
        color: #2a2a2a; 
        margin-bottom: 0; 
      }
      .preview-seg { 
        display: flex; 
        flex-wrap: wrap; 
        gap: 8px; 
        margin-bottom: 0; 
      }
      .preview-chip { 
        display: inline-flex; 
        align-items: center; 
        justify-content: center; 
        height: 36px; 
        padding: 0 12px; 
        background: #fff; 
        border: 1px solid #e8e8e8; 
        border-radius: 8px; 
        cursor: pointer; 
        font-size: 11px; 
        font-weight: 700; 
        color: #1a1a1a; 
        transition: all .22s ease;
      }
      .preview-chip:active { 
        background: #1a1a1a; 
        color: #fff; 
        border-color: #1a1a1a; 
      }
      
      
      .toast { 
        position: fixed; 
        left: 16px; 
        right: 16px; 
        bottom: 16px; 
        transform: none; 
        background: #1a1a1a; 
        color: white; 
        padding: 12px 16px; 
        border-radius: 8px; 
        font-size: 12px; 
        font-weight: 600; 
        opacity: 0; 
        pointer-events: none; 
        transition: opacity .3s ease; 
        z-index: 10000; 
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
      }
      .toast.show { opacity: 1; }
      
      
      .privacy-note { 
        margin: 16px 0 0; 
        text-align: center; 
        font-size: 11px; 
        color: #8a8a8a; 
        letter-spacing: 0px; 
        padding-bottom: 20px; 
      }
      
      
      @supports (padding: max(0px)) {
        .wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
        .toast { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
      }
    }


    @media (max-width: 380px) {
      .wrap { padding: 0 12px; }
      
      .header { margin-top: 12px; margin-bottom: 16px; }
      .header-title { font-size: 24px; letter-spacing: -0.4px; }
      .header-subtitle { font-size: 12px; }
      
      .controls-section, .preview-card, .palette-card { padding: 12px; border-radius: 12px; }
      .controls-section { margin-bottom: 16px; }
      
      .main-grid { gap: 12px; }
      .preview-surface { aspect-ratio: 1 / 0.75; }
      
      .palette-topbar { 
        padding: 20px 12px 10px 12px; 
        gap: 6px;
        flex-direction: column;
        align-items: center;
      }
      
      .generator-cta--topbar .btn-primary { height: 40px; }
      
      .seg button { height: 32px; padding: 0 8px; font-size: 10px; }
      .pill, .seed-box { height: 36px; padding: 0 10px; font-size: 10px; }
      .pill input[type="range"] { width: 70px; }
      
      .stepper-btn { width: 24px; height: 24px; font-size: 14px; }
      .btn-primary { height: 36px; padding: 0 14px; font-size: 11px; }
      .btn-secondary, .btn-export { height: 34px; padding: 0 12px; font-size: 10px; }
      
      .preview-legend { gap: 4px; margin-top: 6px; }
      .preview-pill { padding: 3px 6px; font-size: 8px; }
      .preview-pill-dot { width: 6px; height: 6px; }
      
      .note-list { gap: 6px; }
      .note-item { padding: 6px 8px; }
      
      .export-buttons { gap: 8px; }
      .btn-export { height: 36px; }
      
      .controls-label, .card-label { font-size: 9px; margin-bottom: 8px; }
      .space-key { min-width: 44px; height: 22px; font-size: 8px; }
      
      .palette-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
      
      .preview-chip { height: 32px; padding: 0 10px; font-size: 10px; }
      .preview-meta { font-size: 11px; }
      
      .modal-content { padding: 12px; }
      .editor-actions { gap: 8px; }
      .btn-modal { height: 36px; font-size: 11px; }
      
      .toast { left: 12px; right: 12px; bottom: 12px; padding: 10px 12px; font-size: 11px; }
      .privacy-note { font-size: 10px; margin: 12px 0 0; padding-bottom: 16px; }
    }


  .preview-color-locks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
  }
  .preview-color-lock-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #f7f7f7;
    transition: background .15s;
  }
  .preview-color-lock-row:hover { background: #f0f0f0; }
  .preview-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex: 0 0 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
  }
  .preview-color-lock-name {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }
  .preview-lock-btn {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    padding: 0;
    transition: color .15s, background .15s;
  }
  .preview-lock-btn:hover { color: #999; background: #e8e8e8; }
  .preview-lock-btn.active { color: #111; }
  .preview-lock-btn.active:hover { color: #333; background: #e8e8e8; }

  .export-format-wrap{
    display:flex;
    align-items:center;
    gap:8px;
    position:relative;
  }

  .export-help{
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  .export-help-btn{
    width:22px;
    height:22px;
    flex:0 0 22px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:none;
    border-radius:999px;
    background:#f1f1f1;
    color:#b8b8b8;
    cursor:help;
    font-size:12px;
    font-weight:700;
    line-height:1;
    padding:0;
    transition:background .18s ease, color .18s ease, transform .18s ease;
  }

  .export-help:hover .export-help-btn,
  .export-help:focus-within .export-help-btn{
    background:#ebebeb;
    color:#9f9f9f;
    transform:translateY(-1px);
  }

  .export-tooltip{
    position:absolute;
    left:50%;
    bottom:calc(100% + 10px);
    transform:translateX(-50%) translateY(4px);
    min-width:220px;
    max-width:260px;
    padding:10px 12px;
    border-radius:10px;
    background:#2f2f2f;
    color:#fff;
    font-size:12px;
    line-height:1.5;
    font-weight:500;
    box-shadow:0 10px 26px rgba(0,0,0,.16);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .18s ease, transform .18s ease, visibility .18s ease;
    z-index:20;
    text-align:left;
  }

  .export-tooltip::after{
    content:"";
    position:absolute;
    left:50%;
    top:100%;
    transform:translateX(-50%);
    border:6px solid transparent;
    border-top-color:#2f2f2f;
  }

  .export-help:hover .export-tooltip,
  .export-help:focus-within .export-tooltip{
    opacity:1;
    visibility:visible;
    transform:translateX(-50%) translateY(0);
  }
  
  .export-tooltip {
  max-width: min(260px, calc(100vw - 24px));
}

.export-buttons .export-format-wrap:nth-child(2) .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3) .export-tooltip {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.export-buttons .export-format-wrap:nth-child(2) .export-tooltip::after,
.export-buttons .export-format-wrap:nth-child(3) .export-tooltip::after {
  left: auto;
  right: 8px;
  transform: none;
}

.export-buttons .export-format-wrap:nth-child(2):hover .export-tooltip,
.export-buttons .export-format-wrap:nth-child(2):focus-within .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3):hover .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3):focus-within .export-tooltip {
  transform: translateY(0);
}

  @media (max-width: 768px) {
.user-svg-bg-lock,
.template-bg-lock {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0 !important;
  justify-content: center !important;
}
    
      #userSvgPreviewSurface {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    overflow: hidden;
  }

  #userSvgPreviewSurface > svg {
    width: 100%;
    height: 100%;
    display: block;
  }

    .export-tooltip{
      left:auto;
      right:0;
      transform:translateY(4px);
    }

    .export-tooltip::after{
      left:auto;
      right:8px;
      transform:none;
    }

    .export-help:hover .export-tooltip,
    .export-help:focus-within .export-tooltip{
      transform:translateY(0);
    }
  }

/* ===== FIX: history ===== */

  .preview-color-locks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
  }
  .preview-color-lock-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 8px;
    background: #f7f7f7;
    transition: background .15s;
  }
  .preview-color-lock-row:hover { background: #f0f0f0; }
  .preview-color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex: 0 0 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
  }
  .preview-color-lock-name {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }
  .preview-lock-btn {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    padding: 0;
    transition: color .15s, background .15s;
  }
  .preview-lock-btn:hover { color: #999; background: #e8e8e8; }
  .preview-lock-btn.active { color: #111; }
  .preview-lock-btn.active:hover { color: #333; background: #e8e8e8; }

  .export-format-wrap{
    display:flex;
    align-items:center;
    gap:8px;
    position:relative;
  }

  .export-help{
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
  }

  .export-help-btn{
    width:22px;
    height:22px;
    flex:0 0 22px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:999px;
    background:#ffffff;
    border: 1px solid #e8e8e8;
    color:#2663eb;
    cursor:help;
    font-size:12px;
    font-weight:700;
    line-height:1;
    padding:0;
    transition:background .18s ease, color .18s ease, transform .18s ease;
  }

  .export-help:hover .export-help-btn,
  .export-help:focus-within .export-help-btn{
    background:#ebebeb;
    color:#9f9f9f;
    transform:translateY(-1px);
  }

  .export-tooltip{
    position:absolute;
    left:50%;
    bottom:calc(100% + 10px);
    transform:translateX(-50%) translateY(4px);
    min-width:220px;
    max-width:260px;
    padding:10px 12px;
    border-radius:10px;
    background:#2f2f2f;
    color:#fff;
    font-size:12px;
    line-height:1.5;
    font-weight:500;
    box-shadow:0 10px 26px rgba(0,0,0,.16);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .18s ease, transform .18s ease, visibility .18s ease;
    z-index:20;
    text-align:left;
  }

  .export-tooltip::after{
    content:"";
    position:absolute;
    left:50%;
    top:100%;
    transform:translateX(-50%);
    border:6px solid transparent;
    border-top-color:#2f2f2f;
  }

  .export-help:hover .export-tooltip,
  .export-help:focus-within .export-tooltip{
    opacity:1;
    visibility:visible;
    transform:translateX(-50%) translateY(0);
  }
  
  .export-tooltip {
  max-width: min(260px, calc(100vw - 24px));
}

.export-buttons .export-format-wrap:nth-child(2) .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3) .export-tooltip {
  left: auto;
  right: 0;
  transform: translateY(4px);
}

.export-buttons .export-format-wrap:nth-child(2) .export-tooltip::after,
.export-buttons .export-format-wrap:nth-child(3) .export-tooltip::after {
  left: auto;
  right: 8px;
  transform: none;
}

.export-buttons .export-format-wrap:nth-child(2):hover .export-tooltip,
.export-buttons .export-format-wrap:nth-child(2):focus-within .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3):hover .export-tooltip,
.export-buttons .export-format-wrap:nth-child(3):focus-within .export-tooltip {
  transform: translateY(0);
}

  @media (max-width: 768px) {
.user-svg-bg-lock,
.template-bg-lock {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 12px auto 0 !important;
  justify-content: center !important;
}
    
      #userSvgPreviewSurface {
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    overflow: hidden;
  }

  #userSvgPreviewSurface > svg {
    width: 100%;
    height: 100%;
    display: block;
  }

    .export-tooltip{
      left:auto;
      right:0;
      transform:translateY(4px);
    }

    .export-tooltip::after{
      left:auto;
      right:8px;
      transform:none;
    }

    .export-help:hover .export-tooltip,
    .export-help:focus-within .export-tooltip{
      transform:translateY(0);
    }
  }

/* ===== Palette strip redesign final override ===== */

.palette-strip-fullwidth {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: 0;
  padding: 0 3px;
  box-sizing: border-box;
}

.palette-strip-fullwidth .color-strip {
  display: flex;
  align-items: stretch;
  width: 100%;
  padding: 0;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  overflow: visible;
  gap: 3px;
}

.palette-strip-fullwidth .swatch-wrap {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(360px, 56vh) 86px;
  gap: 0;
  margin: 0;
  padding-bottom: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #ffffff;
}

.palette-strip-fullwidth .swatch-wrap:last-child {
  border-right: 0;
}

.palette-strip-fullwidth .color-swatch {
  width: 100%;
  height: 100%;
  min-height: 360px;
  box-shadow: none;
  border-radius: 12px;
}

.palette-strip-fullwidth .swatch-lock {
  width: 100%;
  height: 86px;
  padding: 14px 10px 12px;
  background: #f8fafc;
  color: #0f172a;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  cursor: default;
  overflow: hidden;
  border-radius: 12px;
  margin-top: 3px;
}

.palette-strip-fullwidth .swatch-lock:hover {
  background: #f8fafc;
}

.palette-strip-fullwidth .swatch-lock.active {
  background: #ffffff;
  color: #9aa3b2;
}

.palette-strip-fullwidth .swatch-lock__icon {
  display: none;
  width: 16px;
  height: 16px;
  justify-self: end;
  opacity: 0.9;
}

.palette-strip-fullwidth .swatch-lock:not(.active) .icon-unlock {
  display: block;
}

.palette-strip-fullwidth .swatch-lock:not(.active) .swatch-lock__button:hover .icon-unlock {
  display: none;
}

.palette-strip-fullwidth .swatch-lock:not(.active) .swatch-lock__button:hover .icon-lock-on {
  display: block;
}

.palette-strip-fullwidth .swatch-lock.just-unlocked .swatch-lock__button:hover .icon-lock-on {
  display: none;
}

.palette-strip-fullwidth .swatch-lock.just-unlocked .swatch-lock__button:hover .icon-lock-off {
  display: block;
  opacity: 1;
}

.palette-strip-fullwidth .swatch-lock.active .icon-lock-black {
  display: block;
  opacity: 1;
}

.palette-strip-fullwidth .swatch-lock.active.just-locked .swatch-lock__button:hover .icon-lock-black {
  display: block;
}

.palette-strip-fullwidth .swatch-lock.active.just-locked .swatch-lock__button:hover .icon-lock-off {
  display: none;
}

.palette-strip-fullwidth .swatch-lock.active:not(.just-locked) .swatch-lock__button:hover .icon-lock-black {
  display: none;
}

.palette-strip-fullwidth .swatch-lock.active:not(.just-locked) .swatch-lock__button:hover .icon-lock-off {
  display: block;
  opacity: 1;
}

.palette-strip-fullwidth .swatch-lock__content {
  min-width: 0;
  display: grid;
  gap: 5px;
  text-align: center;
  justify-self: center;
}

.palette-strip-fullwidth .swatch-lock__name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0f172a;
  white-space: nowrap;
}

.palette-strip-fullwidth .swatch-lock__hex {
  display: block;
  font-size: 13px;
  line-height: 1.1;
  font-weight: 400;
  color: #64748b;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.palette-strip-fullwidth .swatch-lock.active .swatch-lock__name,
.palette-strip-fullwidth .swatch-lock.active .swatch-lock__hex {
  color: #9aa3b2;
}

@media (max-width: 640px) {

  .palette-strip-fullwidth .swatch-wrap {
    grid-template-rows: minmax(300px, 52vh) 68px;
  }


  .palette-strip-fullwidth .swatch-lock {
    height: 68px;
    padding: 10px 6px;
    gap: 5px;
  }

  .palette-strip-fullwidth .swatch-lock__icon {
    width: 14px;
    height: 14px;
  }

  .palette-strip-fullwidth .swatch-lock__name {
    font-size: 11px;
  }

  .palette-strip-fullwidth .swatch-lock__hex {
    font-size: 10px;
  }
}

/* ===== History redesign ===== */

.history-bar--empty .history-nav-btn,
.history-bar--empty .history-thumbs {
  opacity: 1;
  pointer-events: auto;
}

.history-bar {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.history-thumbs {
  width: 0;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 2px 1px 4px;
  scrollbar-width: none;
}

.history-thumbs::-webkit-scrollbar {
  display: none;
}

.history-thumb {
  flex: 0 0 auto;
  width: max-content;
  min-width: 0;
  min-height: 60px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #ffffff;
  display: grid;
  gap: 7px;
  cursor: pointer;
  box-shadow: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.history-thumb:hover {
  background: #f4f5f7;
  border-color: transparent;
  box-shadow: none;
}

.history-thumb:active {
  background: #ffffff;
  border-color: #e3e3e3;
  box-shadow: none;
}

.history-thumb.active {
  background: #ffffff;
  border-color: #e8e8e8;
  box-shadow: none;
}

.history-thumb__strip {
  height: 28px;
  display: flex;
  align-items: stretch;
  width: max-content;
  min-width: 100%;
  overflow: hidden;
  border-radius: 6px;
}

.history-thumb-swatch {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.history-thumb__meta {
  display: flex;
  align-items: center;
  min-width: 0;
  color: #66748a;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
}

.history-thumb__date {
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-thumb__sparkle {
  display: none;
}

.history-nav-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border: 0.5px solid transparent;
  border-radius: 999px;
  background: #fafafa;
  color: #3f4654;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-size: 0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease;
}

.history-nav-btn:hover:not(:disabled) {
  background: #f4f5f7;
  border-color: transparent;
  color: #111827;
  box-shadow: none;
}

.history-nav-btn:active:not(:disabled) {
  background: #ffffff;
  border-color: #e3e3e3;
  color: #111827;
  box-shadow: none;
}

.history-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.history-nav-btn svg {
  width: 15px;
  height: 15px;
  display: block;
  stroke-width: 2.6;
}

@media (max-width: 640px) {
  .history-thumbs {
    gap: 8px;
    padding-bottom: 4px;
  }

.history-thumb {
  width: max-content;
  min-width: 0;
  min-height: 0;
  padding: 6px;
  border-radius: 9px;
  gap: 6px;
}

.history-thumb__strip {
  height: 24px;
  min-width: 0;
  border-radius: 5px;
}

.history-thumb-swatch {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

  .history-thumb__meta {
    font-size: 8px;
  }

  .history-nav-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .history-nav-btn svg {
    width: 13px;
    height: 13px;
  }
}



/* ===== Palette mode settings: harmony + mood ===== */

.palette-mode-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 44px;
}

.palette-mode-card {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.palette-mode-card--harmony,
.palette-mode-card--mood,
.palette-seed-card,
.palette-adjust-card,
.palette-tonal-card,
.palette-sort-card,
.svg-preview-panel,
.svg-preview-tools,
.export-share-download,
.export-share-link {
  display: grid;
  grid-template-rows: 44px auto;
  row-gap: 16px;
  align-content: start;
}

.palette-mode-card--harmony .palette-mode-card__header,
.palette-mode-card--mood .palette-mode-card__header,
.palette-seed-card .palette-mode-card__header,
.palette-adjust-card .palette-mode-card__header,
.palette-tonal-card .palette-mode-card__header,
.palette-sort-card .palette-mode-card__header,
.svg-preview-panel .svg-preview-header,
.svg-preview-tools .svg-preview-tools__header,
.export-share-download > .palette-mode-card__title,
.export-share-link > .palette-mode-card__title {
  height: 44px;
  min-height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
}

.palette-mode-card__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}

.palette-mode-card__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #111827;
}

.palette-mode-card__subtitle {
  margin: -6px 0 14px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  color: #8b95a7;
}


.palette-mode-toggle {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.palette-mode-toggle__text {
  display: inline-flex;
  align-items: center;
  color: #667085;
}

.palette-mode-switch {
  display: inline-block;
  position: relative;
  width: 45px;
  height: 22px;
  flex: 0 0 auto;
}

.palette-mode-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.palette-mode-switch__slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background-color: #4bc05f;
  border-radius: 34px;
  transition: background-color 0.3s ease;
}

.palette-mode-switch__slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.palette-mode-switch input:checked + .palette-mode-switch__slider {
  background-color: #ca70d4;
}

.palette-mode-switch input:checked + .palette-mode-switch__slider::before {
  transform: translateX(23px);
}

.palette-mode-switch__knob {
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  pointer-events: none;
}

.palette-mode-switch input:checked ~ .palette-mode-switch__knob {
  transform: translateX(23px) translateY(-50%);
}

.palette-mode-seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: 0;
}

.palette-mode-seg button {
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: #fafafa;
  color: #3f4654;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.palette-mode-seg button:hover {
  background: #f4f5f7;
}

.palette-mode-seg button.active {
  background: #ffffff;
  border: 0;
  box-shadow: inset 0 0 0 1px #e3e3e3;
  color: #111827;
}

@media (max-width: 900px) {
  .palette-mode-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 640px) {
  .palette-mode-grid {
    margin-top: 20px;
    gap: 24px;
  }

.palette-mode-card__header {
    align-items: center;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
  }

  .palette-mode-seg {
    gap: 8px;
  }

  .palette-mode-seg button {
    height: 38px;
    padding: 0 13px;
    border-radius: 10px;
    font-size: 12px;
  }
}


/* ===== Palette color settings ===== */

.palette-seed-card {
  width: 100%;
  max-width: none;
}

.palette-seed-layout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.palette-seed-field {
  width: auto;
  min-width: 0;
  max-width: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex: 0 0 auto;
  overflow: visible;
}

.palette-seed-field #seedColor {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.palette-seed-label {
  color: #3f4654;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  white-space: nowrap;
}

.palette-seed-preview {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: none;
  flex: 0 0 auto;
}

.palette-seed-input {
  width: auto;
  min-width: 0;
  max-width: none;
  border: 0;
  background: transparent;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  outline: none;
  text-transform: uppercase;
}

.palette-seed-mode-seg {
  flex: 0 0 auto;
  gap: 10px;
}

.palette-seed-random {
  height: 46px;
  padding: 0 22px;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.palette-seed-random:hover {
  background: #f4f5f7;
}

.palette-seed-random:active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3e3e3;
}

.palette-seed-random .btn-icon {
  width: 16px;
  height: 16px;
}


/* ===== SVG preview redesign ===== */

.svg-preview-section {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.svg-preview-panel,
.svg-preview-tools {
  min-width: 0;
}

.svg-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 0;
}

.svg-preview-file-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


.svg-preview-surface > svg {
  width: 100%;
  height: 100%;
  display: block;
}

.svg-preview-surface {
  position: relative;
  width: 100%;
  min-height: 520px;
  border: 1px dashed #d8dee8;
  border-radius: 22px;
  background-color: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.svg-preview-surface:has(.svg-preview-empty)::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 18px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.90)),
    url("/images/uploade-template-preview.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.svg-preview-surface > svg {
  position: relative;
  z-index: 1;
}

.svg-preview-surface > svg {
  width: 100%;
  height: 100%;
  display: block;
}

.svg-preview-empty {
  width: 100%;
  min-height: 520px;
  padding: 44px 40px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  color: #64708a;
  background: transparent;
  position: relative;
  z-index: 1;
}

.svg-preview-empty__cloud {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #f7f8fb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.svg-preview-empty__cloud-icon {
  width: 24px;
  height: 24px;
  display: block;
  opacity: 0.9;
}

.svg-preview-empty__button {
  height: 46px;
  padding: 0 22px;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.svg-preview-empty__button:hover {
  background: #f4f5f7;
}

.svg-preview-empty__button:active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3e3e3;
}

.svg-preview-empty__button-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.svg-preview-empty__text {
  max-width: 460px;
  margin-top: 4px;
  color: #64708a;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 500;
}

.svg-preview-empty__note {
  max-width: 420px;
  color: #8a94a8;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
}

.svg-preview-tools__header {
  margin-bottom: 0;
}

.svg-preview-tools__row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 44px;
}

.svg-preview-rotate {
  min-width: 0;
}

.svg-preview-lock-toggle {
  height: 44px;
  padding: 0 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
  color: #667085;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
}

.svg-preview-lock-toggle .palette-mode-toggle__text {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.svg-preview-locks {
  display: grid;
  gap: 16px;
}

.svg-preview-locks__title {
  margin: 0;
  color: #999;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.preview-color-locks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.preview-color-lock {
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: #fafafa;
  color: #3f4654;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.preview-color-lock:hover {
  background: #f4f5f7;
}

.preview-color-lock:active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3e3e3;
}

.preview-color-lock__dot {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-color-lock__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-color-lock__icon {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex: 0 0 auto;
  opacity: 0.55;
}

.preview-color-lock.is-locked .preview-color-lock__icon {
  opacity: 0.85;
}

/* ===== Template preview redesign ===== */

.template-preview-section {
  margin-bottom: var(--palette-section-gap);
}

.template-preview-surface {
  position: relative;
  min-height: 520px;
  aspect-ratio: 1 / 1;
  border-style: solid;
  border-color: #e8e8e8;
  background: #f7f8fb;
  isolation: isolate;
}

.template-preview-surface .preview-art,
.template-preview-surface .preview-glow,
.template-preview-surface .preview-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.template-preview-surface .preview-art {
  z-index: 1;
}

.template-preview-surface .preview-glow {
  z-index: 2;
  mix-blend-mode: screen;
  opacity: 0.82;
  background:
    radial-gradient(circle at 18% 16%, rgba(255,255,255,.30), rgba(255,255,255,0) 26%),
    radial-gradient(circle at 78% 28%, rgba(255,255,255,.18), rgba(255,255,255,0) 30%),
    radial-gradient(circle at 52% 82%, rgba(255,255,255,.10), rgba(255,255,255,0) 28%);
}

.template-preview-surface .preview-vignette {
  z-index: 4;
  background:
    radial-gradient(120% 110% at 50% 50%, rgba(255,255,255,0) 42%, rgba(0,0,0,.08) 100%),
    linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 20%, rgba(0,0,0,.02) 100%);
}

.template-preview-legend {
  margin-top: 14px;
}

.template-preview-tools {
  min-width: 0;
}

.template-preview-tools__row {
  margin-bottom: 44px;
}

.template-distribution-tools {
  display: grid;
  gap: 16px;
}

.template-distribution-seg {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.template-distribution-seg button {
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: #fafafa;
  color: #3f4654;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.template-distribution-seg button:hover {
  background: #f4f5f7;
}

.template-distribution-seg button.active {
  background: #ffffff;
  border: 0;
  box-shadow: inset 0 0 0 1px #e3e3e3;
  color: #111827;
}

/* ===== Export & share ===== */

.export-share-buttons,
.export-share-url {
  margin-top: 0;
}

.export-share-section {
  width: 100%;
  max-width: none;
  margin: 0;
}

.export-share-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  margin-top: 0;
}

.export-share-download {
  min-width: 0;
}

.export-share-link {
  min-width: 0;
  padding-left: 44px;
  border-left: 1px solid #e8e8e8;
  display: grid;
  align-content: start;
}

.export-share-subtitle {
  margin: 0 0 16px;
  color: #3f4654;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
}

.export-share-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.export-share-btn {
  height: 46px;
  min-width: 102px;
  padding: 0 22px;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.export-share-btn:hover {
  background: #f4f5f7;
}

.export-share-btn:active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3e3e3;
}

.export-share-btn__icon {
  width: 16px;
  height: 16px;
  display: block;
  flex: 0 0 auto;
}

.export-share-url {
  height: 46px;
  width: 100%;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  background: #ffffff;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
}

.export-share-url__icon {
  width: 18px;
  height: 18px;
  margin-left: 18px;
  display: block;
  flex: 0 0 auto;
}

.export-share-url__input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 16px;
  border: 0;
  outline: none;
  background: transparent;
  color: #3f4654;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 600;
}

.export-share-copy {
  height: 100%;
  min-width: 92px;
  padding: 0 22px;
  border: 0;
  border-left: 1px solid #e8e8e8;
  background: #ffffff;
  color: #111827;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.export-share-copy:hover {
  background: #f4f5f7;
}

.export-share-copy:active {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e3e3e3;
}

.palette-seed-adjust-grid {
  align-items: start;
}

.palette-adjust-card {
  min-width: 0;
}

.palette-adjust-reset {
  height: 34px;
  padding: 0 16px;
  border: 1px solid #e3e3e3;
  border-radius: 999px;
  background: #ffffff;
  color: #667085;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.palette-adjust-reset:hover {
  background: #f8f8f8;
}

.palette-adjust-sliders {
  display: grid;
  gap: 18px;
  margin-top: 0;
}

.palette-adjust-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 16px;
}

.palette-adjust-label {
  color: #344054;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.palette-adjust-value {
  color: #667085;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.palette-adjust-range {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background: #f1f1f1;
  cursor: pointer;
}

.palette-adjust-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #45c463;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.18);
  appearance: none;
  -webkit-appearance: none;
}

.palette-adjust-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #45c463;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.18);
}

@media (max-width: 900px) {
  .palette-adjust-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .palette-adjust-value {
    text-align: left;
  }
}

.template-preview-surface {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: #ffffff;
}

.template-preview-surface > svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
}