/* Shared base for the zora games: page basics and the widgets drawn by zora-view.js and
   zora-widgets.js (allele picker, DNA -> Protein -> Trait header, genotype table, hints).
   Every page loads clinic.css after this file; the colours here are clinic.css's variables
   (each with its value as a fallback), so nothing of the older blue-and-purple look remains. */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--wall, #1d2b3a);
  min-height: 100vh;
  color: var(--cream, #f4f1e4);
  padding: 20px;
}

.page { max-width: 1100px; margin: 0 auto; }

h1 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 2.2rem;
  color: var(--gold, #ffd36b);
}

.panel {
  background: var(--wall, #1d2b3a);
  padding: 20px;
  border: 2px solid var(--edge, #3f6b73);
}

/* Game 0's two notes: the "Try this" prompt and the "One gene, two effects" explanation. */
.note-callout { background: var(--wall-2, #25394a); border: 2px solid var(--gold, #ffd36b); padding: 10px 12px; font-size: 0.85rem; line-height: 1.4; color: var(--cream, #f4f1e4); }
.note-callout h2 { font-size: 0.95rem; color: var(--gold, #ffd36b); margin-bottom: 4px; }
.top-note { margin-bottom: 10px; }
.try-this { text-align: center; color: var(--ice, #d0f0f0); font-size: 0.95rem; }

@media (min-width: 721px) {
  body { padding: 12px 20px; }
}

/* A zora picture's box. clinic.css gives it the small platform backdrop. */
.zora-box { width: 100%; max-width: 100%; aspect-ratio: 1 / 1; background: var(--wall, #1d2b3a); }

/* Allele picker (zora-view.js createAllelePicker) */
.picker-group { margin-bottom: 10px; }
.picker-head, .picker-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr 1fr;
  gap: 8px;
  align-items: center;
}
.allele-picker.with-result .picker-head, .allele-picker.with-result .picker-row { grid-template-columns: 5.5rem 1fr 1fr 1.5fr; }
.picker-head { margin-bottom: 4px; }
/* Chromosome names are headings (gold); Genotype, Phenotype, Copy A, Copy B and the gene
   names are categories (mint); the phenotype in words is a value (cream). */
.allele-picker .picker-chr { grid-column: 1 / -1; font-size: 1rem; color: var(--gold, #ffd36b); }
.picker-geno, .picker-pheno { grid-row: 2; color: var(--mint, #90e0c0); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.picker-geno { grid-column: 2 / span 2; border-bottom: 2px solid var(--edge, #3f6b73); padding-bottom: 2px; }
.picker-pheno { grid-column: 4; border-bottom: 2px solid var(--edge, #3f6b73); padding-bottom: 2px; }
.picker-col { grid-row: 3; color: var(--mint, #90e0c0); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; }
.picker-copy-a { grid-column: 2; }
.picker-copy-b { grid-column: 3; }
.picker-gene { color: var(--mint, #90e0c0); font-size: 0.9rem; }
.picker-result { font-size: 0.85rem; color: var(--cream, #f4f1e4); min-width: 0; overflow-wrap: anywhere; }
.picker-row { margin-bottom: 6px; }

select {
  width: 100%;
  min-width: 0;
  padding: 7px 26px 7px 10px;
  border: 2px solid var(--edge, #3f6b73);
  border-radius: 0;
  background-color: var(--wall-2, #25394a);
  color: var(--cream, #f4f1e4);
  font-size: 1rem;
  cursor: pointer;
  appearance: none;
}
/* The drop-down arrow. Written as "html select" so that it is still there after clinic.css
   sets the select's background colour. */
html select {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath fill='%23f4f1e4' d='M1 3h10v2H9v2H7v2H5V7H3V5H1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
select:hover { background-color: var(--wall-3, #2f4f5f); border-color: var(--mint-bright, #4fc4a0); }
select option { background: var(--wall, #1d2b3a); color: var(--cream, #f4f1e4); }

button {
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--ink, #1a1c2c);
  background: var(--wood, #7a5238);
  color: var(--cream, #f4f1e4);
}
.buttons { display: flex; gap: 10px; margin-top: 20px; }

a { color: var(--ice, #d0f0f0); }

@media (max-width: 720px) {
  body { padding: 12px; }
  h1 { font-size: 1.6rem; }
  .allele-picker.with-result .picker-head, .allele-picker.with-result .picker-row { grid-template-columns: 5.5rem 1fr 1fr; }
  /* Narrow: the phenotype wraps under its row, and its column heading is dropped. */
  .picker-pheno { display: none; }
  .picker-result { grid-column: 2 / span 2; margin-top: -2px; }
}

/* DNA -> Protein -> Trait header (zora-view.js renderCentralDogma): three framed cells joined
   by pixel arrows. Headings gold, the gene name mint, values cream. */
.dogma { display: flex; align-items: stretch; gap: 6px; }
.dogma-panel { flex: 1 1 0; min-width: 0; padding: 0 6px;
  border: 24px solid transparent; border-image: url(clinic/panel.png) 8 fill / 24px stretch; image-rendering: pixelated; }
.dogma .dogma-title { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gold, #ffd36b); margin-bottom: 6px; }
.dogma-arrow { align-self: center; flex: none; width: 32px; height: 32px; font-size: 0; color: transparent;
  background: url(clinic/icon_right.png) center / 100% 100% no-repeat; image-rendering: pixelated; }
.dogma-gene { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--mint, #90e0c0); }
.dogma-chips { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.dogma-copy { min-width: 0; max-width: 100%; }
.dogma-seq { margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; letter-spacing: 1px; overflow-wrap: anywhere; color: var(--cream, #f4f1e4); }
.dogma-var { background: var(--gold, #ffd36b); color: var(--ink, #1a1c2c); font-weight: 700; }
.dogma-seq-note { margin-top: 6px; font-size: 0.75rem; color: var(--dim, #b9c4c9); }
.dogma-chip { display: inline-block; font-size: 0.85rem; line-height: 16px; color: var(--cream, #f4f1e4);
  border: solid transparent; border-width: 6px 12px; border-image: url(clinic/chip.png) 4 fill / 12px stretch; image-rendering: pixelated; }
.dogma-blocks { display: flex; flex-wrap: wrap; gap: 12px; }
.dogma-block { flex: 1 1 110px; min-width: 0; }
.dogma-pic { display: flex; flex-wrap: wrap; gap: 4px; min-height: 52px; align-items: flex-start; }
.dogma-img { width: 48px; height: 48px; object-fit: contain; }
.dogma-missing { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--edge, #3f6b73); background: var(--wall-2, #25394a);
  font-size: 0.5rem; line-height: 1.1; padding: 2px; color: var(--dim, #b9c4c9); overflow: hidden; overflow-wrap: anywhere; }
.dogma-none { font-style: italic; color: var(--dim, #b9c4c9); align-self: center; }
.dogma-name { margin-top: 6px; font-size: 0.8rem; color: var(--cream, #f4f1e4); overflow-wrap: anywhere; }
.dogma-trait { font-size: 1rem; font-weight: 600; color: var(--cream, #f4f1e4); margin-bottom: 8px; overflow-wrap: anywhere; }
.dogma-zora { width: 120px; }

@media (max-width: 700px) {
  .dogma { flex-direction: column; }
  .dogma-arrow { transform: rotate(90deg); }
}

/* Shared widgets (zora-widgets.js): genotype table, feature list, trait-name hints.
   clinic.css colours the table's headers (categories) mint. */
.gtable { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.gtable th, .gtable td { text-align: left; padding: 3px 6px; }
.gtable .chr-head { padding-top: 8px; }
.gtable .col-head { font-weight: normal; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; }
.gtable tbody th { font-weight: normal; }

.feature-list { list-style: none; font-size: 0.9rem; }
.feature-list li { padding: 2px 0; overflow-wrap: anywhere; }

/* Trait-name hints: how a gene's alleles relate (dominant, recessive, codominant). */
.hint, .hint-sample { text-decoration: underline dotted; text-underline-offset: 3px; }
.hint { cursor: help; }
.hint:focus-visible { outline: 2px solid var(--gold, #ffd36b); outline-offset: 2px; }
.hint-tip { position: fixed; display: none; z-index: 20; max-width: min(300px, calc(100vw - 16px)); background: var(--ink, #1a1c2c); color: var(--cream, #f4f1e4);
  border: 2px solid var(--mint-bright, #4fc4a0); padding: 8px 10px; font-size: 0.85rem; line-height: 1.4;
  box-shadow: 3px 3px 0 var(--ink, #1a1c2c); pointer-events: none; }
