/* Good Genes live client. Palette and type follow the 3D viewer (web/shell.html):
   brand ink/teal/leaf/mint/amber for the world chrome, the creator sheet's
   cream cards with plum ink for everything you read and tap. Fredoka throughout. */
@font-face { font-family: Fredoka; src: url(Fredoka.ttf) format("truetype"); font-weight: 300 700; font-display: swap; }
:root {
  --ink: #06121a;
  --deep: #0b2427;
  --teal: #1a4e4a;
  --leaf: #47a47b;
  --mint: #aace93;
  --glow: #7fe0a0;
  --amber: #f2c66d;
  --text: #d8ecd0;
  --cream: #fffdf4;
  --cream2: #fff8ec;
  --plum: #4a3b52;
  --plum-soft: #7a6a82;
  --sand: #ebdcc6;
  --coral: #e0675a;
  --sky: #7fb8f0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; color: var(--text); }
body {
  min-height: 100vh;
  background: radial-gradient(120% 60% at 50% 0%, var(--teal) 0%, var(--deep) 45%, var(--ink) 100%) fixed;
  font: 16px/1.4 Fredoka, ui-rounded, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px 28px; }
h2 { font-size: 21px; font-weight: 600; margin: 14px 0 4px; }
a { color: var(--leaf); }
.muted { color: var(--plum-soft); }
.small { font-size: 14px; }
.err { color: var(--coral); font-weight: 500; }
.msg { color: var(--leaf); font-weight: 500; }

/* ---- header ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 640px; margin: 0 auto; padding: 12px 16px 4px; }
.brand { font-weight: 700; font-size: 26px; color: var(--mint); text-shadow: 0 0 18px rgba(127, 224, 160, 0.35); letter-spacing: 0.01em; }
.brand span { color: var(--amber); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #8a958f; }
.pill.on { background: rgba(71, 164, 123, 0.22); color: #dff7e6; box-shadow: inset 0 0 0 1.5px rgba(127, 224, 160, 0.55); }
.pill.on .dot { background: var(--glow); animation: pulse 2s infinite; }
.pill.off { background: rgba(255, 255, 255, 0.07); color: #a9b5ad; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.12); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(127, 224, 160, 0.7); } 70% { box-shadow: 0 0 0 8px rgba(127, 224, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(127, 224, 160, 0); } }
.worldline { max-width: 640px; margin: 0 auto; padding: 2px 16px 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: rgba(170, 206, 147, 0.13); color: var(--text); font-size: 13.5px; }
.chip b { color: var(--amber); font-weight: 600; }

/* ---- map ---- */
.mapwrap { position: relative; border-radius: 22px; overflow: hidden; background: #0b1a17; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(170, 206, 147, 0.25); }
#map { display: block; width: 100%; aspect-ratio: 1 / 1; touch-action: manipulation; }
.mapnote { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--mint); pointer-events: none; text-align: center; padding: 20px; font-size: 18px; }
.maplegend { position: absolute; left: 10px; bottom: 8px; right: 10px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.maplegend span { background: rgba(6, 18, 26, 0.62); color: #eef6ea; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; }
.maplegend span:empty { display: none; }
.tip { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 10px; align-items: center; background: var(--cream); color: var(--plum); border-radius: 16px; padding: 8px 12px; font-size: 15px; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35); }
.tip canvas { flex: none; }

/* ---- tabs + panels ---- */
.tabs { display: flex; gap: 8px; margin: 14px 0 8px; }
.tabs button { flex: 1; min-height: 52px; padding: 8px 6px; border-radius: 18px; border: 0; background: rgba(255, 253, 244, 0.1); color: var(--text); font: inherit; font-size: 16.5px; font-weight: 600; }
.tabs button.on { background: var(--cream); color: var(--plum); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); }
.panel { background: var(--cream); color: var(--plum); border-radius: 24px; padding: 6px 16px 16px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35), inset 0 0 0 2px var(--sand); }
.panel h2 { color: var(--plum); }

.row { display: flex; gap: 10px; margin: 12px 0 6px; }
input { flex: 1; min-width: 0; min-height: 54px; padding: 12px 16px; border-radius: 18px; border: 2px solid var(--sand); background: #fff; color: var(--plum); font: inherit; font-size: 18px; }
input:focus { outline: none; border-color: var(--leaf); }
button { cursor: pointer; }
button.primary { min-height: 54px; padding: 12px 22px; border-radius: 18px; border: 0; background: var(--leaf); color: #fff; font: inherit; font-size: 18px; font-weight: 600; box-shadow: 0 4px 0 #2b7d5e; }
button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #2b7d5e; }
button.primary:disabled { opacity: 0.55; }
button.ghost { min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--sand); background: var(--cream2); color: var(--plum); font: inherit; font-size: 15px; font-weight: 600; }
button.ghost.on { background: var(--amber); border-color: var(--amber); }

.starters { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 10px 0; }
.starter { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; min-height: 150px; padding: 12px 10px; border-radius: 20px; border: 2px solid var(--sand); background: var(--cream2); color: var(--plum); font: inherit; }
.starter b { font-size: 18px; font-weight: 600; }
.starter span { color: var(--plum-soft); font-size: 13.5px; line-height: 1.3; }
.lvl { font-style: normal; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #e7f4e0; color: #2e6b45; }
.lvl.medium { background: #fbefd2; color: #7a5410; }
.lvl.hard { background: #f8e0dc; color: #a2433a; }
.starter.on { border-color: var(--leaf); background: #eef8e8; box-shadow: 0 0 0 3px rgba(71, 164, 123, 0.25); }
.hues { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.hue { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--sand); }
.hue.on { box-shadow: 0 0 0 3px var(--plum); transform: scale(1.08); }

/* ---- lineage cards ---- */
.card { background: var(--cream2); border-radius: 22px; padding: 12px 14px 14px; margin: 12px 0; box-shadow: inset 0 0 0 2px var(--sand); }
.cardhead { display: flex; align-items: center; gap: 12px; }
.cardhead .art { flex: none; width: 64px; height: 64px; border-radius: 18px; background: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--sand); }
.cardhead .title { flex: 1; min-width: 0; }
.cardhead h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.15; }
.cardhead .who { color: var(--plum-soft); font-size: 14px; }
.stars { margin-top: 4px; font-size: 20px; letter-spacing: 2px; color: var(--amber); text-shadow: 0 1px 0 #b98a2c; }
.stars .off { color: #e6dccb; text-shadow: none; }
.status { display: inline-block; margin-top: 3px; font-size: 14px; font-weight: 600; padding: 3px 11px; border-radius: 999px; }
.status.alive { background: #dcf3e3; color: #23704f; }
.status.extinct { background: #f8e0dc; color: #a2433a; }
.status.wait { background: #fbefd2; color: #8a6418; }
.fate { margin: 10px 0 6px; font-size: 16px; }
.delta { background: #fbefd2; color: #7a5410; border-radius: 10px; padding: 1px 7px; }
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 2px var(--sand); font-size: 14.5px; }
.badge b { font-weight: 600; }
.kids { display: flex; gap: 10px; margin: 10px 0 0; overflow-x: auto; padding-bottom: 2px; }
.kid { flex: none; width: 104px; background: #fff; border-radius: 16px; padding: 6px; text-align: center; box-shadow: inset 0 0 0 2px var(--sand); font-size: 12.5px; color: var(--plum-soft); }
.kid canvas { display: block; margin: 0 auto 2px; }
.kid b { display: block; color: var(--plum); font-size: 13.5px; font-weight: 600; }
.cardfoot { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.listrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 2px dashed var(--sand); }
.listrow:last-child { border-bottom: 0; }
.listrow .art { flex: none; width: 48px; height: 48px; border-radius: 14px; background: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 2px var(--sand); }
.listrow .who { flex: 1; min-width: 0; font-size: 16px; }
.listrow .who small { display: block; color: var(--plum-soft); font-size: 13.5px; }
.empty { text-align: center; padding: 18px 8px 8px; color: var(--plum-soft); font-size: 16px; }
.empty .big { font-size: 40px; display: block; }

.ticker { margin: 12px 2px 0; font-size: 14px; color: var(--mint); min-height: 1.4em; }
.ticker div { padding: 3px 0; }
.ticker .mine { color: var(--amber); font-weight: 500; }
.foot { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; color: rgba(216, 236, 208, 0.7); font-size: 14px; }
.foot a { color: var(--glow); font-weight: 600; font-size: 16px; }
