/* --- 1. MODERN LIGHT THEME VARIABLES & RESET --- */
:root {
    --bg-base: #faf5ff; /* Very light purple background */
    --bg-surface: #ffffff; /* Pure white for cards */
    --bg-elevated: #F4E8FD; /* Soft purple for hovers and active states */
    --text-primary: #1e1b4b; /* Deep purple-black for high contrast */
    --text-secondary: #6b21a8; /* Muted brand purple for secondary text */
    --border-color: rgba(0, 0, 0, 0.15); /* Purple-tinted borders */
    --border-hover: rgba(141, 24, 231, 0.3);
    --accent: #8D18E7; /* Brand Primary */
    --radius-lg: 24px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 10px 40px -10px rgba(141, 24, 231, 0.08); /* Purple-tinted shadow */
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.04);
}
/* Removes the default blue flash on mobile taps */

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* CHANGE: Applied Outfit font */
  font-family: 'Outfit', sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(at 0% 0%, rgba(141, 24, 231, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(141, 24, 231, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    display: flex;
    flex-direction: column; 
    align-items: center;    
    justify-content: flex-start; 
    min-height: 100vh;
    gap: 32px;
    
    /* CHANGE: Set the base weight to Thin (100) */
    font-weight: 300; 
}

/* --- 2. MAIN APPLICATION CONTAINER --- */
.app-container {
  width: 100%; /* ADDED: Forces full width on mobile */
  max-width: 1000px;
  background: rgba(255, 255, 255, 0.85); /* Light frosted glass */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow:
    var(--shadow-soft),
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 0 1px var(--border-color);
  overflow: hidden;
}

/* --- 3. TOP METRICS BAR --- */
.metrics-bar {
  position: relative; /* Added so we can perfectly center the child */
  display: flex;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.01);
}

.swatch-group,
.actions-group {
  display: flex;
  align-items: center;
  gap: 8px; /* Slightly reduced gap for a tighter look (optional) */
  background: var(--bg-surface);
  padding: 6px 8px; /* Top/Bottom 6px, Left/Right 8px for a balanced pill */
  border-radius: 100px;
  border: 1px solid var(--border-color);
}

.metrics-group {
  /* Absolute centering */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);

  /* Flex layout */
  display: flex;
  gap: 24px; /* Slightly tighter to ensure it fits well on smaller screens */
  flex-wrap: nowrap; /* FORCES it to stay on one line */
  width: max-content; /* Stops the browser from squishing the container */
  align-items: center;
}

.metric {
  display: flex;
  flex-direction: row; /* Make them horizontal */
  align-items: center;
  gap: 8px;
}

.metric span:first-child {
  font-size: 14px;
  font-weight: 500;
  text-transform: capitalize; /* Remove all-caps */
  letter-spacing: normal;
  color: var(--text-secondary);
}
/* --- HERO SECTION --- */
.hero-section {
    text-align: center;
    max-width: 800px;
    margin: 20px auto 0;
    padding: 0 20px;
}

.hero-section h1 {
    font-size: 3.0rem;
    font-weight: 800;
    color: #111827; /* Darker near-black for high contrast like the image */
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -0.04em;
}

.hero-section p {
    font-size: 1.125rem;
    color: #4b5563; /* Slate grey for the paragraph text */
    line-height: 1.6;
}

.hero-section strong {
    color: #1f2937; /* Darker text for bolded elements */
    font-weight: 700;
}

/* Hero Section Mobile Responsiveness */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2.5rem;
    }
    .hero-section p {
        font-size: 1rem;
    }
    .hero-section p br {
        display: none; /* Allows text to wrap naturally on small screens */
    }
}

@media (max-width: 480px) {
    .hero-section {
        margin-top: 0;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
}
.metric span:last-child {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  /* Removed monospace font to match the cleaner look in your screenshot */
}

.active-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#native-top-picker {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 60px;
  height: 60px;
  opacity: 0;
  cursor: pointer;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.mini-palette {
  display: flex;
  height: 32px;
  width: 90px;
  border-radius: 100px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.mini-swatch {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mini-swatch .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
/* Make specific text elements clickable */
.metric span:last-child,
#preview-hex-text,
.harmony-swatch-label {
  cursor: pointer;
  transition:
    opacity 0.2s,
    color 0.2s;
  user-select: none; /* Prevents text highlighting when clicking fast */
}

.metric span:last-child:hover,
#preview-hex-text:hover,
.harmony-swatch-label:hover {
  opacity: 0.6;
}

.metric span:last-child:active,
#preview-hex-text:active,
.harmony-swatch-label:active {
  opacity: 1;
}

/* --- 4. MAIN DASHBOARD --- */
.main-dashboard {
  display: grid;
  grid-template-columns: 300px 1fr 280px; /* Slightly wider right column for hex labels */
  gap: 32px;
  padding: 32px;
}

.color-map {
  position: relative;
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
  border: 1px solid var(--border-color);
}

.map-overlay-white {
  background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
  position: absolute;
  inset: 0;
}
.map-overlay-black {
  background: linear-gradient(to top, #000, rgba(0, 0, 0, 0));
  position: absolute;
  inset: 0;
}

.map-pointer {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
  z-index: 10;
}

.hue-slider-container {
  position: relative;
  width: 100%;
  height: 16px;
  margin-top: 24px;
  border-radius: 100px;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.hue-track {
  width: 100%;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(
    to right,
    #f00 0%,
    #ff0 17%,
    #0f0 33%,
    #0ff 50%,
    #00f 67%,
    #f0f 83%,
    #f00 100%
  );
}

.hue-pointer {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
}

.large-preview {
  width: 100%;
  height: 100%; /* FIXED HEIGHT: Stops it from stretching */
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  border: 1px solid var(--border-color);
}

/* --- NEW: HARMONY STYLING --- */
.harmony-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.harmony-header h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-weight: 600;
}

#harmony-selector {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
}

.harmony-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.harmony-item span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.harmony-palette {
  display: flex;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.harmony-swatch {
  flex: 1;
}

.harmony-swatch-label {
  flex: 1.5;
  background: #fff;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-left: 1px solid var(--border-color);
}

/* --- 5. DETAIL SECTIONS --- */
.detail-section {
  padding: 40px 32px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.01);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.variation-group {
  margin-bottom: 32px;
}

.variation-group:last-child {
  margin-bottom: 0; /* Keeps the bottom of the section neat */
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.group-header h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.export-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary); /* Dark text */
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600  ;
}
.export-btn:hover { 
  background: var(--bg-elevated); 
  color: black; /* Changes text/icon to purple on hover */
  border-color: var(--border-hover);
}
.palette-row {
  display: flex;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.palette-swatch {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.palette-swatch .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0.6;
}

.conversion-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.conversion-table th,
.conversion-table td {
  padding: 16px 20px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

.conversion-table th {
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.conversion-table td {
  font-family: "JetBrains Mono", monospace;
}
.conversion-table tr:last-child td {
  border-bottom: none;
}
/* --- CONTRAST CHECKER --- */
.contrast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.ratio-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.contrast-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.card-top {
  padding: 48px 24px;
  text-align: center;
}
.card-top.white-bg {
  background-color: #ffffff;
}
.card-top.black-bg {
  background-color: #000000;
}
.ratio-number {
  font-size: 3rem;
  font-weight: 800;
  display: block;
}
.wcag-table {
  width: 100%;
  text-align: center;
  border-collapse: collapse;
}
.wcag-table td,
.wcag-table th {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.icon-pass svg {
  color: var(--accent);
  width: 20px;
}
.icon-fail svg {
  color: #ef4444;
  width: 20px;
}

/* --- TOP BAR DROPDOWN STYLES --- */
.palette-dropdown {
  position: absolute;
  top: 130%;
  right: 0;
  width: 250px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 8px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.palette-dropdown.hidden {
  display: none;
}
.dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}
.dropdown-item:hover,
.dropdown-item.active {
  background: var(--bg-elevated);
}
.dropdown-item span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}
.dropdown-pill {
  display: flex;
  height: 16px;
  width: 100px;
  border-radius: 100px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.dropdown-pill .mini-swatch {
  flex: 1;
}

/* --- CUSTOM SELECT DROPDOWN (HARMONIES) --- */
.custom-select-container {
  position: relative;
  min-width: 170px;
}
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}
.custom-select-trigger:hover {
  border-color: var(--border-hover);
}
.custom-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.2s ease;
}
.custom-options:not(.hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.custom-option {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.custom-option:hover {
  background: var(--bg-elevated);
}
.custom-option.active {
  background: var(--bg-elevated);
  color: black;
  font-weight: 600;
}

/* --- NEW INPUT CONTROLS & BUTTONS --- */
.color-input-control {
  display: flex;
  align-items: center;
  margin-top: 24px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  gap: 8px;
}
.input-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
#color-input-field {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  font-weight: 500;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-primary);
  width: 100%;
  background: transparent;
}
.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.copy-btn:hover {
  color: var(--text-primary);
}
.format-select-wrapper {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}
.format-select-wrapper .custom-select-trigger {
  border: none;
  background: transparent;
  padding: 6px 10px;
  min-width: 80px;
  font-size: 11px;
}
.format-select-wrapper .custom-select-trigger:hover {
  border-color: transparent;
}
.format-select-wrapper .custom-options {
  min-width: 90px;
  right: 0;
  left: auto; /* Aligns dropdown to the right edge */
  top: calc(100% + 6px);
}
.picker-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.action-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.action-btn.outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.action-btn.outline:hover {
  background: var(--bg-elevated);
}
.action-btn.filled {
  background: #0f172a;
  border: 1px solid #0f172a;
  color: #ffffff;
}
.action-btn.filled:hover {
  background: #1e293b;
}

/* --- EXPORT MODAL STYLES --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); 
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: all 0.2s ease;
  padding: 16px; /* 👈 ADDED: Gives the modal some breathing room on mobile */
}
.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}
.modal-container {
  background: var(--bg-surface);
  width: 800px;
  flex-direction: column; 
  max-height: 90vh; 
  display: flex;    
  max-width: 95vw;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.hidden .modal-container {
  transform: translateY(20px);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
}
.modal-body {
  display: flex;
  flex: 1; 
  min-height: 0; 
  overflow-y: auto; 
}
.modal-sidebar {
  width: 240px;
  border-right: 1px solid var(--border-color);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-base);
}
.sidebar-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
}
.sidebar-item:hover {
  background: var(--border-color);
}
.sidebar-item.active {
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.sidebar-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.sidebar-item span {
  font-size: 11px;
  color: var(--text-secondary);
}
.modal-content {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.export-top-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}
.export-tabs {
  display: flex;
  gap: 16px;
}
.export-tab {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.export-tab.active {
  color: var(--text-primary);
}
.prefix-input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  outline: none;
  width: 120px;
}
.export-preview-area {
  display: flex;
  gap: 16px;
  flex: 1;
  min-height: 0;
}
.export-swatches {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  overflow: auto;
}
.export-swatch-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  min-height: 40px; 
}
.export-swatch-row:hover {
  opacity: 0.9;
}
.export-swatch-row svg {
  margin-left: 8px;
  opacity: 0.7;
}
.export-code-block {
  flex: 1;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.export-code-block pre {
  flex: 1;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text-primary);
  line-height: 2;
  overflow-y: auto;
}
/* --- Fix for Export Copy Button Height --- */
#copy-all-export-btn {
  flex: none; 
  padding: 10px; 
}

/* --- HOVER OVERLAYS FOR SWATCHES --- */
.palette-swatch,
.harmony-swatch {
  position: relative;
  cursor: pointer;
}

.swatch-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.05); /* Slight darkening on hover */
}

.palette-swatch:hover .swatch-overlay,
.harmony-swatch:hover .swatch-overlay {
  opacity: 1;
}

/* Hide the tiny dot when hovering */
.palette-swatch:hover .dot {
  opacity: 0;
}

/* --- TOAST NOTIFICATION --- */
/* --- MULTI-TOAST SYSTEM --- */
.toast-wrapper {
  position: fixed;
  bottom: 32px;
  right: 32px;
  display: flex;
  flex-direction: column; 
  gap: 12px;
  z-index: 9999;
  pointer-events: none; 
}
@media (max-width: 900px) {
  /* ... your existing mobile styles ... */

  /* Center the toast wrapper on mobile */
  .toast-wrapper {
    right: auto; /* Overrides the right: 32px rule */
    left: 50%; /* Moves to the horizontal center */
    transform: translateX(-50%); /* Shifts it perfectly to the middle */
    bottom: 24px; /* Optional: Slightly lower on mobile for easier reach */
    align-items: center; /* Ensures the toasts stack centered if there are multiple */
    width: max-content; 
  }
}
.toast-notification {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15);
  border-radius: 100px;
  padding: 10px 20px 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-notification span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-notification b {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

.toast-icon {
  background: #22c55e;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-notification.fade-out {
  animation: fadeOutDown 0.3s forwards;
}

/* --- FIX: EXPORT MODAL SIZING & CORNERS --- */
.export-swatch-row {
    min-height: 34px !important; 
}

.export-swatch-row:first-child {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.export-swatch-row:last-child {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* --- INTERACTION PERFORMANCE FIX --- */
#color-map, 
.hue-slider-container {
    touch-action: none; 
    user-select: none;
    -webkit-user-select: none;
}

.modal-body {
    max-height: 90vh !important; 
}

/* --- FIX: PREVENT POINTERS FROM BLOCKING CLICKS --- */
.map-overlay-white,
.map-overlay-black,
.map-pointer,
.hue-pointer {
    pointer-events: none;
}

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeOutDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(20px); /* Pushes it down as it fades */
    opacity: 0;
  }
} 

/* --- BLINDNESS SIMULATOR GRID --- */
.blindness-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0px 48px; 
}

/* --- NEW: HARMONY GRID SECTION STYLES --- */
.harmony-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0px 48px; 
}

/* --- MOBILE RESPONSIVENESS OVERRIDES --- */
/* --- MOBILE VERTICAL PALETTE FIX --- */
@media (max-width: 768px) {
    .palette-row {
        flex-direction: column;
        height: auto;
    }
    .palette-swatch {
        min-height: 56px;
        width: 100%;
    }
    .swatch-overlay {
        opacity: 1;
        background: transparent; 
    }
    .palette-swatch .dot {
        position: absolute;
        left: 20px;
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 850px) {
  /* 1. Stack the Main Dashboard */
  .main-dashboard {
    grid-template-columns: 1fr; 
    padding: 20px;
    gap: 24px;
  }

  /* 2. Fix the Metrics Bar */
  .metrics-bar {
    flex-direction: column;
    gap: 16px;
    padding: 20px;
  }

  .metrics-group {
    position: static; 
    transform: none;
    left: auto;
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 12px;
    width: 100%;
  }

  .metric {
    background: var(--bg-elevated);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    justify-content: space-between;
  }

  /* 3. Adjust Large Preview Height */
  .large-preview {
    height: 200px;
    order: -1; 
  }

  /* 4. Modal Adjustments */
  .modal-body {
    flex-direction: column; 
    height: auto;
    max-height: 80vh;
    overflow-y: auto;
  }

  .modal-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row;
    overflow-x: auto; 
    padding: 8px;
  }

  .sidebar-item {
    min-width: 140px;
    padding: 8px;
  }

  .sidebar-item span { display: none; } 

  .export-preview-area {
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  .export-swatches {
    flex: none; 
    max-height: 35vh; 
    overflow-y: auto; 
  }

  .export-code-block {
    flex: none; 
    max-height: 25vh; 
    overflow-y: auto; 
  }

  /* 5. Contrast Grid */
  .contrast-grid {
    grid-template-columns: 1fr;
  }

  /* 6. General Cleanup */
  .app-container { border-radius: 0; }
  body { padding: 0; }
}

/* --- DESKTOP & TABLET ZOOM OPTIMIZATION --- */
@media (min-width: 769px) {
  .app-container {
    zoom: 0.95; 
    transition: zoom 0.2s ease;
  }
  .modal-container {
    zoom: 0.85; 
    transition: zoom 0.2s ease;
  }
}

@media (max-width: 480px) {
  .metrics-group { grid-template-columns: 1fr; }
  .picker-actions { flex-direction: column; }
  .harmony-grid, .blindness-grid { grid-template-columns: 1fr; }
  .section-header h2 { font-size: 1.1rem; }
}

/* --- ARTICLE / SEO CONTENT STYLES --- */
.article-section { padding-bottom: 64px; }
.article-content { color: var(--text-primary); line-height: 1.7; }
.article-content p { margin-bottom: 16px; font-size: 1.05rem; font-weight: 300; color: #374151; }
.article-content h3 { font-size: 1.5rem; font-weight: 600; margin: 32px 0 16px 0; color: #111827; letter-spacing: -0.02em; }
.article-content h4 { font-size: 1.15rem; font-weight: 500; margin: 24px 0 12px 0; color: #111827; }
.article-content ul { margin: 0 0 24px 24px; color: #374151; font-weight: 300; }
.article-content li { margin-bottom: 8px; }
.article-content strong { font-weight: 600; color: #111827; }
.article-content code { background: var(--bg-elevated); color: var(--accent); padding: 2px 6px; border-radius: 4px; font-family: "JetBrains Mono", monospace; font-size: 0.9em; font-weight: 500; }

.math-callout {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.2rem !important;
  font-family: "JetBrains Mono", monospace;
  margin: 24px 0 !important;
}

.article-divider {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 40px 0;
}

/* Flex Grid for Tints, Tones & Shades */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 24px 0;
}

.article-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--radius-md);
}
.article-card h4 { margin-top: 0; }
.article-card ul { margin-bottom: 0; }

/* Article Responsive Adjustments */
@media (max-width: 850px) {
  .article-grid { grid-template-columns: 1fr; }
}

/* Center the 7th Tetradic item in the 2-column harmony grid on desktop */
@media (min-width: 481px) {
  .harmony-grid .tetradic-center {
    grid-column: 1 / -1; 
    max-width: calc(50% - 24px); 
    margin: 0 auto; 
    width: 100%;
  }
}