function TweaksPanel({ tweaks, setTweaks, onClose }) {
  const set = (k, v) => {
    const next = { ...tweaks, [k]: v };
    setTweaks(next);
    try { window.parent.postMessage({ type: '__edit_mode_set_keys', edits: { [k]: v } }, '*'); } catch (e) {}
  };
  return (
    <div className="tweaks-panel">
      <div className="tweaks-panel-header">
        <h4>Tweaks</h4>
        <button className="tweaks-close" onClick={onClose} aria-label="Close tweaks panel">
          <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round">
            <path d="M18 6 6 18M6 6l12 12"/>
          </svg>
        </button>
      </div>
      <div className="grp">
        <label>Hero Headline</label>
        <textarea rows={3} value={tweaks.heroHeadline} onChange={e => set('heroHeadline', e.target.value)} />
        <p style={{fontSize:11, color:'var(--dim)', marginTop:6}}>Line 2 renders in bronze italic.</p>
      </div>
      <div className="grp">
        <label>Animation Intensity</label>
        <input type="range" min="1" max="10" value={tweaks.animationIntensity} onChange={e => set('animationIntensity', Number(e.target.value))} />
        <p style={{fontSize:11, color:'var(--muted)', marginTop:4}}>{tweaks.animationIntensity} / 10</p>
      </div>
      <div className="grp">
        <label className="toggle">
          <input type="checkbox" checked={!!tweaks.showFloatingCTA} onChange={e => set('showFloatingCTA', e.target.checked)} />
          Floating Quote Button
        </label>
      </div>
      <div className="grp">
        <label>Accent</label>
        <div className="swatches">
          {['bronze','steel','forest'].map(k => (
            <button key={k} onClick={() => set('accentHue', k)}
              className={`swatch ${tweaks.accentHue === k ? 'active' : ''}`}
              style={{background: k==='bronze' ? '#B97C4B' : k==='steel' ? '#7A8FA8' : '#6B8A6E'}} />
          ))}
        </div>
      </div>
    </div>
  );
}
window.TweaksPanel = TweaksPanel;
