/* ==========================================================================
   P009 — Palette Analyzer
   Standalone stylesheet (includes P003 design system variables so the page
   works in the P009 test folder without the live site's global CSS).
   When uploaded to dandistudio.com, these :root and body rules defer to the
   site-wide style.css — no conflict since they are identical values.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323:wght@400&family=Share+Tech+Mono&display=swap');

/* ── P003 design system (copied verbatim) ────────────────────────────────── */
:root {
  --bg:          #000000;
  --green:       #33FF33;
  --green-dim:   #1a661a;
  --green-faint: #0a3a0a;
  --red:         #FF0000;
  --purple:      #6C5EB5;
  --cyan:        #00FFFF;
  --yellow:      #FFD700;
  --white:       #FFFFFF;

  --font-pixel: 'Press Start 2P', 'Courier New', monospace;
  --font-body:  'VT323', 'Courier New', monospace;
  --font-mono:  'Share Tech Mono', 'Courier New', monospace;

  --gap-sm: 6px;
  --gap-md: 12px;
  --gap-lg: 24px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  background:  var(--bg);
  color:       var(--green);
  font-family: var(--font-mono);
  line-height: 1.6;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.page-inner {
  overflow-y: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* CRT scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.10) 2px, rgba(0,0,0,0.10) 4px
  );
  pointer-events: none;
  z-index: 9998;
}

img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

a { color: var(--green); text-decoration: none; }
a:hover, a:focus { color: var(--cyan); outline: 2px solid var(--cyan); outline-offset: 2px; }

.hidden { display: none !important; }

.btn-pixel {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--green);
  padding: 8px 12px;
  cursor: pointer;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.1s, background 0.1s, border-color 0.1s;
  white-space: nowrap;
  line-height: 1.6;
}
.btn-pixel:hover, .btn-pixel:focus {
  color: var(--bg);
  background: var(--green);
  outline: none;
}
.btn-pixel.active {
  color: var(--bg);
  background: var(--green);
}
.btn-pixel.btn-cyan {
  color: var(--cyan);
  border-color: var(--cyan);
}
.btn-pixel.btn-cyan:hover {
  color: var(--bg);
  background: var(--cyan);
}
.btn-pixel.btn-green {
  color: var(--green);
  border-color: var(--green);
}
.btn-pixel.btn-green:hover {
  color: var(--bg);
  background: var(--green);
}

@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
@keyframes fade-in { from{opacity:0} to{opacity:1} }
@keyframes phosphor-pulse {
  0%,100%{text-shadow:0 0 6px var(--green),0 0 12px var(--green-dim)}
  50%    {text-shadow:0 0 10px var(--green),0 0 20px var(--green-dim)}
}

/* ── Site Header ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--green-dim);
  gap: 16px;
  flex-wrap: wrap;
}
.header-brand {
  font-family: var(--font-pixel);
  font-size: 9px;
  color: var(--green);
  letter-spacing: 2px;
  text-shadow: 0 0 6px var(--green);
  white-space: nowrap;
}
.header-brand a { color: inherit; }
.header-nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.header-nav a {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green-dim);
  letter-spacing: 1px;
  padding: 4px 6px;
  border: 1px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.header-nav a:hover, .header-nav a:focus, .header-nav a.active {
  color: var(--green);
  border-color: var(--green-dim);
  outline: none;
}
.header-nav a.active { color: var(--cyan); border-color: var(--cyan); }

/* ── Help button + overlay ───────────────────────────────────────────────── */
@keyframes app-help-pulse {
  0%, 100% { opacity: 1;    box-shadow: 0 0 4px  var(--cyan); }
  50%       { opacity: 0.5; box-shadow: 0 0 12px var(--cyan); }
}
.app-help-btn {
  position:   absolute;
  top:        16px;
  right:      20px;
  width:      26px;
  height:     26px;
  border:     1px solid var(--cyan);
  color:      var(--cyan);
  background: #000;
  font-family: var(--font-pixel);
  font-size:  8px;
  cursor:     pointer;
  animation:  app-help-pulse 2.4s ease-in-out infinite;
  z-index:    10;
  display:    flex;
  align-items: center;
  justify-content: center;
  padding:    0;
}
.app-help-btn:hover { background: rgba(0,255,255,0.12); animation: none; opacity: 1; }
.app-help-overlay {
  display:    none;
  position:   fixed;
  inset:      0;
  background: rgba(0,0,0,0.88);
  z-index:    1001;
  align-items: center;
  justify-content: center;
}
.app-help-overlay.open { display: flex; }
.app-help-modal {
  background:  #000;
  border:      1px solid var(--green);
  padding:     24px;
  max-width:   420px;
  width:       90%;
  font-family: var(--font-mono);
  max-height:  90vh;
  overflow-y:  auto;
}
.app-help-modal-title {
  font-family:    var(--font-pixel);
  font-size:      8px;
  color:          var(--green);
  letter-spacing: 1px;
  margin-bottom:  16px;
}
.app-help-modal ol  { margin: 0 0 14px 18px; padding: 0; }
.app-help-modal li  { font-size: 11px; color: var(--green-dim); margin-bottom: 10px; line-height: 1.6; }
.app-help-modal li strong { color: var(--green); }
.app-help-warn { font-size: 10px; color: #FF6644; margin: 0 0 4px; line-height: 1.5; }

/* ── Inner-page mascot nav widget ────────────────────────────────────────── */
#inner-mascot-container {
  display:     none;
  position:    relative;
  cursor:      pointer;
  flex-shrink: 0;
}
#inner-mascot-container canvas { display: block; }
#inner-mascot-nav {
  display:    none;
  position:   absolute;
  top:        calc(100% + 6px);
  right:      0;
  background: var(--bg);
  border:     1px solid var(--green-dim);
  padding:    10px 14px;
  z-index:    200;
  min-width:  210px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
}
#inner-mascot-container.active #inner-mascot-nav,
#inner-mascot-container:hover  #inner-mascot-nav {
  display: flex; flex-direction: column; gap: 8px;
}
#inner-mascot-nav a {
  font-family: var(--font-pixel); font-size: 7px;
  color: var(--green-dim); letter-spacing: 1px;
  padding: 3px 0; white-space: nowrap;
}
#inner-mascot-nav a:hover, #inner-mascot-nav a.active { color: var(--green); }

/* ── Page Content ────────────────────────────────────────────────────────── */
.page-content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--green);
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 0 8px var(--green);
  animation: phosphor-pulse 3s ease-in-out infinite;
}
.page-title .cursor::after {
  content: '█';
  animation: blink 1s step-end infinite;
  color: var(--green);
}

.page-subtitle {
  font-family: var(--font-body);
  font-size: 19px;
  color: var(--green-dim);
  margin-bottom: 28px;
  line-height: 1.5;
}
.page-subtitle span { color: var(--green); }

/* ── Main App Layout ─────────────────────────────────────────────────────── */
.pa-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: auto;
  gap: 20px;
  align-items: start;
}

.pa-col-left  { display: flex; flex-direction: column; gap: 14px; }
.pa-col-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.pa-panel {
  border: 1px solid var(--green-dim);
  padding: 14px;
  background: rgba(51,255,51,0.015);
}

.panel-title {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--purple);
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--green-faint);
}
.pa-collapsible {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}
.pa-collapsible:hover { color: var(--cyan); }
.pa-arrow { font-size: 8px; transition: transform 0.15s; }
.pa-collapsible.open .pa-arrow { transform: rotate(90deg); }
.pa-panel-body { margin-top: 12px; }

/* ── Hue Wheel ───────────────────────────────────────────────────────────── */
.wheel-container {
  position: relative;
  width: 100%;
  max-width: 310px;
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
}

/* CSS hue ring */
.wheel-bg-hue {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  clip-path: circle(37%);
  background: conic-gradient(
    from 0deg,
    hsl(0,100%,50%)   0deg,
    hsl(30,100%,50%)  30deg,
    hsl(60,100%,50%)  60deg,
    hsl(90,100%,50%)  90deg,
    hsl(120,100%,50%) 120deg,
    hsl(150,100%,50%) 150deg,
    hsl(180,100%,50%) 180deg,
    hsl(210,100%,50%) 210deg,
    hsl(240,100%,50%) 240deg,
    hsl(270,100%,50%) 270deg,
    hsl(300,100%,50%) 300deg,
    hsl(330,100%,50%) 330deg,
    hsl(360,100%,50%) 360deg
  );
}

/* Saturation fade: white centre to transparent */
.wheel-bg-sat {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  clip-path: circle(37%);
  background: radial-gradient(
    circle at center,
    rgba(255,255,255,0.88) 0%,
    rgba(255,255,255,0.55) 30%,
    rgba(255,255,255,0)    60%
  );
}

/* Dark inner hub */
.wheel-bg-dark {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(0,0,0,0.90);
  border: 1px solid var(--green-dim);
  pointer-events: none;
}

.wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ── Vision Simulation ───────────────────────────────────────────────────── */
.vision-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.vision-btn { width: 100%; text-align: center; font-size: 6px; padding: 7px 4px; }
.vision-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.vision-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-dim);
  margin-top: 7px;
  min-height: 14px;
}

/* ── Harmony Buttons ─────────────────────────────────────────────────────── */
.harmony-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.harmony-btn { width: 100%; text-align: center; font-size: 6px; padding: 7px 4px; }

/* ── Color Count ─────────────────────────────────────────────────────────── */
.count-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.count-row input[type=range] {
  flex: 1;
  accent-color: var(--green);
  cursor: pointer;
  height: 4px;
}
.count-val {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  min-width: 24px;
  text-align: right;
}

/* ── Palette Swatches ────────────────────────────────────────────────────── */
.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pa-swatch {
  position: relative;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.15);
  transition: transform 0.1s, border-color 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2px;
  overflow: hidden;
}
.pa-swatch:hover { transform: scale(1.12); border-color: var(--white); z-index: 2; }
.swatch-num {
  font-family: var(--font-pixel);
  font-size: 6px;
  line-height: 1;
  text-shadow: 0 0 3px rgba(0,0,0,0.8);
}
.swatch-hex {
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s;
  white-space: nowrap;
  text-shadow: 0 0 3px rgba(0,0,0,0.9);
}
.pa-swatch:hover .swatch-hex { opacity: 1; }
.swatch-de {
  position: absolute;
  top: 2px; right: 2px;
  font-family: var(--font-mono);
  font-size: 6px;
  padding: 1px 3px;
  border-radius: 2px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
}
.pa-swatch:hover .swatch-de { opacity: 1; }

/* Lock button */
.swatch-lock {
  position: absolute;
  top: 2px; left: 2px;
  background: none;
  border: none;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s;
  filter: drop-shadow(0 0 2px #000);
}
.pa-swatch:hover .swatch-lock { opacity: 1; }
.pa-swatch.locked .swatch-lock { opacity: 1; }
.pa-swatch.locked {
  border-color: #33FF33;
  box-shadow: 0 0 6px rgba(51, 255, 51, 0.55);
}

/* Copy feedback */
#copy-feedback {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--cyan);
  margin-top: 8px;
  letter-spacing: 1px;
  animation: fade-in 0.1s ease-out;
}

/* ── Export Buttons ──────────────────────────────────────────────────────── */
.export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.btn-villain {
  color: var(--cyan);
  border-color: var(--cyan);
}
.btn-villain:hover {
  background: var(--cyan);
  color: var(--bg);
}

/* ── 3D Viewer Panel ─────────────────────────────────────────────────────── */
.pa-panel--3d { padding: 14px; }

#three-container {
  width: 100%;
  aspect-ratio: 4/3;
  background: #000;
  border: 1px solid var(--green-dim);
  position: relative;
  overflow: hidden;
}
#three-container canvas {
  width: 100% !important;
  height: 100% !important;
  image-rendering: auto; /* Three.js handles its own rendering */
}

.view-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ── Legend Table ────────────────────────────────────────────────────────── */
#three-legend {
  margin-top: 10px;
  overflow-x: auto;
}
.legend-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
}
.legend-table th {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--purple);
  padding: 4px 8px;
  border-bottom: 1px solid var(--green-dim);
  text-align: left;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.legend-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--green-faint);
  white-space: nowrap;
}
.legend-table tr:hover td { background: rgba(51,255,51,0.04); }
.leg-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.2);
}
.leg-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
  outline: none;
  padding: 0 2px;
  margin: 0 1px;
  vertical-align: middle;
}
.leg-input:focus {
  border-bottom-color: var(--green);
  background: rgba(51,255,51,0.05);
}

/* ── Villain Modal ───────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease-out;
}
.modal-box {
  background: var(--bg);
  border: 1px solid var(--cyan);
  padding: 28px 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 0 30px rgba(0,255,255,0.2);
}
.modal-title {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-bottom: 14px;
  text-shadow: 0 0 6px var(--cyan);
}
.modal-desc {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--green);
  margin-bottom: 14px;
}
.slot-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
#villain-confirm {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  border: 1px solid var(--cyan);
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

/* ── Fine-Tune Colour Modal ──────────────────────────────────────────────── */
.ft-box {
  border-color: var(--green);
  box-shadow: 0 0 30px rgba(51, 255, 51, 0.18);
}
.ft-preview-row {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 18px;
}
.ft-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ft-preview {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.ft-label {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--green-dim);
  letter-spacing: 1px;
}
.ft-sliders {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.ft-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ft-slider-label {
  font-family: var(--font-pixel);
  font-size: 8px;
  color: var(--green);
  width: 14px;
}
.ft-slider-row input[type=range] {
  flex: 1;
  accent-color: #33FF33;
  cursor: pointer;
  height: 4px;
}
.ft-slider-val {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  width: 42px;
  text-align: right;
}
.ft-hex {
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--green);
  text-align: center;
  letter-spacing: 3px;
  margin-bottom: 20px;
  cursor: pointer;
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.5);
  transition: color 0.1s;
}
.ft-hex:hover { color: #ffffff; }
.ft-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Import Panel ────────────────────────────────────────────────────────── */
.import-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.import-tab.active {
  background: var(--green);
  color: var(--bg);
}
.import-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.import-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green-dim);
  line-height: 1.5;
  margin: 0;
}
.import-ip-note {
  font-size: 10px;
  color: #1a4a1a;
}
.import-count-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.import-count-label {
  font-family: var(--font-pixel);
  font-size: 7px;
  color: var(--green);
}
.import-count-row input[type=range] {
  flex: 1;
  accent-color: #33FF33;
  cursor: pointer;
}
.import-count-row span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
  width: 24px;
}
.import-textarea {
  width: 100%;
  height: 80px;
  background: #0a0a0a;
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
}
.import-textarea:focus {
  outline: none;
  border-color: var(--green);
}
.import-status {
  font-family: var(--font-mono);
  font-size: 11px;
  min-height: 16px;
}

/* Library slot grid */
.import-library-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.import-library-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--green-dim);
  cursor: default;
}
.import-library-slot:hover { border-color: var(--green); }
.import-library-swatches {
  display: flex;
  gap: 2px;
  flex: 1;
}
.import-library-swatch {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.import-library-load {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--green);
  background: none;
  border: 1px solid var(--green-dim);
  padding: 3px 5px;
  cursor: pointer;
  white-space: nowrap;
}
.import-library-load:hover {
  background: var(--green);
  color: var(--bg);
}

/* ── Eyedropper Modal ────────────────────────────────────────────────────── */
.eyedrop-box {
  border-color: var(--green);
  box-shadow: 0 0 30px rgba(51,255,51,0.15);
  max-width: 95vw;
  width: 860px;
}
.eyedrop-body {
  display: flex;
  gap: 12px;
  margin: 14px 0;
  overflow: hidden;
  min-height: 0;
}
.eyedrop-canvas-wrap {
  overflow: auto;
  border: 1px solid var(--green-dim);
  cursor: crosshair;
  flex: 1;
  min-width: 0;
  max-height: 440px;
}
#eyedrop-canvas { display: block; image-rendering: pixelated; }
.eyedrop-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 110px;
  flex-shrink: 0;
}
#eyedrop-preview { border-radius: 50%; border: 1px solid var(--green-dim); }
.eyedrop-hex-live {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  min-height: 14px;
  letter-spacing: 1px;
}
.eyedrop-shades-lbl {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: #555;
  text-align: center;
}
#eyedrop-shades {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}
.eyedrop-pinned-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 160px;
  flex-shrink: 0;
}
.eyedrop-pinned-lbl {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--green);
  letter-spacing: 1px;
}
#eyedrop-counter { color: var(--cyan); }
.eyedrop-pinned-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}
.eyedrop-pinned-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.eyedrop-pinned-swatch {
  width: 20px;
  height: 20px;
  border: 1px solid #333;
  border-radius: 2px;
  flex-shrink: 0;
}
.eyedrop-pinned-hex {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan);
  flex: 1;
}
.eyedrop-remove {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}
.eyedrop-remove:hover { color: #FF4444; }
.eyedrop-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--green-dim);
}

/* ── Analytical Charts ───────────────────────────────────────────────────── */
.pa-charts-row {
  margin-top: 14px;
}

.chart-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.chart-tab.active {
  background: var(--green);
  color: var(--bg);
}

#chart-linechart svg,
#chart-heatmap svg {
  width: 100%;
  display: block;
  overflow: visible;
}

/* ── Site Footer ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--green-dim);
  padding: 12px 24px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.site-footer a {
  font-family: var(--font-pixel);
  font-size: 6px;
  color: var(--green-dim);
  letter-spacing: 1px;
}
.site-footer a:hover { color: var(--green); }

.attribution {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green-dim);
  text-align: center;
  width: 100%;
  line-height: 1.6;
  margin-top: 4px;
}
.attribution a { color: var(--cyan); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .pa-layout {
    grid-template-columns: 300px 1fr;
  }
}

@media (max-width: 860px) {
  .pa-layout {
    grid-template-columns: 1fr;
  }
  .pa-col-right { order: -1; }
  #three-container { aspect-ratio: 16/9; }
}

@media (max-width: 600px) {
  .page-content   { padding: 20px 12px 48px; }
  .page-title     { font-size: 8px; }
  .header-brand   { font-size: 7px; }
  .header-nav              { display: none; }
  #inner-mascot-container  { display: block; }
  .harmony-grid   { grid-template-columns: repeat(2, 1fr); }
  .wheel-container { max-width: 280px; }
  #three-container { aspect-ratio: 4/3; }
  .export-row     { flex-direction: column; }
}

/* ── Eyedropper modal — portrait mobile ─────────────────────────────────── */
@media (max-width: 768px) and (orientation: portrait) {
  /* Box: full-width, tall — keep as block so children fill full width */
  .eyedrop-box {
    width: 100%;
    max-width: 100vw;
    max-height: 99vh;
    overflow-y: auto;
    padding: 16px 12px;
  }
  /* Title centred */
  .eyedrop-box .modal-title {
    text-align: center;
  }
  /* Body: single column, full width, no clipping */
  .eyedrop-body {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 10px;
    overflow: visible;
  }
  /* Reorder: preview+shades → image → pinned */
  .eyedrop-center      { order: 1; flex: none; }
  .eyedrop-canvas-wrap { order: 2; flex: none; }
  .eyedrop-pinned-col  { order: 3; flex: none; }
  /* center section: vertical stack, centred */
  .eyedrop-center {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  #eyedrop-preview    { display: block; margin: 0 auto; }
  .eyedrop-hex-live   { text-align: center; }
  .eyedrop-shades-lbl { text-align: center; }
  #eyedrop-shades     { justify-content: center; }
  /* Image canvas */
  .eyedrop-canvas-wrap {
    width: 100%;
    max-height: 79vw;
    overflow: auto;
  }
  /* Pinned colours */
  .eyedrop-pinned-col  { width: 100%; text-align: center; }
  .eyedrop-pinned-lbl  { text-align: center; }
  .eyedrop-pinned-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    overflow-y: visible;
    flex: none;
  }
  /* Footer buttons side by side, centred */
  .eyedrop-footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
  }
}

/* ── Portrait mobile layout ──────────────────────────────────────────────── */
@media (max-width: 768px) and (orientation: portrait) {

  /* Move ? button clear of the first panel */
  .app-help-btn { top: 6px; }

  /* Single-column flow */
  .pa-layout {
    flex-direction: column;
  }

  /* Dissolve left column so each panel joins the outer flex directly */
  .pa-col-left {
    display: contents;
  }

  /* Section order */
  .pa-top-row   { order: 1; }
  .pa-col-right { order: 2; width: 100%; }
  #panel-count  { order: 3; }
  #panel-palette{ order: 4; }
  #panel-vision { order: 5; }
  #import-panel { order: 6; }
  #panel-export { order: 7; }

  /* Wheel + Harmony side by side at the top */
  .pa-top-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
  }
  .pa-top-row > .pa-panel {
    flex: 1;
    min-width: 0;
  }

  /* Wheel fits its half of the row */
  .wheel-container {
    max-width: 100%;
  }

  /* Harmony buttons: 2 columns so they don't overflow */
  .harmony-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 3D viewer: compact height in portrait */
  #three-container {
    aspect-ratio: 16/9;
    max-height: 260px;
  }
}
