/* Tweaks panel — matches portfolio aesthetic */
#tweaks-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 320px;
  max-height: calc(100vh - 40px);
  background: var(--paper, #fbf7ee);
  border: 1px solid var(--rule, #d9cfbb);
  border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(60, 40, 20, 0.35), 0 8px 20px -8px rgba(60, 40, 20, 0.15);
  z-index: 999;
  display: none;
  flex-direction: column;
  font-family: var(--sans, "Instrument Sans", system-ui);
  overflow: hidden;
  color: var(--ink, #1a1815);
}
#tweaks-panel.open { display: flex; }

.tw-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-warm, #efe6d5);
}
.tw-title {
  font-family: var(--serif, "Newsreader");
  font-style: italic;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tw-title .tw-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--coral-deep, #3a7ca8);
  animation: pulse 2.5s ease-in-out infinite;
}
.tw-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--ink-mute, #8a8378);
  cursor: pointer;
  line-height: 1;
  width: 28px; height: 28px;
  border-radius: 50%;
  transition: background .15s, color .15s;
}
.tw-close:hover { background: rgba(0,0,0,0.06); color: var(--ink); }

.tw-body {
  padding: 6px 16px 16px;
  overflow-y: auto;
  flex: 1;
}
.tw-body::-webkit-scrollbar { width: 6px; }
.tw-body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.tw-section {
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
}
.tw-section:last-child { border-bottom: none; }

.tw-section-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute, #8a8378);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tw-value {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-transform: none;
}

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

/* Palette swatches */
.tw-palettes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tw-swatch {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 6px 6px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  color: var(--ink);
}
.tw-swatch:hover { border-color: var(--coral-deep); transform: translateY(-1px); }
.tw-swatch.active {
  border-color: var(--coral-deep);
  border-width: 2px;
  padding: 7px 5px 5px;
  background: rgba(0,0,0,0.02);
}
.tw-sw-inner {
  display: flex;
  gap: 3px;
  width: 100%;
  height: 24px;
}
.tw-sw-deep, .tw-sw-soft {
  flex: 1;
  border-radius: 4px;
  background: var(--sw-a);
}
.tw-sw-soft { background: var(--sw-b); }
.tw-sw-label {
  font-size: 9px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
}

/* Selects */
.tw-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg, #f6f1e8);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s;
}
.tw-select:hover, .tw-select:focus { border-color: var(--coral-deep); outline: none; }

/* Toggle */
.tw-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}
.tw-toggle input {
  opacity: 0;
  width: 0; height: 0;
}
.tw-toggle span {
  position: absolute;
  inset: 0;
  background: var(--rule);
  border-radius: 100px;
  transition: background .2s;
}
.tw-toggle span::before {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tw-toggle input:checked + span { background: var(--coral-deep); }
.tw-toggle input:checked + span::before { transform: translateX(16px); }

/* Cursor pets */
.tw-pets {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}
.tw-pet {
  aspect-ratio: 1;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  padding: 0;
}
.tw-pet:hover { border-color: var(--coral-deep); transform: translateY(-1px); }
.tw-pet.active {
  background: var(--coral-deep);
  color: white;
  border-color: var(--coral-deep);
}

/* Range slider */
.tw-range {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--rule);
  border-radius: 100px;
  outline: none;
  cursor: pointer;
}
.tw-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  background: var(--coral-deep);
  border-radius: 50%;
  cursor: pointer;
  transition: transform .15s;
}
.tw-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.tw-range::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--coral-deep);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Reset button */
.tw-reset {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.04em;
}
.tw-reset:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

@media (max-width: 500px) {
  #tweaks-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 12px;
  }
}
