* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: #0b1420; color: #f3f1ea;
  font-family: 'Rubik', system-ui, sans-serif; font-weight: 500; user-select: none; -webkit-user-select: none; touch-action: none; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
[hidden] { display: none !important; }

.panel { background: rgba(10, 18, 30, .62); border: 1px solid rgba(255, 255, 255, .13);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 14px; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#status { position: absolute; left: max(12px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); width: 210px; padding: 10px 12px; }
#stageRow { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
#stageName { font-weight: 900; font-size: 17px; color: #f3c14b; letter-spacing: .3px; }
#speciesName { font-size: 10.5px; opacity: .65; text-align: right; margin-left: 8px; }
.bar { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.bar i { font-style: normal; font-size: 12px; width: 15px; text-align: center; }
.track { flex: 1; height: 9px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.fill { height: 100%; width: 100%; border-radius: 6px; transition: width .15s linear; }
.fill.health { background: linear-gradient(90deg, #e2483d, #ff7a5c); }
.fill.hunger { background: linear-gradient(90deg, #d68a2a, #f3c14b); }
.fill.stamina { background: linear-gradient(90deg, #2aa9c9, #6fe0f0); }
.fill.brood { background: linear-gradient(90deg, #5fae58, #a5e08a); }
.fill.low { animation: pulse .7s infinite alternate; }
@keyframes pulse { to { opacity: .35; } }

#objectives { position: absolute; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); width: 250px; padding: 10px 12px; }
#objectives h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; margin-bottom: 6px; }
#objList { list-style: none; }
#objList li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 3px 0; line-height: 1.25; }
#objList li span:last-child { font-weight: 700; white-space: nowrap; color: #f3c14b; }
#objList li.done { opacity: .5; text-decoration: line-through; }
#objList li.done span:last-child { color: #7be08a; text-decoration: none; }

#compass { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  padding: 6px 14px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
#nestArrow { display: inline-block; color: #f3c14b; font-size: 14px; }
#flight { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); padding: 7px 12px; font-size: 13px; }
#flight b { font-weight: 900; font-size: 16px; }
#btnEvo { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom));
  pointer-events: auto; padding: 9px 14px; color: inherit; font: inherit; font-size: 14px; cursor: pointer; }
#btnEvo b { color: #f3c14b; font-weight: 900; margin-left: 4px; }
#audioBtns { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px); display: flex; gap: 6px; }
#audioBtns button { pointer-events: auto; width: 40px; height: 36px; color: inherit; font: inherit; font-size: 15px; cursor: pointer; }
#audioBtns button.off { opacity: .4; filter: grayscale(1); }
#btnEvo.ready { border-color: #f3c14b; box-shadow: 0 0 18px rgba(243, 193, 75, .45); }

#banner { position: absolute; top: 24%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-weight: 900;
  font-size: clamp(26px, 5vw, 46px); text-shadow: 0 3px 18px rgba(0, 0, 0, .7); opacity: 0; transition: opacity .5s; width: 92%; }
#banner small { display: block; font-size: .42em; font-weight: 700; color: #f3c14b; margin-top: 6px; }
#banner.show { opacity: 1; }
#toast { position: absolute; top: 38%; left: 50%; transform: translateX(-50%); text-align: center; font-weight: 700; font-size: 17px;
  padding: 7px 16px; border-radius: 12px; background: rgba(10, 18, 30, .7); opacity: 0; transition: opacity .3s; max-width: 90%; }
#toast.show { opacity: 1; }
#prompt { position: absolute; bottom: 86px; left: 50%; transform: translateX(-50%); text-align: center; font-size: 15px; font-weight: 700;
  padding: 8px 16px; border-radius: 12px; background: rgba(10, 18, 30, .7); max-width: 92%; }
#prompt:empty { display: none; }
#prompt b { color: #f3c14b; }

#touch { position: fixed; inset: 0; pointer-events: none; }
#stick { position: absolute; left: 22px; bottom: 70px; width: 128px; height: 128px; border-radius: 50%; pointer-events: auto;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .22); }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(255, 255, 255, .45); }
.tbtn { position: absolute; right: 22px; width: 84px; height: 84px; border-radius: 50%; pointer-events: auto; font: inherit; font-weight: 900; font-size: 13px;
  color: #fff; background: rgba(42, 169, 201, .45); border: 2px solid rgba(255, 255, 255, .35); }
#tFlap { bottom: 70px; }
#tDive { bottom: 168px; right: 96px; background: rgba(226, 72, 61, .45); }
#tAct { bottom: 172px; width: 62px; height: 62px; background: rgba(243, 193, 75, .5); }
.tbtn:active, .tbtn.on { filter: brightness(1.6); }

#overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(5, 10, 18, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#overlay.clear { display: none; }
.card { width: min(430px, 100%); max-height: 100%; overflow: auto; padding: 26px 24px; border-radius: 22px; text-align: center;
  background: rgba(12, 21, 34, .93); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 20px 60px rgba(0, 0, 0, .55); }
.card.wide { width: min(720px, 100%); }
.card h1 { font-size: 46px; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.card h1 span { display: block; font-size: 20px; letter-spacing: 6px; text-transform: uppercase; color: #f3c14b; margin-top: 6px; }
.card h2 { font-size: 26px; font-weight: 900; }
.card h2 .ep { font-size: 15px; color: #f3c14b; margin-left: 10px; }
#speciesPick { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
#speciesPick button { flex: 1; padding: 9px 8px; border-radius: 12px; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  color: inherit; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .16); }
#speciesPick button.on { background: rgba(243, 193, 75, .18); border-color: #f3c14b; color: #f3c14b; }
.lead { margin: 14px 0; font-size: 15px; line-height: 1.45; opacity: .9; }
.dim { font-size: 13px; opacity: .6; line-height: 1.4; margin: 8px 0 14px; }
.keys { text-align: left; font-size: 13.5px; line-height: 1.9; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); margin-bottom: 16px; }
.keys b { color: #f3c14b; }
button.primary { width: 100%; padding: 14px; border: 0; border-radius: 14px; font: inherit; font-weight: 900; font-size: 17px; cursor: pointer;
  color: #1a1206; background: linear-gradient(180deg, #f8d06a, #e8a92f); }
button.ghost { width: 100%; margin-top: 8px; padding: 10px; border-radius: 14px; font: inherit; font-size: 14px; cursor: pointer;
  color: inherit; background: transparent; border: 1px solid rgba(255, 255, 255, .2); }

#evoGrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; text-align: left; }
.trait { padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.evoHead { grid-column: 1 / -1; margin-top: 6px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: #f3c14b; }
.evoHead small { margin-left: 8px; font-weight: 500; text-transform: none; letter-spacing: 0; color: rgba(255, 255, 255, .5); }
.trait.locked { opacity: .6; }
.trait.form { border-color: rgba(243, 193, 75, .35); }
.trait.form.active { border-color: #f3c14b; box-shadow: 0 0 16px rgba(243, 193, 75, .35); }
.trait p.req { color: rgba(255, 255, 255, .7); }
.trait h4 { font-size: 16px; font-weight: 900; display: flex; justify-content: space-between; align-items: center; }
.pips { display: flex; gap: 4px; }
.pips i { width: 14px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .16); }
.pips i.on { background: #f3c14b; }
.trait p { font-size: 12.5px; line-height: 1.4; margin-top: 5px; }
.trait p.plus { color: #8fe39c; }
.trait p.minus { color: #f09a8c; }
.trait button { width: 100%; margin-top: 9px; padding: 8px; border-radius: 10px; border: 0; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
  color: #1a1206; background: #f3c14b; }
.trait button:disabled { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .45); cursor: default; }

/* Inside Zynk the host draws a round exit button in the top-left corner. */
body.embedded #status { top: max(52px, env(safe-area-inset-top)); }

@media (max-width: 720px) {
  #status { width: 168px; padding: 8px 10px; }
  #objectives { width: 190px; padding: 8px 10px; }
  #objList li { font-size: 11.5px; }
  #compass { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
  #flight { display: none; }
  #btnEvo { bottom: auto; top: 176px; right: auto; left: max(12px, env(safe-area-inset-left)); padding: 7px 10px; font-size: 12px; }
  #prompt { bottom: 214px; font-size: 13px; }
  #audioBtns { right: auto; bottom: auto; left: max(12px, env(safe-area-inset-left)); top: 216px; }
  #evoGrid { grid-template-columns: 1fr; }
  .keys { display: none; }
  body.embedded #btnEvo { top: 216px; }
  body.embedded #audioBtns { top: 256px; }
}
