@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(139, 92, 246, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-1: #8b5cf6;
  --accent-2: #6366f1;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);
  --glow-accent: rgba(139, 92, 246, 0.15);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background gradient blobs */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 600px;
  height: 600px;
  background: var(--accent-1);
  top: -200px;
  right: -100px;
}

body::after {
  width: 500px;
  height: 500px;
  background: #3b82f6;
  bottom: -150px;
  left: -100px;
}

/* ===== LAYOUT ===== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

header p {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 300;
}

.main-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* ===== CONTROLS PANEL ===== */
.controls-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: sticky;
  top: 2rem;
}

.controls-panel h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.locus-group {
  margin-bottom: 1.1rem;
  padding: 0.85rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
  transition-property: border-color, box-shadow, opacity;
}

.locus-group:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 20px var(--glow-accent);
}

.locus-group.masked {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.5);
}

.locus-group.masked::after {
  content: '⛔ ' attr(title);
  display: block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
}

.locus-group.flash {
  animation: flash-highlight 0.6s ease-out;
}

@keyframes flash-highlight {
  0% {
    border-color: var(--accent-1);
    box-shadow: 0 0 25px var(--glow-accent);
  }

  100% {
    border-color: var(--border-subtle);
    box-shadow: none;
  }
}

.locus-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
  letter-spacing: 0.01em;
}

.locus-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.locus-select:hover,
.locus-select:focus {
  border-color: var(--accent-1);
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.locus-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.locus-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.4;
  min-height: 1.2em;
}

/* ===== VISUALIZATION PANEL ===== */
.visualization-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.dog-viewport {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  position: relative;
  overflow: hidden;
}

.dog-viewport::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 60%,
      rgba(139, 92, 246, 0.04),
      transparent);
  pointer-events: none;
}

#dog-display {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 1;
}

#dog-display svg {
  width: 100%;
  height: auto;
}

.dog-zone {
  transition: fill 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.merle-overlay {
  opacity: 0.7;
  mix-blend-mode: multiply;
  transition: fill 0.5s ease, opacity 0.5s ease;
}

.brindle-overlay {
  opacity: 0.5;
  mix-blend-mode: multiply;
}

.brindle-stripe {
  transition: fill 0.5s ease;
}

/* ===== PHENOTYPE CARD ===== */
.phenotype-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.phenotype-card h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

#phenotype-name {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  transition: var(--transition);
}

#phenotype-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== GENE TABLE (bottom legend) ===== */
.gene-legend {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin-top: 1rem;
}

.gene-legend h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.gene-legend .allele-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.allele-chip {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: 'Inter', monospace;
}

.allele-chip.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--accent-1);
  color: var(--text-primary);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  margin-top: 3rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

footer a {
  color: var(--accent-1);
  text-decoration: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}