/* Good Genes pilot page: you are one creature (web/live/pilot.js). Phone first. */
@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;
  --amber: #f2c66d; --text: #e6f2de; --cream: #fffdf4; --plum: #4a3b52; --coral: #e0675a;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--deep); color: var(--text);
  font: 16px/1.3 Fredoka, ui-rounded, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  touch-action: none; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
canvas#cv { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }

.hud { position: fixed; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 10px) 16px 0;
  display: flex; gap: 10px; align-items: flex-start; pointer-events: none; }
.bars { flex: 1; min-width: 0; }
.bar { position: relative; height: 22px; border-radius: 11px; background: rgba(6,18,26,.72);
  border: 2px solid rgba(255,253,244,.25); overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 50%; background: linear-gradient(90deg, #7fe0a0, #47a47b);
  transition: width .25s, background .25s; }
.bar .mark { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--amber); left: 85%; }
.bar.low i { background: linear-gradient(90deg, #f29a6d, #e0675a); }
.bar span { position: relative; display: block; text-align: center; font-size: 13px; line-height: 18px; font-weight: 600;
  color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.lifeline { margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--cream);
  text-shadow: 0 1px 3px rgba(0,0,0,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch { pointer-events: auto; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center;
  background: rgba(6,18,26,.72); text-decoration: none; font-size: 20px; border: 2px solid rgba(255,253,244,.25); }

.hint { position: fixed; left: 50%; top: 34%; transform: translateX(-50%); max-width: 300px; text-align: center;
  padding: 10px 16px; border-radius: 14px; background: rgba(6,18,26,.8); color: var(--cream); font-size: 17px;
  font-weight: 500; pointer-events: none; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -6px); } }
.toast { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 74px); text-align: center;
  pointer-events: none; font-size: 18px; font-weight: 600; color: var(--amber); text-shadow: 0 2px 4px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .3s; }
.toast.on { opacity: 1; }
.net { position: fixed; left: 16px; bottom: calc(env(safe-area-inset-bottom) + 190px); font-size: 13px;
  color: var(--amber); background: rgba(6,18,26,.75); padding: 4px 10px; border-radius: 10px; }

.pad { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 60px;
  border: 3px solid rgba(255,253,244,.35); background: rgba(255,253,244,.08); pointer-events: none;
  left: 86px; top: calc(100% - env(safe-area-inset-bottom) - 110px); opacity: .55; transition: opacity .15s; }
.pad.on { opacity: 1; }
.knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 26px;
  background: rgba(255,253,244,.55); }

.btns { position: fixed; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 22px); width: 170px; height: 170px; }
.btn { position: absolute; border: 0; border-radius: 50%; color: var(--ink); font: inherit; display: grid;
  place-items: center; align-content: center; gap: 0; touch-action: none; box-shadow: 0 4px 0 rgba(0,0,0,.35);
  transition: transform .06s, filter .2s, background .2s; }
.btn b { font-size: 26px; line-height: 1; }
.btn small { font-size: 12px; font-weight: 600; max-width: 84px; line-height: 1.1; text-align: center; }
.btn.a { right: 0; bottom: 0; width: 96px; height: 96px; background: var(--mint); }
.btn.b { left: 0; top: 0; width: 76px; height: 76px; background: #b9b2a4; }
.btn.b.ready { background: var(--amber); animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 8px rgba(242,198,109,.35), 0 4px 0 rgba(0,0,0,.35); } }
.btn.off { filter: grayscale(.8) brightness(.7); }
.btn.down { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 rgba(0,0,0,.35); }

.card { position: fixed; left: 16px; right: 16px; top: 50%; transform: translateY(-50%); max-width: 420px; margin: 0 auto;
  background: var(--cream); color: var(--plum); border-radius: 22px; padding: 18px 16px 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); text-align: center; touch-action: auto; }
.card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.card .life { margin: 0 0 4px; font-size: 15px; }
.card .line { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #2f6f52; }
.cands { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.cand { border: 2px solid #e5dccb; background: #fff8ec; border-radius: 16px; padding: 8px 6px; font: inherit; color: var(--plum);
  display: grid; justify-items: center; gap: 4px; }
.cand:active, .cand.pick { border-color: var(--leaf); background: #eef7e6; }
.cand canvas { width: 64px; height: 64px; }
.cand .diff { font-size: 12px; line-height: 1.25; min-height: 30px; }
.cand .tag { font-size: 11px; font-weight: 600; color: #2f6f52; }
.cand.old .tag { color: #a0522d; } /* gg-fix: less than 2 min of life left */
.card .foot { margin: 12px 0 0; font-size: 13px; color: #7a6a82; }
.primary { margin-top: 12px; border: 0; border-radius: 14px; padding: 12px 22px; font: inherit; font-weight: 600;
  background: var(--leaf); color: var(--cream); font-size: 17px; }

/* M2: the "while you were away" card (never blocks control) and the boards. */
button.watch { font: inherit; font-size: 20px; padding: 0; color: inherit; cursor: pointer; }
.away { position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top) + 80px); max-width: 420px; margin: 0 auto;
  background: rgba(255,253,244,.97); color: var(--plum); border-radius: 20px; padding: 14px 16px 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); touch-action: auto; }
.away h2 { margin: 0 0 8px; font-size: 19px; font-weight: 600; }
.away ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.away li { display: grid; grid-template-columns: 26px 1fr; align-items: start; }
.away .primary { margin-top: 10px; width: 100%; padding: 10px; }
.board { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 64px); bottom: calc(env(safe-area-inset-bottom) + 210px);
  max-width: 440px; margin: 0 auto; background: rgba(6,18,26,.94); border: 2px solid rgba(255,253,244,.2); border-radius: 20px;
  padding: 12px 14px; display: flex; flex-direction: column; touch-action: pan-y; }
.boardHead { display: flex; align-items: center; justify-content: space-between; }
.boardHead h2 { margin: 0; font-size: 19px; font-weight: 600; color: var(--cream); }
.boardHead button { border: 0; background: none; color: var(--cream); font-size: 20px; width: 36px; height: 36px; }
.tabs { display: flex; gap: 6px; margin: 8px 0; }
.tabs button { flex: 1; border: 0; border-radius: 12px; padding: 7px 0; font: inherit; font-size: 14px; font-weight: 600;
  background: rgba(255,253,244,.1); color: var(--text); }
.tabs button.on { background: var(--amber); color: var(--ink); }
.board ol { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.board li { display: grid; grid-template-columns: 40px 1fr auto; gap: 6px; align-items: center; padding: 8px 6px;
  border-bottom: 1px solid rgba(255,253,244,.08); font-size: 15px; }
.board li b { color: var(--amber); }
.board li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li em { font-style: normal; color: var(--mint); font-size: 14px; }
.board li.you { background: rgba(242,198,109,.15); border-radius: 10px; }
.board li.empty { display: block; text-align: center; color: #9fb3a6; }
.board .note { margin: 8px 0 0; font-size: 13px; color: #c9d8c2; }
.away, .board { z-index: 20; }
body.boardOpen .hint, body.boardOpen .toast { display: none; }
/* Both up (you died while away): the away card on top, the rebirth card at the bottom. */
.away:not([hidden]) ~ .card { top: auto; bottom: calc(env(safe-area-inset-bottom) + 12px); transform: none; }

/* B37: the goal line, ghost hints, and the deep-water warning (edge pulse). */
.goal { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); width: min(340px, calc(100vw - 32px));
  text-align: center; padding: 12px 18px 14px; border-radius: 18px; background: rgba(6,18,26,.86);
  border: 2px solid rgba(242,198,109,.6); color: var(--cream); font-size: 19px; font-weight: 600; line-height: 1.25;
  pointer-events: none; animation: goalIn .4s ease-out; }
.goal b { display: block; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); margin-bottom: 4px; }
@keyframes goalIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.hint { background: rgba(6,18,26,.62); border: 2px dashed rgba(255,253,244,.35); opacity: .92; } /* a ghost */
.water { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 108px); transform: translateX(-50%);
  padding: 8px 16px; border-radius: 14px; background: rgba(23,72,128,.9); color: var(--cream); font-size: 18px; font-weight: 600;
  white-space: nowrap; pointer-events: none; box-shadow: 0 0 0 2px rgba(159,226,255,.6); }
.edge { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  box-shadow: inset 0 0 0 6px rgba(80,170,255,.75), inset 0 0 48px 18px rgba(47,99,144,.65); }
body.waterAhead .edge { animation: edgePulse 1s ease-in-out infinite; }
@keyframes edgePulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
body.boardOpen .goal, body.boardOpen .water { display: none; }
/* Landscape phones: keep the goal, hints and the water label off your creature (it sits at 46% height). */
@media (max-height: 500px) and (orientation: landscape) {
  .goal { top: calc(env(safe-area-inset-top) + 60px); width: min(560px, calc(100vw - 32px)); padding: 8px 18px 10px; }
  .hint { top: calc(env(safe-area-inset-top) + 76px); }
  .water { top: auto; bottom: calc(env(safe-area-inset-bottom) + 20px); }
}
