:root {
  color-scheme: light;
  --ink: #050505;
  --muted: #626262;
  --panel: #ffffff;
  --line: #d8d8d8;
  --field: #f8f8f8;
  --primary: #000000;
  --primary-dark: #000000;
  --accent: #c79a3b;
  --moss: #60795d;
  --clay: #b96f4a;
  --mist: #e9eee7;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(199, 154, 59, 0.18), transparent 23rem),
    radial-gradient(circle at 88% 28%, rgba(96, 121, 93, 0.16), transparent 26rem),
    linear-gradient(135deg, #f5f3ed 0%, #f7f7f4 50%, #edf1eb 100%);
}

button,
input,
textarea {
  font: inherit;
}

.page-shell {
  display: grid;
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 3rem);
  place-items: center;
}

.signup-panel {
  width: min(1120px, 100%);
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-row p {
  margin: 0;
}

.brand-divider {
  width: 1px;
  height: 1.15rem;
  background: rgba(199, 154, 59, 0.55);
}

.brand-context {
  color: var(--muted);
}

.brand-logo {
  display: block;
  width: clamp(5.5rem, 13vw, 8.5rem);
  height: auto;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.intro {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--moss);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.92;
}

.lede {
  max-width: 39rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.visual-card {
  width: min(100%, 34rem);
  margin-top: clamp(1.5rem, 4vw, 2.4rem);
  border: 1px solid rgba(96, 121, 93, 0.22);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.reptile-chart {
  display: grid;
  gap: 1.1rem;
  padding: 1.1rem;
  background:
    linear-gradient(90deg, rgba(96, 121, 93, 0.1) 1px, transparent 1px),
    linear-gradient(0deg, rgba(199, 154, 59, 0.09) 1px, transparent 1px),
    #fffdf8;
  background-size: 2rem 2rem, 2rem 2rem, auto;
}

.chart-header,
.chart-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.chart-header p,
.chart-stats span {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chart-header strong {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.35rem;
}

.chart-header > span {
  border: 1px solid rgba(199, 154, 59, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0.45rem 0.7rem;
  white-space: nowrap;
}

.bar-chart {
  display: grid;
  gap: 0.78rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.9fr) minmax(8rem, 1.5fr) 2.1rem;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  font-weight: 850;
}

.bar-row strong {
  text-align: right;
}

.bar-track {
  height: 0.74rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eee9;
}

.bar-track span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--moss) 58%, var(--accent));
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-stats div {
  min-width: 0;
  border: 1px solid rgba(96, 121, 93, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 0.7rem;
}

.chart-stats strong {
  display: block;
  margin-top: 0.18rem;
  color: var(--moss);
  font-size: 1rem;
}

.form-panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

form {
  display: grid;
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.45;
}

label,
legend {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 800;
}

input[type="text"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: none;
  padding: 0.82rem 0.9rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--moss);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(96, 121, 93, 0.15);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: #222222;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  padding: 0.72rem;
}

.gene-field {
  position: relative;
}

.multi-select {
  position: relative;
  display: grid;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.role-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.role-options label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: #222222;
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.35;
  padding: 0.68rem;
}

.select-trigger {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0.82rem 2.45rem 0.82rem 0.9rem;
  position: relative;
  text-align: left;
}

.select-trigger::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-bottom: 2px solid var(--primary-dark);
  border-right: 2px solid var(--primary-dark);
  transform: translateY(-65%) rotate(45deg);
}

.select-trigger:focus {
  border-color: var(--moss);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(96, 121, 93, 0.15);
  outline: none;
}

.gene-menu {
  position: absolute;
  z-index: 10;
  top: 3.7rem;
  left: 0;
  right: 0;
  display: grid;
  gap: 0.65rem;
  max-height: min(23rem, 58vh);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 52px rgba(23, 33, 31, 0.18);
  padding: 0.85rem;
}

.gene-menu[hidden] {
  display: none;
}

.search-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gene-options {
  display: grid;
  gap: 0.35rem;
  max-height: 15.5rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.gene-group-heading {
  margin: 0.55rem 0 0.15rem;
  color: var(--moss);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gene-group-heading:first-child {
  margin-top: 0;
}

.gene-options label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #222222;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.35;
  padding: 0.55rem 0.6rem;
}

.gene-options label:hover {
  border-color: var(--line);
  background: var(--field);
}

.gene-options .het-option {
  margin-left: 1.35rem;
  color: var(--muted);
}

.selected-gene-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 0.4rem;
}

.gene-chip {
  border: 1px solid rgba(96, 121, 93, 0.24);
  border-radius: 999px;
  background: #eef3ec;
  color: #334a31;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.2;
  min-height: 2rem;
  padding: 0.35rem 0.68rem;
}

.gene-chip::after {
  content: " x";
  font-weight: 900;
}

.empty-options {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.75rem 0.6rem;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0.12rem 0 0;
  accent-color: var(--moss);
  flex: 0 0 auto;
}

.primary-button,
.secondary-button {
  min-height: 2.9rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #050505 0%, #1f261f 62%, #60795d 100%);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button:hover {
  background: linear-gradient(135deg, #000000 0%, #2d342b 58%, #6f885f 100%);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--moss);
  padding: 0 0.95rem;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.status {
  min-height: 1.3rem;
  margin: 0;
  color: var(--moss);
  font-size: 0.9rem;
  font-weight: 800;
}

.saved-list {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.saved-label {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.saved-list strong {
  display: block;
  font-size: 1.05rem;
}

.export-panel {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.export-panel[hidden] {
  display: none;
}

.export-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.export-actions > div {
  display: flex;
  gap: 0.55rem;
}

.export-actions > div:first-child {
  display: block;
}

.export-path {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--moss);
  font-weight: 900;
  padding: 0 0.95rem;
  text-decoration: none;
}

#csv-output {
  min-height: 8rem;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 840px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 11ch;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 0;
  }

  .signup-panel {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .saved-list {
    align-items: stretch;
    flex-direction: column;
  }

  .export-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .export-actions > div {
    flex-direction: column;
  }

  .role-options {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }

  .visual-card {
    width: 100%;
  }

  .chart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .bar-row strong {
    display: none;
  }

  .chart-stats {
    grid-template-columns: 1fr;
  }
}
