:root{
  --gap: 10px;
  --outer: 10px;
  --bg: #f6f1e6;
}

html, body {
  height: 100%;
  margin: 0;
  background: #f8f8f8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-header {
  text-align: center;
  margin-bottom: 24px;
}

.site-header-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.site-header-heading {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0 0 10px;
  line-height: 1.1;
  background: linear-gradient(135deg, #110623 0%, #4a4a4a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header-subtitle {
  font-size: 18px; color: #666; font-weight: 400; letter-spacing: .2px;
  margin: 0;
}

#wrap{
  height: 100vh;
  box-sizing: border-box;
}

#board{
  height: 100vh;
  box-sizing: border-box;
  padding: var(--outer);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  overflow: hidden; /* no scrolling */
}

.row{
  display: flex;
  gap: var(--gap);
  width: 100%;
  align-items: stretch;
  justify-content: center;
}

.item{
  overflow: hidden;
  border-radius: 10px;
  background: transparent;
  flex: 0 0 auto;
  cursor: grab;
  transition: opacity .15s ease, transform .15s ease, box-shadow .15s ease;
}

.item.dragging{
  opacity: .35;
  transform: scale(.97);
  cursor: grabbing;
}

.item.drag-over{
  box-shadow: 0 0 0 3px #6c47ff, 0 4px 24px rgba(108,71,255,.25);
  transform: scale(1.03);
}

.item img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* ====== Center Button ====== */
#pickerOverlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

#btnPick{
  pointer-events: auto;
  appearance: none;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  padding: 14px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.10);
}

#btnPick:active{ transform: translateY(1px); }

.pickerBox{
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

#privacyNote{
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(0,0,0,0.45);
  z-index: 60;
  margin: 0;
}

#usageHint{
  pointer-events: none;
  max-width: min(560px, calc(100vw - 40px));
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: .2px;
  color: #888888;
  padding-top: 20px;
  margin: 0;
}

.hidden{ display: none !important; }

/* ====== Lightbox (no close icon) ====== */
#lightbox{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#lightbox.open{ display: flex; }

#lightboxInner{
  position: relative;
  max-width: min(92vw, 1400px);
  max-height: 90vh;
  border-radius: 14px;
  overflow: visible;
  box-shadow: none;
  background: transparent;
  transform: scale(0.98);
  opacity: 0;
  transition: transform .16s ease, opacity .16s ease;
}

#lightbox.open #lightboxInner{
  transform: scale(1);
  opacity: 1;
}

#lightboxContent{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  box-sizing: border-box;
}

#lightboxImg{
  display: block;
  width: 100%;
  height: 100%;
  max-width: min(92vw, 1400px);
  max-height: calc(90vh - 18px);
  object-fit: contain;
  background: transparent;
  border-radius: 4px;
}

#lightboxCaption{
  font-size: 11px;
  line-height: 1.2;
  color: rgb(255 255 255 / 44%);
  text-align: center;
  letter-spacing: 0.01em;
  user-select: none;
}


/* ============================================================
   RESPONSIVE — Tablet landscape  (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  :root {
    --gap: 8px;
    --outer: 8px;
  }

  .site-header-heading {
    font-size: 38px;
    letter-spacing: -1px;
  }

  .site-header-subtitle {
    font-size: 16px;
  }
}


/* ============================================================
   RESPONSIVE — Tablet portrait  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --gap: 6px;
    --outer: 12px;
  }

  .site-header {
    margin-bottom: 20px;
    padding: 0 16px;
  }

  .site-header-title {
    gap: 10px;
    flex-wrap: wrap;
  }

  .site-header-logo {
    height: 48px;
  }

  .site-header-heading {
    font-size: 32px;
    letter-spacing: -0.8px;
    margin: 0 0 8px;
  }

  .site-header-subtitle {
    font-size: 15px;
  }

  #btnPick {
    font-size: 15px;
    padding: 13px 20px;
    border-radius: 12px;
  }

  #usageHint {
    font-size: 13px;
    padding-top: 14px;
  }

  #privacyNote {
    font-size: 12px;
    bottom: 16px;
    padding: 0 16px;
  }

  .item {
    border-radius: 8px;
  }

  #lightbox {
    padding: 16px;
  }

  #lightboxImg {
    max-height: calc(90vh - 14px);
  }
}


/* ============================================================
   RESPONSIVE — Phone  (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  :root {
    --gap: 5px;
    --outer: 10px;
  }

  .site-header {
    margin-bottom: 16px;
    padding: 0 12px;
  }

  .site-header-title {
    flex-direction: column;
    gap: 8px;
  }

  .site-header-logo {
    height: 40px;
  }

  .site-header-heading {
    font-size: 26px;
    letter-spacing: -0.5px;
    margin: 0 0 6px;
    text-align: center;
  }

  .site-header-subtitle {
    font-size: 14px;
    line-height: 1.4;
  }

  .pickerBox {
    gap: 8px;
    padding: 0 12px;
  }

  #btnPick {
    font-size: 15px;
    padding: 14px 24px;
    border-radius: 12px;
    width: 100%;
    max-width: 280px;
  }

  #usageHint {
    font-size: 13px;
    padding-top: 12px;
    line-height: 1.45;
  }

  #privacyNote {
    font-size: 11px;
    bottom: 14px;
    padding: 0 20px;
    line-height: 1.4;
  }

  .item {
    border-radius: 6px;
  }

  #lightbox {
    padding: 12px;
  }

  #lightboxImg {
    max-height: calc(88vh - 14px);
  }

  #lightboxCaption {
    font-size: 10px;
  }
}


/* ============================================================
   RESPONSIVE — Small phone  (≤ 360px)
   ============================================================ */
@media (max-width: 360px) {
  :root {
    --gap: 4px;
    --outer: 8px;
  }

  .site-header-logo {
    height: 34px;
  }

  .site-header-heading {
    font-size: 22px;
    letter-spacing: -0.3px;
  }

  .site-header-subtitle {
    font-size: 13px;
  }

  #btnPick {
    font-size: 14px;
    padding: 13px 20px;
    max-width: 260px;
  }

  #usageHint {
    font-size: 12px;
  }

  #privacyNote {
    font-size: 11px;
    bottom: 10px;
  }
}


/* ====== Extracted inline styles ====== */
.site-header-logo {
  height: 64px;
  max-height: 64px;
  width: auto;
  display: block;
  padding-bottom: 11px;
  flex-shrink: 0;
}

.usage-hint-icon {
  display: inline-block;
  vertical-align: -2px;
  margin-right: 5px;
  opacity: 0.75;
}


/* ============================================================
   PALETTE STUDIO
   ============================================================ */

/* Reset */
* {
  box-sizing: border-box;
}

/* Body additions for palette page */
body {
  width: 100%;
  color: #1a1a1a;
  line-height: 1.6;
  background: linear-gradient(158deg, #ffffff 40%, #f8f8f8 100%);
  background-attachment: fixed;
}

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html, body {
      width: 100%;
      height: 100%;
    }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      background: linear-gradient(158deg, #ffffff 40%, #f8f8f8 100%);
      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;
      padding: 48px 32px;
    }

    /* ============ HEADER ============ */
    .header {
      margin-bottom: 56px;
      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;
      display: inline-flex;
      align-items: center;
      gap: 12px;
      justify-content: center;
    }

    .header-subtitle {
      font-size: 16px;
      color: #666;
      font-weight: 400;
      letter-spacing: 0.2px;
    }

    /* ============ CONTROLS SECTION ============ */
    .controls-section {
      background: white;
      border-radius: 20px;
      padding: 32px;
      margin-bottom: 40px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .controls-label {
      display: block;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: #999;
      margin-bottom: 16px;
    }

    .controls {
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
      align-items: center;
    }

    .controls .spacer {
      flex: 1;
      min-width: 12px;
    }

    /* ============ FILE INPUT ============ */
    input[type="file"] {
      display: none;
    }

    .file-btn {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      height: 48px;
      padding: 0 24px;
      background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
      color: white;
      border: none;
      border-radius: 12px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
    }

    .file-btn::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 0;
      height: 0;
      background: rgba(255, 255, 255, 0.15);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      transition: width 0.6s, height 0.6s;
    }

    .file-btn:hover::before {
      width: 300px;
      height: 300px;
    }

    .file-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

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

    .file-btn svg {
      width: 18px;
      height: 18px;
      opacity: 0.95;
    }

    /* ============ SEGMENTED CONTROL ============ */
    .seg {
      display: flex;
      background: #f5f5f5;
      border-radius: 10px;
      padding: 4px;
      gap: 0;
      border: 1px solid #e8e8e8;
    }

    .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 0.25s ease;
      white-space: nowrap;
    }

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

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

    /* ============ TOGGLE SWITCH ============ */
    .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 0.25s ease;
      user-select: none;
    }

    .toggle:hover {
      background: #fafafa;
      border-color: #d8d8d8;
    }

    .toggle input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }

    .toggle .track {
      width: 48px;
      height: 28px;
      background: #10b981; /* always green */
      border-radius: 999px;
      position: relative;
      transition: background 0.3s ease;
      flex-shrink: 0;
    }

    .toggle .thumb {
      position: absolute;
      width: 24px;
      height: 24px;
      background: white;
      border-radius: 999px;
      top: 2px;
      left: 2px;
      transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }

    /* Track stays green even when unchecked */
    .toggle input:checked + .track {
      background: #10b981;
    }

    .toggle input:checked + .track .thumb {
      left: 22px;
    }

    /* ============ SLIDER PILL ============ */
    .pill {
      display: flex;
      align-items: center;
      gap: 12px;
      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: none;
      border-radius: 2px;
      background: linear-gradient(to right, #ddd 0%, #ddd 100%);
      outline: none;
      -webkit-appearance: none;
      appearance: none;
      cursor: pointer;
    }

    .pill input[type="range"]::-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, 0.15);
      border: 2px solid #1a1a1a;
      transition: all 0.2s ease;
    }

    .pill input[type="range"]::-webkit-slider-thumb:hover {
      transform: scale(1.15);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .pill input[type="range"]::-moz-range-thumb {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      border: 2px solid #1a1a1a;
      transition: all 0.2s ease;
    }

    .pill input[type="range"]::-moz-range-thumb:hover {
      transform: scale(1.15);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .pill .value {
      font-variant-numeric: tabular-nums;
      min-width: 28px;
      text-align: right;
      font-weight: 700;
    }

    /* ============ PRIMARY BUTTON ============ */
    .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;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
      overflow: hidden;
      letter-spacing: 0;
    }

    .btn-primary::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 0;
      height: 0;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      transition: width 0.6s, height 0.6s;
    }

    .btn-primary:hover:not(:disabled)::before {
      width: 300px;
      height: 300px;
    }

    .btn-primary:hover:not(:disabled) {
      transform: translateY(-3px);
      box-shadow: 0 8px 28px rgba(16, 185, 129, 0.4);
    }

    .btn-primary:active:not(:disabled) {
      transform: translateY(-1px);
    }

    .btn-primary:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }


    /* Button icon + label layout */
    .btn-primary{
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      }
    .btn-primary .btn-icon{
      width: 18px;
      height: 18px;
      display: block;
      flex: 0 0 auto;
    }

    /* ============ MAIN CONTENT LAYOUT ============ */
    /*
      Match the original "Palette New" layout from the screenshot:
      small thumbnail column on the left, wide palette/tools column on the right.
    */
    .main-grid {
      display: grid;
      grid-template-columns: 360px 1fr;
      gap: 40px;
      align-items: start;
    }

    @media (max-width: 1200px) {
      .main-grid {
        grid-template-columns: 1fr;
        gap: 32px;
      }
    }

    /* ============ PREVIEW CARD ============ */
    .preview-card {
      background: white;
      border-radius: 20px;
      padding: 32px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .card-label {
      display: block;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: #999;
      margin-bottom: 20px;
    }

    canvas#photo {
      width: 100%;
      border-radius: 16px;
    }

    /* ============ PALETTE CARD ============ */
    .palette-card {
      background: white;
      border-radius: 20px;
      padding: 32px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
      border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .palette-grid {
      display: grid;
      gap: 24px;
    }

    


    .extras-title {
      display: block;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: #999;
      margin: 0 0 14px 0;
    }

/* ============ COLOR STRIP ============ */
    .color-strip {
      /* Stretch swatches to fill the whole row, like in the old file */
      display: flex;
      align-items: stretch;
      gap: 8px;
      padding: 16px;
      background: #f9f9f9;
      border-radius: 16px;
      border: 1px solid #e8e8e8;
      width: 100%;
      height: 98px;
    }

    .color-swatch {
      flex: 1 1 0;
      min-width: 28px;
      height: 64px;
      border-radius: 14px;
      border: 1px solid rgba(0, 0, 0, 0.08);
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      position: relative;
      overflow: hidden;
    }

    .color-swatch::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 100%);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .color-swatch:hover {
      transform: translateY(-6px);
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    }

    .color-swatch:hover::after {
      opacity: 1;
    }

    .color-swatch:active {
      transform: translateY(-2px);
    }

    /* ============ DOMINANCE BAR ============ */
    .dominance-bar {
      display: flex;
      height: 48px;
      border-radius: 12px;
      overflow: hidden;
      border: 1px solid #e8e8e8;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    .dominance-segment {
      flex: 0 0 auto;
      height: 100%;
      position: relative;
      transition: flex 0.3s ease;
      border-right: 1px solid rgba(255, 255, 255, 0.4);
    }

    .dominance-segment:last-child {
      border-right: none;
    }

    /* ============ EXPORT BUTTONS ============ */
    .export-section {
      margin-top: 24px;
    }

    .export-buttons {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }

    .btn-export {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      height: 44px;
      padding: 0 18px;
      background: white;
      border: 1.5px solid #e8e8e8;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 600;
      color: #1a1a1a;
      cursor: pointer;
      transition: all 0.25s ease;
      white-space: nowrap;
    }

    .btn-export:hover:not(:disabled) {
      background: #f5f5f5;
      border-color: #d8d8d8;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .btn-export:active:not(:disabled) {
      transform: translateY(0);
    }

    .btn-export:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .btn-export svg {
      width: 16px;
      height: 16px;
      opacity: 0.7;
    }

    
    /* ============ CODES HEADER ============ */
    .codes-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 16px;
      width: 100%;
    }

    .codes-sort-links {
      display: flex;
      gap: 0;
      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 0.2s ease;
    }

    .codes-sort-link:hover {
      color: #666;
    }

    .codes-sort-link.active {
      color: #1a1a1a;
      text-decoration: underline;
      text-underline-offset: 3px;
    }

    .codes-sort-sep {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1.2px;
      color: #bbb;
      margin: 0 10px;
      user-select: none;
    }

    /* ============ COLOR CODES SECTION (Legacy buttons) ============ */
    .codes-section { margin-top: 28px; }

    /* match old grid behavior */
    .details{
      display:grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
    }
    @media (max-width: 1200px){
      .details{ grid-template-columns: 1fr; }
    }

    .rowCard{
      background: #fff;
      border: 1px solid #e8e8e8;
      border-radius: 14px;
      overflow:hidden;
      cursor: pointer;
      display:grid;
      grid-template-columns: 56px 1fr;
      min-height: 92px;
      transition: all 0.25s ease;
    }
    .rowCard:hover{
      border-color:#d8d8d8;
      box-shadow: 0 10px 24px rgba(0,0,0,0.08);
      transform: translateY(-2px);
    }
    .rowCard:active{ transform: translateY(0); }

    .miniChip{
      border-right: 1px solid #e8e8e8;
      background: #eee;
    }

    .rowBody{
      padding: 12px 14px;
      display:grid;
      gap: 8px;
      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;
      flex-wrap: nowrap;
      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;
      user-select:none;
      transition: all 0.2s ease;
      width: fit-content;
      max-width: 100%;
    }
    .codeTag:hover{ background: rgba(0,0,0,.04); border-color:#cfcfcf; }
    .codeTag:active{ transform: translateY(1px); }

    .label{
      font-size: 12px;
      font-weight: 800;
      color:#7a7a7a;
      letter-spacing: .02em;
    }
    .mono{
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
      font-size: 12px;
      font-weight: 700;
      color:#7a7a7a;
    }

    /* hide new cards if still present */
    .codes-grid, .color-card{ all: unset; }


    /* ============ MODAL/* ============ MODAL ============ */
    .modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(0, 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, 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;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #1a1a1a;
    }

    .modal-close:hover {
      background: #e8e8e8;
    }

    .modal-body {
      display: grid;
      grid-template-columns: 280px 1fr;
      gap: 40px;
    }

    @media (max-width: 768px) {
      .modal-body {
        grid-template-columns: 1fr;
      }
    }

    /* ============ COLOR WHEEL ============ */
    .wheel-container {
      display: grid;
      gap: 20px;
      justify-items: start;
    }

    .wheel-frame {
      width: 240px;
      height: 240px;
      border-radius: 50%;
      border: 1px solid #e8e8e8;
      background: white;
      overflow: hidden;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    }

    canvas#wheel {
      width: 240px;
      height: 240px;
      display: block;
      cursor: crosshair;
    }

    .value-slider {
      width: 240px;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
      padding: 16px 18px;
      background: #f5f5f5;
      border-radius: 12px;
      border: 1px solid #e8e8e8;
      box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    }

    .value-slider label {
      font-size: 13px;
      font-weight: 700;
      color: #1a1a1a;
      text-align: center;
      letter-spacing: 0.02em;
    }

    .value-row{
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 0;
    }

    .value-slider input[type="range"] {
      flex: 1 1 auto;
      height: 4px;
      border: none;
      border-radius: 2px;
      background: #ddd;
      outline: none;
      -webkit-appearance: none;
      appearance: none;
      cursor: pointer;
      min-width: 0;
    }

    .value-slider input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      border: 2px solid #1a1a1a;
    }

    .value-slider input[type="range"]::-moz-range-thumb {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: white;
      cursor: pointer;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
      border: 2px solid #1a1a1a;
    }

    .value-display {
      font-variant-numeric: tabular-nums;
      font-weight: 800;
      font-size: 14px;
      min-width: 36px;
      text-align: right;
      color: #1a1a1a;
    }

    /* ============ INLINE COLOR PICKER ============ */
    .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;
      flex-shrink: 0;
      box-shadow: 0 2px 8px rgba(0,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,0.4), 0 2px 6px rgba(0,0,0,0.3);
      transform: translate(-50%, -50%);
      pointer-events: none;
      top: 50%; left: 50%;
    }
    #pickerHue {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 16px;
      border-radius: 8px;
      border: none;
      outline: none;
      cursor: pointer;
      background: linear-gradient(to right,
        #ff0000,#ffff00,#00ff00,#00ffff,#0000ff,#ff00ff,#ff0000);
    }
    #pickerHue::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 20px; height: 20px;
      border-radius: 50%;
      background: white;
      border: 2px solid rgba(0,0,0,0.25);
      box-shadow: 0 1px 4px rgba(0,0,0,0.25);
      cursor: pointer;
    }
    #pickerHue::-moz-range-thumb {
      width: 20px; height: 20px;
      border-radius: 50%;
      background: white;
      border: 2px solid rgba(0,0,0,0.25);
      cursor: pointer;
    }
    .picker-rgb-row {
      display: flex;
      gap: 6px;
      align-items: flex-end;
    }
    .picker-rgb-field {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }
    .picker-rgb-input {
      width: 100%;
      height: 34px;
      border: 1.5px solid #e8e8e8;
      border-radius: 8px;
      background: #f9f9f9;
      text-align: center;
      font-size: 13px;
      font-weight: 700;
      font-family: ui-monospace, 'Courier New', monospace;
      color: #1a1a1a;
      outline: none;
      transition: border-color 0.2s;
    }
    .picker-rgb-input:focus { border-color: #aaa; background: white; }
    .picker-rgb-label {
      font-size: 11px;
      font-weight: 700;
      color: #999;
      letter-spacing: 0.5px;
    }

    .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, 0.06);
      background: #fff;
      box-shadow: 0 4px 14px rgba(0, 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-value--static {
      color: #999;
      cursor: default !important;
    }

    .editor-field-value--static:active {
      transform: none !important;
    }

    /* ============ COLOR EDITOR ============ */
    .editor-controls {
      display: grid;
      gap: 20px;
    }

    .editor-field {
      display: grid;
      gap: 12px;
    }

    .editor-field-label {
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #999;
    }

    .current-color-swatch {
      width: 100%;
      height: 64px;
      padding: 0;
      border-radius: 14px;
      border: 1px solid rgba(0, 0, 0, 0.06);
      cursor: pointer;
      background: #fff;
      box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
      outline: none;
    }

    .current-color-swatch:focus-visible {
      box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.10), 0 10px 26px rgba(0, 0, 0, 0.08);
    }

    .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;
    }

    .editor-field-value{ cursor: pointer; }
    .editor-field-value:active{ transform: translateY(1px); }


    .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;
      transition: all 0.2s ease;
      color: #1a1a1a;
    }

    .btn-modal:hover {
      background: #f5f5f5;
      border-color: #d8d8d8;
    }

    .btn-modal.primary {
      background: #1a1a1a;
      color: white;
      border-color: #1a1a1a;
    }

    .btn-modal.primary:hover {
      background: #333;
      border-color: #333;
    }

    /* ============ TOAST ============ */
    .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 0.3s ease;
      z-index: 10000;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }

    .toast.show {
      opacity: 1;
    }

    /* ============ RESPONSIVE ============ */
    @media (max-width: 768px) {
      .wrap {
        padding: 32px 20px;
      }

      .header-title {
        font-size: 36px;
      }

      .controls {
        gap: 12px;
      }

      .controls-section,
      .preview-card,
      .palette-card {
        padding: 24px;
      }

      .modal-content {
        padding: 28px;
      }

      .color-strip {
        padding: 12px;
        gap: 6px;
      }

      .color-swatch {
        height: 56px;
        border-radius: 12px;
      }

      .codes-grid {
        grid-template-columns: 1fr;
      }
    }

    /* ============ FOOTNOTE ============ */
    .privacy-note{
      margin: 22px 0 0;
      text-align: center;
      font-size: 12px;
      color: #8a8a8a;
      letter-spacing: 0.2px;
      padding-bottom: 30px;
    }

/* ============ HEADER LOGO (inline) ============ */
.header-logo {
  height: 1.35em;
  width: auto;
  display: inline-block;
  vertical-align: middle;
  position: relative;
}

/* ============ CARD LABEL MODIFIER ============ */
.card-label--no-mb {
  margin-bottom: 0;
}

/* ============ TOGGLE LABELS ============ */
.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}
