*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1a1a1a 0, #0a0a0a 55%, #050505 100%);
  color: #f5f5f5;
}

.app-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(200,200,208,0.25);
  background: linear-gradient(to right, #080808, #111111);
}

.app-header h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c8c8d0;
}

.app-header .subtitle {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.8;
}

.app-main {
  display: flex;
  gap: 16px;
  padding: 16px 24px 24px;
}

.left-panel,
.right-panel {
  background: rgba(10, 10, 10, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(200,200,208,0.18);
  padding: 16px;
}

.left-panel {
  flex: 0 0 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dropzone {
  border: 1px dashed rgba(200,200,208,0.5);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(14, 14, 14, 0.95);
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.dropzone.dragover {
  border-color: #c8c8d0;
  background: rgba(22, 22, 22, 0.98);
  transform: translateY(-1px);
}

.dropzone p {
  margin: 0 0 4px;
}

.dropzone small {
  opacity: 0.7;
  font-size: 11px;
}

.preview {
  margin-top: 12px;
  max-height: 220px;
  overflow: hidden;
}

.preview img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

.settings-panel,
.tools-panel,
.gradient-panel {
  background: rgba(13, 13, 13, 0.95);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(200,200,208,0.12);
}

.settings-panel h2,
.tools-panel h2,
.gradient-panel h2 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8c8d0;
}

.settings-row,
.tools-row,
.gradient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}

.settings-row label,
.gradient-row label {
  font-size: 12px;
}

.settings-row select {
  background: #0d0d0d;
  color: #f5f5f5;
  border-radius: 4px;
  border: 1px solid rgba(200,200,208,0.4);
  padding: 2px 6px;
  font-size: 12px;
}

.primary-btn,
.secondary-btn,
.tool-btn,
.export-btn {
  border-radius: 6px;
  border: 1px solid rgba(200,200,208,0.5);
  background: linear-gradient(to bottom, #1e1e1e, #111111);
  color: #c8c8d0;
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}

.primary-btn {
  width: 100%;
}

.secondary-btn.small {
  font-size: 11px;
  padding: 4px 8px;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.tool-btn:disabled,
.export-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.primary-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled),
.tool-btn:hover:not(:disabled),
.export-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #2a2a2a, #181818);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(200,200,208,0.3);
}

.tools-row {
  gap: 6px;
}

.tool-btn {
  flex: 1;
}

.gradient-preview {
  margin-top: 6px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(200,200,208,0.4);
  background: #0d0d0d;
}

.gradient-code {
  margin-top: 6px;
  font-size: 11px;
  background: #0d0d0d;
  border-radius: 6px;
  padding: 6px;
  border: 1px solid rgba(200,200,208,0.2);
  max-height: 80px;
  overflow: auto;
}

.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.palette-header h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c8c8d0;
}

.hint {
  font-size: 11px;
  opacity: 0.7;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.swatch {
  background: #0f0f0f;
  border-radius: 8px;
  border: 1px solid rgba(200,200,208,0.18);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}

.swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(200,200,208,0.4);
  border-color: rgba(200,200,208,0.6);
}

.swatch-color {
  height: 60px;
  position: relative;
}

.swatch-meta {
  padding: 7px 9px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.swatch-hex {
  font-family: "Fira Code", monospace;
  font-size: 14px;
  color: #c8c8d0;
}

.swatch-name {
  font-size: 12px;
  opacity: 0.85;
}

.swatch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.swatch-lock {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 2px 6px;
  border: 1px solid rgba(200,200,208,0.4);
  background: rgba(10, 10, 10, 0.9);
  color: #c8c8d0;
  cursor: pointer;
}

.swatch-lock.locked {
  background: rgba(200,200,208,0.15);
  border-color: rgba(200,200,208,0.9);
  color: #c8c8d0;
}

.swatch-contrast {
  font-size: 12px;
  opacity: 0.85;
}

.swatch-contrast span.badge {
  border-radius: 999px;
  padding: 2px 6px;
  border: 1px solid rgba(200,200,208,0.4);
  margin-left: 4px;
}

.export-btn {
  font-size: 11px;
}

.export-btn.figma-btn {
  border-color: rgba(160, 120, 255, 0.6);
  color: #c8aaff;
}
.export-btn.figma-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(160, 120, 255, 0.4);
}

.export-btn.tailwind-btn {
  border-color: rgba(56, 189, 248, 0.6);
  color: #7dd3fc;
}
.export-btn.tailwind-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.library-panel {
  margin-top: 12px;
  background: rgba(13, 13, 13, 0.95);
  border-radius: 8px;
  border: 1px solid rgba(200,200,208,0.18);
  padding: 8px 10px;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library-header h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8c8d0;
}

.library-container {
  margin-top: 8px;
  max-height: 220px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.library-item {
  background: #0d0d0d;
  border-radius: 8px;
  border: 1px solid rgba(200,200,208,0.18);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.library-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.library-title-row input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(200,200,208,0.4);
  color: #c8c8d0;
  font-size: 11px;
  padding: 0 0 1px;
  outline: none;
}

.library-swatches {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}

.library-swatches div {
  flex: 1;
  height: 18px;
  border-radius: 3px;
}

.library-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.library-actions button {
  font-size: 10px;
  padding: 2px 6px;
}

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 10, 10, 0.97);
  color: #c8c8d0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(200,200,208,0.7);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Tablet ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-main { flex-direction: column; padding: 12px; gap: 12px; }
  .left-panel { flex: 0 0 auto; }
  .right-panel { flex: 1; }
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .app-header { padding: 10px 14px; }
  .app-header h1 { font-size: 15px; letter-spacing: 0.08em; }
  .app-header .subtitle { display: none; }
  #shortcutsHint { padding: 6px 10px; font-size: 11px; }

  .app-main { flex-direction: column-reverse; padding: 8px 8px 12px; gap: 10px; }
  .left-panel { flex: 0 0 auto; gap: 10px; padding: 12px; }
  .right-panel { padding: 12px; }

  .dropzone { padding: 20px 12px; min-height: 90px; }
  .dropzone p { font-size: 13px; }
  .dropzone small { font-size: 11px; }

  .palette-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    max-height: none !important;
    overflow-y: visible !important;
    gap: 8px;
  }
  .swatch-color { height: 64px !important; min-height: 64px !important; }
  .swatch-meta { padding: 6px 8px; }
  .swatch-hex { font-size: 12px; }
  .swatch-name { font-size: 10px; }
  .swatch-contrast { font-size: 9px; }
  .swatch-lock { font-size: 9px; padding: 2px 5px; }
  .swatch-expand-btn { font-size: 10px; }

  .palette-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .palette-header > div:last-child { display: flex; gap: 6px; flex-wrap: wrap; }
  .palette-header h2 { font-size: 13px; }
  .hint { font-size: 10px; }

  .action-bar {
    position: sticky;
    bottom: 0;
    z-index: 200;
    background: rgba(6,6,6,0.98);
    border-top: 1px solid rgba(200,200,208,0.2);
    padding: 8px 10px;
    margin: 10px -12px -12px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .action-bar::-webkit-scrollbar { display: none; }
  .action-bar-btn { font-size: 10px; padding: 7px 10px; white-space: nowrap; flex-shrink: 0; }

  .library-container { max-height: 180px; }
  .history-list { max-height: 140px; }

  .color-sidebar { width: 100% !important; border-radius: 0; border-left: none; }

  .tool-btn { font-size: 11px; padding: 7px 8px; }
  .primary-btn { font-size: 12px; padding: 9px 12px; }
  .secondary-btn { font-size: 11px; padding: 5px 10px; }
  .tools-row { flex-wrap: wrap; }
  .tools-row .tool-btn { flex: 1 1 calc(50% - 5px); }

  #scoreWidget { padding: 4px 8px !important; gap: 6px !important; }
  #harmonyBadge { display: none; }
  #scoreTip { left: 0; right: auto; }
}

/* ── Live Preview Overlay ───────────────────────────────────────────── */
.live-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.live-preview-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.live-preview-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.live-preview-title {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(200,200,208,0.7);
  font-weight: 600;
}

.live-preview-close {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(200,200,208,0.4);
  color: #c8c8d0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.live-preview-close:hover {
  background: rgba(200,200,208,0.15);
}

.live-preview-stripes {
  display: flex;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.lp-stripe {
  flex: none;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 48px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: width;
}

.lp-stripe-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 4px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}

.lp-stripe-bottom-hex {
  font-family: "Fira Code", monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
  padding: 0 3px;
  opacity: 0.9;
}

.lp-stripe.flash-copy .lp-stripe-bottom {
  background: linear-gradient(to top, rgba(200,200,208,0.35) 0%, transparent 100%);
  transition: background 0.15s;
}

.lp-stripe-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px) rotate(-90deg);
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  pointer-events: none;
}

.lp-stripe.expanded .lp-stripe-label {
  opacity: 1;
  transform: translateY(-40px) rotate(-90deg);
}

.lp-stripe-hex {
  font-family: "Fira Code", "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.lp-stripe-name {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.75;
}

.lp-stripe-copied {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(0,0,0,0.6);
  padding: 6px 12px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  white-space: nowrap;
}

.lp-stripe-copied.show { opacity: 1; }

@keyframes lp-fadein {
  from { opacity: 0; transform: scaleY(0.96); }
  to   { opacity: 1; transform: scaleY(1); }
}

.lp-stripe { animation: lp-fadein 0.5s ease-out both; }

.export-btn.live-btn {
  border-color: rgba(136, 255, 184, 0.5);
  color: #88ffb8;
}
.export-btn.live-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(136, 255, 184, 0.35);
}
.export-btn.video-btn {
  border-color: rgba(167, 139, 250, 0.5);
  color: #a78bfa;
}
.export-btn.video-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35);
}

.score-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.score-tip-lbl {
  font-size: 11px;
  color: rgba(232,232,232,0.45);
  width: 58px;
  font-family: 'Fira Code', monospace;
}
.score-tip-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.score-tip-fill {
  height: 100%;
  background: #c8c8d0;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.score-tip-pts {
  font-size: 11px;
  color: rgba(232,232,232,0.55);
  font-family: 'Fira Code', monospace;
  width: 30px;
  text-align: right;
}

.video-sheet {
  background: #111;
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUpSheet 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes slideUpSheet {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.vid-style-btn {
  padding: 5px 11px;
  border-radius: 4px;
  border: 1px solid rgba(200,200,208,0.2);
  background: rgba(13,13,13,0.95);
  color: rgba(232,232,232,0.5);
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.vid-style-btn.on, .vid-style-btn:hover {
  border-color: rgba(167,139,250,0.5);
  color: #a78bfa;
  background: rgba(167,139,250,0.08);
}

/* ── Action Bar ──────────────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.action-bar-btn {
  border-radius: 7px;
  border: 1px solid rgba(200,200,208,0.45);
  background: linear-gradient(to bottom, #1e1e1e, #111111);
  color: #c8c8d0;
  font-size: 12px;
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  font-family: inherit;
}

.action-bar-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.action-bar-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #2a2a2a, #181818);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(200,200,208,0.3);
}

.live-preview-btn {
  border-color: rgba(136, 255, 184, 0.5);
  color: #88ffb8;
}
.live-preview-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(136, 255, 184, 0.35) !important;
}

/* ── Export Dropdown ─────────────────────────────────────────────────────── */
.export-dropdown-wrap {
  position: relative;
}

.export-chevron {
  display: inline-block;
  font-size: 10px;
  margin-left: 4px;
  transition: transform 0.2s;
}

.export-chevron.open { transform: rotate(180deg); }

/* ── Export Modal Overlay ── */
.export-modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 99998;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.export-modal-bg.open {
  display: flex;
}
.export-dropdown {
  background: #111;
  border: 1px solid rgba(200,200,208,0.25);
  border-radius: 12px;
  padding: 10px 8px;
  width: 100%;
  max-width: 280px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9);
  animation: dropDown 0.18s ease-out;
}

@keyframes dropDown {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.export-cat-label {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(232, 232, 232, 0.35);
  padding: 8px 10px 4px;
  margin-top: 2px;
}

.export-cat-label:first-child {
  margin-top: 0;
  padding-top: 2px;
}

.export-drop-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: rgba(232, 232, 232, 0.8);
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.03em;
  transition: background 0.12s, color 0.12s;
}

.export-drop-item:hover {
  background: rgba(200,200,208,0.08);
  color: #c8c8d0;
}

.export-drop-item.figma-item { color: #c8aaff; }
.export-drop-item.figma-item:hover { background: rgba(200, 170, 255, 0.1); color: #d8baff; }

.export-drop-item.tailwind-item { color: #7dd3fc; }
.export-drop-item.tailwind-item:hover { background: rgba(125, 211, 252, 0.1); color: #a5e0fd; }
.export-drop-item.design-item { color: #5eead4; }
.export-drop-item.design-item:hover { background: rgba(94, 234, 212, 0.1); color: #7ff0e0; }

.export-drop-item.video-item { color: #a78bfa; }
.export-drop-item.video-item:hover { background: rgba(167, 139, 250, 0.1); color: #c4b0fd; }

.export-cat-label + .export-cat-label {
  border-top: 1px solid rgba(200,200,208,0.08);
}

/* ── Random Generator sliders ───────────────────────────────────────────── */
.rnd-sliders {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid rgba(200,200,208,0.08);
}

.rnd-slider-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.rnd-slider-label {
  width: 54px;
  color: rgba(232,232,232,0.55);
  font-size: 10px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.rnd-slider {
  flex: 1;
  height: 2px;
  accent-color: #c8c8d0;
  cursor: pointer;
}

.rnd-slider-val {
  width: 22px;
  text-align: right;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #c8c8d0;
  flex-shrink: 0;
}

/* ── Video resolution buttons ────────────────────────────────────────────── */
.vid-res-btn {
  flex: 1;
  padding: 5px 0;
  border-radius: 5px;
  border: 1px solid rgba(167,139,250,0.3);
  background: transparent;
  color: rgba(167,139,250,0.6);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.vid-res-btn.on {
  background: rgba(167,139,250,0.15);
  border-color: rgba(167,139,250,0.8);
  color: #a78bfa;
  font-weight: 700;
}

.vid-res-btn:hover:not(.on) {
  background: rgba(167,139,250,0.08);
  color: rgba(167,139,250,0.9);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Keyboard Shortcuts Modal
═══════════════════════════════════════════════════════════════════════════ */
.shortcuts-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.shortcuts-modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
.shortcuts-modal {
  background: #111;
  border: 1px solid rgba(200,200,208,0.25);
  border-radius: 14px;
  padding: 28px 32px;
  width: 480px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s ease;
}
.shortcuts-modal-backdrop.open .shortcuts-modal {
  transform: scale(1) translateY(0);
}
.shortcuts-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.shortcuts-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #c8c8d0;
  letter-spacing: 0.05em;
}
.shortcuts-modal-close {
  background: transparent;
  border: 1px solid rgba(200,200,208,0.3);
  color: rgba(200,200,208,0.7);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.shortcuts-modal-close:hover { background: rgba(200,200,208,0.08); }
.shortcuts-section-title {
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(232,232,232,0.3);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(200,200,208,0.07);
}
.shortcuts-section-title:first-of-type { margin-top: 0; }
.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  color: rgba(232,232,232,0.7);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.shortcut-row:last-child { border-bottom: none; }
.shortcut-keys {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  border: 1px solid rgba(200,200,208,0.35);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: #c8c8d0;
  padding: 3px 7px;
  min-width: 24px;
  line-height: 1;
}
.shortcuts-hint {
  position: fixed;
  bottom: 16px;
  right: 20px;
  z-index: 500;
  background: rgba(10,10,10,0.9);
  border: 1px solid rgba(200,200,208,0.2);
  border-radius: 999px;
  padding: 5px 11px;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  color: rgba(200,200,208,0.45);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.shortcuts-hint:hover { color: #c8c8d0; border-color: rgba(200,200,208,0.5); }

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Color Detail Sidebar
═══════════════════════════════════════════════════════════════════════════ */
.color-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 300px;
  background: #0d0d0d;
  border-left: 1px solid rgba(200,200,208,0.18);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  box-shadow: -12px 0 40px rgba(0,0,0,0.6);
}
.color-sidebar.open {
  transform: translateX(0);
}
.cs-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(200,200,208,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.cs-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
}
.cs-header-info { flex: 1; min-width: 0; }
.cs-hex {
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #c8c8d0;
}
.cs-name {
  font-size: 13px;
  color: rgba(232,232,232,0.55);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cs-close {
  background: transparent;
  border: 1px solid rgba(200,200,208,0.2);
  color: rgba(200,200,208,0.5);
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}
.cs-close:hover { background: rgba(200,200,208,0.07); color: #c8c8d0; }
.cs-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 24px;
}
.cs-section-title {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(232,232,232,0.35);
  margin: 16px 0 8px;
}
.cs-section-title:first-child { margin-top: 0; }
.cs-value-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: #111;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.12s;
}
.cs-value-row:hover { background: #181818; }
.cs-value-label {
  font-size: 12px;
  color: rgba(232,232,232,0.4);
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.08em;
}
.cs-value-text {
  font-size: 13px;
  font-family: 'Fira Code', monospace;
  color: rgba(232,232,232,0.85);
}
.cs-copy-icon {
  font-size: 10px;
  color: rgba(200,200,208,0.3);
  margin-left: 8px;
  transition: color 0.15s;
}
.cs-value-row:hover .cs-copy-icon { color: rgba(200,200,208,0.8); }

.cs-tints-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 3px;
  margin-top: 6px;
}
.cs-tint-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s;
  border: 1px solid rgba(255,255,255,0.04);
}
.cs-tint-cell:hover { transform: scale(1.12); z-index: 1; }
.cs-tint-cell.is-base {
  border: 2px solid rgba(200,200,208,0.7);
}
.cs-tint-cell[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #c8c8d0;
  font-family: 'Fira Code', monospace;
  font-size: 9px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid rgba(200,200,208,0.25);
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.cs-wcag-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #111;
  border-radius: 6px;
  margin-bottom: 4px;
}
.cs-wcag-dot {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.cs-wcag-info { flex: 1; }
.cs-wcag-label { font-size: 12px; color: rgba(232,232,232,0.45); }
.cs-wcag-score { font-size: 13px; font-family: 'Fira Code', monospace; }

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Tints & Shades inline expander on swatch
═══════════════════════════════════════════════════════════════════════════ */
.swatch-expand-btn {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(232,232,232,0.45);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.swatch-expand-btn:hover { color: #c8c8d0; }

.swatch-shades {
  display: none;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  padding: 6px 8px 8px;
  background: rgba(0,0,0,0.3);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.swatch-shades.open { display: grid; }

.shade-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.1s;
  border: 1px solid rgba(255,255,255,0.04);
  position: relative;
}
.shade-cell.is-base { border-color: rgba(200,200,208,0.6); }
.shade-cell:hover { transform: scale(1.15); z-index: 1; }

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Manual Color + Variations Generator
═══════════════════════════════════════════════════════════════════════════ */
.color-input-panel {
  background: rgba(13,13,13,0.95);
  border-radius: 8px;
  border: 1px solid rgba(200,200,208,0.12);
  padding: 10px 12px;
}
.color-input-panel h2 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8c8d0;
}
.color-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.color-hex-input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid rgba(200,200,208,0.35);
  border-radius: 5px;
  color: #f5f5f5;
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.color-hex-input:focus {
  border-color: rgba(200,200,208,0.7);
}
.color-hex-input.invalid {
  border-color: rgba(255,100,100,0.7);
  color: #ff8888;
}
.color-swatch-thumb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
  transition: background 0.15s;
}
.color-native-picker {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}
.variation-mode-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.var-mode-btn {
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 4px;
  border: 1px solid rgba(200,200,208,0.25);
  background: transparent;
  color: rgba(232,232,232,0.5);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.var-mode-btn.on {
  background: rgba(200,200,208,0.12);
  border-color: rgba(200,200,208,0.6);
  color: #c8c8d0;
}
.var-mode-btn:hover:not(.on) {
  color: rgba(232,232,232,0.85);
  border-color: rgba(200,200,208,0.4);
}
.variation-preview-strip {
  display: flex;
  gap: 2px;
  border-radius: 5px;
  overflow: hidden;
  height: 22px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.05);
}
.variation-preview-strip div {
  flex: 1;
}
.variation-count-label {
  font-size: 10px;
  color: rgba(232,232,232,0.4);
  font-family: 'Fira Code', monospace;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Share via URL button
═══════════════════════════════════════════════════════════════════════════ */
.share-btn {
  border-color: rgba(200,200,208,0.5);
  color: #c8c8d0;
}
.share-btn:hover:not(:disabled) {
  box-shadow: 0 0 0 1px rgba(200,200,208,0.3);
}
.share-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Palette History
═══════════════════════════════════════════════════════════════════════════ */
.history-panel {
  margin-top: 10px;
  background: rgba(13,13,13,0.95);
  border-radius: 8px;
  border: 1px solid rgba(200,200,208,0.12);
  padding: 8px 10px;
}
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.history-header h2 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8c8d0;
}
.history-clear-btn {
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255,100,100,0.3);
  background: transparent;
  color: rgba(255,100,100,0.6);
  cursor: pointer;
  transition: all 0.15s;
}
.history-clear-btn:hover { border-color: rgba(255,100,100,0.7); color: #ff8888; }
.history-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  background: #0d0d0d;
  border-radius: 6px;
  border: 1px solid rgba(200,200,208,0.08);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.history-item:hover {
  border-color: rgba(200,200,208,0.3);
  background: #131313;
}
.history-swatches {
  display: flex;
  gap: 2px;
  flex: 1;
}
.history-swatches span {
  flex: 1;
  height: 16px;
  border-radius: 2px;
}
.history-meta {
  font-size: 9px;
  color: rgba(232,232,232,0.35);
  font-family: 'Fira Code', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}
.history-empty {
  font-size: 11px;
  color: rgba(232,232,232,0.3);
  text-align: center;
  padding: 8px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Theme Toggle Button
═══════════════════════════════════════════════════════════════════════════ */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-toggle {
  background: transparent;
  border: 1px solid rgba(200,200,208,0.3);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: rgba(200,200,208,0.1);
  border-color: rgba(200,200,208,0.6);
  transform: scale(1.08);
}

/* Lock All button accent */
#btnLockAll {
  border-color: rgba(200,200,208,0.5);
  color: #c8c8d0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
#btnLockAll.all-locked {
  background: rgba(200,200,208,0.15);
  border-color: rgba(200,200,208,0.9);
  color: #f0f0f4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME: Light Mode
   Applied via [data-theme="light"] on <body>
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  /* ── Core surfaces ── */
  --lt-bg:          #f4f4f6;
  --lt-surface:     #ffffff;
  --lt-panel:       #fafafa;
  --lt-border:      rgba(0,0,0,0.10);
  --lt-border-mid:  rgba(0,0,0,0.15);

  /* ── Text ── */
  --lt-text-primary:   #0d0d0d;
  --lt-text-secondary: #3a3a44;
  --lt-text-muted:     #6b6b78;
  --lt-text-faint:     #9898a4;
}

[data-theme="light"] body {
  background: radial-gradient(circle at top, #e8e8f0 0, #f4f4f6 55%, #f8f8fa 100%);
  color: var(--lt-text-primary);
}

[data-theme="light"] .app-header {
  background: linear-gradient(to right, #ececf2, #f4f4f6);
  border-bottom-color: var(--lt-border-mid);
}

[data-theme="light"] .app-header h1 {
  color: #1a1a22;
}

[data-theme="light"] .theme-toggle {
  border-color: rgba(0,0,0,0.2);
  color: #1a1a22;
}
[data-theme="light"] .theme-toggle:hover {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.4);
}

[data-theme="light"] .left-panel,
[data-theme="light"] .right-panel {
  background: var(--lt-surface);
  border-color: var(--lt-border);
}

[data-theme="light"] .settings-panel,
[data-theme="light"] .tools-panel,
[data-theme="light"] .gradient-panel,
[data-theme="light"] .color-input-panel {
  background: var(--lt-panel);
  border-color: var(--lt-border);
}

[data-theme="light"] .settings-panel h2,
[data-theme="light"] .tools-panel h2,
[data-theme="light"] .gradient-panel h2,
[data-theme="light"] .color-input-panel h2 {
  color: var(--lt-text-secondary);
}

[data-theme="light"] .dropzone {
  background: #f8f8fb;
  border-color: rgba(0,0,0,0.22);
  color: var(--lt-text-primary);
}
[data-theme="light"] .dropzone.dragover {
  background: #f0f0f5;
  border-color: rgba(0,0,0,0.5);
}
[data-theme="light"] .dropzone small {
  color: var(--lt-text-muted);
}

[data-theme="light"] .primary-btn,
[data-theme="light"] .secondary-btn,
[data-theme="light"] .tool-btn,
[data-theme="light"] .export-btn,
[data-theme="light"] .action-bar-btn {
  background: linear-gradient(to bottom, #ffffff, #ececf0);
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-secondary);
}
[data-theme="light"] .primary-btn:hover:not(:disabled),
[data-theme="light"] .secondary-btn:hover:not(:disabled),
[data-theme="light"] .tool-btn:hover:not(:disabled),
[data-theme="light"] .export-btn:hover:not(:disabled),
[data-theme="light"] .action-bar-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f8f8fc, #e4e4ea);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

[data-theme="light"] #btnClearPalette {
  border-color: rgba(200,50,50,0.4) !important;
  color: rgba(180,40,40,0.9) !important;
}

[data-theme="light"] #btnLockAll {
  color: var(--lt-text-secondary);
  border-color: rgba(0,0,0,0.2);
}
[data-theme="light"] #btnLockAll.all-locked {
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.5);
  color: var(--lt-text-primary);
}

[data-theme="light"] .settings-row select {
  background: #ffffff;
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.22);
}

[data-theme="light"] .palette-header h2 {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .hint {
  color: var(--lt-text-muted);
}

[data-theme="light"] .swatch {
  background: #f8f8fb;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .swatch:hover {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  border-color: rgba(0,0,0,0.3);
}
[data-theme="light"] .swatch-hex {
  color: #1a1a2e;
}
[data-theme="light"] .swatch-name {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .swatch-contrast {
  color: var(--lt-text-muted);
}
[data-theme="light"] .swatch-lock {
  background: rgba(255,255,255,0.9);
  border-color: rgba(0,0,0,0.25);
  color: var(--lt-text-secondary);
}
[data-theme="light"] .swatch-lock.locked {
  background: rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.5);
  color: var(--lt-text-primary);
}
[data-theme="light"] .swatch-expand-btn {
  color: var(--lt-text-muted);
}
[data-theme="light"] .swatch-expand-btn:hover {
  color: var(--lt-text-primary);
}
[data-theme="light"] .shade-cell {
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .shade-cell.is-base {
  border-color: rgba(0,0,0,0.45);
}
[data-theme="light"] .swatch-shades {
  background: rgba(0,0,0,0.04);
  border-top-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .gradient-preview {
  border-color: rgba(0,0,0,0.2);
  background: #f0f0f4;
}
[data-theme="light"] .gradient-code {
  background: #f0f0f4;
  border-color: rgba(0,0,0,0.12);
  color: var(--lt-text-secondary);
}

[data-theme="light"] .rnd-slider-label {
  color: var(--lt-text-muted);
}
[data-theme="light"] .rnd-slider-val {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .rnd-slider {
  accent-color: #3a3a60;
}
[data-theme="light"] .rnd-sliders {
  border-top-color: rgba(0,0,0,0.08);
}

[data-theme="light"] .color-hex-input {
  background: #ffffff;
  border-color: rgba(0,0,0,0.22);
  color: var(--lt-text-primary);
}
[data-theme="light"] .color-hex-input:focus {
  border-color: rgba(0,0,0,0.5);
}
[data-theme="light"] .variation-count-label {
  color: var(--lt-text-muted);
}
[data-theme="light"] .var-mode-btn {
  border-color: rgba(0,0,0,0.18);
  color: var(--lt-text-muted);
}
[data-theme="light"] .var-mode-btn.on {
  background: rgba(0,0,0,0.07);
  border-color: rgba(0,0,0,0.4);
  color: var(--lt-text-primary);
}
[data-theme="light"] .var-mode-btn:hover:not(.on) {
  color: var(--lt-text-secondary);
  border-color: rgba(0,0,0,0.3);
}
[data-theme="light"] .variation-preview-strip {
  border-color: rgba(0,0,0,0.08);
}

/* Score widget */
[data-theme="light"] #scoreWidget {
  background: rgba(248,248,252,0.98) !important;
  border-color: rgba(0,0,0,0.12) !important;
}
[data-theme="light"] #scoreTip {
  background: #ffffff !important;
  border-color: rgba(0,0,0,0.14) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
[data-theme="light"] .score-tip-lbl {
  color: var(--lt-text-muted);
}
[data-theme="light"] .score-tip-bar {
  background: rgba(0,0,0,0.08);
}
[data-theme="light"] .score-tip-fill {
  background: #3a3a60;
}
[data-theme="light"] .score-tip-pts {
  color: var(--lt-text-muted);
}
[data-theme="light"] #harmonyBadge {
  border-color: rgba(0,0,0,0.2) !important;
  color: var(--lt-text-muted) !important;
  background: rgba(0,0,0,0.04) !important;
}
[data-theme="light"] #scoreGrade {
  color: var(--lt-text-primary) !important;
}

/* Export dropdown */
[data-theme="light"] .export-modal-bg {
  background: rgba(0,0,0,0.35);
}
[data-theme="light"] .export-dropdown {
  background: #ffffff;
  border-color: rgba(0,0,0,0.14);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
[data-theme="light"] .export-cat-label {
  color: var(--lt-text-faint);
  border-top-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .export-drop-item {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .export-drop-item:hover {
  background: rgba(0,0,0,0.05);
  color: var(--lt-text-primary);
}
[data-theme="light"] .live-preview-btn {
  border-color: rgba(20,160,80,0.6);
  color: #0d8040;
}

/* Library */
[data-theme="light"] .library-panel {
  background: #fafafa;
  border-color: var(--lt-border);
}
[data-theme="light"] .library-header h2 {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .library-item {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .library-title-row input {
  color: var(--lt-text-primary);
  border-bottom-color: rgba(0,0,0,0.2);
}
[data-theme="light"] .library-actions button {
  color: var(--lt-text-secondary);
  border-color: rgba(0,0,0,0.18);
  background: #fafafa;
}

/* History */
[data-theme="light"] .history-panel {
  background: #fafafa;
  border-color: var(--lt-border);
}
[data-theme="light"] .history-header h2 {
  color: var(--lt-text-secondary);
}
[data-theme="light"] .history-item {
  background: #ffffff;
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .history-item:hover {
  background: #f4f4f8;
  border-color: rgba(0,0,0,0.2);
}
[data-theme="light"] .history-meta {
  color: var(--lt-text-faint);
}
[data-theme="light"] .history-empty {
  color: var(--lt-text-faint);
}
[data-theme="light"] .history-clear-btn {
  border-color: rgba(200,50,50,0.3);
  color: rgba(180,40,40,0.7);
}

/* Toast */
[data-theme="light"] .toast {
  background: rgba(255,255,255,0.97);
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.3);
}

/* Shortcuts hint */
[data-theme="light"] .shortcuts-hint {
  background: rgba(255,255,255,0.92);
  border-color: rgba(0,0,0,0.15);
  color: var(--lt-text-muted);
}
[data-theme="light"] .shortcuts-hint:hover {
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.35);
}

/* Shortcuts modal */
[data-theme="light"] .shortcuts-modal-backdrop {
  background: rgba(0,0,0,0.4);
}
[data-theme="light"] .shortcuts-modal {
  background: #ffffff;
  border-color: rgba(0,0,0,0.14);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
}
[data-theme="light"] .shortcuts-modal-title {
  color: var(--lt-text-primary);
}
[data-theme="light"] .shortcuts-modal-close {
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-muted);
}
[data-theme="light"] .shortcuts-section-title {
  color: var(--lt-text-faint);
  border-bottom-color: rgba(0,0,0,0.07);
}
[data-theme="light"] .shortcut-row {
  color: var(--lt-text-secondary);
  border-bottom-color: rgba(0,0,0,0.04);
}
[data-theme="light"] kbd {
  background: #f0f0f4;
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-secondary);
}

/* Color sidebar */
[data-theme="light"] .color-sidebar {
  background: #ffffff;
  border-left-color: rgba(0,0,0,0.12);
  box-shadow: -12px 0 40px rgba(0,0,0,0.1);
}
[data-theme="light"] .cs-header {
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .cs-hex {
  color: var(--lt-text-primary);
}
[data-theme="light"] .cs-name {
  color: var(--lt-text-muted);
}
[data-theme="light"] .cs-close {
  border-color: rgba(0,0,0,0.18);
  color: var(--lt-text-muted);
}
[data-theme="light"] .cs-section-title {
  color: var(--lt-text-faint);
}
[data-theme="light"] .cs-value-row {
  background: #f4f4f8;
}
[data-theme="light"] .cs-value-row:hover {
  background: #eeeef4;
}
[data-theme="light"] .cs-value-label {
  color: var(--lt-text-muted);
}
[data-theme="light"] .cs-value-text {
  color: var(--lt-text-primary);
}
[data-theme="light"] .cs-copy-icon {
  color: var(--lt-text-faint);
}
[data-theme="light"] .cs-wcag-pair {
  background: #f4f4f8;
}
[data-theme="light"] .cs-wcag-label {
  color: var(--lt-text-muted);
}
[data-theme="light"] .cs-tint-cell {
  border-color: rgba(0,0,0,0.05);
}
[data-theme="light"] .cs-tint-cell.is-base {
  border-color: rgba(0,0,0,0.5);
}
[data-theme="light"] .cs-tint-cell[title]:hover::after {
  background: #ffffff;
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-primary);
}

/* Video drawer */
[data-theme="light"] .video-sheet {
  background: #ffffff;
  border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .vid-style-btn {
  background: #f8f8fc;
  border-color: rgba(0,0,0,0.15);
  color: var(--lt-text-muted);
}
[data-theme="light"] .vid-style-btn.on,
[data-theme="light"] .vid-style-btn:hover {
  border-color: rgba(167,139,250,0.6);
  color: #7c5fa0;
  background: rgba(167,139,250,0.08);
}
[data-theme="light"] .vid-res-btn {
  background: #f8f8fc;
  border-color: rgba(167,139,250,0.3);
  color: rgba(100,80,160,0.7);
}
[data-theme="light"] .vid-res-btn.on {
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.7);
  color: #7c5fa0;
}

/* RND slider label in light mode */
[data-theme="light"] .rnd-slider-row {
  color: var(--lt-text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Undo / Redo panel
═══════════════════════════════════════════════════════════════════════════ */
.undo-redo-panel {
  display: flex;
  gap: 6px;
}
.undo-redo-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.undo-redo-btn svg {
  flex-shrink: 0;
  opacity: 0.75;
}

/* ── Theme toggle: show/hide moon vs sun icon ── */
.theme-icon svg { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Light mode — text invisible in settings / gradient panels
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .settings-row,
[data-theme="light"] .settings-row label,
[data-theme="light"] .tools-row,
[data-theme="light"] .gradient-row,
[data-theme="light"] .gradient-row label,
[data-theme="light"] .rnd-slider-row {
  color: var(--lt-text-secondary);
}

/* Checkboxes in light mode */
[data-theme="light"] .settings-row input[type="checkbox"] {
  accent-color: #3a3a60;
}

/* Palette size select */
[data-theme="light"] .settings-row select {
  background: #ffffff;
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.22);
}

/* Gradient selects */
[data-theme="light"] .gradient-row select {
  background: #ffffff;
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.22);
}

/* Undo/redo in light mode */
[data-theme="light"] .undo-redo-btn {
  background: linear-gradient(to bottom, #ffffff, #ececf0);
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-secondary);
}
[data-theme="light"] .undo-redo-btn:hover:not(:disabled) {
  background: linear-gradient(to bottom, #f8f8fc, #e4e4ea);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Theme toggle icon — explicit white in dark mode so SVG currentColor
   is light, not inherited black
═══════════════════════════════════════════════════════════════════════════ */
.theme-toggle {
  color: #c8c8d0;
}
[data-theme="light"] .theme-toggle {
  color: #1a1a22;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Score widget — all inline-styled white text invisible in light mode.
   Using !important to beat the inline style specificity.
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .score-intelligence-label {
  color: var(--lt-text-muted) !important;
}
[data-theme="light"] #scoreGrade {
  color: var(--lt-text-primary) !important;
}
[data-theme="light"] #harmonyBadge {
  color: var(--lt-text-muted) !important;
  border-color: rgba(0,0,0,0.2) !important;
  background: rgba(0,0,0,0.04) !important;
}
/* Score breakdown tooltip inline-styled labels */
[data-theme="light"] #scoreTip > div:first-child {
  color: var(--lt-text-muted) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Catch-all — any remaining element with explicit white/near-white
   text that slips through in light mode
═══════════════════════════════════════════════════════════════════════════ */

/* Video drawer inline-styled text */
[data-theme="light"] .video-sheet * {
  color: inherit;
}
[data-theme="light"] .video-sheet {
  color: var(--lt-text-primary);
}
/* Specifically override the inline purple/colored labels — keep those */
[data-theme="light"] #vidExportBtn {
  color: #7c5fa0 !important;
}

/* Export modal category labels that have inline rgba white colors */
[data-theme="light"] .export-cat-label {
  color: var(--lt-text-faint) !important;
}

/* Live preview overlay — keep dark, it's a fullscreen dark UI intentionally */
/* No changes needed there */

/* Any stray rgba(232,232,232,...) or #f5f5f5 text inside light-mode panels */
[data-theme="light"] .library-actions button {
  color: var(--lt-text-secondary) !important;
}
[data-theme="light"] .swatch-contrast .badge {
  border-color: rgba(0,0,0,0.2);
  color: var(--lt-text-secondary);
}
[data-theme="light"] .variation-count-label {
  color: var(--lt-text-muted) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Export dropdown hover — light mode
   Old rgba(0,0,0,0.05) was invisible on white. Now a proper solid hover.
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .export-drop-item:hover {
  background: #e8e8f0 !important;
  color: var(--lt-text-primary) !important;
}
/* Colored items — keep their hue but make background solid enough to read */
[data-theme="light"] .export-drop-item.figma-item:hover {
  background: rgba(160,120,255,0.14) !important;
  color: #6a3fbf !important;
}
[data-theme="light"] .export-drop-item.tailwind-item:hover {
  background: rgba(56,189,248,0.14) !important;
  color: #0369a1 !important;
}
[data-theme="light"] .export-drop-item.design-item:hover {
  background: rgba(94,234,212,0.18) !important;
  color: #0d7066 !important;
}
[data-theme="light"] .export-drop-item.video-item:hover {
  background: rgba(167,139,250,0.14) !important;
  color: #6d3ab8 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Expand All Tints button
═══════════════════════════════════════════════════════════════════════════ */
#btnExpandAllTints {
  width: 100%;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Export dropdown hover — light mode — proper neutral grey
   Replaces the previous near-invisible fixes with solid readable grey
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] .export-drop-item:hover {
  background: #d6d6e2 !important;
  color: var(--lt-text-primary) !important;
}
[data-theme="light"] .export-drop-item.figma-item:hover {
  background: #ddd6f5 !important;
  color: #5a2da0 !important;
}
[data-theme="light"] .export-drop-item.tailwind-item:hover {
  background: #cce8f8 !important;
  color: #0369a1 !important;
}
[data-theme="light"] .export-drop-item.design-item:hover {
  background: #c8f0ea !important;
  color: #0d7066 !important;
}
[data-theme="light"] .export-drop-item.video-item:hover {
  background: #ddd6f5 !important;
  color: #5a2da0 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Auto-save indicator — top centre of header
═══════════════════════════════════════════════════════════════════════════ */
.auto-save-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: 'Fira Code', monospace;
  letter-spacing: 0.1em;
  color: rgba(200,200,208,0.55);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(200,200,208,0.15);
  background: rgba(10,10,10,0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  z-index: 10;
}
.auto-save-indicator.show {
  opacity: 1;
}
.auto-save-indicator svg {
  flex-shrink: 0;
  color: #4ade80;
}
[data-theme="light"] .auto-save-indicator {
  color: var(--lt-text-muted);
  background: rgba(255,255,255,0.85);
  border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .auto-save-indicator svg {
  color: #16a34a;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Version badge in header
═══════════════════════════════════════════════════════════════════════════ */
.version-badge {
  display: inline-block;
  font-size: 13px;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5a5a6e 0%, #32323f 50%, #5a5a6e 100%);
  border: 1px solid rgba(200,200,208,0.45);
  color: #e8e8f0;
  vertical-align: middle;
  margin-left: 10px;
  position: relative;
  top: -1px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 2px 6px rgba(0,0,0,0.5);
}
[data-theme="light"] .version-badge {
  background: linear-gradient(135deg, #d4d4e0 0%, #b0b0c4 50%, #d4d4e0 100%);
  border-color: rgba(0,0,0,0.25);
  color: #1a1a2e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.18);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Shortcuts hint — bigger, more readable
═══════════════════════════════════════════════════════════════════════════ */
.shortcuts-hint {
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEATURE: Gradient copy button
═══════════════════════════════════════════════════════════════════════════ */
.gradient-code-row {
  position: relative;
  margin-top: 6px;
}
.gradient-code-row .gradient-code {
  margin-top: 0;
  padding-right: 34px; /* make room for the copy button */
}
.gradient-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(200,200,208,0.08);
  border: 1px solid rgba(200,200,208,0.25);
  border-radius: 5px;
  color: rgba(200,200,208,0.6);
  padding: 4px 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 0;
}
.gradient-copy-btn:hover {
  background: rgba(200,200,208,0.18);
  color: #c8c8d0;
  border-color: rgba(200,200,208,0.5);
}
[data-theme="light"] .gradient-copy-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.18);
  color: var(--lt-text-muted);
}
[data-theme="light"] .gradient-copy-btn:hover {
  background: rgba(0,0,0,0.1);
  color: var(--lt-text-primary);
  border-color: rgba(0,0,0,0.35);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FIX: Video export drawer — all white inline text invisible in light mode
═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] #videoDrawer {
  background: rgba(0,0,0,0.5);
}
[data-theme="light"] .video-sheet {
  background: #ffffff;
  border-color: rgba(0,0,0,0.14);
  color: var(--lt-text-primary);
}
/* Every inline rgba(232,232,232,...) or rgba(255,255,255,...) text node */
[data-theme="light"] .video-sheet div,
[data-theme="light"] .video-sheet span {
  color: inherit;
}
/* Section labels — the tiny uppercase font-size:9px/10px labels */
[data-theme="light"] .video-sheet [style*="rgba(232,232,232,0.4)"],
[data-theme="light"] .video-sheet [style*="rgba(232,232,232,0.5)"] {
  color: var(--lt-text-muted) !important;
}
/* Main title "Palette Video Export" keep its purple */
[data-theme="light"] #videoDrawer [style*="color:#a78bfa"] {
  color: #7c5fa0 !important;
}
/* Sub-label "animated palette · exported as WebM" */
[data-theme="light"] #videoDrawer [style*="Fira Code"][style*="rgba(232"] {
  color: var(--lt-text-muted) !important;
}
/* Progress text */
[data-theme="light"] #vidProgressTxt {
  color: var(--lt-text-muted) !important;
}
/* Close button text */
[data-theme="light"] #vidCloseBtn {
  color: var(--lt-text-secondary) !important;
  border-color: rgba(0,0,0,0.2) !important;
}
/* Cancel button */
[data-theme="light"] #vidCancelBtn {
  color: var(--lt-text-muted) !important;
  border-color: rgba(0,0,0,0.14) !important;
}
/* Drag handle bar */
[data-theme="light"] .video-sheet > div:first-child > span:first-child {
  background: rgba(0,0,0,0.12) !important;
}
