:root{--bg:#0f0f12;--panel:#111111;--panel2:#1b1b1b;--stroke:#30303a;--stroke-soft:#24242a;--line:var(--stroke-soft);--badge:var(--panel2);--bar:#1b1b1b;--ink:#e8e8ec;--muted:#b6b6c0;--accent:#6aa3ff;--shadow:0 8px 28px rgba(0,0,0,.4);--headerH:58px}
*{box-sizing:border-box}html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:14px/1.25 system-ui,-apple-system,Segoe UI,Inter,Roboto,Arial}
.app{display:grid;grid-template-rows:auto 1fr;height:100vh}
header{padding:10px 12px;background:transparent;border:0}

/* Palette Grabber Pro top bar look */
.bar{
  display:flex;
  gap:12px;
  align-items:center;
  padding-top:3px;
  padding-bottom:2px;
  padding-left:12px;
  padding-right:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--bar);
  height:100%;
}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brandLogo{width:30px;height:30px;flex:0 0 30px;display:block}
.brandName{font-weight:700;letter-spacing:.10em;text-transform:uppercase;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand small{opacity:.7;font-weight:500}
.header-chips{display:flex;gap:8px;align-items:center;margin-left:12px;flex-wrap:wrap}
.header-actions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.btn{background:var(--panel2);color:var(--ink);border:2px solid #525252;padding:8px 10px;border-radius:12px;cursor:pointer}
.btn.primary{border-color:var(--accent)}
.input{background:#0f0f12;border:1px solid var(--stroke-soft);color:var(--ink);padding:8px 10px;border-radius:12px;min-width:120px}
.chip{padding:3px 6px;border:1px solid var(--stroke-soft);border-radius:999px;background:var(--badge);font-size:11px;color:#bfc3ce;display:inline-flex;align-items:center;white-space:nowrap}

.main{display:grid;grid-template-columns:1fr 320px;gap:12px;padding:12px;min-height:0}
@media (max-width:980px){.main{grid-template-columns:1fr}}
.canvasWrap{height:100%;background:var(--panel);border:1px solid var(--stroke);border-radius:16px;padding:16px;display:flex;flex-direction:column;gap:12px;min-height:0}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;align-items:center;border-bottom:1px dashed var(--stroke-soft);padding-bottom:10px}
.stage{flex:1;min-height:0;background:#0d0d11;border:1px solid var(--stroke);border-radius:14px;position:relative;overflow:hidden}
.stage>svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.stage .hint{position:absolute;inset:auto 0 14px 0;text-align:center;color:var(--muted);font-size:12px;opacity:.8;pointer-events:none}

.sidebar{width:320px;max-width:320px;background:var(--panel);border:1px solid var(--stroke);border-radius:16px;display:flex;flex-direction:column;min-height:0;overflow:auto}
.panel{padding:12px}
.effect{border:1px solid var(--stroke-soft);border-radius:14px;padding:10px;margin-bottom:12px;background:var(--panel2)}
.effect h4{margin:0 0 8px 0;font-size:12px;opacity:.85}
.row{display:flex;align-items:center;gap:8px}
.row label{min-width:120px;opacity:.85}
.row input[type="range"], .row select, .row .input{flex:1;min-width:0}
.note{background:#15151a;border:1px solid var(--stroke-soft);padding:8px 10px;border-radius:10px;color:#d5d5da}
.state{opacity:.7}
.drop{border:1px dashed var(--stroke-soft);border-radius:10px;padding:6px 8px;color:#b9bcc6}

/* Export card + preview */
.effect.export-card{z-index:1}
.export-preview{margin-top:8px;border:1px dashed var(--stroke-soft);border-radius:10px;background:#0f0f12;padding:8px;position:relative}
#exportPreview{width:100%;height:180px;display:block;background:#0c0c10;border-radius:8px}
.export-preview .meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.export-preview .meta .chip{font-size:10px}

/* Magnifier lens */
.preview-lens{
  position:absolute;width:140px;height:140px;border-radius:50%;
  border:1px solid #2a2a35;box-shadow:0 4px 16px rgba(0,0,0,.45),inset 0 0 0 1px rgba(255,255,255,.06);
  overflow:hidden;pointer-events:none;display:none;background:#0b0b11aa
}
.preview-lens svg{width:100%;height:100%;display:block}
.preview-lens::after{content:"";position:absolute;inset:0;border-radius:50%;box-shadow:inset 0 0 18px rgba(0,0,0,.35);pointer-events:none}
/* Cross-browser styling for all <input type="range"> sliders */
input[type="range"]{
  -webkit-appearance: none; /* Safari/Chrome/Opera */
  appearance: none;
  background: transparent;
  height: 28px;            /* gives room for the thumb */
  margin: 0;
  cursor: pointer;
}

/* Track */
input[type="range"]::-webkit-slider-runnable-track{
  height: 6px;
  background: var(--stroke-soft);
  border-radius: 999px;
}
input[type="range"]::-moz-range-track{
  height: 6px;
  background: var(--stroke-soft);
  border-radius: 999px;
}
/* Edge/IE fallback */
input[type="range"]::-ms-track{
  height: 6px;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
input[type="range"]::-ms-fill-lower,
input[type="range"]::-ms-fill-upper{
  background: var(--stroke-soft);
  border-radius: 999px;
}

/* Thumb (the handle) */
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--badge); /* matches your UI */
  margin-top: -6px; /* center the thumb on the 6px track: (18-6)/2 */
}
input[type="range"]::-moz-range-thumb{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--badge);
}
input[type="range"]::-ms-thumb{
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--badge);
}

/* Optional: hover/focus polish */
input[type="range"]:hover::-webkit-slider-thumb{ box-shadow: 0 0 0 3px rgba(106,163,255,.15); }
input[type="range"]:hover::-moz-range-thumb{    box-shadow: 0 0 0 3px rgba(106,163,255,.15); }
input[type="range"]:focus{ outline: none; }


/* === COPYRIGHT LINE === */
.copyright{
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #24242a;
  font-size: 11px;
  color: #8d8d98;
  text-align: center;
}


/* === GREEN MACARONI PALETTE BAR + TITLE OUTPUT CONTROLS === */
.paletteControls{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.paletteScroller{width:100%;overflow-x:auto;overflow-y:hidden;padding:2px 2px 8px;scrollbar-width:thin}
.paletteScroller::-webkit-scrollbar{height:8px}
.paletteScroller::-webkit-scrollbar-thumb{background:#30303a;border-radius:999px}
.paletteScroller::-webkit-scrollbar-track{background:#111116;border-radius:999px}
.paletteGroup{display:flex;align-items:center;gap:8px;flex-wrap:nowrap}
.paletteLabel{font-size:11px;color:var(--muted);letter-spacing:.04em;text-transform:uppercase}
.swatchBtn{width:28px;height:28px;min-width:28px;flex:0 0 auto;border-radius:9px;border:1px solid rgba(255,255,255,.2);background:var(--swatch,#fff);box-shadow:inset 0 0 0 1px rgba(0,0,0,.28);cursor:pointer}
.swatchBtn.activeFill{outline:2px solid var(--accent);outline-offset:2px}
.swatchBtn.activeStroke{box-shadow:inset 0 0 0 3px #0f0f12,0 0 0 2px var(--accent)}
.swatchBtn.transparentSwatch{background-color:#f0f0f0;background-image:linear-gradient(45deg,#d9d9d9 25%,transparent 25%),linear-gradient(-45deg,#d9d9d9 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#d9d9d9 75%),linear-gradient(-45deg,transparent 75%,#d9d9d9 75%);background-size:12px 12px;background-position:0 0,0 6px,6px -6px,-6px 0}
.colorRole{display:flex;align-items:center;gap:6px}
.colorRole strong{font-size:11px;color:var(--muted);font-weight:600}
.stage.bg-transparent{background-color:#f4f4f4;background-image:linear-gradient(45deg,#e1e1e1 25%,transparent 25%),linear-gradient(-45deg,#e1e1e1 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e1e1e1 75%),linear-gradient(-45deg,transparent 75%,#e1e1e1 75%);background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0}
.stage.bg-solid{background:var(--stage-bg,#0d0d11)}
.smallSelect{min-width:92px!important}
.paletteTargetSelect{min-width:150px!important;border-color:var(--accent)}
.paletteImportBtn{font-size:12px}
.swatchBtn.activeTarget{outline:2px solid var(--accent);outline-offset:2px}
#word{min-width:260px;resize:vertical;min-height:38px;max-height:86px}
@media (max-width:720px){.ecoPaletteBar{margin:0 12px 10px}.paletteControls{align-items:flex-start}.swatchBtn{width:26px;height:26px;min-width:26px}.row label{min-width:96px}}


/* =========================================================
   === R10 PALETTE SCROLL CONTAINMENT FIX ==================
   ========================================================= */


.paletteControls{
  width:100%;
  max-width:100%;
  min-width:0;
}

.paletteScroller{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
}

#paletteSwatches.paletteGroup{
  display:flex;
  flex-wrap:nowrap;
  width:max-content;
  max-width:none;
}

.swatchBtn{
  flex:0 0 auto;
}

/* Softer transparent checkerboard */
.stage.bg-transparent{
  background-color:#f7f7f7;
  background-image:
    linear-gradient(45deg,#ededed 25%,transparent 25%),
    linear-gradient(-45deg,#ededed 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#ededed 75%),
    linear-gradient(-45deg,transparent 75%,#ededed 75%);
  background-size:18px 18px;
  background-position:0 0,0 9px,9px -9px,-9px 0;
}

/* PNG output size controls */
.pngSizeControls{
  margin-top:6px;
}

#pngDimInfo{
  opacity:.82;
}


/* =========================================================
   === R11 APP GRID + PALETTE BAR RESTORE ==================
   ========================================================= */

/* The app now has: header, palette bar, main workspace. */
.app{
  grid-template-rows:auto auto 1fr;
}

/* Keep the palette inside the viewport instead of letting the long swatch row widen the page. */
/* === ECO PALETTE BAR (CONSOLIDATED) === */

.ecoPaletteBar{
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;

  width:auto;
  max-width:calc(100vw - 24px);
  min-width:0;
  
  margin-top:0px;
  margin-right:12px;
  margin-bottom:0px; /* ← reduced as requested */
  margin-left:12px;

  padding-top:10px;
  padding-right:12px;
  padding-bottom:2px; /* final compact palette bar padding */
  padding-left:12px;

  border:1px solid var(--line);
  border-radius:14px;
  background:var(--bar);

  overflow:hidden;
}

.paletteControls{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  width:100%;
  max-width:100%;
  min-width:0;
}

.paletteScroller{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:hidden;
  white-space:nowrap;
  padding:2px 2px 8px;
}

#paletteSwatches.paletteGroup{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:nowrap;
  width:max-content;
  max-width:none;
  min-width:0;
}

.swatchBtn{
  flex:0 0 auto;
}

/* Make the PNG scale selector readable beside the calculated dimensions. */
#pngScale{
  flex:0 0 76px;
  width:76px;
  min-width:76px;
}

.pngSizeControls .input{
  flex:0 0 auto;
}

/* All Caps button beside Align. */
#allCapsBtn{
  min-height:36px;
  white-space:nowrap;
}

/* =========================================================
   === R12 TINY UI TIDY PASS ===============================
   ========================================================= */

/* Keep PNG dimensions readable without the row label shoving it off-canvas. */
.pngSizeControls label{
  flex:0 0 60px;
  min-width:60px;
}

#pngDimInfo{
  flex:1 1 auto;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Swatch file status chip beside the drag/drop tip. */
.swatchInfoChip{
  max-width:360px;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Reversible All Caps toggle state. */
#allCapsBtn.active,
#titleCaseBtn.active{
  border-color:var(--accent);
  color:var(--accent);
  box-shadow:0 0 0 2px rgba(106,163,255,.12);
}

/* === STROKE WIDTH VALUE STABILITY FIX === */
#strokeWidthVal {
  display: inline-block;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}


/* =========================================================
   === R14 TITLE CASE + SWATCH SPACING POLISH ==============
   ========================================================= */

.toolbar{
  padding-bottom:4px;
}

.paletteScroller{
  padding:4px 6px 14px;
  padding-top:4px;
  padding-right:6px;
  padding-bottom:14px;
  padding-left:6px;
  scrollbar-gutter:stable;
}

.swatchBtn.active,
.swatchBtn.activeTarget,
.swatchBtn.activeFill{
  outline:2px solid var(--accent);
  outline-offset:2px;
}


/* === LIVE COLORS === */

.liveColorStrip{
  display:flex;
  align-items:center;
  gap:10px;
}

.liveColorLabel{
  font-size:11px;
  color:var(--muted);
  font-weight:600;
  white-space:nowrap;
}

.liveColorBtn{
  width:28px;
  height:28px;
  min-width:28px;
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:9px;
  border:1px solid rgba(255,255,255,.2);
  background:var(--live-color,#fff);
  color:#ffffff;
  font-size:11px;
  font-weight:800;
  text-shadow:0 1px 2px rgba(0,0,0,.85),0 0 3px rgba(0,0,0,.85);
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.28);
  cursor:pointer;
}

.liveColorBtn.activeLiveColor{
  outline:2px solid var(--accent);
  outline-offset:2px;
}

@media (max-width:720px){
  .liveColorBtn{
    width:26px;
    height:26px;
    min-width:26px;
  }
}


/* === COLOR MIXER === */

.rainbowBtn {
  /* background: linear-gradient(90deg,
    #ff4d4d, #ff9a3c, #ffd93c, #6aff6a, #3cd9ff, #7a6aff, #ff6ad5);
  color: #000; */
  font-weight: 600;
}

.colorMixerModal {
  position: fixed;
  inset: 0;
  background: transparent; /* keep the live preview visible while mixing */
  display: none;
  z-index: 9999;
  pointer-events: none; /* only the floating mixer panel catches clicks */
}

.colorMixerPanel {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  background: #111116;
  border: 1px solid #30303a;
  padding: 16px;
  border-radius: 12px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.35),
    0 12px 42px rgba(0,0,0,.72),
    0 0 32px rgba(0,0,0,.52);
}

.colorMixerPanel h3 {
  margin: 0;
  cursor: move;
  user-select: none;
}

.mixerPreview {
  height: 40px;
  border-radius: 6px;
  border: 1px solid #30303a;
}

.mixerActions {
  display: flex;
  gap: 8px;
}

/* === ADD CONFIRMATION CHECK === */

.addCheck {
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.addCheck.show {
  opacity: 1;
}

